private void Start() { try { //if (Application.unityVersion != "2017.1.0p5") //{ // Log.Error("请使用Unity2017.1.0p5版本"); //} DontDestroyOnLoad(gameObject); Instance = this; ObjectEvents.Instance.Add("Model", typeof(Init).Assembly); string hotfixPath = $"{Application.dataPath}/../../PC/StreamingAssets/hotfixcode"; #if ILRuntime Log.Debug("run in ilruntime mode"); this.AppDomain = new ILRuntime.Runtime.Enviorment.AppDomain(); DllHelper.LoadHotfixAssembly(hotfixPath); ILHelper.InitILRuntime(); this.start = new ILStaticMethod("Hotfix.Init", "Start", 0); this.update = new ILStaticMethod("Hotfix.Init", "Update", 0); this.lateUpdate = new ILStaticMethod("Hotfix.Init", "LateUpdate", 0); this.onApplicationQuit = new ILStaticMethod("Hotfix.Init", "OnApplicationQuit", 0); #else Log.Debug("run in mono mode"); ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly(hotfixPath); Type hotfixInit = ObjectEvents.Instance.HotfixAssembly.GetType("Hotfix.Init"); this.start = new MonoStaticMethod(hotfixInit, "Start"); this.update = new MonoStaticMethod(hotfixInit, "Update"); this.lateUpdate = new MonoStaticMethod(hotfixInit, "LateUpdate"); this.onApplicationQuit = new MonoStaticMethod(hotfixInit, "OnApplicationQuit"); #endif Game.Scene.AddComponent <OpcodeTypeComponent>(); Game.Scene.AddComponent <MessageDispatherComponent>(); Game.Scene.AddComponent <NetOuterComponent>(); Game.Scene.AddComponent <ResourcesComponent>(); Game.Scene.AddComponent <BehaviorTreeComponent>(); Game.Scene.AddComponent <ConfigComponent>(); Game.Scene.AddComponent <PlayerComponent>(); Game.Scene.AddComponent <UnitComponent>(); Game.Scene.AddComponent <ClientFrameComponent>(); Game.Scene.AddComponent <ClientComponent>(); // 进入热更新层 this.start.Run(); } catch (Exception e) { Log.Error(e.ToString()); } }
public void LoadHotfixDll() { #if ILRuntime DllHelper.LoadHotfixAssembly(); #else this.HotfixAssembly = DllHelper.LoadHotfixAssembly(); #endif this.Load(); }
public void LoadHotfixDll() { #if ILRuntime DllHelper.LoadHotfixAssembly(); #else ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly(); #endif this.Load(); }
private void Start() { #if ILRuntime Game.EntityEventManager.RegisterILRuntime(); Game.EntityEventManager.RegisterILAdapter(); #else Game.EntityEventManager.Register("Hotfix", DllHelper.LoadHotfixAssembly()); #endif Game.EntityEventManager.Register("Model", typeof(Game).Assembly); Game.Scene.AddComponent <ResourcesComponent>(); Game.Scene.AddComponent <UIComponent>(); Game.Scene.AddComponent <UnitComponent>(); Game.Scene.AddComponent <BehaviorTreeComponent>(); EventHelper.Run(EventIdType.InitSceneStart); }
private void Start() { #if ILRuntime ObjectEvents.Instance.RegisterILRuntime(); ObjectEvents.Instance.RegisterILAdapter(); #else ObjectEvents.Instance.Register("Hotfix", DllHelper.LoadHotfixAssembly()); #endif ObjectEvents.Instance.Register("Model", typeof(Game).Assembly); Game.Scene.AddComponent <ResourcesComponent>(); Game.Scene.AddComponent <UIComponent>(); Game.Scene.AddComponent <UnitComponent>(); Game.Scene.AddComponent <BehaviorTreeComponent>(); Game.Scene.AddComponent <MessageDispatherComponent, AppType>(AppType.Client); Game.Scene.AddComponent <NetOuterComponent>(); EventHelper.Run(EventIdType.InitSceneStart); }
private void Start() { try { if (Application.unityVersion != "2017.1.0p5") { Log.Error("请使用Unity2017.1.0p5版本"); return; } DontDestroyOnLoad(gameObject); Instance = this; ObjectEvents.Instance.Add("Model", typeof(Init).Assembly); #if ILRuntime Log.Debug("run in ilruntime mode"); this.AppDomain = new ILRuntime.Runtime.Enviorment.AppDomain(); DllHelper.LoadHotfixAssembly(); ILHelper.InitILRuntime(); this.start = new ILStaticMethod("Hotfix.Init", "Start", 0); this.update = new ILStaticMethod("Hotfix.Init", "Update", 0); this.lateUpdate = new ILStaticMethod("Hotfix.Init", "LateUpdate", 0); this.onApplicationQuit = new ILStaticMethod("Hotfix.Init", "OnApplicationQuit", 0); #else Log.Debug("run in mono mode"); ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly(); Type hotfixInit = ObjectEvents.Instance.HotfixAssembly.GetType("Hotfix.Init"); this.start = new MonoStaticMethod(hotfixInit, "Start"); this.update = new MonoStaticMethod(hotfixInit, "Update"); this.lateUpdate = new MonoStaticMethod(hotfixInit, "LateUpdate"); this.onApplicationQuit = new MonoStaticMethod(hotfixInit, "OnApplicationQuit"); #endif // 进入热更新层 this.start.Run(); } catch (Exception e) { Log.Error(e.ToString()); } }