| | |
| | | SetDisplay();
|
| | | TimeMgr.Instance.OnMinuteEvent += UpdateMinute;
|
| | | GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
|
| | | CrossServerPKSeason.Instance.updateSelfSeasonEvent += OnChangeMatchState;
|
| | | DTCC002_tagGCCrossRealmPKStartMatch.CrossServerStartMatchEvent += OnStartMatch;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | {
|
| | | TimeMgr.Instance.OnMinuteEvent -= UpdateMinute;
|
| | | GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
|
| | | CrossServerPKSeason.Instance.updateSelfSeasonEvent -= OnChangeMatchState;
|
| | | DTCC002_tagGCCrossRealmPKStartMatch.CrossServerStartMatchEvent -= OnStartMatch;
|
| | | }
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
| | | UpdatePKInfo();
|
| | | UpdateActivityState();
|
| | | UpdateLookPlayerTime();
|
| | | OnChangeMatchState();
|
| | | var pkSeason = CrossServerPKSeason.Instance;
|
| | | seasonTimeText.text = pkSeason.ToDisplaySeasonTime();
|
| | | var openTimes = pkSeason.GetActivityTimes();
|
| | |
| | | openTimeText.text = Language.Get("CrossServer119", openTimeDes);
|
| | | }
|
| | |
|
| | | lookPlayerObj.SetActive(pkSeason.MatchState != 0);
|
| | | lookPlayerObj.SetActive(crossServerModel.IsMatching);
|
| | | }
|
| | |
|
| | | private void UpdateMatchInfo()
|
| | |
| | |
|
| | | private void UpdateLookPlayerTime()
|
| | | {
|
| | | if (CrossServerPKSeason.Instance.MatchState == 0) return;
|
| | | if (!crossServerModel.IsMatching) return;
|
| | |
|
| | | int totalSeconds = Mathf.RoundToInt((float)(DateTime.Now - crossServerModel.matchStartTime).TotalSeconds);
|
| | | if(totalSeconds < 3600)
|
| | |
| | | matchBtn.RemoveAllListeners();
|
| | | matchBtn_Text.text = Language.Get("CrossServer109");
|
| | | matchBtn_Img.material = MaterialUtility.GetUIDefaultGraphicMaterial();
|
| | | if (CrossServerPKSeason.Instance.MatchState == 0)
|
| | | if (!crossServerModel.IsMatching)
|
| | | {
|
| | | matchBtn.AddListener(() => { ClickMatch(1); });
|
| | | }
|
| | |
| | | WindowCenter.Instance.Open<RankingWin>();
|
| | | }
|
| | |
|
| | | private void OnChangeMatchState()
|
| | | private void OnStartMatch()
|
| | | {
|
| | | int matchState = CrossServerPKSeason.Instance.MatchState;
|
| | | lookPlayerObj.SetActive(matchState != 0);
|
| | | if(matchState != 0)
|
| | | {
|
| | | crossServerModel.matchStartTime = DateTime.Now;
|
| | | UpdateLookPlayerTime();
|
| | | }
|
| | | lookPlayerObj.SetActive(true);
|
| | | crossServerModel.matchStartTime = DateTime.Now;
|
| | | UpdateLookPlayerTime();
|
| | | UpdateActivityState();
|
| | | }
|
| | |
|
| | | private void ClickMatch(int type)
|
| | | {
|
| | | crossServerModel.SendCrossMatch(type);
|
| | | if(type == 0)
|
| | | {
|
| | | crossServerModel.IsMatching = false;
|
| | | lookPlayerObj.SetActive(false);
|
| | | UpdateActivityState();
|
| | | }
|
| | | }
|
| | |
|
| | | private void ClickMatchRecord()
|