MainHomePanelCtrl.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. Context.ShowTips("OnClickGoldBtn");
  54. }
  55. private void OnClickDiamondBtn(EventContext context)
  56. {
  57. Context.ShowTips("OnClickDiamondBtn");
  58. }
  59. private void OnClickShopBtn(EventContext context)
  60. {
  61. Context.ShowTips("OnClickShopBtn");
  62. }
  63. private void OnClickSCBtn(EventContext context)
  64. {
  65. Context.ShowTips("OnClickSCBtn");
  66. // 临时测试GM消息按钮
  67. Context.UI.OpenAsync(UIKeys.GmToolSendMsgPanel);
  68. }
  69. private void OnClickHDBtn(EventContext context)
  70. {
  71. Context.ShowTips("OnClickHDBtn");
  72. }
  73. private void OnClickXSLBtn(EventContext context)
  74. {
  75. Context.ShowTips("OnClickXSLBtn");
  76. }
  77. private void OnClickGoldBox(EventContext context)
  78. {
  79. Context.ShowTips("OnClickGoldBox");
  80. }
  81. private void OnClickTaskBtn(EventContext context)
  82. {
  83. Context.ShowTips("OnClickTaskBtn");
  84. }
  85. private void OnClickXinXiBtn(EventContext context)
  86. {
  87. Context.ShowTips("OnClickXinXiBtn");
  88. }
  89. private void OnClickSheZhiBtn(EventContext context)
  90. {
  91. Context.ShowTips("OnClickSheZhiBtn");
  92. }
  93. #endregion
  94. }
  95. }