UILoginComponentSystem.cs 896 B

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