| | |
| | | public class MultipleRealmPointModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
|
| | | {
|
| | | public Redpoint multipleRed = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20908);
|
| | | public string LocalRecord_Key = "MultipleRealmRecord";
|
| | | public string LocalRecord_Key;
|
| | | bool isNewDay = false;
|
| | |
|
| | | public event Action<int> onStateUpate;
|
| | |
| | | public override void Init()
|
| | | {
|
| | | OpenServerActivityCenter.Instance.Register(8, this);
|
| | | |
| | | //StageManager.Instance.onStageLoadFinish += CheckReconnect;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | LocalRecord_Key = StringUtility.Contact(LocalRecord_Key, PlayerDatas.Instance.baseData.PlayerID);
|
| | | CheckShowRed();
|
| | | LocalRecord_Key = StringUtility.Contact("MultipleRealmRecord", PlayerDatas.Instance.baseData.PlayerID);
|
| | | OperationTimeHepler.Instance.operationStartEvent -= RefreshOperationState;
|
| | | OperationTimeHepler.Instance.operationStartEvent += RefreshOperationState;
|
| | | OperationTimeHepler.Instance.operationEndEvent -= RefreshOperationState;
|
| | | OperationTimeHepler.Instance.operationEndEvent += RefreshOperationState;
|
| | | OperationTimeHepler.Instance.operationServerCloseEvent -= RefreshOperationClose;
|
| | | OperationTimeHepler.Instance.operationServerCloseEvent += RefreshOperationClose;
|
| | | CheckShowRed();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | |
| | | StageManager.Instance.onStageLoadFinish -= CheckReconnect;
|
| | | }
|
| | |
|
| | | public bool IsOpen
|
| | |
| | | return multipleRed.state == RedPointState.Simple;
|
| | | }
|
| | | }
|
| | |
|
| | | private void CheckReconnect()
|
| | | {
|
| | | if (!(StageManager.Instance.CurrentStage is DungeonStage))
|
| | | {
|
| | | CheckShowRed();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void RefreshOperationClose(Operation type)
|
| | | {
|
| | |
| | |
|
| | | if(!isNewDay)
|
| | | {
|
| | | |
| | | if (!PlayerPrefs.HasKey(LocalRecord_Key))
|
| | | {
|
| | | DebugEx.Log("设置记录时间:" + TimeUtility.ServerNow.Day);
|
| | | LocalSave.SetInt(LocalRecord_Key, TimeUtility.ServerNow.Day);
|
| | | isNewDay = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | DebugEx.Log("得到记录时间:" + LocalSave.GetInt(LocalRecord_Key));
|
| | | if (TimeUtility.ServerNow.Day != LocalSave.GetInt(LocalRecord_Key))
|
| | | {
|
| | | isNewDay = true;
|
| | | DebugEx.Log("设置记录时间:" + TimeUtility.ServerNow.Day);
|
| | | LocalSave.SetInt(LocalRecord_Key, TimeUtility.ServerNow.Day);
|
| | | }
|
| | | }
|