ChooseManager.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. public void gotozhidao()
  51. {
  52. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowZhidao);
  53. }
  54. private void ControlTip()
  55. {
  56. Tip.SetActive(false);
  57. }
  58. private void OnEnable()
  59. {
  60. if(mQueueSystem.Level3QueueCount.Value>0)
  61. ShowHide_Toggle.interactable = true;
  62. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  63. //OnReset?.Invoke();
  64. /*
  65. transform.eulerAngles = new Vector3(0, OpenXRCamera.Instance.head.eulerAngles.y, 0);
  66. Vector3 pos = OpenXRCamera.Instance.head.position+ OpenXRCamera.Instance.head.forward * 2.5f;
  67. transform.position = new Vector3(pos.x, 0.5f, pos.z);
  68. */
  69. Debug.Log("DGJ =======> " +transform.position);
  70. BladeServerManager.Instance.isDaoHang = false;
  71. ShowHideLevel3(true);
  72. }
  73. private void Update()
  74. {
  75. if (Test) return;
  76. #if UNITY_EDITOR
  77. return;
  78. #endif
  79. OnReset?.Invoke();
  80. }
  81. private void ShowHideLevel3(bool on)
  82. {
  83. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  84. foreach(var go in mQueueSystem.Level3List)
  85. {
  86. go.SetActive(!on);
  87. }
  88. }
  89. #region 事件监听
  90. private void mQueueSystemCountNotNull(int newCount)
  91. {
  92. if(newCount>0)
  93. ShowHide_Toggle.interactable = true;
  94. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  95. }
  96. #endregion
  97. }