コード例 #1
0
        public static void LoadOneConfig(this ConfigComponent self, Type configType)
        {
            byte[] oneConfigBytes = self.ConfigLoader.GetOneConfigBytes(configType.FullName);

            object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);

            self.AllConfig[configType] = category;
        }
コード例 #2
0
        public static void LoadOneConfig(this ConfigComponent self, Type configType)
        {
            byte[] oneConfigBytes = Game.EventSystem.Callback <string, byte[]>(CallbackType.GetOneConfigBytes, configType.FullName);

            object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);

            self.AllConfig[configType] = category;
        }
コード例 #3
0
ファイル: MessagePackHelper.cs プロジェクト: warpten2001/ET-1
        public static object DeserializeFrom(ushort opcode, Type type, byte[] bytes, int index, int count)
        {
            if (opcode >= 20000)
            {
                return(ProtobufHelper.FromBytes(type, bytes, index, count));
            }

            return(MongoHelper.FromBson(type, bytes, index, count));
        }
コード例 #4
0
        private static void LoadOneInThread(this ConfigComponent self, Type configType, Dictionary <string, byte[]> configBytes)
        {
            byte[] oneConfigBytes = configBytes[configType.Name];

            object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);

            lock (self)
            {
                self.AllConfig[configType] = category;
            }
        }
コード例 #5
0
ファイル: ConfigComponentSystem.cs プロジェクト: wqaetly/ET
        private static void LoadOneInThread(this ConfigComponent self, Type configType, Dictionary <string, byte[]> configBytes)
        {
            byte[] oneConfigBytes = configBytes[configType.Name];
            object category       = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);

#if !SERVER
            MethodInfo methodInfo = category.GetType().GetMethod("AfterDeserialization");
            methodInfo?.Invoke(category, null);
#endif
            lock (self)
            {
                self.AllConfig[configType] = category;
            }
        }
コード例 #6
0
        public static object ToActorMessage(this MemoryStream memoryStream)
        {
            ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), 8);
            Type   type   = OpcodeTypeComponent.Instance.GetType(opcode);

            if (opcode < MessageSerializeHelper.PbMaxOpcode)
            {
                return(ProtobufHelper.FromBytes(type, memoryStream.GetBuffer(), 10, (int)memoryStream.Length - 10));
            }

            if (opcode >= MessageSerializeHelper.JsonMinOpcode)
            {
                return(JsonHelper.FromJson(type, memoryStream.GetBuffer().ToStr(10, (int)(memoryStream.Length - 10))));
            }
            return(MongoHelper.FromBson(type, memoryStream.GetBuffer(), 10, (int)memoryStream.Length - 10));
        }
コード例 #7
0
        public static T LoadOneConfig <T>(this ConfigComponent self, string name = "", bool cache = false) where T : ProtoObject
        {
            Type configType = typeof(T);

            if (string.IsNullOrEmpty(name))
            {
                name = configType.FullName;
            }
            byte[] oneConfigBytes = self.ConfigLoader.GetOneConfigBytes(name);

            object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);

            if (cache)
            {
                self.AllConfig[configType] = category;
            }

            return(category as T);
        }
コード例 #8
0
ファイル: ProtobufPacker.cs プロジェクト: xwmeteor/ET-QiPai
 public object DeserializeFrom(object instance, byte[] bytes, int index, int count)
 {
     return(ProtobufHelper.FromBytes(instance, bytes, index, count));
 }
コード例 #9
0
ファイル: ProtobufPacker.cs プロジェクト: xwmeteor/ET-QiPai
 public object DeserializeFrom(Type type, byte[] bytes, int index, int count)
 {
     return(ProtobufHelper.FromBytes(type, bytes, index, count));
 }
コード例 #10
0
ファイル: ProtoObject.cs プロジェクト: chanayy123/ET
 public object Clone()
 {
     byte[] bytes = ProtobufHelper.ToBytes(this);
     return(ProtobufHelper.FromBytes(this.GetType(), bytes, 0, bytes.Length));
 }