UIMainComponentSystem.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using ET;
  4. namespace ET.Client
  5. {
  6. [FriendOf(typeof(UIMainComponent))]
  7. public static class UIMainComponentSystem
  8. {
  9. [ObjectSystem]
  10. public class UIMainComponentAwakeSystem : AwakeSystem<UIMainComponent>
  11. {
  12. protected override void Awake(UIMainComponent self)
  13. {
  14. ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
  15. self.guildBtn = rc.Get<GameObject>("GuildBtn");
  16. self.guildBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnGuild(); });
  17. self.bagBtn = rc.Get<GameObject>("BagBtn");
  18. self.bagBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnBag(); });
  19. self.startBtn = rc.Get<GameObject>("StartBtn");
  20. self.startBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnStart(); });
  21. self.featureBtn = rc.Get<GameObject>("FeatureBtn");
  22. self.featureBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnFeature(); });
  23. self.checkPointBtn = rc.Get<GameObject>("CheckPointBtn");
  24. self.checkPointBtn.GetComponent<Button>().onClick.AddListener(() => { self.OnCheckPoint(); });
  25. }
  26. }
  27. public static void OnGuild(this UIMainComponent self)
  28. {
  29. Log.Error("OnGuild");
  30. }
  31. public static void OnBag(this UIMainComponent self)
  32. {
  33. Log.Error("OnBag");
  34. }
  35. public static void OnStart(this UIMainComponent self)
  36. {
  37. Log.Error("OnStart");
  38. }
  39. public static void OnFeature(this UIMainComponent self)
  40. {
  41. Log.Error("OnFeature");
  42. }
  43. public static void OnCheckPoint(this UIMainComponent self)
  44. {
  45. Log.Error("OnCheckPoint");
  46. }
  47. }
  48. }