ChooseManager.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. Debug.Log("DGJ =====>GotoXunJian ");
  31. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  32. }
  33. public void GotoSupport()
  34. {
  35. Debug.Log("DGJ =====>GotoSupport ");
  36. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowRTC);
  37. BladeServerManager.Instance.isDaoHang = true;
  38. WayFindingManager.Instance.CloseWayFind();
  39. }
  40. public void GotoNav()
  41. {
  42. Debug.Log("=====>GotoNav ");
  43. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  44. ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
  45. BladeServerManager.Instance.isDaoHang = true;
  46. }
  47. private void ControlTip()
  48. {
  49. Tip.SetActive(false);
  50. }
  51. private void OnEnable()
  52. {
  53. if(mQueueSystem.Level3QueueCount.Value>0)
  54. ShowHide_Toggle.interactable = true;
  55. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  56. //OnReset?.Invoke();
  57. /*
  58. transform.eulerAngles = new Vector3(0, OpenXRCamera.Instance.head.eulerAngles.y, 0);
  59. Vector3 pos = OpenXRCamera.Instance.head.position+ OpenXRCamera.Instance.head.forward * 2.5f;
  60. transform.position = new Vector3(pos.x, 0.5f, pos.z);
  61. */
  62. Debug.Log("DGJ =======> " +transform.position);
  63. BladeServerManager.Instance.isDaoHang = false;
  64. }
  65. private void Update()
  66. {
  67. if (Test) return;
  68. #if UNITY_EDITOR
  69. return;
  70. #endif
  71. OnReset?.Invoke();
  72. }
  73. private void ShowHideLevel3(bool on)
  74. {
  75. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  76. foreach(var go in mQueueSystem.Level3List)
  77. {
  78. go.SetActive(!on);
  79. }
  80. }
  81. #region 事件监听
  82. private void mQueueSystemCountNotNull(int newCount)
  83. {
  84. if(newCount>0)
  85. ShowHide_Toggle.interactable = true;
  86. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  87. }
  88. #endregion
  89. }