ChooseManager.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System.Collections;
  2. using GHZLangChao;
  3. using Blue;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class ChooseManager : MonoBehaviour,IController
  7. {
  8. [SerializeField] private GameObject Tip;
  9. [SerializeField] private GameObject ShowDevice => SceneIOCContainer.Instance.Pull("ShowDevice") as GameObject;
  10. [SerializeField] private Toggle ShowHide_Toggle;
  11. private IQueueSystem mQueueSystem;
  12. void Awake()
  13. {
  14. transform.localPosition = new Vector3(0,0,500f);
  15. StartCoroutine(ControlTip());
  16. ShowDevice.SetActive(true);
  17. ShowHide_Toggle.onValueChanged.AddListener(ShowHideLevel3);
  18. mQueueSystem = this.GetService<IQueueSystem>();
  19. mQueueSystem.Level3QueueCount.Register(mQueueSystemCountNotNull).UnRegisterWhenGameObjectDestroyed(gameObject);
  20. }
  21. public void GotoXunJian()
  22. {
  23. Debug.Log("DGJ =====>GotoXunJian ");
  24. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  25. }
  26. public void GotoSupport()
  27. {
  28. Debug.Log("DGJ =====>GotoSupport ");
  29. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowRTC);
  30. }
  31. public void GotoNav()
  32. {
  33. Debug.Log("=====>GotoNav ");
  34. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  35. ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
  36. }
  37. private IEnumerator ControlTip()
  38. {
  39. Tip.SetActive(true);
  40. yield return new WaitForSeconds(3);
  41. Tip.SetActive(false);
  42. }
  43. private void OnEnable()
  44. {
  45. if(mQueueSystem.Level3QueueCount.Value>0)
  46. ShowHide_Toggle.interactable = true;
  47. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  48. }
  49. private void ShowHideLevel3(bool on)
  50. {
  51. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  52. foreach(var go in mQueueSystem.Level3List)
  53. {
  54. go.SetActive(!on);
  55. }
  56. }
  57. #region 事件监听
  58. private void mQueueSystemCountNotNull(int newCount)
  59. {
  60. if(newCount>0)
  61. ShowHide_Toggle.interactable = true;
  62. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  63. }
  64. #endregion
  65. }