ChooseManager.cs 2.3 KB

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