Example #1
0
        private SoulProxy _NewSoul(object soul, Type soul_type)
        {
            int interfaceId = _Protocol.GetMemberMap().GetInterface(soul_type);
            var newSoul     = new SoulProxy(_IdLandlord.Rent(), interfaceId, soul_type, soul);

            newSoul.SupplySoulEvent   += _PropertyBind;
            newSoul.UnsupplySoulEvent += _PropertyUnbind;
            Regulus.Utility.Log.Instance.WriteInfo($"soul add {newSoul.Id}:{soul_type.Name}.");
            _Souls.TryAdd(newSoul.Id, newSoul);

            return(newSoul);
        }
Example #2
0
        private SoulProxy _Bind(object soul, Type soul_type, bool return_type, long return_id)
        {
            SoulProxy newSoul = _NewSoul(soul, soul_type);


            _LoadSoul(newSoul.InterfaceId, newSoul.Id, return_type);
            _LoadProperty(newSoul);
            _LoadSoulCompile(newSoul.InterfaceId, newSoul.Id, return_id);
            newSoul.Initial(_Protocol.GetMemberMap().Propertys.Item1s);
            //Regulus.Utility.Log.Instance.WriteInfoNoDelay($"bind i:{soul.GetHashCode()} t:{soul_type} id:{newSoul.Id}");
            return(newSoul);
        }
Example #3
0
        private void _LoadProperty(SoulProxy new_soul)
        {
            IEnumerable <PropertyInfo> propertys = new_soul.PropertyInfos;
            MemberMap map = _Protocol.GetMemberMap();

            foreach (PropertyInfo property in propertys)
            {
                int id = map.GetProperty(property);

                if (property.PropertyType.GetInterfaces().Any(t => t == typeof(IDirtyable)))
                {
                    object propertyValue = property.GetValue(new_soul.ObjectInstance);

                    IAccessable accessable = propertyValue as IAccessable;
                    _LoadProperty(new_soul.Id, id, accessable.Get());
                }
            }
        }