MainHomePanelCtrl.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using XGame.Framework.UI;
  8. namespace FL.FGUI
  9. {
  10. /// <summary>
  11. /// UI逻辑处理类
  12. /// </summary>
  13. /// <typeparam name=""></typeparam>
  14. public partial class MainHomePanelCtrl : UIController<MainHomePanelVM>
  15. {
  16. protected override void OnEnable(object intent)
  17. {
  18. AddUIListenres();
  19. }
  20. protected override void OnDisable()
  21. {
  22. RemoveUIListenres();
  23. }
  24. #region UI事件
  25. private void AddUIListenres()
  26. {
  27. VM.GoldBtn.onClick.Add(OnClickGoldBtn);
  28. VM.DiamondBtn.onClick.Add(OnClickDiamondBtn);
  29. VM.ShopBtn.onClick.Add(OnClickShopBtn);
  30. VM.SCBtn.onClick.Add(OnClickSCBtn);
  31. VM.HDBtn.onClick.Add(OnClickHDBtn);
  32. VM.XSLBtn.onClick.Add(OnClickXSLBtn);
  33. VM.GoldBox.onClick.Add(OnClickGoldBox);
  34. VM.TaskBtn.onClick.Add(OnClickTaskBtn);
  35. VM.XinXiBtn.onClick.Add(OnClickXinXiBtn);
  36. VM.SheZhiBtn.onClick.Add(OnClickSheZhiBtn);
  37. }
  38. private void RemoveUIListenres()
  39. {
  40. VM.GoldBtn.onClick.Remove(OnClickGoldBtn);
  41. VM.DiamondBtn.onClick.Remove(OnClickDiamondBtn);
  42. VM.ShopBtn.onClick.Remove(OnClickShopBtn);
  43. VM.SCBtn.onClick.Remove(OnClickSCBtn);
  44. VM.HDBtn.onClick.Remove(OnClickHDBtn);
  45. VM.XSLBtn.onClick.Remove(OnClickXSLBtn);
  46. VM.GoldBox.onClick.Remove(OnClickGoldBox);
  47. VM.TaskBtn.onClick.Remove(OnClickTaskBtn);
  48. VM.XinXiBtn.onClick.Remove(OnClickXinXiBtn);
  49. VM.SheZhiBtn.onClick.Remove(OnClickSheZhiBtn);
  50. }
  51. private void OnClickGoldBtn(EventContext context)
  52. {
  53. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickGoldBtn");
  54. }
  55. private void OnClickDiamondBtn(EventContext context)
  56. {
  57. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickDiamondBtn");
  58. }
  59. private void OnClickShopBtn(EventContext context)
  60. {
  61. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickShopBtn");
  62. }
  63. private void OnClickSCBtn(EventContext context)
  64. {
  65. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickSCBtn");
  66. }
  67. private void OnClickHDBtn(EventContext context)
  68. {
  69. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickHDBtn");
  70. }
  71. private void OnClickXSLBtn(EventContext context)
  72. {
  73. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickXSLBtn");
  74. }
  75. private void OnClickGoldBox(EventContext context)
  76. {
  77. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickGoldBox");
  78. }
  79. private void OnClickTaskBtn(EventContext context)
  80. {
  81. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickTaskBtn");
  82. }
  83. private void OnClickXinXiBtn(EventContext context)
  84. {
  85. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickXinXiBtn");
  86. }
  87. private void OnClickSheZhiBtn(EventContext context)
  88. {
  89. EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickSheZhiBtn");
  90. }
  91. #endregion
  92. }
  93. }