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

修复ILRuntime模式下,IMHandler编译的问题

tanghai 8 лет назад
Родитель
Сommit
2a0a7c1434

+ 10 - 1
Unity/Assets/Scripts/Base/Object/ObjectEvents.cs

@@ -54,7 +54,6 @@ namespace Model
 			set
 			{
 				this.hotfixAssembly = value;
-				this.Load();
 			}
 		}
 
@@ -78,6 +77,16 @@ namespace Model
 			instance = null;
 		}
 
+		public void LoadHotfixDll()
+		{
+#if ILRuntime
+			DllHelper.LoadHotfixAssembly();	
+#else
+			ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly();
+#endif
+			this.Load();
+		}
+
 		public void Add(string name, Assembly assembly)
 		{
 			this.assemblies[name] = assembly;

+ 2 - 2
Unity/Assets/Scripts/Init.cs

@@ -41,7 +41,7 @@ namespace Model
 				Log.Debug("run in ilruntime mode");
 
 				this.AppDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
-				DllHelper.LoadHotfixAssembly();
+				ObjectEvents.Instance.LoadHotfixDll();
 				ILHelper.InitILRuntime();
 				
 				this.start = new ILStaticMethod("Hotfix.Init", "Start", 0);
@@ -50,7 +50,7 @@ namespace Model
 				this.onApplicationQuit = new ILStaticMethod("Hotfix.Init", "OnApplicationQuit", 0);
 #else
 				Log.Debug("run in mono mode");
-				ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly();
+				ObjectEvents.Instance.LoadHotfixDll();
 				Type hotfixInit = ObjectEvents.Instance.HotfixAssembly.GetType("Hotfix.Init");
 				this.start = new MonoStaticMethod(hotfixInit, "Start");
 				this.update = new MonoStaticMethod(hotfixInit, "Update");

+ 1 - 0
Unity/Hotfix/Base/Message/IMHandler.cs

@@ -1,4 +1,5 @@
 using System;
+using Model;
 
 namespace Hotfix
 {