72 lines
1.9 KiB
C#
72 lines
1.9 KiB
C#
using System;
|
|
using BingoBrain.Core;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BingoBrain
|
|
{
|
|
public class PrenterCtrl : BaseCtrl
|
|
{
|
|
private List<uint> msgList = new List<uint>();
|
|
|
|
#region 生命周期
|
|
|
|
protected override void OnInit()
|
|
{
|
|
}
|
|
|
|
protected override void OnDispose()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 消息
|
|
|
|
protected override void AddListener()
|
|
{
|
|
ctrlDispatcher.AddListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
|
|
ctrlDispatcher.AddListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
|
|
}
|
|
|
|
protected override void RemoveListener()
|
|
{
|
|
ctrlDispatcher.RemoveListener(CtrlMsg.Preferences_InitComplete, PreferenceDataReady);
|
|
ctrlDispatcher.RemoveListener(CtrlMsg.Game_StartBefore, SendCtrlMsg);
|
|
}
|
|
|
|
#endregion
|
|
|
|
public void PreferenceDataReady(object objs = null)
|
|
{
|
|
InspectionNewDay();
|
|
PreferencesMgr.Instance.GameStartCount++;
|
|
}
|
|
|
|
public void InspectionNewDay()
|
|
{
|
|
DateTime data = DateTimeBoardk.Instance.GetDateTime(GameHelper.GetNowTime());
|
|
string dateStr = DateTimeBoardk.Instance.DateTimeToYYYYMMDD(data);
|
|
if (!PreferencesMgr.Instance.Date.Equals(dateStr))
|
|
{
|
|
PreferencesMgr.Instance.Date = dateStr;
|
|
msgList.Add(CtrlMsg.NewDays);
|
|
PreferencesMgr.Instance.LoginGameTodayTimes = 1;
|
|
}
|
|
else
|
|
{
|
|
PreferencesMgr.Instance.LoginGameTodayTimes++;
|
|
}
|
|
}
|
|
|
|
|
|
public void SendCtrlMsg(object args = null)
|
|
{
|
|
for (int i = 0; i < msgList.Count; i++)
|
|
{
|
|
ctrlDispatcher.Dispatch(msgList[i]);
|
|
}
|
|
|
|
msgList.Clear();
|
|
}
|
|
}
|
|
} |