Files
BingoGrassland/Assets/BingoBrain/ModuleUI/Rewardbox/RewardboxUI.cs
T
2026-04-20 13:49:36 +08:00

112 lines
3.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using BingoBrain.Core;
using BingoBrain;
using FGUI.G008_reward_animal;
using DG.Tweening;
using FGUI.Common_animal;
namespace BingoBrain
{
public class RewardboxUI : BaseUI
{
private RewardboxUICtrl ctrl;
private RewardboxModel model;
private FGUI.G008_reward_animal.com_rewardbox ui;
public RewardboxUI(RewardboxUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.RewardboxUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "G008_reward_animal";
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.G008_reward_animal.com_rewardbox;
}
protected override void OnOpenBefore(object args)
{
GameHelper.showGameUI = false;
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_lookad.GetChild("img_saveingpot") as GImage).visible = true;
if (GameHelper.IsGiftSwitch()) ui.switchgift.selectedIndex = 1;
else ui.switchgift.selectedIndex = 0;
(ui.btn_lookad as btn_tabad).color.selectedIndex = 1;
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();
});
ui.gold_text.text = string.Format(ui.gold_text.text, cash_array[0]);
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()
{
}
}
}