UILoginComponentSystem.cs 745 B

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