Root.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. using LitJson;
  6. /*
  7. * 点云项目需要运行在联网环境中
  8. */
  9. public class Root : MonoBehaviour
  10. {
  11. private bool m_IsSelect;
  12. private float time = 0;
  13. void Start()
  14. {
  15. LitJson.JsonMapper.RegisterImporter<int, string>((int input) => { return input.ToString(); });
  16. LitJson.JsonMapper.RegisterImporter<string, int>((string input) => { return Int32.Parse(input); });
  17. LitJson.JsonMapper.RegisterImporter<float, Double>((float input) => { return (double)(input); });
  18. m_IsSelect = false;
  19. // PlayerPrefs.DeleteAll();
  20. UIManager.Instance.Init();
  21. var connect = API_Module_NetStatus.IsConnect();
  22. if (connect)
  23. {
  24. UIManager.Instance.ShowUI(UINameConfig.LoginPanel, typeof(LoginPanel));
  25. }
  26. else
  27. {
  28. //增加提示面板
  29. StartCoroutine(NetEnumerator());
  30. }
  31. WriteLog.ConsoleLog.LogStart();
  32. }
  33. private void Update()
  34. {
  35. if (API_GSXR_Slam.GSXR_Get_Head() != null && !m_IsSelect)
  36. {
  37. time += Time.deltaTime;
  38. UIManager.Instance.ChangePos();
  39. if (time >= 0.5f)
  40. {
  41. m_IsSelect = true;
  42. time = 0;
  43. }
  44. }
  45. }
  46. IEnumerator NetEnumerator()
  47. {
  48. while (!API_Module_NetStatus.IsConnect())
  49. {
  50. yield return null;
  51. }
  52. //网络连接成功后的操作
  53. UIManager.Instance.ShowUI(UINameConfig.LoginPanel, typeof(LoginPanel));
  54. yield break;
  55. }
  56. }