| | |
| | | public Redpoint multipleRed = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20908);
|
| | | public string LocalRecord_Key;
|
| | | bool isNewDay = false;
|
| | | bool openNotify = false;
|
| | |
|
| | | public event Action<int> onStateUpate;
|
| | |
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | openNotify = false;
|
| | | 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;
|
| | | GlobalTimeEvent.Instance.secondEvent -= SecondEvent;
|
| | | GlobalTimeEvent.Instance.secondEvent += SecondEvent;
|
| | | CheckShowRed();
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | OperationBase operation;
|
| | | OperationTimeHepler.Instance.TryGetOperationTime(Operation.MultipRealmPoint, out operation);
|
| | | return operation != null && operation.SatisfyOpenCondition() && operation.InDay(TimeUtility.ServerNow);
|
| | | return operation != null && (operation as OperationMultipleRealmPoint).InActiveTime(TimeUtility.ServerNow);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void RefreshOperationClose(Operation type)
|
| | | private void SecondEvent()
|
| | | {
|
| | | if (type != Operation.MultipRealmPoint) return;
|
| | | CheckShowRed();
|
| | | if (onStateUpate != null)
|
| | | if (IsOpen && !openNotify)
|
| | | {
|
| | | onStateUpate(8);
|
| | | openNotify = true;
|
| | | CheckShowRed();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(8);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshOperationState(Operation type, int arg2)
|
| | | {
|
| | | if (type != Operation.MultipRealmPoint) return;
|
| | | CheckShowRed();
|
| | | if (onStateUpate != null)
|
| | | else if (!IsOpen && openNotify)
|
| | | {
|
| | | onStateUpate(8);
|
| | | openNotify = false;
|
| | | CheckShowRed();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(8);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void CheckShowRed(bool isClick = false)
|
| | | {
|
| | | bool isOpen = OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.MultipRealmPoint);
|
| | | if (!isOpen) return;
|
| | | if (!IsOpen) return;
|
| | |
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | if(!isClick)
|
| | | {
|
| | | if (isOpen && isNewDay)
|
| | | if (IsOpen && isNewDay)
|
| | | {
|
| | | multipleRed.state = RedPointState.Simple;
|
| | | }
|