ball 项目提交
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
using SGModule.NetKit;
|
||||
|
||||
namespace BallKingdomCrush {
|
||||
public class PreferencesDataReadyCtrl : BaseCtrl {
|
||||
private readonly List<uint> msgList = new();
|
||||
|
||||
|
||||
public void PreferenceDataReady(object objs = null) {
|
||||
InspectionNewDay();
|
||||
|
||||
|
||||
DataMgr.GameStartCount.Value++;
|
||||
}
|
||||
|
||||
|
||||
public void InspectionNewDay() {
|
||||
var login_time = LoginKit.Instance.LoginModel.LoginTime;
|
||||
var data = DateTimeManager.Instance.GetDateTime(login_time);
|
||||
var dateStr = DateTimeManager.Instance.DateTimeToYYYYMMDD(data);
|
||||
if (!DataMgr.Date.Value.Equals(dateStr)) {
|
||||
DataMgr.Date.Value = dateStr;
|
||||
msgList.Add(CtrlMsg.NewDays);
|
||||
DataMgr.LoginGameTodayTimes.Value = 1;
|
||||
}
|
||||
else {
|
||||
DataMgr.LoginGameTodayTimes.Value++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SendCtrlMsg(object args = null) {
|
||||
for (var i = 0; i < msgList.Count; i++) {
|
||||
ctrlDispatcher.Dispatch(msgList[i]);
|
||||
}
|
||||
|
||||
msgList.Clear();
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user