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; }
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; }
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)); }
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; } }
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; } }
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)); }
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); }
public object DeserializeFrom(object instance, byte[] bytes, int index, int count) { return(ProtobufHelper.FromBytes(instance, bytes, index, count)); }
public object DeserializeFrom(Type type, byte[] bytes, int index, int count) { return(ProtobufHelper.FromBytes(type, bytes, index, count)); }
public object Clone() { byte[] bytes = ProtobufHelper.ToBytes(this); return(ProtobufHelper.FromBytes(this.GetType(), bytes, 0, bytes.Length)); }