Просмотр исходного кода

1.OuterDispatcher需要判断下session断开
2.只有设置了ILRuntime宏才能进行绑定操作,避免新人出错

tanghai 6 лет назад
Родитель
Сommit
e9a60dee75

+ 7 - 1
Server/Hotfix/Module/Message/OuterMessageDispatcher.cs

@@ -20,10 +20,16 @@ namespace ETHotfix
 					ActorLocationSender actorLocationSender = Game.Scene.GetComponent<ActorLocationSenderComponent>().Get(unitId);
 
 					int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId
+					long instanceId = session.InstanceId;
 					IResponse response = await actorLocationSender.Call(actorLocationRequest);
 					response.RpcId = rpcId;
 
-					session.Reply(response);
+					// session可能已经断开了,所以这里需要判断
+					if (session.InstanceId == instanceId)
+					{
+						session.Reply(response);
+					}
+					
 					break;
 				}
 				case IActorLocationMessage actorLocationMessage:

+ 5 - 7
Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs

@@ -1,18 +1,14 @@
-#if UNITY_EDITOR
+#if ILRuntime
 using UnityEditor;
 using UnityEngine;
 using System;
-using System.Text;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
-using ILRuntime.Runtime.Enviorment;
 using ETModel;
 
-[System.Reflection.Obfuscation(Exclude = true)]
-public class ILRuntimeCLRBinding
+public static class ILRuntimeCLRBinding
 {
-    [MenuItem("Tools/ILRuntime/Generate CLR Binding Code")]
+    //[MenuItem("Tools/ILRuntime/Generate CLR Binding Code")]
     static void GenerateCLRBinding()
     {
         List<Type> types = new List<Type>();
@@ -41,6 +37,8 @@ public class ILRuntimeCLRBinding
     [MenuItem("Tools/ILRuntime/Generate CLR Binding Code by Analysis")]
     static void GenerateCLRBindingByAnalysis()
     {
+	    GenerateCLRBinding();
+	    
         //用新的分析热更dll调用引用来生成绑定代码
         ILRuntime.Runtime.Enviorment.AppDomain domain = new ILRuntime.Runtime.Enviorment.AppDomain();
         using (FileStream fs = new FileStream("Assets/Res/Code/Hotfix.dll.bytes", FileMode.Open, FileAccess.Read))