Files
ArrowBeatTap-Gp/Assets/Scripts/ModuleUI/ArrowTips/ArrowTipsUI.cs
T

92 lines
2.3 KiB
C#

using System;
using FGUI.Arrow_game;
using UnityEngine;
namespace ChillConnect
{
public class ArrowTipsUI : BaseUI
{
private ArrowTipsUICtrl ctrl;
private ArrowTipsModel model;
private com_tips ui;
public ArrowTipsUI(ArrowTipsUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.ArrowTipsUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "Arrow_game";
uiInfo.assetName = "com_tips";
uiInfo.layerType = UILayerType.Loading;
uiInfo.isNeedUIMask = true;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
}
protected override void OnInit()
{
}
protected override void OnClose()
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
CommonHelper.FadeOut(ui);
}
protected override void OnBind()
{
ui = baseUI as com_tips;
}
protected override void OnOpenBefore(object args)
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
if (args != null)
InitView((int)args);
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
protected override void AddListener()
{
}
protected override void RemoveListener()
{
}
private void InitView(int type)
{
int state = type;
Debug.Log($"tips state = {state} ");
// 0 提示 1 删除道具
ui.state.selectedIndex = state;
ui.btn_watch.SetClick(() =>
{
string idStr = state == 1 ? "deletePop" : "HintPop";
GameHelper.ShowVideoAd(idStr, isSuccess =>
{
if (isSuccess)
{
Debug.Log($"isSuccess tips state = {state} ");
GameDispatcher.Instance.Dispatch(GameMsg.UseProps, state);
CtrlCloseUI();
}
});
});
ui.btn_close.SetClick(CtrlCloseUI);
}
}
}