UIRuleComponentSystem.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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(UIRuleComponent))]
  10. public static class UIRuleComponentSystem
  11. {
  12. [ObjectSystem]
  13. public class UIRuleComponentAwakeSystem : AwakeSystem<UIRuleComponent>
  14. {
  15. protected override void Awake(UIRuleComponent self, params object[] param)
  16. {
  17. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  18. self.noStatsTxt = rc.Get<GameObject>("noStatsTxt");
  19. self.closeBtn = rc.Get<GameObject>("closeBtn");
  20. self.closeBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnCloseBtn(); });
  21. self.Init();
  22. }
  23. }
  24. private static void Init(this UIRuleComponent self)
  25. {
  26. self.noStatsTxt.SetActive(true);
  27. }
  28. public static void OnNextTimeBtn(this UIRuleComponent self)
  29. {
  30. }
  31. public static async void OnCloseBtn(this UIRuleComponent self)
  32. {
  33. await SoundManager.Instance.PlaySound("clickbtnsound");
  34. self.OnCloseAsync();
  35. }
  36. public static async void OnCloseAsync(this UIRuleComponent self)
  37. {
  38. await UIHelper.Remove(self.ClientScene(),UIType.UIRule);
  39. }
  40. }
  41. }