using System; using ETModel; namespace ETHotfix { public static class Init { public static void Start() { try { Game.Scene.ModelScene = ETModel.Game.Scene; // 注册热更层回调 ETModel.Game.Hotfix.Update = () => { Update(); }; ETModel.Game.Hotfix.LateUpdate = () => { LateUpdate(); }; ETModel.Game.Hotfix.OnApplicationQuit = () => { OnApplicationQuit(); }; Game.Scene.AddComponent(); Game.Scene.AddComponent(); Game.Scene.AddComponent(); // 加载热更配置 ETModel.Game.Scene.GetComponent().LoadBundle("config.unity3d"); Game.Scene.AddComponent(); ETModel.Game.Scene.GetComponent().UnloadBundle("config.unity3d"); UnitConfig unitConfig = (UnitConfig)Game.Scene.GetComponent().Get(typeof(UnitConfig), 1001); Log.Debug($"config {JsonHelper.ToJson(unitConfig)}"); Game.EventSystem.Run(EventIdType.InitSceneStart); } catch (Exception e) { Log.Error(e); } } public static void Update() { try { Game.EventSystem.Update(); } catch (Exception e) { Log.Error(e); } } public static void LateUpdate() { try { Game.EventSystem.LateUpdate(); } catch (Exception e) { Log.Error(e); } } public static void OnApplicationQuit() { Game.Close(); } } }