UIIphoneComponentSystem.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using static System.Net.Mime.MediaTypeNames;
  7. namespace ET.Client
  8. {
  9. [FriendOf(typeof(UIIphoneComponent))]
  10. public static class UIIphoneComponentSystem
  11. {
  12. [ObjectSystem]
  13. public class UIIphoneComponentAwakeSystem : AwakeSystem<UIIphoneComponent>
  14. {
  15. protected override void Awake(UIIphoneComponent self, params object[] param)
  16. {
  17. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  18. self.IphoneObj = rc.Get<GameObject>("IphoneObj");
  19. self.UnIphoneObj = rc.Get<GameObject>("UnIphoneObj");
  20. self.yourIphone = rc.Get<GameObject>("yourIphone");
  21. self.invateInput = rc.Get<GameObject>("invateInput");
  22. self.verCodeInput = rc.Get<GameObject>("verCodeInput");
  23. self.verCodeBtn = rc.Get<GameObject>("verCodeBtn");
  24. self.verCodeBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnVerCodeBtn(); });
  25. self.sureBtn = rc.Get<GameObject>("sureBtn");
  26. self.sureBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnSureBtn(); });
  27. self.Init();
  28. }
  29. }
  30. private static void Init(this UIIphoneComponent self)
  31. {
  32. self.UnIphoneObj.SetActive(false);
  33. self.IphoneObj.SetActive(true);
  34. }
  35. public static async void OnVerCodeBtn(this UIIphoneComponent self)
  36. {
  37. await SoundManager.Instance.PlaySound("clickbtnsound");
  38. }
  39. public static async void OnSureBtn(this UIIphoneComponent self)
  40. {
  41. await SoundManager.Instance.PlaySound("clickbtnsound");
  42. self.OnCloseAsync();
  43. }
  44. public static async void OnCloseAsync(this UIIphoneComponent self)
  45. {
  46. await UIHelper.Remove(self.ClientScene(),UIType.UIIphone);
  47. }
  48. }
  49. }