// Use this for initialization void Start() { DontDestroyOnLoad(this.gameObject); AppFacade.Instance.StartUp(); AppFacade.Instance.GetManager <GameManager>(ManagerName.Game).StartGame(); Application.logMessageReceived += LogHandler; LogCenter.Instance().OpenTrace(LogTraceType.File); Screen.sleepTimeout = SleepTimeout.NeverSleep; if (Application.isMobilePlatform) { Application.targetFrameRate = AppConst.GameFrameRate; } OnInitialize(); }
/// <summary> /// 析构函数 /// </summary> void OnDestroy() { LuaManager lurMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua); if (lurMgr != null) { lurMgr.Close(); } if (AppFacade.Instance.networkManager != null) { AppFacade.Instance.networkManager.Close(); } LogCenter.Instance().Close(); Util.Log("Game", "~Main was destroyed"); }
void Start() { DontDestroyOnLoad(gameObject); //防止销毁自己 //#if !UNITY_EDITOR Application.logMessageReceived += LogHandler; //#endif LogCenter.Instance().OpenTrace(LogTraceType.File); CheckExtractResource(); //释放资源 Screen.sleepTimeout = SleepTimeout.NeverSleep; if (Application.isMobilePlatform) { Application.targetFrameRate = AppConst.GameFrameRate; } AppFacade.Instance.gameManager.CullGroup = Camera.main.GetComponent <CullingGroupLoadRes>(); }