diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef index ebbd05e2..cac2e137 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxibugEmuOnline.Client.asmdef @@ -10,7 +10,8 @@ "StoicGooseUnity", "Unity.InputSystem", "AxiNSApi", - "Unity.InputSystem.Switch" + "Unity.InputSystem.Switch", + "Google.Protobuf" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Common/ProtoBufHelper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Common/ProtoBufHelper.cs index 9fc6d905..32d07206 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Common/ProtoBufHelper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Common/ProtoBufHelper.cs @@ -8,6 +8,7 @@ namespace AxibugEmuOnline.Client.Common public static class ProtoBufHelper { private static ProtobufferMsgPool _msgPool = new ProtobufferMsgPool(); + static CodedInputStream codedInputStream = new CodedInputStream(); public static void RentSerizlizeData(IMessage msg, out byte[] data, out int usedlength) { @@ -28,14 +29,17 @@ namespace AxibugEmuOnline.Client.Common { var msgType = typeof(T); object msg = _msgPool.Get(msgType); - ((IMessage)msg).MergeFrom(bytes); + //((IMessage)msg).MergeFrom(bytes); + ((IMessage)msg).MergeFromEx(codedInputStream, bytes, 0, bytes.Length); return (T)msg; } + public static IMessage DeSerizlizeFromPool(byte[] bytes, Type protoType) { var msgType = protoType; object msg = _msgPool.Get(msgType); - ((IMessage)msg).MergeFrom(bytes); + //((IMessage)msg).MergeFrom(bytes); + ((IMessage)msg).MergeFromEx(codedInputStream, bytes, 0, bytes.Length); return (IMessage)msg; } public static void ReleaseToPool(IMessage msg)