UILobbyComponentSystem.cs 881 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. namespace ET
  4. {
  5. [ObjectSystem]
  6. public class UILobbyComponentAwakeSystem: AwakeSystem<UILobbyComponent>
  7. {
  8. public override void Awake(UILobbyComponent self)
  9. {
  10. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  11. self.enterMap = rc.Get<GameObject>("EnterMap");
  12. self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap().Coroutine(); });
  13. self.text = rc.Get<GameObject>("Text").GetComponent<Text>();
  14. }
  15. }
  16. public static class UILobbyComponentSystem
  17. {
  18. public static async ETTask EnterMap(this UILobbyComponent self)
  19. {
  20. await EnterMapHelper.EnterMapAsync(self.ZoneScene());
  21. await UIHelper.Remove(self.ZoneScene(), UIType.UILobby);
  22. }
  23. }
  24. }