/// #pkgName FGUI包名
/// #panelName UIPanel名字
/// #UIName = $"{#pkgName}{#panelName}" UIKey名字
/// 该脚本由模板创建
/// created by cb 2024

using FairyGUI;
using XGame.Framework.UI;

namespace FL.FGUI
{
    /// <summary>
    /// UI逻辑处理类
    /// </summary>
    /// <typeparam name=""></typeparam>
    public partial class MainHomePanelCtrl : UIController<MainHomePanelVM>
    {
        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)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickGoldBtn");
        }
        private void OnClickDiamondBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickDiamondBtn");
        }
        private void OnClickShopBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickShopBtn");
        }
        private void OnClickSCBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickSCBtn");
        }
        private void OnClickHDBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickHDBtn");
        }
        private void OnClickXSLBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickXSLBtn");
        }
        private void OnClickGoldBox(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickGoldBox");
        }
        private void OnClickTaskBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickTaskBtn");
        }
        private void OnClickXinXiBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickXinXiBtn");
        }
        private void OnClickSheZhiBtn(EventContext context)
        {
            EventSingle.Instance.Notify(EventDefine.ShowTips, "OnClickSheZhiBtn");
        }

        #endregion
    }
}