Root.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. Debug.Log("1111111");
  16. LitJson.JsonMapper.RegisterImporter<int, string>((int input) => { return input.ToString(); });
  17. LitJson.JsonMapper.RegisterImporter<string, int>((string input) => { return Int32.Parse(input); });
  18. LitJson.JsonMapper.RegisterImporter<float, Double>((float input) => { return (double)(input); });
  19. m_IsSelect = false;
  20. Debug.Log("2222222");
  21. // PlayerPrefs.DeleteAll();
  22. UIManager.Instance.Init();
  23. var connect = API_Module_NetStatus.IsConnect();
  24. if (connect)
  25. {
  26. UIManager.Instance.ShowUI(UINameConfig.LoginPanel, typeof(LoginPanel));
  27. }
  28. else
  29. {
  30. //增加提示面板
  31. StartCoroutine(NetEnumerator());
  32. }
  33. WriteLog.ConsoleLog.LogStart();
  34. }
  35. private void Update()
  36. {
  37. if (API_GSXR_Slam.GSXR_Get_Head() != null && !m_IsSelect)
  38. {
  39. time += Time.deltaTime;
  40. UIManager.Instance.ChangePos();
  41. if (time >= 0.5f)
  42. {
  43. m_IsSelect = true;
  44. time = 0;
  45. }
  46. }
  47. }
  48. IEnumerator NetEnumerator()
  49. {
  50. while (!API_Module_NetStatus.IsConnect())
  51. {
  52. yield return null;
  53. }
  54. //网络连接成功后的操作
  55. UIManager.Instance.ShowUI(UINameConfig.LoginPanel, typeof(LoginPanel));
  56. yield break;
  57. }
  58. }