提交 7e5bbcdd 编写于 作者: T tanghai

客户端提高获取hotfix types的性能

上级 22a86995
......@@ -16,16 +16,12 @@ namespace ETModel
#endif
private IStaticMethod start;
private List<Type> hotfixTypes;
public Action Update;
public Action LateUpdate;
public Action OnApplicationQuit;
public Hotfix()
{
}
public void GotoHotfix()
{
#if ILRuntime
......@@ -36,23 +32,9 @@ namespace ETModel
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()
{
Game.Scene.GetComponent<ResourcesComponent>().LoadBundle($"code.unity3d");
......@@ -72,6 +54,8 @@ namespace ETModel
}
this.start = new ILStaticMethod(this.appDomain, "ETHotfix.Init", "Start", 0);
this.hotfixTypes = this.appDomain.LoadedTypes.Values.Select(x => x.ReflectionType).ToList();
#else
Log.Debug($"当前使用的是Mono模式");
......@@ -79,6 +63,8 @@ namespace ETModel
Type hotfixInit = this.assembly.GetType("ETHotfix.Init");
this.start = new MonoStaticMethod(hotfixInit, "Start");
this.hotfixTypes = this.assembly.GetTypes().ToList();
#endif
Game.Scene.GetComponent<ResourcesComponent>().UnloadBundle($"code.unity3d");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册