|
@@ -16,16 +16,12 @@ namespace ETModel
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
private IStaticMethod start;
|
|
private IStaticMethod start;
|
|
|
|
|
+ private List<Type> hotfixTypes;
|
|
|
|
|
|
|
|
public Action Update;
|
|
public Action Update;
|
|
|
public Action LateUpdate;
|
|
public Action LateUpdate;
|
|
|
public Action OnApplicationQuit;
|
|
public Action OnApplicationQuit;
|
|
|
|
|
|
|
|
- public Hotfix()
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public void GotoHotfix()
|
|
public void GotoHotfix()
|
|
|
{
|
|
{
|
|
|
#if ILRuntime
|
|
#if ILRuntime
|
|
@@ -36,23 +32,9 @@ namespace ETModel
|
|
|
|
|
|
|
|
public List<Type> GetHotfixTypes()
|
|
public List<Type> GetHotfixTypes()
|
|
|
{
|
|
{
|
|
|
-#if ILRuntime
|
|
|
|
|
- if (this.appDomain == null)
|
|
|
|
|
- {
|
|
|
|
|
- return new List<Type>();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return this.appDomain.LoadedTypes.Values.Select(x => x.ReflectionType).ToList();
|
|
|
|
|
-#else
|
|
|
|
|
- if (this.assembly == null)
|
|
|
|
|
- {
|
|
|
|
|
- return new List<Type>();
|
|
|
|
|
- }
|
|
|
|
|
- return this.assembly.GetTypes().ToList();
|
|
|
|
|
-#endif
|
|
|
|
|
|
|
+ return this.hotfixTypes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
public void LoadHotfixAssembly()
|
|
public void LoadHotfixAssembly()
|
|
|
{
|
|
{
|
|
|
Game.Scene.GetComponent<ResourcesComponent>().LoadBundle($"code.unity3d");
|
|
Game.Scene.GetComponent<ResourcesComponent>().LoadBundle($"code.unity3d");
|
|
@@ -72,6 +54,8 @@ namespace ETModel
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.start = new ILStaticMethod(this.appDomain, "ETHotfix.Init", "Start", 0);
|
|
this.start = new ILStaticMethod(this.appDomain, "ETHotfix.Init", "Start", 0);
|
|
|
|
|
+
|
|
|
|
|
+ this.hotfixTypes = this.appDomain.LoadedTypes.Values.Select(x => x.ReflectionType).ToList();
|
|
|
#else
|
|
#else
|
|
|
Log.Debug($"当前使用的是Mono模式");
|
|
Log.Debug($"当前使用的是Mono模式");
|
|
|
|
|
|
|
@@ -79,6 +63,8 @@ namespace ETModel
|
|
|
|
|
|
|
|
Type hotfixInit = this.assembly.GetType("ETHotfix.Init");
|
|
Type hotfixInit = this.assembly.GetType("ETHotfix.Init");
|
|
|
this.start = new MonoStaticMethod(hotfixInit, "Start");
|
|
this.start = new MonoStaticMethod(hotfixInit, "Start");
|
|
|
|
|
+
|
|
|
|
|
+ this.hotfixTypes = this.assembly.GetTypes().ToList();
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
Game.Scene.GetComponent<ResourcesComponent>().UnloadBundle($"code.unity3d");
|
|
Game.Scene.GetComponent<ResourcesComponent>().UnloadBundle($"code.unity3d");
|