Files
MiniGame_Unity_GP/Assets/Scripts/ModuleUI/FlowerUnlockItem/FlowerUnlockItemUI.cs
T
2026-07-06 16:27:14 +08:00

104 lines
2.7 KiB
C#

using FGUI.ZM_Common_01;
using UnityEngine;
using FairyGUI;
using SGModule.DataStorage;
namespace TowerClimberChronicles
{
public class FlowerUnlockItemUI : BaseUI
{
private FlowerUnlockItemUICtrl ctrl;
private FlowerUnlockItemModel model;
private FGUI.Game_flower_buy.com_unlockitem ui;
public FlowerUnlockItemUI(FlowerUnlockItemUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.FlowerUnlockItemUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "Game_flower_buy";
uiInfo.assetName = "com_unlockitem";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region 生命周期
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.FlowerUnlockItemModel) as FlowerUnlockItemModel;
}
protected override void OnClose()
{
}
protected override void OnBind()
{
ui = baseUI as FGUI.Game_flower_buy.com_unlockitem;
}
protected override void OnOpenBefore(object args)
{
int type = (int)args;
ui.type.selectedIndex = type;
ui.btn_close.SetClick(() =>
{
if (type == 0)
{
DataMgr.FlowerItem0.Value = DataMgr.FlowerItem0.Value + 1;
DataMgr.FlowerItemUnlock.Value[0] = true;
}
else if (type == 1)
{
DataMgr.FlowerItem1.Value = DataMgr.FlowerItem1.Value + 1;
DataMgr.FlowerItemUnlock.Value[1] = true;
}
else if (type == 2)
{
DataMgr.FlowerItem2.Value = DataMgr.FlowerItem2.Value + 1;
DataMgr.FlowerItemUnlock.Value[2] = true;
}
DataMgr.FlowerItemUnlock.Save();
GameDispatcher.Instance.Dispatch(GameMsg.FlowerBuyItem);
CtrlCloseUI();
});
InitView();
}
protected override void OnOpen(object args)
{
}
protected override void OnHide()
{
}
protected override void OnDisplay(object args)
{
}
#endregion
#region 消息
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
#endregion
//初始化页面逻辑
private void InitView()
{
}
}
}