ChooseManager.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. StartCoroutine(ControlTip());
  15. ShowDevice.SetActive(true);
  16. ShowHide_Toggle.onValueChanged.AddListener(ShowHideLevel3);
  17. mQueueSystem = this.GetService<IQueueSystem>();
  18. mQueueSystem.Level3QueueCount.Register(mQueueSystemCountNotNull).UnRegisterWhenGameObjectDestroyed(gameObject);
  19. }
  20. public void GotoXunJian()
  21. {
  22. Debug.Log("DGJ =====>GotoXunJian ");
  23. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  24. }
  25. public void GotoSupport()
  26. {
  27. Debug.Log("DGJ =====>GotoSupport ");
  28. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowRTC);
  29. }
  30. private IEnumerator ControlTip()
  31. {
  32. Tip.SetActive(true);
  33. yield return new WaitForSeconds(3);
  34. Tip.SetActive(false);
  35. }
  36. private void OnEnable()
  37. {
  38. if(mQueueSystem.Level3QueueCount.Value>0)
  39. ShowHide_Toggle.interactable = true;
  40. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  41. }
  42. private void ShowHideLevel3(bool on)
  43. {
  44. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  45. foreach(var go in mQueueSystem.Level3List)
  46. {
  47. go.SetActive(!on);
  48. }
  49. }
  50. #region 事件监听
  51. private void mQueueSystemCountNotNull(int newCount)
  52. {
  53. if(newCount>0)
  54. ShowHide_Toggle.interactable = true;
  55. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  56. }
  57. #endregion
  58. }