ChooseManager.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.Collections;
  2. using GHZLangChao;
  3. using Blue;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using UnityEngine.Events;
  7. public class ChooseManager : MonoBehaviour,IController
  8. {
  9. public bool Test = false;
  10. [SerializeField] private GameObject Tip;
  11. [SerializeField] private GameObject ShowDevice => SceneIOCContainer.Instance.Pull("ShowDevice") as GameObject;
  12. [SerializeField] private Toggle ShowHide_Toggle;
  13. public UnityEvent OnReset = new UnityEvent();
  14. private IQueueSystem mQueueSystem;
  15. void Awake()
  16. {
  17. #if UNITY_EDITOR
  18. Test = true;
  19. #endif
  20. // transform.localPosition = new Vector3(0,0,500f);
  21. Invoke("ControlTip",3);
  22. ShowDevice.SetActive(true);
  23. ShowHide_Toggle.onValueChanged.AddListener(ShowHideLevel3);
  24. mQueueSystem = this.GetService<IQueueSystem>();
  25. mQueueSystem.Level3QueueCount.Register(mQueueSystemCountNotNull).UnRegisterWhenGameObjectDestroyed(gameObject);
  26. SceneIOCContainer.Instance.Push("ShowChoose",gameObject);
  27. }
  28. public void GotoXunJian()
  29. {
  30. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  31. }
  32. public void GetInspectionInfo()
  33. {
  34. this.GetService<IInspectionService>().Get();
  35. }
  36. public void GotoSupport()
  37. {
  38. Debug.Log("DGJ =====>GotoSupport ");
  39. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowRTC);
  40. BladeServerManager.Instance.isDaoHang = true;
  41. WayFindingManager.Instance.CloseWayFind();
  42. }
  43. public void GotoNav()
  44. {
  45. Debug.Log("=====>GotoNav ");
  46. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  47. ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
  48. BladeServerManager.Instance.isDaoHang = true;
  49. }
  50. private void ControlTip()
  51. {
  52. Tip.SetActive(false);
  53. }
  54. private void OnEnable()
  55. {
  56. if(mQueueSystem.Level3QueueCount.Value>0)
  57. ShowHide_Toggle.interactable = true;
  58. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  59. //OnReset?.Invoke();
  60. /*
  61. transform.eulerAngles = new Vector3(0, OpenXRCamera.Instance.head.eulerAngles.y, 0);
  62. Vector3 pos = OpenXRCamera.Instance.head.position+ OpenXRCamera.Instance.head.forward * 2.5f;
  63. transform.position = new Vector3(pos.x, 0.5f, pos.z);
  64. */
  65. Debug.Log("DGJ =======> " +transform.position);
  66. BladeServerManager.Instance.isDaoHang = false;
  67. }
  68. private void Update()
  69. {
  70. if (Test) return;
  71. #if UNITY_EDITOR
  72. return;
  73. #endif
  74. OnReset?.Invoke();
  75. }
  76. private void ShowHideLevel3(bool on)
  77. {
  78. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  79. foreach(var go in mQueueSystem.Level3List)
  80. {
  81. go.SetActive(!on);
  82. }
  83. }
  84. #region 事件监听
  85. private void mQueueSystemCountNotNull(int newCount)
  86. {
  87. if(newCount>0)
  88. ShowHide_Toggle.interactable = true;
  89. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  90. }
  91. #endregion
  92. }