/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using FairyGUI; using XGame.Framework.UI; namespace FL.FGUI { /// /// UI逻辑处理类 /// /// public partial class MainHomePanelCtrl : UIController { protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { VM.GoldBtn.onClick.Add(OnClickGoldBtn); VM.DiamondBtn.onClick.Add(OnClickDiamondBtn); VM.ShopBtn.onClick.Add(OnClickShopBtn); VM.SCBtn.onClick.Add(OnClickSCBtn); VM.HDBtn.onClick.Add(OnClickHDBtn); VM.XSLBtn.onClick.Add(OnClickXSLBtn); VM.GoldBox.onClick.Add(OnClickGoldBox); VM.TaskBtn.onClick.Add(OnClickTaskBtn); VM.XinXiBtn.onClick.Add(OnClickXinXiBtn); VM.SheZhiBtn.onClick.Add(OnClickSheZhiBtn); } private void RemoveUIListenres() { VM.GoldBtn.onClick.Remove(OnClickGoldBtn); VM.DiamondBtn.onClick.Remove(OnClickDiamondBtn); VM.ShopBtn.onClick.Remove(OnClickShopBtn); VM.SCBtn.onClick.Remove(OnClickSCBtn); VM.HDBtn.onClick.Remove(OnClickHDBtn); VM.XSLBtn.onClick.Remove(OnClickXSLBtn); VM.GoldBox.onClick.Remove(OnClickGoldBox); VM.TaskBtn.onClick.Remove(OnClickTaskBtn); VM.XinXiBtn.onClick.Remove(OnClickXinXiBtn); VM.SheZhiBtn.onClick.Remove(OnClickSheZhiBtn); } private void OnClickGoldBtn(EventContext context) { Context.ShowTips("OnClickGoldBtn"); } private void OnClickDiamondBtn(EventContext context) { Context.ShowTips("OnClickDiamondBtn"); } private void OnClickShopBtn(EventContext context) { Context.ShowTips("OnClickShopBtn"); } private void OnClickSCBtn(EventContext context) { Context.ShowTips("OnClickSCBtn"); // 临时测试GM消息按钮 Context.UI.OpenAsync(UIKeys.GmToolSendMsgPanel); } private void OnClickHDBtn(EventContext context) { Context.ShowTips("OnClickHDBtn"); } private void OnClickXSLBtn(EventContext context) { Context.ShowTips("OnClickXSLBtn"); } private void OnClickGoldBox(EventContext context) { Context.ShowTips("OnClickGoldBox"); } private void OnClickTaskBtn(EventContext context) { Context.ShowTips("OnClickTaskBtn"); } private void OnClickXinXiBtn(EventContext context) { Context.ShowTips("OnClickXinXiBtn"); } private void OnClickSheZhiBtn(EventContext context) { Context.ShowTips("OnClickSheZhiBtn"); } #endregion } }