| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using JCUnityLib;
- /* Home场景管理者 */
- public class HomeMgr : MonoBehaviour
- {
- public static HomeMgr ins;
- void Awake()
- {
- ins = this;
- PersistenHandler.Init();
- //ViewMgr.Instance.ShowView<TopBarView>();
- ViewMgr.Instance.ShowView<HomeView>();
- ViewMgr.Instance.ShowView<HomeFrameView>();
- Instantiate(SceneResourceManager.Instance.GetPrefab("DeviceBatteryView"));
- Instantiate(SceneResourceManager.Instance.GetPrefab("AuthLoginMask"));
- //Instantiate(SceneResourceManager.Instance.GetPrefab("RenderBowCamera"));
- Instantiate(SceneResourceManager.Instance.GetPrefab("NewUserGuiderManager"));
- //标记某些界面不需要销毁
- ViewMgr.Instance.SetViewDontDestroy<GameStartView>();
- ViewMgr.Instance.SetViewDontDestroy<ChallengeOptionView>();
- ViewMgr.Instance.SetViewDontDestroy<RoleSelectView>();
- ViewMgr.Instance.SetViewDontDestroy<PKGameOptionView>();
- ViewMgr.Instance.SetViewDontDestroy<PKMatchView>();
- //显示缓存的隐藏页面
- ViewMgr.Instance.ResumeView<GameStartView>();
- ViewMgr.Instance.ResumeView<ChallengeOptionView>();
- ViewMgr.Instance.ResumeView<RoleSelectView>();
- ViewMgr.Instance.ResumeView<PKGameOptionView>();
- ViewMgr.Instance.ResumeView<PKMatchView>();
- //红外界面
- InfraredDemo.Create();
- }
- void Start()
- {
- Time.timeScale = 1; //保证时间缩放为1
- if (CommonConfig.StandaloneMode)
- {
- DoTweenUtil.CallDelay(0.1f, () => new UserPlayer());
- StandaloneAPI.InitTimeCounter();
- }
- else UserPlayer.ConnectServer();
- }
- void OnDestroy()
- {
- if (ins == this) ins = null;
- ViewMgr.Instance.DestroyAllViewsExcludeDontDestroy();
- //隐藏可缓存的页面
- ViewMgr.Instance.HideView<GameStartView>();
- ViewMgr.Instance.HideView<ChallengeOptionView>();
- ViewMgr.Instance.HideView<RoleSelectView>();
- ViewMgr.Instance.HideView<PKGameOptionView>();
- ViewMgr.Instance.HideView<PKMatchView>();
- }
- }
|