Assets/Editor/Tool/TableTool.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Editor/ILRuntimeCLRBinding.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Generated.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Src/ILBehaviourProxy.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Src/ILLauncherProxy.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Src/ILLauncherProxy.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Src/ILOneLevelWindowProxy.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/ILRuntime/Src/ILWindowProxy.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Assets/Editor/Tool/TableTool.cs
@@ -274,6 +274,7 @@ /// <param name="setPath"></param> private static void PathCache(string setPath = "") { DebugEx.Log("路径缓存:" + setPath); string configPath = UnityEngine.Application.dataPath; configPath = configPath + "/ResourcesOut/Refdata/Config/PathCache/TablePath.txt"; FileStream configPathTxt = File.Open(configPath, FileMode.Open); Assets/ILRuntime/Editor/ILRuntimeCLRBinding.cs
@@ -13,7 +13,7 @@ [System.Reflection.Obfuscation(Exclude = true)] public class ILRuntimeCLRBinding { const string genPath = "Assets/Scripts/ILRuntime/Generated"; const string genPath = "Assets/ILRuntime/Generated"; //需要生成绑定代码的类, litjson 和 c# system 下的代码不要在这生成,会有问题 //此处配置的类,生成代码会覆盖自动生成的。 @@ -31,6 +31,7 @@ typeof(Button), typeof(Image), //主工程相关 typeof(Redpoint), typeof(Int2), typeof(Int3), typeof(UILoader), @@ -168,7 +169,11 @@ if (exist.Contains(file.Name)) file.Delete(); else added.Add(Path.GetFileNameWithoutExtension(file.Name)); { var className = GetClassName(file.FullName); if (!string.IsNullOrEmpty(className)) added.Add(className); } } //将dll新增代码写入到CLRBindings中注册 var lines = File.ReadAllLines(path1 + "/CLRBindings.cs").ToList(); @@ -191,6 +196,21 @@ File.WriteAllLines(path1 + "/CLRBindings.cs", lines); } //获取文件的类名 static string GetClassName(string path) { var lines = File.ReadAllLines(path).ToList(); foreach (var line in lines) { if (line.Contains("class")) { var strs = line.Split(' '); return strs[strs.Length - 1]; } } return null; } //这里需要注册所有热更DLL中用到的跨域继承Adapter,否则无法正确抓取引用 static void InitILRuntime(ILRuntime.Runtime.Enviorment.AppDomain domain) { Assets/ILRuntime/Generated.meta
@@ -1,5 +1,5 @@ fileFormatVersion: 2 guid: 085891858c30b314cadd10f32049c31c guid: b99dce5c258fa0841ba4708f9eb10a8a folderAsset: yes DefaultImporter: externalObjects: {} Assets/ILRuntime/Src/ILBehaviourProxy.cs
@@ -16,14 +16,14 @@ Dictionary<string, ILBehaviourHolder> ilBehaviourHolders = new Dictionary<string, ILBehaviourHolder>(); AppDomain appDomain { get { return ILRuntimeLoader.Instance.appDomain; } get { return ILLauncherProxy.Instance.appDomain; } } private void Init() { InitWidgts(); ilBehaviourHolders.Clear(); var baseType = appDomain.LoadedTypes["BaseILBehaviour"]; var baseType = appDomain.LoadedTypes["ILBehaviour"]; foreach (var name in classNames) { if (ilBehaviourHolders.ContainsKey(name)) Assets/ILRuntime/Src/ILLauncherProxy.cs
File was renamed from Assets/ILRuntime/Src/ILRuntimeLoader.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using System.IO; using ILCrossBinding; using ILRuntime.CLR.Method; using ILRuntime.Mono.Cecil.Pdb; using ILRuntime.Runtime.Intepreter; using Snxxz.UI; using UnityEngine; public class ILRuntimeLoader : SingletonMonobehaviour<ILRuntimeLoader> public class ILLauncherProxy : SingletonMonobehaviour<ILLauncherProxy> { FileStream dllFS, pdbFS; @@ -16,14 +18,19 @@ { get { if (_appdomain == null) DebugEx.Log("AppDomain 调用时为空!"); return _appdomain; } } public bool started; ILTypeInstance launcherInstance; IMethod update, onDestroy; public void Init() { started = false; LoadILRuntime(); //由于Unity的Profiler接口只允许在主线程使用,为了避免出异常,需要告诉ILRuntime主线程的线程ID才能正确将函数运行耗时报告给Profiler #if UNITY_EDITOR @@ -143,14 +150,7 @@ appDomain.DelegateManager.RegisterMethodDelegate<Window>(); appDomain.DelegateManager.RegisterMethodDelegate<TimeMgr.SyntonyType>(); appDomain.DelegateManager.RegisterMethodDelegate<DateTime>(); appDomain.DelegateManager.RegisterDelegateConvertor<UnityEngine.Events.UnityAction>((action) => { return new UnityEngine.Events.UnityAction(() => { ((System.Action)action)(); }); }); appDomain.DelegateManager.RegisterMethodDelegate<System.Object>(); //有返回值 appDomain.DelegateManager.RegisterFunctionDelegate<int>(); @@ -160,6 +160,29 @@ appDomain.DelegateManager.RegisterFunctionDelegate<float>(); appDomain.DelegateManager.RegisterFunctionDelegate<double>(); appDomain.DelegateManager.RegisterFunctionDelegate<int, bool>(); appDomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.Int32, System.Int32>(); appDomain.DelegateManager.RegisterDelegateConvertor<UnityEngine.Events.UnityAction>((action) => { return new UnityEngine.Events.UnityAction(() => { ((System.Action)action)(); }); }); appDomain.DelegateManager.RegisterDelegateConvertor<System.Threading.WaitCallback>((act) => { return new System.Threading.WaitCallback((state) => { ((Action<System.Object>)act)(state); }); }); appDomain.DelegateManager.RegisterDelegateConvertor<System.Comparison<System.Int32>>((act) => { return new System.Comparison<System.Int32>((x, y) => { return ((Func<System.Int32, System.Int32, System.Int32>)act)(x, y); }); }); } public void LaunchStart() @@ -167,12 +190,27 @@ #if UNITY_EDITOR _appdomain.DebugService.StartDebugService(56000); #endif _appdomain.Invoke("GameLogicMgr", "Init", null, null); launcherInstance = appDomain.Instantiate("LogicLauncher"); var type = launcherInstance.Type; update = type.GetMethod("Update"); onDestroy = type.GetMethod("OnDestroy", 0); _appdomain.Invoke("LogicLauncher", "LaunchStart", launcherInstance, null); } private void Update() { if (update != null) appDomain.Invoke(update, launcherInstance); } protected override void OnDestroy() { base.OnDestroy(); if (onDestroy != null) appDomain.Invoke(onDestroy, launcherInstance); #if UNITY_EDITOR var type = Type.GetType("ILRuntime.Runtime.Generated.CLRBindings"); if (type != null) Assets/ILRuntime/Src/ILLauncherProxy.cs.meta
File was renamed from Assets/ILRuntime/Src/ILRuntimeLoader.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 guid: 3bd1d701cd6c1cb45913ed0999ced256 guid: c019f0e1c95d1d64b9eee16ffaccb910 MonoImporter: externalObjects: {} serializedVersion: 2 Assets/ILRuntime/Src/ILOneLevelWindowProxy.cs
@@ -16,7 +16,7 @@ IMethod dipose; AppDomain appDomain { get { return ILRuntimeLoader.Instance.appDomain; } get { return ILLauncherProxy.Instance.appDomain; } } private void Init() { Assets/ILRuntime/Src/ILWindowProxy.cs
@@ -15,14 +15,14 @@ IMethod dipose; AppDomain appDomain { get { return ILRuntimeLoader.Instance.appDomain; } get { return ILLauncherProxy.Instance.appDomain; } } private void Init() { InitWidgts(); //使用与预制同名的代码文件 var windowName =gameObject.name; var baseType = appDomain.LoadedTypes["BaseILWindow"]; var baseType = appDomain.LoadedTypes["ILWindow"]; obj = appDomain.Instantiate(windowName); if (obj == null) {