UILoginComponentSystem.cs 741 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Net;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace ET
  6. {
  7. public class UILoginComponentAwakeSystem : AwakeSystem<UILoginComponent>
  8. {
  9. public override void Awake(UILoginComponent self)
  10. {
  11. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  12. self.loginBtn = rc.Get<GameObject>("LoginBtn");
  13. self.loginBtn.GetComponent<Button>().onClick.AddListener(self.OnLogin);
  14. self.account = rc.Get<GameObject>("Account");
  15. }
  16. }
  17. public static class UILoginComponentSystem
  18. {
  19. public static void OnLogin(this UILoginComponent self)
  20. {
  21. LoginHelper.Login(self.DomainScene(), "127.0.0.1:10002", self.account.GetComponent<InputField>().text).Coroutine();
  22. }
  23. }
  24. }