UILobbyComponentSystem.cs 911 B

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