Beispiel #1
0
        private void _UpdateSetProperty(long entity_id, int property, byte[] buffer)
        {
            IGhost ghost = _FindGhost(entity_id);

            if (ghost == null)
            {
                return;
            }

            MemberMap    map  = _Protocol.GetMemberMap();
            PropertyInfo info = map.GetProperty(property);

            object    value    = _Serializer.Deserialize(buffer);
            object    instance = ghost.GetInstance();
            Type      type     = _InterfaceProvider.Find(info.DeclaringType);
            FieldInfo field    = type.GetField("_" + info.Name, BindingFlags.Instance | BindingFlags.Public);

            if (field != null)
            {
                object      filedValue = field.GetValue(instance);
                IAccessable updateable = filedValue as IAccessable;
                updateable.Set(value);


                PackageSetPropertyDone pkg = new PackageSetPropertyDone();
                pkg.EntityId = entity_id;
                pkg.Property = property;
                _Requester.Request(ClientToServerOpCode.UpdateProperty, pkg.ToBuffer(_Serializer));
            }
        }
Beispiel #2
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());
                }
            }
        }
Beispiel #3
0
        private void _LoadProperty(Soul new_soul)
        {
            PropertyInfo[] propertys = new_soul.ObjectType.GetProperties(BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public);
            MemberMap      map       = _Protocol.GetMemberMap();

            for (int i = 0; i < propertys.Length; ++i)
            {
                PropertyInfo property = propertys[i];
                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());
                }
            }
        }
Beispiel #4
0
 public RPGProcessor(IAccessable dal)
 {
     this.dal = dal;
 }