ChooseManager.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. BladeServerManager.Instance.isDaoHang = false;
  33. }
  34. public void GotoNav()
  35. {
  36. Debug.Log("=====>GotoNav ");
  37. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowXunJian);
  38. ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
  39. BladeServerManager.Instance.isDaoHang = true;
  40. }
  41. private IEnumerator ControlTip()
  42. {
  43. Tip.SetActive(true);
  44. yield return new WaitForSeconds(3);
  45. Tip.SetActive(false);
  46. }
  47. private void OnEnable()
  48. {
  49. if(mQueueSystem.Level3QueueCount.Value>0)
  50. ShowHide_Toggle.interactable = true;
  51. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  52. }
  53. private void ShowHideLevel3(bool on)
  54. {
  55. Debug.Log("Level3Queue:"+mQueueSystem.Level3List.Count);
  56. foreach(var go in mQueueSystem.Level3List)
  57. {
  58. go.SetActive(!on);
  59. }
  60. }
  61. #region 事件监听
  62. private void mQueueSystemCountNotNull(int newCount)
  63. {
  64. if(newCount>0)
  65. ShowHide_Toggle.interactable = true;
  66. Debug.Log($"打开的数量:{mQueueSystem.Level3QueueCount.Value}");
  67. }
  68. #endregion
  69. }