HomeMgr.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using AppUI.Manager.View;
  2. using UnityEngine;
  3. using UIViewMgr = AppUI.Manager.ViewMgr;
  4. namespace AppUI.View.Home.Main
  5. {
  6. public class HomeMgr : MonoBehaviour
  7. {
  8. void Awake()
  9. {
  10. PersistenHandler.Init();
  11. // 初始化 ViewMgr 根节点与分组 0、1(仅需调用一次)
  12. UIViewMgr.EnsureInitialized();
  13. ViewManager.ShowView(UIViewType.HomeView);
  14. Instantiate(ViewManager.GetPrefabByType(UIPrefabType.AuthLoginMask));
  15. //Instantiate(SceneResourceManager.Instance.GetPrefab("DeviceBatteryView"));
  16. //Instantiate(SceneResourceManager.Instance.GetPrefab("NewUserGuiderManager"));
  17. InfraredDemo.Create();
  18. if (CommonConfig.StandaloneModeOrPlatformB)
  19. DevicesHolder.Init();
  20. }
  21. void Start()
  22. {
  23. Time.timeScale = 1;
  24. if (CommonConfig.StandaloneMode)
  25. {
  26. DoTweenUtil.CallDelay(0.1f, () => new UserPlayer());
  27. if (CommonConfig.StandaloneModeOrPlatformB)
  28. StandaloneAPI.InitTimeCounter();
  29. }
  30. else
  31. UserPlayer.ConnectServer();
  32. }
  33. void OnDestroy()
  34. {
  35. if (UIViewMgr.HasInstance())
  36. ViewManager.HideAllView();
  37. }
  38. }
  39. }