Explorar o código

1.一些性能相关的代码挪到mono中
2.替换支持ILRuntime的protobuf-net,litjson库

tanghai %!s(int64=4) %!d(string=hai) anos
pai
achega
b6087c0904
Modificáronse 100 ficheiros con 1213 adicións e 796 borrados
  1. 2 2
      Robot/App/Program.cs
  2. 6 2
      Robot/Model/Robot.Model.csproj
  3. 2 2
      Server/App/Program.cs
  4. 1 1
      Server/Hotfix/Demo/C2G_LoginGateHandler.cs
  5. 3 3
      Server/Hotfix/Demo/Session/InnerMessageDispatcherHelper.cs
  6. 3 3
      Server/Hotfix/Module/Actor/ActorMessageSenderComponentSystem.cs
  7. 10 10
      Server/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  8. 1 1
      Server/Model/Module/Actor/AMActorRpcHandler.cs
  9. 1 1
      Server/Model/Module/ActorLocation/AMActorLocationRpcHandler.cs
  10. 1 1
      Server/Model/Module/NetworkTCP/AMRpcHandler.cs
  11. 7 9
      Server/Model/Server.Model.csproj
  12. 1 1
      Unity/Assets/Bundles/Code.meta
  13. 2 2
      Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs
  14. 4 5
      Unity/Assets/Mono/CodeLoader.cs
  15. 0 0
      Unity/Assets/Mono/Core/DoubleMap.cs
  16. 1 1
      Unity/Assets/Mono/Core/DoubleMap.cs.meta
  17. 1 1
      Unity/Assets/Mono/Core/Helper/JsonHelper.cs
  18. 2 1
      Unity/Assets/Mono/Core/Log.meta
  19. 0 0
      Unity/Assets/Mono/Core/Log/FileLogger.cs
  20. 1 1
      Unity/Assets/Mono/Core/Log/FileLogger.cs.meta
  21. 0 0
      Unity/Assets/Mono/Core/Log/ILog.cs
  22. 1 1
      Unity/Assets/Mono/Core/Log/ILog.cs.meta
  23. 20 30
      Unity/Assets/Mono/Core/Log/Log.cs
  24. 1 1
      Unity/Assets/Mono/Core/Log/Log.cs.meta
  25. 0 0
      Unity/Assets/Mono/Core/Log/NLogger.cs
  26. 11 0
      Unity/Assets/Mono/Core/Log/NLogger.cs.meta
  27. 0 0
      Unity/Assets/Mono/Core/Log/UnityLogger.cs
  28. 11 0
      Unity/Assets/Mono/Core/Log/UnityLogger.cs.meta
  29. 0 0
      Unity/Assets/Mono/Core/MultiDictionary.cs
  30. 11 0
      Unity/Assets/Mono/Core/MultiDictionary.cs.meta
  31. 0 0
      Unity/Assets/Mono/Core/MultiMap.cs
  32. 11 0
      Unity/Assets/Mono/Core/MultiMap.cs.meta
  33. 0 0
      Unity/Assets/Mono/Core/MultiMapSet.cs
  34. 11 0
      Unity/Assets/Mono/Core/MultiMapSet.cs.meta
  35. 2 0
      Unity/Assets/Mono/Core/Options.cs
  36. 11 0
      Unity/Assets/Mono/Core/Options.cs.meta
  37. 40 0
      Unity/Assets/Mono/Core/ProtobufHelper.cs
  38. 11 0
      Unity/Assets/Mono/Core/ProtobufHelper.cs.meta
  39. 4 4
      Unity/Assets/Mono/Core/TimeHelper.cs
  40. 11 0
      Unity/Assets/Mono/Core/TimeHelper.cs.meta
  41. 2 2
      Unity/Assets/Mono/Core/TimeInfo.cs
  42. 11 0
      Unity/Assets/Mono/Core/TimeInfo.cs.meta
  43. 0 0
      Unity/Assets/Mono/Core/UnOrderMultiMap.cs
  44. 11 0
      Unity/Assets/Mono/Core/UnOrderMultiMap.cs.meta
  45. 0 0
      Unity/Assets/Mono/Core/UnOrderMultiMapSet.cs
  46. 11 0
      Unity/Assets/Mono/Core/UnOrderMultiMapSet.cs.meta
  47. 0 0
      Unity/Assets/Mono/Helper/AssetsBundleHelper.cs
  48. 1 1
      Unity/Assets/Mono/Helper/AssetsBundleHelper.cs.meta
  49. 69 0
      Unity/Assets/Mono/ILRuntime/IDisposableAdapter.cs
  50. 11 0
      Unity/Assets/Mono/ILRuntime/IDisposableAdapter.cs.meta
  51. 8 5
      Unity/Assets/Mono/ILRuntime/ILHelper.cs
  52. 8 0
      Unity/Assets/Mono/Module.meta
  53. 8 0
      Unity/Assets/Mono/Module/Message.meta
  54. 0 2
      Unity/Assets/Mono/Module/Message/RpcException.cs
  55. 11 0
      Unity/Assets/Mono/Module/Message/RpcException.cs.meta
  56. 8 0
      Unity/Assets/Mono/Module/Network.meta
  57. 0 0
      Unity/Assets/Mono/Module/Network/AChannel.cs
  58. 11 0
      Unity/Assets/Mono/Module/Network/AChannel.cs.meta
  59. 0 0
      Unity/Assets/Mono/Module/Network/AService.cs
  60. 11 0
      Unity/Assets/Mono/Module/Network/AService.cs.meta
  61. 0 0
      Unity/Assets/Mono/Module/Network/Circularbuffer.cs
  62. 11 0
      Unity/Assets/Mono/Module/Network/Circularbuffer.cs.meta
  63. 80 0
      Unity/Assets/Mono/Module/Network/ErrorCore.cs
  64. 11 0
      Unity/Assets/Mono/Module/Network/ErrorCore.cs.meta
  65. 8 8
      Unity/Assets/Mono/Module/Network/KChannel.cs
  66. 11 0
      Unity/Assets/Mono/Module/Network/KChannel.cs.meta
  67. 23 24
      Unity/Assets/Mono/Module/Network/KService.cs
  68. 11 0
      Unity/Assets/Mono/Module/Network/KService.cs.meta
  69. 8 0
      Unity/Assets/Mono/Module/NetworkTCP.meta
  70. 1 1
      Unity/Assets/Mono/Module/NetworkTCP/PacketParser.cs
  71. 11 0
      Unity/Assets/Mono/Module/NetworkTCP/PacketParser.cs.meta
  72. 5 5
      Unity/Assets/Mono/Module/NetworkTCP/TChannel.cs
  73. 11 0
      Unity/Assets/Mono/Module/NetworkTCP/TChannel.cs.meta
  74. 1 1
      Unity/Assets/Mono/Module/NetworkTCP/TService.cs
  75. 11 0
      Unity/Assets/Mono/Module/NetworkTCP/TService.cs.meta
  76. 4 0
      Unity/Assets/Mono/MonoBehaviour/Init.cs
  77. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/IJsonWrapper.cs.meta
  78. 12 69
      Unity/Assets/Mono/ThirdParty/LitJson/JsonData.cs
  79. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonData.cs.meta
  80. 1 6
      Unity/Assets/Mono/ThirdParty/LitJson/JsonException.cs
  81. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonException.cs.meta
  82. 329 258
      Unity/Assets/Mono/ThirdParty/LitJson/JsonMapper.cs
  83. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonMapper.cs.meta
  84. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonMockWrapper.cs.meta
  85. 112 117
      Unity/Assets/Mono/ThirdParty/LitJson/JsonReader.cs
  86. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonReader.cs.meta
  87. 23 31
      Unity/Assets/Mono/ThirdParty/LitJson/JsonWriter.cs
  88. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/JsonWriter.cs.meta
  89. 4 4
      Unity/Assets/Mono/ThirdParty/LitJson/Lexer.cs
  90. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/Lexer.cs.meta
  91. 1 1
      Unity/Assets/Mono/ThirdParty/LitJson/ParserToken.cs.meta
  92. 2 2
      Unity/Assets/Mono/ThirdParty/LitJson/UnityTypeBindings.cs
  93. 61 55
      Unity/Assets/Mono/ThirdParty/protobuf-net/BclHelpers.cs
  94. 1 1
      Unity/Assets/Mono/ThirdParty/protobuf-net/BclHelpers.cs.meta
  95. 6 6
      Unity/Assets/Mono/ThirdParty/protobuf-net/BufferExtension.cs
  96. 1 1
      Unity/Assets/Mono/ThirdParty/protobuf-net/BufferExtension.cs.meta
  97. 53 99
      Unity/Assets/Mono/ThirdParty/protobuf-net/BufferPool.cs
  98. 1 1
      Unity/Assets/Mono/ThirdParty/protobuf-net/BufferPool.cs.meta
  99. 4 4
      Unity/Assets/Mono/ThirdParty/protobuf-net/CallbackAttributes.cs
  100. 1 1
      Unity/Assets/Mono/ThirdParty/protobuf-net/CallbackAttributes.cs.meta

+ 2 - 2
Robot/App/Program.cs

@@ -32,9 +32,9 @@ namespace ET
                         .WithNotParsed(error => throw new Exception($"命令行格式错误!"))
                         .WithParsed(o => { options = o; });
 
-                Game.Options = options;
+                Options.Instance = options;
 
-                Game.ILog = new NLogger(Game.Options.AppType.ToString());
+                Log.ILog = new NLogger(Game.Options.AppType.ToString());
                 
                 LogManager.Configuration.Variables["appIdFormat"] = $"{Game.Options.Process:000000}";
 				

+ 6 - 2
Robot/Model/Robot.Model.csproj

@@ -47,11 +47,11 @@
             <Link>Module\AI\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
-        <Compile Include="..\..\Unity\Codes\Model\Module\Network\**\*.cs">
+        <Compile Include="..\..\Unity\Assets\Mono\Module\Network\**\*.cs">
             <Link>Module\Network\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
-        <Compile Include="..\..\Unity\Codes\Model\Module\NetworkTCP\**\*.cs">
+        <Compile Include="..\..\Unity\Assets\Mono\Module\NetworkTCP\**\*.cs">
             <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
@@ -71,6 +71,10 @@
             <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
+        <Compile Include="..\..\Unity\Assets\Mono\Module\Message\**\*.cs">
+            <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
         <Compile Include="..\..\Server\Model\Module\Message\**\*.cs">
             <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>

+ 2 - 2
Server/App/Program.cs

@@ -33,9 +33,9 @@ namespace ET
 						.WithNotParsed(error => throw new Exception($"命令行格式错误!"))
 						.WithParsed(o => { options = o; });
 
-				Game.Options = options;
+				Options.Instance = options;
 
-				Game.ILog = new NLogger(Game.Options.AppType.ToString());
+				Log.ILog = new NLogger(Game.Options.AppType.ToString());
 				LogManager.Configuration.Variables["appIdFormat"] = $"{Game.Options.Process:000000}";
 				
 				Log.Info($"server start........................ {Game.Scene.Id}");

+ 1 - 1
Server/Hotfix/Demo/C2G_LoginGateHandler.cs

@@ -12,7 +12,7 @@ namespace ET
 			string account = scene.GetComponent<GateSessionKeyComponent>().Get(request.Key);
 			if (account == null)
 			{
-				response.Error = ErrorCode.ERR_ConnectGateKeyError;
+				response.Error = ErrorCore.ERR_ConnectGateKeyError;
 				response.Message = "Gate key验证失败!";
 				reply();
 				return;

+ 3 - 3
Server/Hotfix/Demo/Session/InnerMessageDispatcherHelper.cs

@@ -15,7 +15,7 @@ namespace ET
             Entity entity = Game.EventSystem.Get(actorId);
             if (entity == null)
             {
-                FailResponse(iActorRequest, ErrorCode.ERR_NotFoundActor, reply);
+                FailResponse(iActorRequest, ErrorCore.ERR_NotFoundActor, reply);
                 return;
             }
 
@@ -23,7 +23,7 @@ namespace ET
             if (mailBoxComponent == null)
             {
                 Log.Warning($"actor not found mailbox: {entity.GetType().Name} {actorId} {iActorRequest}");
-                FailResponse(iActorRequest, ErrorCode.ERR_NotFoundActor, reply);
+                FailResponse(iActorRequest, ErrorCore.ERR_NotFoundActor, reply);
                 return;
             }
 
@@ -38,7 +38,7 @@ namespace ET
                         {
                             if (entity.InstanceId != instanceId)
                             {
-                                FailResponse(iActorRequest, ErrorCode.ERR_NotFoundActor, reply);
+                                FailResponse(iActorRequest, ErrorCore.ERR_NotFoundActor, reply);
                                 return;
                             }
 

+ 3 - 3
Server/Hotfix/Module/Actor/ActorMessageSenderComponentSystem.cs

@@ -30,13 +30,13 @@ namespace ET
     {
         public static void Run(ActorMessageSender self, IActorResponse response)
         {
-            if (response.Error == ErrorCode.ERR_ActorTimeout)
+            if (response.Error == ErrorCore.ERR_ActorTimeout)
             {
                 self.Tcs.SetException(new Exception($"Rpc error: request, 注意Actor消息超时,请注意查看是否死锁或者没有reply: actorId: {self.ActorId} {self.MemoryStream.ToActorMessage()}, response: {response}"));
                 return;
             }
 
-            if (self.NeedException && ErrorCode.IsRpcNeedThrowException(response.Error))
+            if (self.NeedException && ErrorCore.IsRpcNeedThrowException(response.Error))
             {
                 self.Tcs.SetException(new Exception($"Rpc error: actorId: {self.ActorId} request: {self.MemoryStream.ToActorMessage()}, response: {response}"));
                 return;
@@ -65,7 +65,7 @@ namespace ET
                 self.requestCallback.Remove(rpcId);
                 try
                 {
-                    IActorResponse response = ActorHelper.CreateResponse((IActorRequest)actorMessageSender.MemoryStream.ToActorMessage(), ErrorCode.ERR_ActorTimeout);
+                    IActorResponse response = ActorHelper.CreateResponse((IActorRequest)actorMessageSender.MemoryStream.ToActorMessage(), ErrorCore.ERR_ActorTimeout);
                     Run(actorMessageSender, response);
                 }
                 catch (Exception e)

+ 10 - 10
Server/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -95,11 +95,11 @@ namespace ET
             {
                 if (actorLocationSender.InstanceId != actorLocationSenderInstanceId)
                 {
-                    throw new RpcException(ErrorCode.ERR_ActorTimeout, $"{stream.ToActorMessage()}");
+                    throw new RpcException(ErrorCore.ERR_ActorTimeout, $"{stream.ToActorMessage()}");
                 }
 
                 // 队列中没处理的消息返回跟上个消息一样的报错
-                if (actorLocationSender.Error == ErrorCode.ERR_NotFoundActor)
+                if (actorLocationSender.Error == ErrorCore.ERR_NotFoundActor)
                 {
                     return ActorHelper.CreateResponse(iActorRequest, actorLocationSender.Error);
                 }
@@ -134,32 +134,32 @@ namespace ET
                     actorLocationSender.ActorId = await LocationProxyComponent.Instance.Get(actorLocationSender.Id);
                     if (actorLocationSender.InstanceId != instanceId)
                     {
-                        throw new RpcException(ErrorCode.ERR_ActorLocationSenderTimeout2, $"{memoryStream.ToActorMessage()}");
+                        throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{memoryStream.ToActorMessage()}");
                     }
                 }
 
                 if (actorLocationSender.ActorId == 0)
                 {
                     IActorRequest iActorRequest = (IActorRequest)memoryStream.ToActorMessage();
-                    return ActorHelper.CreateResponse(iActorRequest, ErrorCode.ERR_NotFoundActor);
+                    return ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_NotFoundActor);
                 }
 
                 IActorResponse response = await ActorMessageSenderComponent.Instance.Call(actorLocationSender.ActorId, rpcId, memoryStream, false);
                 if (actorLocationSender.InstanceId != instanceId)
                 {
-                    throw new RpcException(ErrorCode.ERR_ActorLocationSenderTimeout3, $"{memoryStream.ToActorMessage()}");
+                    throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout3, $"{memoryStream.ToActorMessage()}");
                 }
 
                 switch (response.Error)
                 {
-                    case ErrorCode.ERR_NotFoundActor:
+                    case ErrorCore.ERR_NotFoundActor:
                     {
                         // 如果没找到Actor,重试
                         ++failTimes;
                         if (failTimes > 20)
                         {
                             Log.Debug($"actor send message fail, actorid: {actorLocationSender.Id}");
-                            actorLocationSender.Error = ErrorCode.ERR_NotFoundActor;
+                            actorLocationSender.Error = ErrorCore.ERR_NotFoundActor;
                             // 这里不能删除actor,要让后面等待发送的消息也返回ERR_NotFoundActor,直到超时删除
                             return response;
                         }
@@ -168,19 +168,19 @@ namespace ET
                         await TimerComponent.Instance.WaitAsync(500);
                         if (actorLocationSender.InstanceId != instanceId)
                         {
-                            throw new RpcException(ErrorCode.ERR_ActorLocationSenderTimeout4, $"{memoryStream.ToActorMessage()}");
+                            throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout4, $"{memoryStream.ToActorMessage()}");
                         }
 
                         actorLocationSender.ActorId = 0;
                         continue;
                     }
-                    case ErrorCode.ERR_ActorTimeout:
+                    case ErrorCore.ERR_ActorTimeout:
                     {
                         throw new RpcException(response.Error, $"{memoryStream.ToActorMessage()}");
                     }
                 }
 
-                if (ErrorCode.IsRpcNeedThrowException(response.Error))
+                if (ErrorCore.IsRpcNeedThrowException(response.Error))
                 {
                     throw new RpcException(response.Error, $"Message: {response.Message} Request: {memoryStream.ToActorMessage()}");
                 }

+ 1 - 1
Server/Model/Module/Actor/AMActorRpcHandler.cs

@@ -41,7 +41,7 @@ namespace ET
                 catch (Exception exception)
                 {
                     Log.Error(exception);
-                    response.Error = ErrorCode.ERR_RpcFail;
+                    response.Error = ErrorCore.ERR_RpcFail;
                     response.Message = exception.ToString();
                     Reply();
                 }

+ 1 - 1
Server/Model/Module/ActorLocation/AMActorLocationRpcHandler.cs

@@ -41,7 +41,7 @@ namespace ET
                 catch (Exception exception)
                 {
                     Log.Error(exception);
-                    response.Error = ErrorCode.ERR_RpcFail;
+                    response.Error = ErrorCore.ERR_RpcFail;
                     response.Message = exception.ToString();
                     Reply();
                 }

+ 1 - 1
Server/Model/Module/NetworkTCP/AMRpcHandler.cs

@@ -47,7 +47,7 @@ namespace ET
                 catch (Exception exception)
                 {
                     Log.Error(exception);
-                    response.Error = ErrorCode.ERR_RpcFail;
+                    response.Error = ErrorCore.ERR_RpcFail;
                     response.Message = exception.ToString();
                     Reply();
                 }

+ 7 - 9
Server/Model/Server.Model.csproj

@@ -72,14 +72,8 @@
     </Compile>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="..\..\Unity\Codes\Model\Module\NetworkTCP\PacketParser.cs">
-      <Link>Module\NetworkTCP\PacketParser.cs</Link>
-    </Compile>
-    <Compile Include="..\..\Unity\Codes\Model\Module\NetworkTCP\TChannel.cs">
-      <Link>Module\NetworkTCP\TChannel.cs</Link>
-    </Compile>
-    <Compile Include="..\..\Unity\Codes\Model\Module\NetworkTCP\TService.cs">
-      <Link>Module\NetworkTCP\TService.cs</Link>
+    <Compile Include="..\..\Unity\Assets\Mono\Module\NetworkTCP\**\*.cs">
+      <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>
     <Compile Include="..\..\Unity\Codes\Model\Module\Numeric\INumericWatcher.cs">
       <Link>Module\Numeric\INumericWatcher.cs</Link>
@@ -100,13 +94,17 @@
 
   <ItemGroup>
 
-    <Compile Include="..\..\Unity\Codes\Model\Module\Network\**\*.cs">
+    <Compile Include="..\..\Unity\Assets\Mono\Module\Network\**\*.cs">
       <Link>Module\Network\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>
 
     <Compile Include="..\..\Unity\Codes\Model\Module\Message\**\*.cs">
       <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>
+
+    <Compile Include="..\..\Unity\Assets\Mono\Module\Message\**\*.cs">
+      <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+    </Compile>
   </ItemGroup>
   
   <ItemGroup>

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/Properties.meta → Unity/Assets/Bundles/Code.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1822baeae59f1410a843ad0c589261b9
+guid: 55d9010d6a87934468703901aa518c85
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 2 - 2
Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs

@@ -30,10 +30,10 @@ namespace ET
         {
             //由于跨域继承特殊性太多,自动生成无法实现完全无副作用生成,所以这里提供的代码自动生成主要是给大家生成个初始模版,简化大家的工作
             //大多数情况直接使用自动生成的模版即可,如果遇到问题可以手动去修改生成后的文件,因此这里需要大家自行处理是否覆盖的问题
-            using (System.IO.StreamWriter sw = new System.IO.StreamWriter("Assets/Mono/ILRuntime/ISupportInitializeAdapter.cs"))
+            using (System.IO.StreamWriter sw = new System.IO.StreamWriter("Assets/Mono/ILRuntime/IDisposableAdapter.cs"))
             {
                 sw.WriteLine(ILRuntime.Runtime.Enviorment.CrossBindingCodeGenerator.GenerateCrossBindingAdapterCode(
-                    typeof (System.ComponentModel.ISupportInitialize), "ET"));
+                    typeof (System.IDisposable), "ET"));
             }
 
             AssetDatabase.Refresh();

+ 4 - 5
Unity/Assets/Mono/CodeLoader.cs

@@ -30,11 +30,10 @@ namespace ET
 			
 #if ILRuntime
 			ILRuntime.Runtime.Enviorment.AppDomain appDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
-			using (System.IO.MemoryStream assStream = new System.IO.MemoryStream(assBytes))
-			using (System.IO.MemoryStream pdbStream = new System.IO.MemoryStream(pdbBytes))
-			{
-				appDomain.LoadAssembly(assStream, pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());
-			}
+			System.IO.MemoryStream assStream = new System.IO.MemoryStream(assBytes);
+			System.IO.MemoryStream pdbStream = new System.IO.MemoryStream(pdbBytes);
+			appDomain.LoadAssembly(assStream, pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());
+			
 			ILHelper.InitILRuntime(appDomain);
 			
 			this.hotfixTypes = Type.EmptyTypes;

+ 0 - 0
Unity/Codes/Model/Core/DoubleMap.cs → Unity/Assets/Mono/Core/DoubleMap.cs


+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/IProtoOutputT.cs.meta → Unity/Assets/Mono/Core/DoubleMap.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 9cd2eeffd22194db8a26b2d2d0bc5de0
+guid: 715c9cf0f50f1fb4c98a8783cb1da714
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Mono/Core/Helper/JsonHelper.cs

@@ -22,7 +22,7 @@ namespace ET
 #if NOT_UNITY
             return MongoDB.Bson.Serialization.BsonSerializer.Deserialize(json, type);
 #else
-            return LitJson.JsonMapper.ToObject(json, type);
+            return LitJson.JsonMapper.ToObject(type, json);
 #endif
             
         }

+ 2 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/protobuf-net.csproj.meta → Unity/Assets/Mono/Core/Log.meta

@@ -1,5 +1,6 @@
 fileFormatVersion: 2
-guid: d0d99b3c8812040b19e8b9c3773a3bf8
+guid: be7dfe93fdca5994f8932114901095c5
+folderAsset: yes
 DefaultImporter:
   externalObjects: {}
   userData: 

+ 0 - 0
Unity/Codes/Model/Core/Log/FileLogger.cs → Unity/Assets/Mono/Core/Log/FileLogger.cs


+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/DiscriminatedUnion.Serializable.cs.meta → Unity/Assets/Mono/Core/Log/FileLogger.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: f1dc6807057f44c4090469509ddd28fe
+guid: 9dbc36c7ee521f34e90cce63cee65af5
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Codes/Model/Core/Log/ILog.cs → Unity/Assets/Mono/Core/Log/ILog.cs


+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/Meta/TypeModel.InputOutput.cs.meta → Unity/Assets/Mono/Core/Log/ILog.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 7f65a2107b3cd4c4db8ac74fbcbde617
+guid: 63e88312339ec39479bf5054c7f5698b
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 20 - 30
Unity/Codes/Model/Core/Log/Log.cs → Unity/Assets/Mono/Core/Log/Log.cs

@@ -11,26 +11,16 @@ namespace ET
 {
     public static class Log
     {
+        public static ILog ILog { get; set; }
+        
         private const int TraceLevel = 1;
         private const int DebugLevel = 2;
         private const int InfoLevel = 3;
         private const int WarningLevel = 4;
 
-        static Log()
+        private static bool CheckLogLevel(int level)
         {
-#if !NOT_UNITY
-            Game.ILog = new UnityLogger();
-#endif
-        }
-
-        public static bool CheckLogLevel(int level)
-        {
-            if (Game.Options == null)
-            {
-                return true;
-            }
-            
-            return Game.Options.LogLevel <= level;
+            return Options.Instance.LogLevel <= level;
         }
         
         public static void Trace(string msg)
@@ -40,7 +30,7 @@ namespace ET
                 return;
             }
             StackTrace st = new StackTrace(1, true);
-            Game.ILog.Trace($"{msg}\n{st}");
+            ILog.Trace($"{msg}\n{st}");
         }
 
         public static void Debug(string msg)
@@ -49,7 +39,7 @@ namespace ET
             {
                 return;
             }
-            Game.ILog.Debug(msg);
+            ILog.Debug(msg);
         }
 
         public static void Info(string msg)
@@ -58,7 +48,7 @@ namespace ET
             {
                 return;
             }
-            Game.ILog.Info(msg);
+            ILog.Info(msg);
         }
 
         public static void TraceInfo(string msg)
@@ -68,7 +58,7 @@ namespace ET
                 return;
             }
             StackTrace st = new StackTrace(1, true);
-            Game.ILog.Trace($"{msg}\n{st}");
+            ILog.Trace($"{msg}\n{st}");
         }
 
         public static void Warning(string msg)
@@ -78,19 +68,19 @@ namespace ET
                 return;
             }
 
-            Game.ILog.Warning(msg);
+            ILog.Warning(msg);
         }
 
         public static void Error(string msg)
         {
             StackTrace st = new StackTrace(1, true);
-            Game.ILog.Error($"{msg}\n{st}");
+            ILog.Error($"{msg}\n{st}");
         }
 
         public static void Error(Exception e)
         {
             string str = e.ToString();
-            Game.ILog.Error(str);
+            ILog.Error(str);
         }
 
         public static void Trace(string message, params object[] args)
@@ -100,7 +90,7 @@ namespace ET
                 return;
             }
             StackTrace st = new StackTrace(1, true);
-            Game.ILog.Trace($"{string.Format(message, args)}\n{st}");
+            ILog.Trace($"{string.Format(message, args)}\n{st}");
         }
 
         public static void Warning(string message, params object[] args)
@@ -109,7 +99,7 @@ namespace ET
             {
                 return;
             }
-            Game.ILog.Warning(string.Format(message, args));
+            ILog.Warning(string.Format(message, args));
         }
 
         public static void Info(string message, params object[] args)
@@ -118,7 +108,7 @@ namespace ET
             {
                 return;
             }
-            Game.ILog.Info(string.Format(message, args));
+            ILog.Info(string.Format(message, args));
         }
 
         public static void Debug(string message, params object[] args)
@@ -127,7 +117,7 @@ namespace ET
             {
                 return;
             }
-            Game.ILog.Debug(string.Format(message, args));
+            ILog.Debug(string.Format(message, args));
 
         }
 
@@ -135,26 +125,26 @@ namespace ET
         {
             StackTrace st = new StackTrace(1, true);
             string s = string.Format(message, args) + '\n' + st;
-            Game.ILog.Error(s);
+            ILog.Error(s);
         }
         
         public static void Console(string message)
         {
-            if (Game.Options.Console == 1)
+            if (Options.Instance.Console == 1)
             {
                 System.Console.WriteLine(message);
             }
-            Game.ILog.Debug(message);
+            ILog.Debug(message);
         }
         
         public static void Console(string message, params object[] args)
         {
             string s = string.Format(message, args);
-            if (Game.Options.Console == 1)
+            if (Options.Instance.Console == 1)
             {
                 System.Console.WriteLine(s);
             }
-            Game.ILog.Debug(s);
+            ILog.Debug(s);
         }
     }
 }

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/IProtoInputT.cs.meta → Unity/Assets/Mono/Core/Log/Log.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1c17e14aecbd949568e43151c98a6e64
+guid: bdc1761525ecfa642b1780a6b4e0243d
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Codes/Model/Core/Log/NLogger.cs → Unity/Assets/Mono/Core/Log/NLogger.cs


+ 11 - 0
Unity/Assets/Mono/Core/Log/NLogger.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 956d9417b1a511c4682e01ccbb38dd6a
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/Log/UnityLogger.cs → Unity/Assets/Mono/Core/Log/UnityLogger.cs


+ 11 - 0
Unity/Assets/Mono/Core/Log/UnityLogger.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a55ad4a2fd2efda40be46bcf4f6459c4
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/MultiDictionary.cs → Unity/Assets/Mono/Core/MultiDictionary.cs


+ 11 - 0
Unity/Assets/Mono/Core/MultiDictionary.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9c12a0ab646b02a42887ca4fd3b9992e
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/MultiMap.cs → Unity/Assets/Mono/Core/MultiMap.cs


+ 11 - 0
Unity/Assets/Mono/Core/MultiMap.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 551a46ca41c86a840a2061737baf5c32
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/MultiMapSet.cs → Unity/Assets/Mono/Core/MultiMapSet.cs


+ 11 - 0
Unity/Assets/Mono/Core/MultiMapSet.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1750c211e8e68d342aade9e95b607640
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 0
Unity/Codes/Model/Core/Options.cs → Unity/Assets/Mono/Core/Options.cs

@@ -16,6 +16,8 @@ namespace ET
     
     public class Options
     {
+        public static Options Instance { get; set; }
+        
         [Option("AppType", Required = false, Default = AppType.Server, HelpText = "serverType enum")]
         public AppType AppType { get; set; }
 

+ 11 - 0
Unity/Assets/Mono/Core/Options.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f4dd4f522b3bcbb49a57beca7f0f7d0c
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 40 - 0
Unity/Assets/Mono/Core/ProtobufHelper.cs

@@ -0,0 +1,40 @@
+using System;
+using System.IO;
+using ProtoBuf.Meta;
+
+namespace ET
+{
+    public static class ProtobufHelper
+    {
+	    public static void Init()
+        {
+        }
+
+        public static object FromBytes(Type type, byte[] bytes, int index, int count)
+        {
+	        using (MemoryStream stream = new MemoryStream(bytes, index, count))
+	        {
+		        return RuntimeTypeModel.Default.Deserialize(stream, null, type);
+	        }
+        }
+
+        public static byte[] ToBytes(object message)
+        {
+	        using (MemoryStream stream = new MemoryStream())
+	        {
+		        ProtoBuf.Serializer.Serialize(stream, message);
+		        return stream.ToArray();
+	        }
+        }
+
+        public static void ToStream(object message, MemoryStream stream)
+        {
+            ProtoBuf.Serializer.Serialize(stream, message);
+        }
+
+        public static object FromStream(Type type, MemoryStream stream)
+        {
+	        return RuntimeTypeModel.Default.Deserialize(stream, null, type);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Mono/Core/ProtobufHelper.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: aff68e23961f9da49963e7666d2467b8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 4 - 4
Unity/Codes/Model/Core/TimeHelper.cs → Unity/Assets/Mono/Core/TimeHelper.cs

@@ -15,7 +15,7 @@ namespace ET
         /// <returns></returns>
         public static long ClientNow()
         {
-            return Game.TimeInfo.ClientNow();
+            return TimeInfo.Instance.ClientNow();
         }
 
         public static long ClientNowSeconds()
@@ -30,17 +30,17 @@ namespace ET
 
         public static long ServerNow()
         {
-            return Game.TimeInfo.ServerNow();
+            return TimeInfo.Instance.ServerNow();
         }
 
         public static long ClientFrameTime()
         {
-            return Game.TimeInfo.ClientFrameTime();
+            return TimeInfo.Instance.ClientFrameTime();
         }
         
         public static long ServerFrameTime()
         {
-            return Game.TimeInfo.ServerFrameTime();
+            return TimeInfo.Instance.ServerFrameTime();
         }
     }
 }

+ 11 - 0
Unity/Assets/Mono/Core/TimeHelper.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: acd4fecfb89276a4681077c9f3a35969
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 2
Unity/Codes/Model/Core/Object/TimeInfo.cs → Unity/Assets/Mono/Core/TimeInfo.cs

@@ -54,7 +54,7 @@ namespace ET
         
         public long ServerNow()
         {
-            return ClientNow() + Game.TimeInfo.ServerMinusClientTime;
+            return ClientNow() + Instance.ServerMinusClientTime;
         }
         
         public long ClientFrameTime()
@@ -64,7 +64,7 @@ namespace ET
         
         public long ServerFrameTime()
         {
-            return this.FrameTime + Game.TimeInfo.ServerMinusClientTime;
+            return this.FrameTime + Instance.ServerMinusClientTime;
         }
         
         public long Transition(DateTime d)

+ 11 - 0
Unity/Assets/Mono/Core/TimeInfo.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fd69a09bd9f00024e88f9148d666253c
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/UnOrderMultiMap.cs → Unity/Assets/Mono/Core/UnOrderMultiMap.cs


+ 11 - 0
Unity/Assets/Mono/Core/UnOrderMultiMap.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 747fe7a9303dd3a40b5385d5a58ffbef
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Core/UnOrderMultiMapSet.cs → Unity/Assets/Mono/Core/UnOrderMultiMapSet.cs


+ 11 - 0
Unity/Assets/Mono/Core/UnOrderMultiMapSet.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 297f219f1c03e26429e6d9b2360f0f18
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Assets/Mono/AssetsBundleHelper.cs → Unity/Assets/Mono/Helper/AssetsBundleHelper.cs


+ 1 - 1
Unity/Assets/Mono/AssetsBundleHelper.cs.meta → Unity/Assets/Mono/Helper/AssetsBundleHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: b4497d7c724c1164a9ef9b95ebbe0fc3
+guid: 0e345c60bebba1742ae15c700ec617d9
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 69 - 0
Unity/Assets/Mono/ILRuntime/IDisposableAdapter.cs

@@ -0,0 +1,69 @@
+using System;
+using ILRuntime.CLR.Method;
+using ILRuntime.Runtime.Enviorment;
+using ILRuntime.Runtime.Intepreter;
+
+namespace ET
+{   
+    public class IDisposableAdapter : CrossBindingAdaptor
+    {
+        static CrossBindingMethodInfo mDispose_0 = new CrossBindingMethodInfo("Dispose");
+        public override Type BaseCLRType
+        {
+            get
+            {
+                return typeof(System.IDisposable);
+            }
+        }
+
+        public override Type AdaptorType
+        {
+            get
+            {
+                return typeof(Adapter);
+            }
+        }
+
+        public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
+        {
+            return new Adapter(appdomain, instance);
+        }
+
+        public class Adapter : System.IDisposable, CrossBindingAdaptorType
+        {
+            ILTypeInstance instance;
+            ILRuntime.Runtime.Enviorment.AppDomain appdomain;
+
+            public Adapter()
+            {
+
+            }
+
+            public Adapter(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
+            {
+                this.appdomain = appdomain;
+                this.instance = instance;
+            }
+
+            public ILTypeInstance ILInstance { get { return instance; } }
+
+            public void Dispose()
+            {
+                mDispose_0.Invoke(this.instance);
+            }
+
+            public override string ToString()
+            {
+                IMethod m = appdomain.ObjectType.GetMethod("ToString", 0);
+                m = instance.Type.GetVirtualMethod(m);
+                if (m == null || m is ILMethod)
+                {
+                    return instance.ToString();
+                }
+                else
+                    return instance.Type.FullName;
+            }
+        }
+    }
+}
+

+ 11 - 0
Unity/Assets/Mono/ILRuntime/IDisposableAdapter.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5b39d0fe586cf3444a227831f9f83f55
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 5
Unity/Assets/Mono/ILRuntime/ILHelper.cs

@@ -44,12 +44,15 @@ namespace ET
             appdomain.DelegateManager.RegisterFunctionDelegate<KeyValuePair<int, List<int>>, bool>();
             appdomain.DelegateManager.RegisterFunctionDelegate<KeyValuePair<int, int>, KeyValuePair<int, int>, int>();
 
-            // 注册适配器
-            RegisterAdaptor(appdomain);
-
-            //LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain);
+            //注册Json的CLR
+            LitJson.JsonMapper.RegisterILRuntimeCLRRedirection(appdomain);
+            //注册ProtoBuf的CLR
+            ProtoBuf.PBType.RegisterILRuntimeCLRRedirection(appdomain);
             
             CLRBindings.Initialize(appdomain);
+            
+            // 注册适配器
+            RegisterAdaptor(appdomain);
         }
         
         public static void RegisterAdaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
@@ -57,7 +60,7 @@ namespace ET
             //注册自己写的适配器
             appdomain.RegisterCrossBindingAdaptor(new IAsyncStateMachineClassInheritanceAdaptor());
             appdomain.RegisterCrossBindingAdaptor(new ISupportInitializeAdapter());
-            
+            appdomain.RegisterCrossBindingAdaptor(new IDisposableAdapter());
         }
     }
 }

+ 8 - 0
Unity/Assets/Mono/Module.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: fd8fccaa2edf3074cb93592239567a21
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/Mono/Module/Message.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9939995d138da85478061f0a24f34e65
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 2
Unity/Codes/Model/Module/Message/RpcException.cs → Unity/Assets/Mono/Module/Message/RpcException.cs

@@ -5,13 +5,11 @@ namespace ET
     /// <summary>
     /// RPC异常,带ErrorCode
     /// </summary>
-    [Serializable]
     public class RpcException: Exception
     {
         public int Error
         {
             get;
-            private set;
         }
 
         public RpcException(int error, string message): base($"Error: {error} Message: {message}")

+ 11 - 0
Unity/Assets/Mono/Module/Message/RpcException.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7c08a3a7ecb608845a83af0456e11dde
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/Mono/Module/Network.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 22651f6a20eccad4cbccb0d3c7c53eea
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Module/Network/AChannel.cs → Unity/Assets/Mono/Module/Network/AChannel.cs


+ 11 - 0
Unity/Assets/Mono/Module/Network/AChannel.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 93ca66d00a5a67f42a4e7d53738c125b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Module/Network/AService.cs → Unity/Assets/Mono/Module/Network/AService.cs


+ 11 - 0
Unity/Assets/Mono/Module/Network/AService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 868f9f49d4ae1e64b8eeb8a81d6fa6e1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Codes/Model/Module/Network/Circularbuffer.cs → Unity/Assets/Mono/Module/Network/Circularbuffer.cs


+ 11 - 0
Unity/Assets/Mono/Module/Network/Circularbuffer.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 94baaad2aba686c4aa2c1e8e3fec21bc
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 80 - 0
Unity/Assets/Mono/Module/Network/ErrorCore.cs

@@ -0,0 +1,80 @@
+namespace ET
+{
+    public static class ErrorCore
+    {
+        public const int ERR_MyErrorCode = 110000;
+        
+        public const int ERR_KcpConnectTimeout = 100205;
+        public const int ERR_PeerDisconnect = 100208;
+        public const int ERR_SocketCantSend = 100209;
+        public const int ERR_SocketError = 100210;
+        public const int ERR_KcpWaitSendSizeTooLarge = 100211;
+        public const int ERR_KcpCreateError = 100212;
+        public const int ERR_SendMessageNotFoundTChannel = 100213;
+        public const int ERR_TChannelRecvError = 100214;
+        public const int ERR_MessageSocketParserError = 100215;
+        public const int ERR_KcpNotFoundChannel = 100216;
+
+        public const int ERR_WebsocketSendError = 100217;
+        public const int ERR_WebsocketPeerReset = 100218;
+        public const int ERR_WebsocketMessageTooBig = 100219;
+        public const int ERR_WebsocketRecvError = 100220;
+        
+        public const int ERR_KcpReadNotSame = 100230;
+        public const int ERR_KcpSplitError = 100231;
+        public const int ERR_KcpSplitCountError = 100232;
+
+        public const int ERR_ActorLocationSenderTimeout = 110004;
+        public const int ERR_PacketParserError = 110005;
+        public const int ERR_KcpChannelAcceptTimeout = 110206;
+        public const int ERR_KcpRemoteDisconnect = 110207;
+        public const int ERR_WebsocketError = 110303;
+        public const int ERR_WebsocketConnectError = 110304;
+        public const int ERR_RpcFail = 110307;
+        public const int ERR_ReloadFail = 110308;
+        public const int ERR_ConnectGateKeyError = 110309;
+        public const int ERR_SessionSendOrRecvTimeout = 110311;
+        public const int ERR_OuterSessionRecvInnerMessage = 110312;
+        public const int ERR_NotFoundActor = 110313;
+        public const int ERR_ActorTimeout = 110315;
+        public const int ERR_UnverifiedSessionSendMessage = 110316;
+        public const int ERR_ActorLocationSenderTimeout2 = 110317;
+        public const int ERR_ActorLocationSenderTimeout3 = 110318;
+        public const int ERR_ActorLocationSenderTimeout4 = 110319;
+        public const int ERR_ActorLocationSenderTimeout5 = 110320;
+        
+        public const int ERR_KcpRouterTimeout = 110401;
+        public const int ERR_KcpRouterTooManyPackets = 110402;
+        public const int ERR_KcpRouterSame = 110402;
+        
+        // 110000 以上,避免跟SocketError冲突
+
+
+        //-----------------------------------
+
+        // 小于这个Rpc会抛异常,大于这个异常的error需要自己判断处理,也就是说需要处理的错误应该要大于该值
+        public const int ERR_Exception = 200000;
+
+        public const int ERR_Cancel = 200001;
+
+        public static bool IsRpcNeedThrowException(int error)
+        {
+            if (error == 0)
+            {
+                return false;
+            }
+            // ws平台返回错误专用的值
+            if (error == -1)
+            {
+                return false;
+            }
+
+            if (error > ERR_Exception)
+            {
+                return false;
+            }
+
+            return true;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Mono/Module/Network/ErrorCore.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7222eec1269a5cb45bf59dbc34ea3fea
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 8
Unity/Codes/Model/Module/Network/KChannel.cs → Unity/Assets/Mono/Module/Network/KChannel.cs

@@ -194,7 +194,7 @@ namespace ET
 			catch (Exception e)
 			{
 				Log.Error(e);
-				this.OnError(ErrorCode.ERR_SocketCantSend);
+				this.OnError(ErrorCore.ERR_SocketCantSend);
 			}
 		}
 
@@ -214,7 +214,7 @@ namespace ET
 				if (timeNow - this.CreateTime > 10000)
 				{
 					Log.Error($"kChannel connect timeout: {this.Id} {this.RemoteConn} {timeNow} {this.CreateTime} {this.ChannelType} {this.RemoteAddress}");
-					this.OnError(ErrorCode.ERR_KcpConnectTimeout);
+					this.OnError(ErrorCore.ERR_KcpConnectTimeout);
 					return;
 				}
 				switch (ChannelType)
@@ -238,7 +238,7 @@ namespace ET
 			catch (Exception e)
 			{
 				Log.Error(e);
-				this.OnError(ErrorCode.ERR_SocketError);
+				this.OnError(ErrorCore.ERR_SocketError);
 				return;
 			}
 
@@ -284,14 +284,14 @@ namespace ET
 					if (n != count)
 					{
 						Log.Error($"kchannel read error1: {this.LocalConn} {this.RemoteConn}");
-						this.OnError(ErrorCode.ERR_KcpReadNotSame);
+						this.OnError(ErrorCore.ERR_KcpReadNotSame);
 						return;
 					}
 					
 					if (this.needReadSplitCount < 0)
 					{
 						Log.Error($"kchannel read error2: {this.LocalConn} {this.RemoteConn}");
-						this.OnError(ErrorCode.ERR_KcpSplitError);
+						this.OnError(ErrorCore.ERR_KcpSplitError);
 						return;
 					}
 										
@@ -324,7 +324,7 @@ namespace ET
 							if (this.needReadSplitCount <= maxPacketSize)
 							{
 								Log.Error($"kchannel read error3: {this.needReadSplitCount} {this.LocalConn} {this.RemoteConn}");
-								this.OnError(ErrorCode.ERR_KcpSplitCountError);
+								this.OnError(ErrorCore.ERR_KcpSplitCountError);
 								return;
 							}
 							this.readMemory = new MemoryStream(this.needReadSplitCount);
@@ -382,7 +382,7 @@ namespace ET
 			catch (Exception e)
 			{
 				Log.Error(e);
-				this.OnError(ErrorCode.ERR_SocketCantSend);
+				this.OnError(ErrorCore.ERR_SocketCantSend);
 			}
 		}
 
@@ -453,7 +453,7 @@ namespace ET
 				if (n > maxWaitSize)
 				{
 					Log.Error($"kcp wait snd too large: {n}: {this.Id} {this.LocalConn} {this.RemoteConn}");
-					this.OnError(ErrorCode.ERR_KcpWaitSendSizeTooLarge);
+					this.OnError(ErrorCore.ERR_KcpWaitSendSizeTooLarge);
 					return;
 				}
 			}

+ 11 - 0
Unity/Assets/Mono/Module/Network/KChannel.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 251e6a92fa54e1a46a4d233e72c458ca
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 23 - 24
Unity/Codes/Model/Module/Network/KService.cs → Unity/Assets/Mono/Module/Network/KService.cs

@@ -168,6 +168,7 @@ namespace ET
         // 记录最小时间,不用每次都去MultiMap取第一个值
         private long minTime;
 
+        private List<long> waitRemoveChannels = new List<long>();
 
         public override bool IsDispose()
         {
@@ -288,7 +289,7 @@ namespace ET
                             catch (Exception e)
                             {
                                 Log.Error(e);
-                                kChannel.OnError(ErrorCode.ERR_SocketCantSend);
+                                kChannel.OnError(ErrorCore.ERR_SocketCantSend);
                             }
 
                             break;
@@ -337,7 +338,7 @@ namespace ET
                             }
                             
                             Log.Info($"kservice recv fin: {kChannel.Id} {localConn} {remoteConn} {error}");
-                            kChannel.OnError(ErrorCode.ERR_PeerDisconnect);
+                            kChannel.OnError(ErrorCore.ERR_PeerDisconnect);
 
                             break;
                         case KcpProtocalType.MSG: // 断开
@@ -354,7 +355,7 @@ namespace ET
                             if (kChannel == null)
                             {
                                 // 通知对方断开
-                                this.Disconnect(localConn, remoteConn, ErrorCode.ERR_KcpNotFoundChannel, (IPEndPoint) this.ipEndPoint, 1);
+                                this.Disconnect(localConn, remoteConn, ErrorCore.ERR_KcpNotFoundChannel, (IPEndPoint) this.ipEndPoint, 1);
                                 break;
                             }
                             
@@ -510,35 +511,33 @@ namespace ET
 
         private void RemoveConnectTimeoutChannels()
         {
-            using (ListComponent<long> waitRemoveChannels = ListComponent<long>.Create())
+            waitRemoveChannels.Clear();
+            foreach (long channelId in this.waitConnectChannels.Keys)
             {
-                foreach (long channelId in this.waitConnectChannels.Keys)
+                this.waitConnectChannels.TryGetValue(channelId, out KChannel kChannel);
+                if (kChannel == null)
                 {
-                    this.waitConnectChannels.TryGetValue(channelId, out KChannel kChannel);
-                    if (kChannel == null)
-                    {
-                        Log.Error($"RemoveConnectTimeoutChannels not found kchannel: {channelId}");
-                        continue;
-                    }
-
-                    // 连接上了要马上删除
-                    if (kChannel.IsConnected)
-                    {
-                        waitRemoveChannels.List.Add(channelId);
-                    }
+                    Log.Error($"RemoveConnectTimeoutChannels not found kchannel: {channelId}");
+                    continue;
+                }
 
-                    // 10秒连接超时
-                    if (this.TimeNow > kChannel.CreateTime + 10 * 1000)
-                    {
-                        waitRemoveChannels.List.Add(channelId);
-                    }
+                // 连接上了要马上删除
+                if (kChannel.IsConnected)
+                {
+                    waitRemoveChannels.Add(channelId);
                 }
 
-                foreach (long channelId in waitRemoveChannels.List)
+                // 10秒连接超时
+                if (this.TimeNow > kChannel.CreateTime + 10 * 1000)
                 {
-                    this.waitConnectChannels.Remove(channelId);
+                    waitRemoveChannels.Add(channelId);
                 }
             }
+
+            foreach (long channelId in waitRemoveChannels)
+            {
+                this.waitConnectChannels.Remove(channelId);
+            }
         }
 
         // 计算到期需要update的channel

+ 11 - 0
Unity/Assets/Mono/Module/Network/KService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 40d9951107a787d4ebe60fd2a63461eb
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/Mono/Module/NetworkTCP.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3d4aa2f56cb87cd40867758a678f7393
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Codes/Model/Module/NetworkTCP/PacketParser.cs → Unity/Assets/Mono/Module/NetworkTCP/PacketParser.cs

@@ -75,7 +75,7 @@ namespace ET
 							return false;
 						}
 
-						MemoryStream memoryStream = MessageSerializeHelper.GetStream(this.packetSize);
+						MemoryStream memoryStream = new MemoryStream(this.packetSize);
 						this.buffer.Read(memoryStream, this.packetSize);
 						//memoryStream.SetLength(this.packetSize - Packet.MessageIndex);
 						this.MemoryStream = memoryStream;

+ 11 - 0
Unity/Assets/Mono/Module/NetworkTCP/PacketParser.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0eca8ccff942df7438ebc49e74229f6b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 5 - 5
Unity/Codes/Model/Module/NetworkTCP/TChannel.cs → Unity/Assets/Mono/Module/NetworkTCP/TChannel.cs

@@ -210,7 +210,7 @@ namespace ET
 				catch (Exception e)
 				{
 					Log.Error($"tchannel error: {this.Id}\n{e}");
-					this.OnError(ErrorCode.ERR_TChannelRecvError);
+					this.OnError(ErrorCore.ERR_TChannelRecvError);
 					return;
 				}
 			
@@ -249,7 +249,7 @@ namespace ET
 
 			if (e.BytesTransferred == 0)
 			{
-				this.OnError(ErrorCode.ERR_PeerDisconnect);
+				this.OnError(ErrorCore.ERR_PeerDisconnect);
 				return;
 			}
 
@@ -281,7 +281,7 @@ namespace ET
 				catch (Exception ee)
 				{
 					Log.Error($"ip: {this.RemoteAddress} {ee}");
-					this.OnError(ErrorCode.ERR_SocketError);
+					this.OnError(ErrorCore.ERR_SocketError);
 					return;
 				}
 			}
@@ -363,7 +363,7 @@ namespace ET
 			
 			if (e.BytesTransferred == 0)
 			{
-				this.OnError(ErrorCode.ERR_PeerDisconnect);
+				this.OnError(ErrorCore.ERR_PeerDisconnect);
 				return;
 			}
 			
@@ -386,7 +386,7 @@ namespace ET
 			{
 				Log.Error($"{this.RemoteAddress} {memoryStream.Length} {e}");
 				// 出现任何消息解析异常都要断开Session,防止客户端伪造消息
-				this.OnError(ErrorCode.ERR_PacketParserError);
+				this.OnError(ErrorCore.ERR_PacketParserError);
 			}
 		}
 

+ 11 - 0
Unity/Assets/Mono/Module/NetworkTCP/TChannel.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fb6fe58f92d2ac444981eb135511618d
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Codes/Model/Module/NetworkTCP/TService.cs → Unity/Assets/Mono/Module/NetworkTCP/TService.cs

@@ -151,7 +151,7 @@ namespace ET
 				TChannel aChannel = this.Get(channelId);
 				if (aChannel == null)
 				{
-					this.OnError(channelId, ErrorCode.ERR_SendMessageNotFoundTChannel);
+					this.OnError(channelId, ErrorCore.ERR_SendMessageNotFoundTChannel);
 					return;
 				}
 				aChannel.Send(actorId, stream);

+ 11 - 0
Unity/Assets/Mono/Module/NetworkTCP/TService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c86d0145bc0f3904795b74ea77da1c45
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 4 - 0
Unity/Assets/Mono/MonoBehaviour/Init.cs

@@ -13,6 +13,10 @@ namespace ET
 			
 			DontDestroyOnLoad(gameObject);
 
+			Log.ILog = new UnityLogger();
+
+			Options.Instance = new Options();
+
 			this.codeLoader = CodeLoader.Instance;
 		}
 

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/IJsonWrapper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1a217e0837c088749b629a606721fb4d
+guid: 66e03e18258607749a2b82b496c87462
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 12 - 69
Unity/Assets/Mono/ThirdParty/LitJson/JsonData.cs

@@ -73,16 +73,6 @@ namespace LitJson
         public ICollection<string> Keys {
             get { EnsureDictionary (); return inst_object.Keys; }
         }
-        
-        /// <summary>
-        /// Determines whether the json contains an element that has the specified key.
-        /// </summary>
-        /// <param name="key">The key to locate in the json.</param>
-        /// <returns>true if the json contains an element that has the specified key; otherwise, false.</returns>
-        public Boolean ContainsKey(String key) {
-            EnsureDictionary();
-            return this.inst_object.Keys.Contains(key);
-        }
         #endregion
 
 
@@ -435,27 +425,22 @@ namespace LitJson
             return data.inst_double;
         }
 
-       public static explicit operator Int32(JsonData data)
+        public static explicit operator Int32 (JsonData data)
         {
-            if (data.type != JsonType.Int && data.type != JsonType.Long)
-            {
-                throw new InvalidCastException(
+            if (data.type != JsonType.Int)
+                throw new InvalidCastException (
                     "Instance of JsonData doesn't hold an int");
-            }
 
-            // cast may truncate data... but that's up to the user to consider
-            return data.type == JsonType.Int ? data.inst_int : (int)data.inst_long;
+            return data.inst_int;
         }
 
-        public static explicit operator Int64(JsonData data)
+        public static explicit operator Int64 (JsonData data)
         {
-            if (data.type != JsonType.Long && data.type != JsonType.Int)
-            {
-                throw new InvalidCastException(
-                    "Instance of JsonData doesn't hold a long");
-            }
+            if (data.type != JsonType.Long)
+                throw new InvalidCastException (
+                    "Instance of JsonData doesn't hold an int");
 
-            return data.type == JsonType.Long ? data.inst_long : data.inst_int;
+            return data.inst_long;
         }
 
         public static explicit operator String (JsonData data)
@@ -819,25 +804,6 @@ namespace LitJson
             return EnsureList ().Add (data);
         }
 
-        public bool Remove(object obj)
-        {
-            json = null;
-            if(IsObject)
-            {
-                JsonData value = null;
-                if (inst_object.TryGetValue((string)obj, out value))
-                    return inst_object.Remove((string)obj) && object_list.Remove(new KeyValuePair<string, JsonData>((string)obj, value));
-                else
-                    throw new KeyNotFoundException("The specified key was not found in the JsonData object.");
-            }
-            if(IsArray)
-            {
-                return inst_array.Remove(ToJsonData(obj));
-            }
-            throw new InvalidOperationException (
-                    "Instance of JsonData is not an object or a list.");
-        }
-
         public void Clear ()
         {
             if (IsObject) {
@@ -857,14 +823,7 @@ namespace LitJson
                 return false;
 
             if (x.type != this.type)
-            {
-                // further check to see if this is a long to int comparison
-                if ((x.type != JsonType.Int && x.type != JsonType.Long)
-                    || (this.type != JsonType.Int && this.type != JsonType.Long))
-                {
-                    return false;
-                }
-            }
+                return false;
 
             switch (this.type) {
             case JsonType.None:
@@ -880,26 +839,10 @@ namespace LitJson
                 return this.inst_string.Equals (x.inst_string);
 
             case JsonType.Int:
-            {
-                if (x.IsLong)
-                {
-                    if (x.inst_long < Int32.MinValue || x.inst_long > Int32.MaxValue)
-                        return false;
-                    return this.inst_int.Equals((int)x.inst_long);
-                }
-                return this.inst_int.Equals(x.inst_int);
-            }
+                return this.inst_int.Equals (x.inst_int);
 
             case JsonType.Long:
-            {
-                if (x.IsInt)
-                {
-                    if (this.inst_long < Int32.MinValue || this.inst_long > Int32.MaxValue)
-                        return false;
-                    return x.inst_int.Equals((int)this.inst_long);
-                }
-                return this.inst_long.Equals(x.inst_long);
-            }
+                return this.inst_long.Equals (x.inst_long);
 
             case JsonType.Double:
                 return this.inst_double.Equals (x.inst_double);

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonData.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: df135f702bdb16c4ea644ca96368175d
+guid: a2716bba00380e94fb8445314553afd2
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 6
Unity/Assets/Mono/ThirdParty/LitJson/JsonException.cs

@@ -14,12 +14,7 @@ using System;
 
 namespace LitJson
 {
-    public class JsonException :
-#if NETSTANDARD1_5
-        Exception
-#else
-        ApplicationException
-#endif
+    public class JsonException : ApplicationException
     {
         public JsonException () : base ()
         {

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonException.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 8dffd6f51ff858946bb25cc9188dfc6e
+guid: 52d51045aee29c34b966d0ec95b076de
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 329 - 258
Unity/Assets/Mono/ThirdParty/LitJson/JsonMapper.cs


+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonMapper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 2ab543118874f8841859d5562afc4ad8
+guid: 3de36c3bb0dedc7439ecef0d890e018c
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonMockWrapper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c5f89b15adfb6c14fa4c1b50113ff553
+guid: cbf47cf2e21a7bf4987ab4b31ee787b7
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 112 - 117
Unity/Assets/Mono/ThirdParty/LitJson/JsonReader.cs

@@ -11,7 +11,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -43,7 +42,7 @@ namespace LitJson
     public class JsonReader
     {
         #region Fields
-        private static readonly IDictionary<int, IDictionary<int, int[]>> parse_table;
+        private static IDictionary<int, IDictionary<int, int[]>> parse_table;
 
         private Stack<int>    automaton_stack;
         private int           current_input;
@@ -99,7 +98,7 @@ namespace LitJson
         #region Constructors
         static JsonReader ()
         {
-            parse_table = PopulateParseTable ();
+            PopulateParseTable ();
         }
 
         public JsonReader (string json_text) :
@@ -139,122 +138,120 @@ namespace LitJson
 
 
         #region Static Methods
-        private static IDictionary<int, IDictionary<int, int[]>> PopulateParseTable ()
+        private static void PopulateParseTable ()
         {
             // See section A.2. of the manual for details
-            IDictionary<int, IDictionary<int, int[]>> parse_table = new Dictionary<int, IDictionary<int, int[]>> ();
-
-            TableAddRow (parse_table, ParserToken.Array);
-            TableAddCol (parse_table, ParserToken.Array, '[',
-                            '[',
-                            (int) ParserToken.ArrayPrime);
-
-            TableAddRow (parse_table, ParserToken.ArrayPrime);
-            TableAddCol (parse_table, ParserToken.ArrayPrime, '"',
-                            (int) ParserToken.Value,
-
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, '[',
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, ']',
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, '{',
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Number,
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.True,
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.False,
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-            TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Null,
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest,
-                            ']');
-
-            TableAddRow (parse_table, ParserToken.Object);
-            TableAddCol (parse_table, ParserToken.Object, '{',
-                            '{',
-                            (int) ParserToken.ObjectPrime);
-
-            TableAddRow (parse_table, ParserToken.ObjectPrime);
-            TableAddCol (parse_table, ParserToken.ObjectPrime, '"',
-                            (int) ParserToken.Pair,
-                            (int) ParserToken.PairRest,
-                            '}');
-            TableAddCol (parse_table, ParserToken.ObjectPrime, '}',
-                            '}');
-
-            TableAddRow (parse_table, ParserToken.Pair);
-            TableAddCol (parse_table, ParserToken.Pair, '"',
-                            (int) ParserToken.String,
-                            ':',
-                            (int) ParserToken.Value);
-
-            TableAddRow (parse_table, ParserToken.PairRest);
-            TableAddCol (parse_table, ParserToken.PairRest, ',',
-                            ',',
-                            (int) ParserToken.Pair,
-                            (int) ParserToken.PairRest);
-            TableAddCol (parse_table, ParserToken.PairRest, '}',
-                            (int) ParserToken.Epsilon);
-
-            TableAddRow (parse_table, ParserToken.String);
-            TableAddCol (parse_table, ParserToken.String, '"',
-                            '"',
-                            (int) ParserToken.CharSeq,
-                            '"');
-
-            TableAddRow (parse_table, ParserToken.Text);
-            TableAddCol (parse_table, ParserToken.Text, '[',
-                            (int) ParserToken.Array);
-            TableAddCol (parse_table, ParserToken.Text, '{',
-                            (int) ParserToken.Object);
-
-            TableAddRow (parse_table, ParserToken.Value);
-            TableAddCol (parse_table, ParserToken.Value, '"',
-                            (int) ParserToken.String);
-            TableAddCol (parse_table, ParserToken.Value, '[',
-                            (int) ParserToken.Array);
-            TableAddCol (parse_table, ParserToken.Value, '{',
-                            (int) ParserToken.Object);
-            TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Number,
-                            (int) ParserToken.Number);
-            TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.True,
-                            (int) ParserToken.True);
-            TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.False,
-                            (int) ParserToken.False);
-            TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Null,
-                            (int) ParserToken.Null);
-
-            TableAddRow (parse_table, ParserToken.ValueRest);
-            TableAddCol (parse_table, ParserToken.ValueRest, ',',
-                            ',',
-                            (int) ParserToken.Value,
-                            (int) ParserToken.ValueRest);
-            TableAddCol (parse_table, ParserToken.ValueRest, ']',
-                            (int) ParserToken.Epsilon);
-
-            return parse_table;
+            parse_table = new Dictionary<int, IDictionary<int, int[]>> ();
+
+            TableAddRow (ParserToken.Array);
+            TableAddCol (ParserToken.Array, '[',
+                         '[',
+                         (int) ParserToken.ArrayPrime);
+
+            TableAddRow (ParserToken.ArrayPrime);
+            TableAddCol (ParserToken.ArrayPrime, '"',
+                         (int) ParserToken.Value,
+
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, '[',
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, ']',
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, '{',
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Number,
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.True,
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.False,
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Null,
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest,
+                         ']');
+
+            TableAddRow (ParserToken.Object);
+            TableAddCol (ParserToken.Object, '{',
+                         '{',
+                         (int) ParserToken.ObjectPrime);
+
+            TableAddRow (ParserToken.ObjectPrime);
+            TableAddCol (ParserToken.ObjectPrime, '"',
+                         (int) ParserToken.Pair,
+                         (int) ParserToken.PairRest,
+                         '}');
+            TableAddCol (ParserToken.ObjectPrime, '}',
+                         '}');
+
+            TableAddRow (ParserToken.Pair);
+            TableAddCol (ParserToken.Pair, '"',
+                         (int) ParserToken.String,
+                         ':',
+                         (int) ParserToken.Value);
+
+            TableAddRow (ParserToken.PairRest);
+            TableAddCol (ParserToken.PairRest, ',',
+                         ',',
+                         (int) ParserToken.Pair,
+                         (int) ParserToken.PairRest);
+            TableAddCol (ParserToken.PairRest, '}',
+                         (int) ParserToken.Epsilon);
+
+            TableAddRow (ParserToken.String);
+            TableAddCol (ParserToken.String, '"',
+                         '"',
+                         (int) ParserToken.CharSeq,
+                         '"');
+
+            TableAddRow (ParserToken.Text);
+            TableAddCol (ParserToken.Text, '[',
+                         (int) ParserToken.Array);
+            TableAddCol (ParserToken.Text, '{',
+                         (int) ParserToken.Object);
+
+            TableAddRow (ParserToken.Value);
+            TableAddCol (ParserToken.Value, '"',
+                         (int) ParserToken.String);
+            TableAddCol (ParserToken.Value, '[',
+                         (int) ParserToken.Array);
+            TableAddCol (ParserToken.Value, '{',
+                         (int) ParserToken.Object);
+            TableAddCol (ParserToken.Value, (int) ParserToken.Number,
+                         (int) ParserToken.Number);
+            TableAddCol (ParserToken.Value, (int) ParserToken.True,
+                         (int) ParserToken.True);
+            TableAddCol (ParserToken.Value, (int) ParserToken.False,
+                         (int) ParserToken.False);
+            TableAddCol (ParserToken.Value, (int) ParserToken.Null,
+                         (int) ParserToken.Null);
+
+            TableAddRow (ParserToken.ValueRest);
+            TableAddCol (ParserToken.ValueRest, ',',
+                         ',',
+                         (int) ParserToken.Value,
+                         (int) ParserToken.ValueRest);
+            TableAddCol (ParserToken.ValueRest, ']',
+                         (int) ParserToken.Epsilon);
         }
 
-        private static void TableAddCol (IDictionary<int, IDictionary<int, int[]>> parse_table, ParserToken row, int col,
+        private static void TableAddCol (ParserToken row, int col,
                                          params int[] symbols)
         {
             parse_table[(int) row].Add (col, symbols);
         }
 
-        private static void TableAddRow (IDictionary<int, IDictionary<int, int[]>> parse_table, ParserToken rule)
+        private static void TableAddRow (ParserToken rule)
         {
             parse_table.Add ((int) rule, new Dictionary<int, int[]> ());
         }
@@ -269,7 +266,7 @@ namespace LitJson
                 number.IndexOf ('E') != -1) {
 
                 double n_double;
-                if (double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out n_double)) {
+                if (Double.TryParse (number, out n_double)) {
                     token = JsonToken.Double;
                     token_value = n_double;
 
@@ -278,7 +275,7 @@ namespace LitJson
             }
 
             int n_int32;
-            if (int.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int32)) {
+            if (Int32.TryParse (number, out n_int32)) {
                 token = JsonToken.Int;
                 token_value = n_int32;
 
@@ -286,7 +283,7 @@ namespace LitJson
             }
 
             long n_int64;
-            if (long.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int64)) {
+            if (Int64.TryParse (number, out n_int64)) {
                 token = JsonToken.Long;
                 token_value = n_int64;
 
@@ -294,7 +291,7 @@ namespace LitJson
             }
 
             ulong n_uint64;
-            if (ulong.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_uint64))
+            if (UInt64.TryParse(number, out n_uint64))
             {
                 token = JsonToken.Long;
                 token_value = n_uint64;
@@ -395,9 +392,7 @@ namespace LitJson
             end_of_json  = true;
 
             if (reader_is_owned)
-            {
-                using(reader){}
-            }
+                reader.Close ();
 
             reader = null;
         }

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonReader.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 080fd553d3da08047ab0298cbfdb2e52
+guid: 43a009d7aafd9a443bfb83efd667e724
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 23 - 31
Unity/Assets/Mono/ThirdParty/LitJson/JsonWriter.cs

@@ -39,7 +39,7 @@ namespace LitJson
     public class JsonWriter
     {
         #region Fields
-        private static readonly NumberFormatInfo number_format;
+        private static NumberFormatInfo number_format;
 
         private WriterContext        context;
         private Stack<WriterContext> ctx_stack;
@@ -50,7 +50,6 @@ namespace LitJson
         private StringBuilder        inst_string_builder;
         private bool                 pretty_print;
         private bool                 validate;
-        private bool                 lower_case_properties;
         private TextWriter           writer;
         #endregion
 
@@ -77,11 +76,6 @@ namespace LitJson
             get { return validate; }
             set { validate = value; }
         }
-
-        public bool LowerCaseProperties {
-            get { return lower_case_properties; }
-            set { lower_case_properties = value; }
-        }
         #endregion
 
 
@@ -172,7 +166,6 @@ namespace LitJson
             indent_value = 4;
             pretty_print = false;
             validate = true;
-            lower_case_properties = false;
 
             ctx_stack = new Stack<WriterContext> ();
             context = new WriterContext ();
@@ -223,7 +216,7 @@ namespace LitJson
                 writer.Write (',');
 
             if (pretty_print && ! context.ExpectingValue)
-                writer.Write (Environment.NewLine);
+                writer.Write ('\n');
         }
 
         private void PutString (string str)
@@ -231,11 +224,13 @@ namespace LitJson
             Put (String.Empty);
 
             writer.Write ('"');
-            writer.Write(str);
-            writer.Write('"');
-            return;
+
+	        //直接存储原始字符串,不再做任何转义字符的解析
+	        writer.Write(str);
+	        writer.Write('"');
+	        return;
 /*
-            int n = str.Length;
+			int n = str.Length;
             for (int i = 0; i < n; i++) {
                 switch (str[i]) {
                 case '\n':
@@ -343,17 +338,6 @@ namespace LitJson
             context.ExpectingValue = false;
         }
 
-        public void Write(float number)
-        {
-            DoValidation(Condition.Value);
-            PutNewline();
-
-            string str = Convert.ToString(number, number_format);
-            Put(str);
-
-            context.ExpectingValue = false;
-        }
-
         public void Write (int number)
         {
             DoValidation (Condition.Value);
@@ -463,17 +447,14 @@ namespace LitJson
         {
             DoValidation (Condition.Property);
             PutNewline ();
-            string propertyName = (property_name == null || !lower_case_properties)
-                ? property_name
-                : property_name.ToLowerInvariant();
 
-            PutString (propertyName);
+            PutString (property_name);
 
             if (pretty_print) {
-                if (propertyName.Length > context.Padding)
-                    context.Padding = propertyName.Length;
+                if (property_name.Length > context.Padding)
+                    context.Padding = property_name.Length;
 
-                for (int i = context.Padding - propertyName.Length;
+                for (int i = context.Padding - property_name.Length;
                      i >= 0; i--)
                     writer.Write (' ');
 
@@ -483,5 +464,16 @@ namespace LitJson
 
             context.ExpectingValue = true;
         }
+        
+        public void Write(float number)
+        {
+            DoValidation(Condition.Value);
+            PutNewline();
+ 
+            string str = number.ToString();
+            Put(str);
+ 
+            context.ExpectingValue = false;
+        }
     }
 }

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/JsonWriter.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 5f513552508ac234f87fbbd28be78e5c
+guid: b4be071ea849a8b41af4fcbf1f25e9e5
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 4 - 4
Unity/Assets/Mono/ThirdParty/LitJson/Lexer.cs

@@ -31,8 +31,8 @@ namespace LitJson
         #region Fields
         private delegate bool StateHandler (FsmContext ctx);
 
-        private static readonly int[]          fsm_return_table;
-        private static readonly StateHandler[] fsm_handler_table;
+        private static int[]          fsm_return_table;
+        private static StateHandler[] fsm_handler_table;
 
         private bool          allow_comments;
         private bool          allow_single_quoted_strings;
@@ -77,7 +77,7 @@ namespace LitJson
         #region Constructors
         static Lexer ()
         {
-            PopulateFsmTables (out fsm_handler_table, out fsm_return_table);
+            PopulateFsmTables ();
         }
 
         public Lexer (TextReader reader)
@@ -130,7 +130,7 @@ namespace LitJson
             }
         }
 
-        private static void PopulateFsmTables (out StateHandler[] fsm_handler_table, out int[] fsm_return_table)
+        private static void PopulateFsmTables ()
         {
             // See section A.1. of the manual for details of the finite
             // state machine.

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/Lexer.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: e6ee4aa34aec6b54e89d18efe8d5a6f9
+guid: 121eed90aacf4064f984583e01eb6cf1
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Mono/ThirdParty/LitJson/ParserToken.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 13415f19664e8ac4eaab52d5335cbc36
+guid: 0b8950249e5e00444b26aba954c668eb
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
Unity/Assets/Mono/ThirdParty/LitJson/UnityTypeBindings.cs

@@ -5,7 +5,7 @@ using LitJson.Extensions;
 namespace LitJson
 {
 
-#if !NOT_CLIENT
+#if !SERVER
 #endif
     /// <summary>
     /// Unity内建类型拓展
@@ -37,7 +37,7 @@ namespace LitJson
             {
                 return Type.GetType(s);
             });
-#if !NOT_CLIENT
+#if !SERVER
             // 注册Vector2类型的Exporter
             Action<UnityEngine.Vector2, JsonWriter> writeVector2 = (v, w) =>
             {

+ 61 - 55
Unity/Assets/Mono/ThirdParty/protobuf-net/BclHelpers.cs

@@ -1,5 +1,5 @@
 using System;
-using System.Reflection;
+
 namespace ProtoBuf
 {
     internal enum TimeSpanScale
@@ -18,7 +18,13 @@ namespace ProtoBuf
     /// Provides support for common .NET types that do not have a direct representation
     /// in protobuf, using the definitions from bcl.proto
     /// </summary>
-    public static class BclHelpers
+    public
+#if FX11
+    sealed
+#else
+    static
+#endif
+        class BclHelpers
     {
         /// <summary>
         /// Creates a new instance of the specified type, bypassing the constructor.
@@ -32,7 +38,7 @@ namespace ProtoBuf
             object obj = TryGetUninitializedObjectWithFormatterServices(type);
             if (obj != null) return obj;
 #endif
-#if PLAT_BINARYFORMATTER && !(COREFX || PROFILE259)
+#if PLAT_BINARYFORMATTER && !(WINRT || PHONE8 || COREFX)
             return System.Runtime.Serialization.FormatterServices.GetUninitializedObject(type);
 #else
             throw new NotSupportedException("Constructor-skipping is not supported on this platform");
@@ -47,12 +53,6 @@ namespace ProtoBuf
             {
                 try {
                     var formatterServiceType = typeof(string).GetTypeInfo().Assembly.GetType("System.Runtime.Serialization.FormatterServices");
-                    if (formatterServiceType == null)
-                    {
-                        // fallback for .Net Core 3.0
-                        var formatterAssembly = Assembly.Load(new AssemblyName("System.Runtime.Serialization.Formatters"));
-                        formatterServiceType = formatterAssembly.GetType("System.Runtime.Serialization.FormatterServices");
-                    }
                     MethodInfo method = formatterServiceType?.GetMethod("GetUninitializedObject", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
                     if (method != null)
                     {
@@ -66,6 +66,9 @@ namespace ProtoBuf
         }
 #endif
 
+#if FX11
+        private BclHelpers() { } // not a static class for C# 1.2 reasons
+#endif
         const int FieldTimeSpanValue = 0x01, FieldTimeSpanScale = 0x02, FieldTimeSpanKind = 0x03;
 
         internal static readonly DateTime[] EpochOrigin = {
@@ -79,6 +82,7 @@ namespace ProtoBuf
         /// </summary>
         private static readonly DateTime TimestampEpoch = EpochOrigin[(int)DateTimeKind.Utc];
 
+
         /// <summary>
         /// Writes a TimeSpan to a protobuf stream using protobuf-net's own representation, bcl.TimeSpan
         /// </summary>
@@ -86,12 +90,11 @@ namespace ProtoBuf
         {
             WriteTimeSpanImpl(timeSpan, dest, DateTimeKind.Unspecified);
         }
-
         private static void WriteTimeSpanImpl(TimeSpan timeSpan, ProtoWriter dest, DateTimeKind kind)
         {
-            if (dest == null) throw new ArgumentNullException(nameof(dest));
+            if (dest == null) throw new ArgumentNullException("dest");
             long value;
-            switch (dest.WireType)
+            switch(dest.WireType)
             {
                 case WireType.String:
                 case WireType.StartGroup:
@@ -138,18 +141,16 @@ namespace ProtoBuf
                     }
 
                     SubItemToken token = ProtoWriter.StartSubItem(null, dest);
-
-                    if (value != 0)
-                    {
+            
+                    if(value != 0) {
                         ProtoWriter.WriteFieldHeader(FieldTimeSpanValue, WireType.SignedVariant, dest);
                         ProtoWriter.WriteInt64(value, dest);
                     }
-                    if (scale != TimeSpanScale.Days)
-                    {
+                    if(scale != TimeSpanScale.Days) {
                         ProtoWriter.WriteFieldHeader(FieldTimeSpanScale, WireType.Variant, dest);
                         ProtoWriter.WriteInt32((int)scale, dest);
                     }
-                    if (kind != DateTimeKind.Unspecified)
+                    if(kind != DateTimeKind.Unspecified)
                     {
                         ProtoWriter.WriteFieldHeader(FieldTimeSpanKind, WireType.Variant, dest);
                         ProtoWriter.WriteInt32((int)kind, dest);
@@ -163,13 +164,13 @@ namespace ProtoBuf
                     throw new ProtoException("Unexpected wire-type: " + dest.WireType.ToString());
             }
         }
-
         /// <summary>
         /// Parses a TimeSpan from a protobuf stream using protobuf-net's own representation, bcl.TimeSpan
         /// </summary>        
         public static TimeSpan ReadTimeSpan(ProtoReader source)
         {
-            long ticks = ReadTimeSpanTicks(source, out DateTimeKind kind);
+            DateTimeKind kind;
+            long ticks = ReadTimeSpanTicks(source, out kind);
             if (ticks == long.MinValue) return TimeSpan.MinValue;
             if (ticks == long.MaxValue) return TimeSpan.MaxValue;
             return TimeSpan.FromTicks(ticks);
@@ -208,10 +209,10 @@ namespace ProtoBuf
         /// </summary>
         public static void WriteDuration(TimeSpan value, ProtoWriter dest)
         {
-            var seconds = ToDurationSeconds(value, out int nanos);
+			int nanos;
+            var seconds = ToDurationSeconds(value, out nanos);
             WriteSecondsNanos(seconds, nanos, dest);
         }
-
         private static void WriteSecondsNanos(long seconds, int nanos, ProtoWriter dest)
         {
             SubItemToken token = ProtoWriter.StartSubItem(null, dest);
@@ -244,8 +245,9 @@ namespace ProtoBuf
         /// </summary>
         public static void WriteTimestamp(DateTime value, ProtoWriter dest)
         {
-            var seconds = ToDurationSeconds(value - TimestampEpoch, out int nanos);
-
+			int nanos;
+            var seconds = ToDurationSeconds(value - TimestampEpoch, out nanos);
+            
             if (nanos < 0)
             {   // from Timestamp.proto:
                 // "Negative second values with fractions must still have
@@ -255,15 +257,14 @@ namespace ProtoBuf
             }
             WriteSecondsNanos(seconds, nanos, dest);
         }
-
+        
         static TimeSpan FromDurationSeconds(long seconds, int nanos)
         {
-
+            
             long ticks = checked((seconds * TimeSpan.TicksPerSecond)
                 + (nanos * TimeSpan.TicksPerMillisecond) / 1000000);
             return TimeSpan.FromTicks(ticks);
         }
-
         static long ToDurationSeconds(TimeSpan value, out int nanos)
         {
             nanos = (int)(((value.Ticks % TimeSpan.TicksPerSecond) * 1000000)
@@ -276,7 +277,8 @@ namespace ProtoBuf
         /// </summary>
         public static DateTime ReadDateTime(ProtoReader source)
         {
-            long ticks = ReadTimeSpanTicks(source, out DateTimeKind kind);
+            DateTimeKind kind;
+            long ticks = ReadTimeSpanTicks(source, out kind);
             if (ticks == long.MinValue) return DateTime.MinValue;
             if (ticks == long.MaxValue) return DateTime.MaxValue;
             return EpochOrigin[(int)kind].AddTicks(ticks);
@@ -289,7 +291,6 @@ namespace ProtoBuf
         {
             WriteDateTimeImpl(value, dest, false);
         }
-
         /// <summary>
         /// Writes a DateTime to a protobuf stream, including the <c>Kind</c>
         /// </summary>
@@ -300,7 +301,7 @@ namespace ProtoBuf
 
         private static void WriteDateTimeImpl(DateTime value, ProtoWriter dest, bool includeKind)
         {
-            if (dest == null) throw new ArgumentNullException(nameof(dest));
+            if (dest == null) throw new ArgumentNullException("dest");
             TimeSpan delta;
             switch (dest.WireType)
             {
@@ -328,8 +329,7 @@ namespace ProtoBuf
             WriteTimeSpanImpl(delta, dest, includeKind ? value.Kind : DateTimeKind.Unspecified);
         }
 
-        private static long ReadTimeSpanTicks(ProtoReader source, out DateTimeKind kind)
-        {
+        private static long ReadTimeSpanTicks(ProtoReader source, out DateTimeKind kind) {
             kind = DateTimeKind.Unspecified;
             switch (source.WireType)
             {
@@ -352,7 +352,7 @@ namespace ProtoBuf
                                 break;
                             case FieldTimeSpanKind:
                                 kind = (DateTimeKind)source.ReadInt32();
-                                switch (kind)
+                                switch(kind)
                                 {
                                     case DateTimeKind.Unspecified:
                                     case DateTimeKind.Utc:
@@ -421,10 +421,12 @@ namespace ProtoBuf
                     case FieldDecimalSignScale: signScale = reader.ReadUInt32(); break;
                     default: reader.SkipField(); break;
                 }
-
+                
             }
             ProtoReader.EndSubItem(token, reader);
 
+            if (low == 0 && high == 0) return decimal.Zero;
+
             int lo = (int)(low & 0xFFFFFFFFL),
                 mid = (int)((low >> 32) & 0xFFFFFFFFL),
                 hi = (int)high;
@@ -432,7 +434,6 @@ namespace ProtoBuf
             byte scale = (byte)((signScale & 0x01FE) >> 1);
             return new decimal(lo, mid, hi, isNeg, scale);
         }
-
         /// <summary>
         /// Writes a decimal to a protobuf stream
         /// </summary>
@@ -445,8 +446,7 @@ namespace ProtoBuf
             uint signScale = (uint)(((bits[3] >> 15) & 0x01FE) | ((bits[3] >> 31) & 0x0001));
 
             SubItemToken token = ProtoWriter.StartSubItem(null, writer);
-            if (low != 0)
-            {
+            if (low != 0) {
                 ProtoWriter.WriteFieldHeader(FieldDecimalLow, WireType.Variant, writer);
                 ProtoWriter.WriteUInt64(low, writer);
             }
@@ -499,12 +499,12 @@ namespace ProtoBuf
                 }
             }
             ProtoReader.EndSubItem(token, source);
-            if (low == 0 && high == 0) return Guid.Empty;
-            uint a = (uint)(low >> 32), b = (uint)low, c = (uint)(high >> 32), d = (uint)high;
-            return new Guid((int)b, (short)a, (short)(a >> 16),
+            if(low == 0 && high == 0) return Guid.Empty;
+            uint a = (uint)(low >> 32), b = (uint)low, c = (uint)(high >> 32), d= (uint)high;
+            return new Guid((int)b, (short)a, (short)(a >> 16), 
                 (byte)d, (byte)(d >> 8), (byte)(d >> 16), (byte)(d >> 24),
                 (byte)c, (byte)(c >> 8), (byte)(c >> 16), (byte)(c >> 24));
-
+            
         }
 
 
@@ -515,7 +515,6 @@ namespace ProtoBuf
             FieldNewTypeKey = 4,
             FieldTypeName = 8,
             FieldObject = 10;
-
         /// <summary>
         /// Optional behaviours that introduce .NET-specific functionality
         /// </summary>
@@ -544,12 +543,14 @@ namespace ProtoBuf
             /// </summary>
             LateSet = 8
         }
-
         /// <summary>
         /// Reads an *implementation specific* bundled .NET object, including (as options) type-metadata, identity/re-use, etc.
         /// </summary>
         public static object ReadNetObject(object value, ProtoReader source, int key, Type type, NetObjectOptions options)
         {
+#if FEAT_IKVM
+            throw new NotSupportedException();
+#else
             SubItemToken token = ProtoReader.StartSubItem(source);
             int fieldNumber;
             int newObjectKey = -1, newTypeKey = -1, tmp;
@@ -575,7 +576,7 @@ namespace ProtoBuf
                     case FieldTypeName:
                         string typeName = source.ReadString();
                         type = source.DeserializeType(typeName);
-                        if (type == null)
+                        if(type == null)
                         {
                             throw new ProtoException("Unable to resolve type: " + typeName + " (you can use the TypeModel.DynamicTypeFormatting event to provide a custom mapping)");
                         }
@@ -594,7 +595,7 @@ namespace ProtoBuf
                         bool isString = type == typeof(string);
                         bool wasNull = value == null;
                         bool lateSet = wasNull && (isString || ((options & NetObjectOptions.LateSet) != 0));
-
+                        
                         if (newObjectKey >= 0 && !lateSet)
                         {
                             if (value == null)
@@ -616,10 +617,10 @@ namespace ProtoBuf
                         {
                             value = ProtoReader.ReadTypedObject(oldValue, key, source, type);
                         }
-
+                        
                         if (newObjectKey >= 0)
                         {
-                            if (wasNull && !lateSet)
+                            if(wasNull && !lateSet)
                             { // this both ensures (via exception) that it *was* set, and makes sure we don't shout
                                 // about changed references
                                 oldValue = source.NetCache.GetKeyedObject(newObjectKey);
@@ -644,20 +645,23 @@ namespace ProtoBuf
                         break;
                 }
             }
-            if (newObjectKey >= 0 && (options & NetObjectOptions.AsReference) == 0)
+            if(newObjectKey >= 0 && (options & NetObjectOptions.AsReference) == 0)
             {
                 throw new ProtoException("Object key in input stream, but reference-tracking was not expected");
             }
             ProtoReader.EndSubItem(token, source);
 
             return value;
+#endif
         }
-
         /// <summary>
         /// Writes an *implementation specific* bundled .NET object, including (as options) type-metadata, identity/re-use, etc.
         /// </summary>
         public static void WriteNetObject(object value, ProtoWriter dest, int key, NetObjectOptions options)
         {
+#if FEAT_IKVM
+            throw new NotSupportedException();
+#else
             if (dest == null) throw new ArgumentNullException("dest");
             bool dynamicType = (options & NetObjectOptions.DynamicType) != 0,
                  asReference = (options & NetObjectOptions.AsReference) != 0;
@@ -666,7 +670,8 @@ namespace ProtoBuf
             bool writeObject = true;
             if (asReference)
             {
-                int objectKey = dest.NetCache.AddObjectKey(value, out bool existing);
+                bool existing;
+                int objectKey = dest.NetCache.AddObjectKey(value, out existing);
                 ProtoWriter.WriteFieldHeader(existing ? FieldExistingObjectKey : FieldNewObjectKey, WireType.Variant, dest);
                 ProtoWriter.WriteInt32(objectKey, dest);
                 if (existing)
@@ -679,6 +684,7 @@ namespace ProtoBuf
             {
                 if (dynamicType)
                 {
+                    bool existing;
                     Type type = value.GetType();
 
                     if (!(value is string))
@@ -686,7 +692,7 @@ namespace ProtoBuf
                         key = dest.GetTypeKey(ref type);
                         if (key < 0) throw new InvalidOperationException("Dynamic type is not a contract-type: " + type.Name);
                     }
-                    int typeKey = dest.NetCache.AddObjectKey(type, out bool existing);
+                    int typeKey = dest.NetCache.AddObjectKey(type, out existing);
                     ProtoWriter.WriteFieldHeader(existing ? FieldExistingTypeKey : FieldNewTypeKey, WireType.Variant, dest);
                     ProtoWriter.WriteInt32(typeKey, dest);
                     if (!existing)
@@ -694,19 +700,19 @@ namespace ProtoBuf
                         ProtoWriter.WriteFieldHeader(FieldTypeName, WireType.String, dest);
                         ProtoWriter.WriteString(dest.SerializeType(type), dest);
                     }
-
+                    
                 }
                 ProtoWriter.WriteFieldHeader(FieldObject, wireType, dest);
                 if (value is string)
                 {
                     ProtoWriter.WriteString((string)value, dest);
                 }
-                else
-                {
+                else { 
                     ProtoWriter.WriteObject(value, key, dest);
                 }
             }
             ProtoWriter.EndSubItem(token, dest);
+#endif
         }
     }
-}
+}

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/BclHelpers.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 2629984b7574c4ae6b581b6a2592ba45
+guid: da4c58c7ab05a47bb804066818a0dfc3
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 6 - 6
Unity/Assets/Mono/ThirdParty/protobuf-net/BufferExtension.cs

@@ -1,5 +1,4 @@
-using System;
-using System.IO;
+using System.IO;
 
 namespace ProtoBuf
 {
@@ -10,6 +9,7 @@ namespace ProtoBuf
     {
         private byte[] buffer;
 
+
         void IExtensionResettable.Reset()
         {
             buffer = null;
@@ -43,9 +43,9 @@ namespace ProtoBuf
                         // note: Array.Resize not available on CF
                         int offset = buffer.Length;
                         byte[] tmp = new byte[offset + len];
-                        Buffer.BlockCopy(buffer, 0, tmp, 0, offset);
+                        Helpers.BlockCopy(buffer, 0, tmp, 0, offset);
 
-#if PORTABLE // no GetBuffer() - fine, we'll use Read instead
+#if PORTABLE || WINRT // no GetBuffer() - fine, we'll use Read instead
                         int bytesRead;
                         long oldPos = ms.Position;
                         ms.Position = 0;
@@ -57,7 +57,7 @@ namespace ProtoBuf
                         if(len != 0) throw new EndOfStreamException();
                         ms.Position = oldPos;
 #else
-                        Buffer.BlockCopy(Helpers.GetBuffer(ms), 0, tmp, offset, len);
+                        Helpers.BlockCopy(Helpers.GetBuffer(ms), 0, tmp, offset, len);
 #endif
                         buffer = tmp;
                     }
@@ -75,4 +75,4 @@ namespace ProtoBuf
             using (stream) { } // just clean up
         }
     }
-}
+}

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/BufferExtension.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c4b5a305faac244409f465ec56185d7c
+guid: 0ba61b3798a2b42f790b8378b42f9597
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 53 - 99
Unity/Assets/Mono/ThirdParty/protobuf-net/BufferPool.cs

@@ -1,75 +1,51 @@
-using System;
-
+
+using System.Threading;
 namespace ProtoBuf
 {
     internal sealed class BufferPool
     {
         internal static void Flush()
         {
-            lock (Pool)
+#if PLAT_NO_INTERLOCKED
+            lock(pool)
+            {
+                for (int i = 0; i < pool.Length; i++) pool[i] = null;
+            }
+#else
+            for (int i = 0; i < pool.Length; i++)
             {
-                for (var i = 0; i < Pool.Length; i++)
-                    Pool[i] = null;
+                Interlocked.Exchange(ref pool[i], null); // and drop the old value on the floor
             }
+#endif
         }
-
         private BufferPool() { }
-        private const int POOL_SIZE = 20;
-        internal const int BUFFER_LENGTH = 1024;
-        private static readonly CachedBuffer[] Pool = new CachedBuffer[POOL_SIZE];
-
-        internal static byte[] GetBuffer() => GetBuffer(BUFFER_LENGTH);
+        const int PoolSize = 20;
+        internal const int BufferLength = 1024;
+        private static readonly object[] pool = new object[PoolSize];
 
-        internal static byte[] GetBuffer(int minSize)
+        internal static byte[] GetBuffer()
         {
-            byte[] cachedBuff = GetCachedBuffer(minSize);
-            return cachedBuff ?? new byte[minSize];
-        }
-
-        internal static byte[] GetCachedBuffer(int minSize)
-        {
-            lock (Pool)
+            object tmp;
+            #if PLAT_NO_INTERLOCKED
+            lock(pool)
             {
-                var bestIndex = -1;
-                byte[] bestMatch = null;
-                for (var i = 0; i < Pool.Length; i++)
+                for (int i = 0; i < pool.Length; i++)
                 {
-                    var buffer = Pool[i];
-                    if (buffer == null || buffer.Size < minSize)
-                    {
-                        continue;
-                    }
-                    if (bestMatch != null && bestMatch.Length < buffer.Size)
-                    {
-                        continue;
-                    }
-
-                    var tmp = buffer.Buffer;
-                    if (tmp == null)
-                    {
-                        Pool[i] = null;
-                    }
-                    else
+                    if((tmp = pool[i]) != null)
                     {
-                        bestMatch = tmp;
-                        bestIndex = i;
+                        pool[i] = null;
+                        return (byte[])tmp;
                     }
                 }
-
-                if (bestIndex >= 0)
-                {
-                    Pool[bestIndex] = null;
-                }
-
-                return bestMatch;
             }
+#else
+            for (int i = 0; i < pool.Length; i++)
+            {
+                if ((tmp = Interlocked.Exchange(ref pool[i], null)) != null) return (byte[])tmp;
+            }
+#endif
+            return new byte[BufferLength];
         }
-
-        /// <remarks>
-        /// https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/gcallowverylargeobjects-element
-        /// </remarks>
-        private const int MaxByteArraySize = int.MaxValue - 56;
-
         internal static void ResizeAndFlushLeft(ref byte[] buffer, int toFitAtLeastBytes, int copyFromIndex, int copyBytes)
         {
             Helpers.DebugAssert(buffer != null);
@@ -77,73 +53,51 @@ namespace ProtoBuf
             Helpers.DebugAssert(copyFromIndex >= 0);
             Helpers.DebugAssert(copyBytes >= 0);
 
+            // try doubling, else match
             int newLength = buffer.Length * 2;
-            if (newLength < 0)
-            {
-                newLength = MaxByteArraySize;
-            }
-
             if (newLength < toFitAtLeastBytes) newLength = toFitAtLeastBytes;
 
-            if (copyBytes == 0)
+            byte[] newBuffer = new byte[newLength];
+            if (copyBytes > 0)
             {
-                ReleaseBufferToPool(ref buffer);
+                Helpers.BlockCopy(buffer, copyFromIndex, newBuffer, 0, copyBytes);
             }
-
-            var newBuffer = GetCachedBuffer(toFitAtLeastBytes) ?? new byte[newLength];
-
-            if (copyBytes > 0)
+            if (buffer.Length == BufferPool.BufferLength)
             {
-                Buffer.BlockCopy(buffer, copyFromIndex, newBuffer, 0, copyBytes);
-                ReleaseBufferToPool(ref buffer);
+                BufferPool.ReleaseBufferToPool(ref buffer);
             }
-
             buffer = newBuffer;
         }
-
         internal static void ReleaseBufferToPool(ref byte[] buffer)
         {
             if (buffer == null) return;
-
-            lock (Pool)
+            if (buffer.Length == BufferLength)
             {
-                var minIndex = 0;
-                var minSize = int.MaxValue;
-                for (var i = 0; i < Pool.Length; i++)
+#if PLAT_NO_INTERLOCKED
+                lock (pool)
                 {
-                    var tmp = Pool[i];
-                    if (tmp == null || !tmp.IsAlive)
+                    for (int i = 0; i < pool.Length; i++)
                     {
-                        minIndex = 0;
-                        break;
+                        if(pool[i] == null)
+                        {
+                            pool[i] = buffer;
+                            break;
+                        }
                     }
-                    if (tmp.Size < minSize)
+                }
+#else
+                for (int i = 0; i < pool.Length; i++)
+                {
+                    if (Interlocked.CompareExchange(ref pool[i], buffer, null) == null)
                     {
-                        minIndex = i;
-                        minSize = tmp.Size;
+                        break; // found a null; swapped it in
                     }
                 }
-
-                Pool[minIndex] = new CachedBuffer(buffer);
+#endif
             }
-
+            // if no space, just drop it on the floor
             buffer = null;
         }
 
-        private class CachedBuffer
-        {
-            private readonly WeakReference _reference;
-
-            public int Size { get; }
-
-            public bool IsAlive => _reference.IsAlive;
-            public byte[] Buffer => (byte[])_reference.Target;
-
-            public CachedBuffer(byte[] buffer)
-            {
-                Size = buffer.Length;
-                _reference = new WeakReference(buffer);
-            }
-        }
     }
-}
+}

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/BufferPool.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 9df5056b98fc54005a82e92e72ff5366
+guid: be085980605f04a70b8b945eaca73013
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 4 - 4
Unity/Assets/Mono/ThirdParty/protobuf-net/CallbackAttributes.cs

@@ -5,28 +5,28 @@ namespace ProtoBuf
 {
     /// <summary>Specifies a method on the root-contract in an hierarchy to be invoked before serialization.</summary>
     [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
-#if !CF && !PORTABLE && !COREFX && !PROFILE259
+#if !CF && !SILVERLIGHT && !MONODROID && !WINRT && !IOS && !PORTABLE && !COREFX
     [ImmutableObject(true)]
 #endif
     public sealed class ProtoBeforeSerializationAttribute : Attribute { }
 
     /// <summary>Specifies a method on the root-contract in an hierarchy to be invoked after serialization.</summary>
     [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
-#if !CF && !PORTABLE && !COREFX && !PROFILE259
+#if !CF && !SILVERLIGHT && !MONODROID && !WINRT && !IOS && !PORTABLE && !COREFX
     [ImmutableObject(true)]
 #endif
     public sealed class ProtoAfterSerializationAttribute : Attribute { }
 
     /// <summary>Specifies a method on the root-contract in an hierarchy to be invoked before deserialization.</summary>
     [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
-#if !CF && !PORTABLE && !COREFX && !PROFILE259
+#if !CF && !SILVERLIGHT && !MONODROID && !WINRT && !IOS && !PORTABLE && !COREFX
     [ImmutableObject(true)]
 #endif
     public sealed class ProtoBeforeDeserializationAttribute : Attribute { }
 
     /// <summary>Specifies a method on the root-contract in an hierarchy to be invoked after deserialization.</summary>
     [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
-#if !CF && !PORTABLE && !COREFX && !PROFILE259
+#if !CF && !SILVERLIGHT && !MONODROID && !WINRT && !IOS && !PORTABLE && !COREFX
     [ImmutableObject(true)]
 #endif
     public sealed class ProtoAfterDeserializationAttribute : Attribute { }

+ 1 - 1
Unity/Assets/Mono/ThirdParty/protobuf-net/CallbackAttributes.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: ea1daf2a71e6641ee8852777aaa3d719
+guid: 95fb2bdeff1144b45b5be0f62507d72e
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio