UILoginComponentSystem.cs 897 B

12345678910111213141516171819202122232425262728293031323334
  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>().GameObject.GetComponent<ReferenceCollector>();
  13. self.loginBtn = rc.Get<GameObject>("LoginBtn");
  14. self.loginBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnLogin(); });
  15. self.account = rc.Get<GameObject>("Account");
  16. self.password = rc.Get<GameObject>("Password");
  17. }
  18. }
  19. public static class UILoginComponentSystem
  20. {
  21. public static void OnLogin(this UILoginComponent self)
  22. {
  23. LoginHelper.Login(
  24. self.DomainScene(),
  25. ConstValue.LoginAddress,
  26. self.account.GetComponent<InputField>().text,
  27. self.password.GetComponent<InputField>().text).Coroutine();
  28. }
  29. }
  30. }