Files
BingoGrassland/Assets/BingoBrain/ModuleUI/CallEnd/CallEndUICtrl.cs
T

91 lines
2.2 KiB
C#
Raw Normal View History

2026-04-20 13:49:36 +08:00
using BingoBrain.Core;
using BingoBrain.HotFix;
namespace BingoBrain
{
public class CallEndUICtrl : BaseUICtrl
{
private CallEndUI ui;
private CallEndModel model;
private uint openUIMsg = SkinInfo.CallEndUI_Open;
private uint closeUIMsg = SkinInfo.CallEndUI_Close;
#region
protected override void OnInit()
{
}
protected override void OnDispose()
{
}
public override void OpenUI(object args = null)
{
if (ui == null)
{
ui = new CallEndUI(this);
ui.Open(args);
}
}
public override void CloseUI(object args = null)
{
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
}
protected override void AddListener()
{
gameDispatcher.AddListener(BingoInfo.CallNumFinish, CheckEnd);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
gameDispatcher.AddListener(BingoInfo.EndBingoGame, CloseUI);
}
private void CheckEnd(object obj)
{
if (BingoCell.AddCallSum >= BingoCell.MaxAddCallSum)
{
gameDispatcher.Dispatch(BingoInfo.ShowGameOver);
}
else
{
GameHelper.GetRewardExtra(111, 1, FGUI.JRewardPop.com_extraItem.Extra_extraball, isSuccess =>
{
if (!isSuccess)
{
gameDispatcher.Dispatch(BingoInfo.ShowGameOver);
}
});
}
}
protected override void RemoveListener()
{
gameDispatcher.RemoveListener(BingoInfo.CallNumFinish, CheckEnd);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
gameDispatcher.RemoveListener(BingoInfo.EndBingoGame, CloseUI);
}
#endregion
}
}