Files
Zoomatch_unity_ios/Assets/Scripts/ModuleUI/Rewardbox/RewardboxUI.cs
T

107 lines
3.0 KiB
C#
Raw Normal View History

2026-05-28 15:23:36 +08:00
// using FGUI.A000_common;
using FairyGUI;
namespace ZooMatch
{
public class RewardboxUI : BaseUI
{
private RewardboxUICtrl ctrl;
private RewardboxModel model;
private FGUI.ZM_Game_04.com_rewardbox ui;
public RewardboxUI(RewardboxUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.RewardboxUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "ZM_Game_04";
uiInfo.assetName = "com_rewardbox";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = true;
}
#region 生命周期
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.RewardboxModel) as RewardboxModel;
}
protected override void OnClose()
{
GameHelper.showGameUI = true;
}
protected override void OnBind()
{
ui = baseUI as FGUI.ZM_Game_04.com_rewardbox;
}
protected override void OnOpenBefore(object args)
{
if (GameHelper.IsGiftSwitch()) ui.switchgift.selectedIndex = 1;
else ui.switchgift.selectedIndex = 0;
// (ui.btn_lookad as btn_tabad).color.selectedIndex = btn_tabad.Color_green;
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_lookad.GetChild("img_saveingpot") as GImage).visible = true;
FGUI.ZM_Common_01.btn_claim btnlook = ui.btn_lookad as FGUI.ZM_Common_01.btn_claim;
btnlook.ad_icon.x += 50;
float[] cash_array = GameHelper.GetRewardValue(2);
ui.btn_lookad.SetClick(() =>
{
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
{
if (isSuccess)
{
GameDispatcher.Instance.Dispatch(GameMsg.Ad_success, cash_array[0]);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardboxUI_Close);
}
});
});
ui.btn_close.SetClick(() =>
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardboxUI_Close);
GameHelper.addInterAdnumber();
});
var num = cash_array[0];
ui.gold_text.SetVar("count", num.ToString()).FlushVars();
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()
{
}
}
}