private void Start() { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.mDateText, (UnityEngine.Object)null)) { return; } GameManager instance = MonoSingleton <GameManager> .Instance; if (instance.VSDraftType != VersusDraftType.Draft) { return; } VersusEnableTimeParam versusEnableTime = instance.GetVersusEnableTime(instance.mVersusEnableId); if (versusEnableTime == null) { return; } DateTime beginAt = versusEnableTime.BeginAt; DateTime endAt = versusEnableTime.EndAt; DateTime dateTime = DateTime.Today; if (versusEnableTime.Schedule != null && versusEnableTime.Schedule.Count > 0) { VersusEnableTimeScheduleParam timeScheduleParam = versusEnableTime.Schedule[versusEnableTime.Schedule.Count - 1]; dateTime = DateTime.Parse(TimeManager.ServerTime.ToShortDateString() + " " + timeScheduleParam.Begin) + TimeSpan.Parse(timeScheduleParam.Open); } this.mDateText.set_text(string.Format(LocalizedText.Get("sys.DRAFT_PERIOD"), (object)beginAt.Month, (object)beginAt.Day, (object)endAt.Month, (object)endAt.Day, (object)dateTime.Hour, (object)dateTime.Minute)); }
public void UpdateValue() { VersusEnableTimeScheduleParam dataOfClass = DataSource.FindDataOfClass <VersusEnableTimeScheduleParam>(((Component)this).get_gameObject(), (VersusEnableTimeScheduleParam)null); if (dataOfClass == null) { return; } DataSource.Bind <QuestParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.FindQuest(dataOfClass.QuestIname)); this.NameParam.UpdateValue(); this.DescriptionParam.UpdateValue(); this.ThumbnailParam.UpdateValue(); DateTime dateTime1 = DateTime.Parse(TimeManager.ServerTime.ToShortDateString() + " " + dataOfClass.Begin + ":00"); TimeSpan timeSpan = TimeSpan.Parse(dataOfClass.Open); DateTime dateTime2 = dateTime1 + timeSpan; this.TimeText.set_text(string.Format(LocalizedText.Get("sys.RANK_MATCH_ENABLE_TIME"), new object[4] { (object)dateTime1.Hour, (object)dateTime1.Minute, (object)dateTime2.Hour, (object)dateTime2.Minute })); }
public bool Deserialize(JSON_VersusEnableTimeParam json) { if (json == null) { return(false); } this.mScheduleId = json.id; this.mVersusType = (VERSUS_TYPE)json.mode; try { if (!string.IsNullOrEmpty(json.begin_at)) { this.mBeginAt = DateTime.Parse(json.begin_at); } if (!string.IsNullOrEmpty(json.end_at)) { this.mEndAt = DateTime.Parse(json.end_at); } } catch (Exception ex) { DebugUtility.LogError(ex.Message); return(false); } this.mSchedule = new List <VersusEnableTimeScheduleParam>(); for (int index = 0; index < json.schedule.Length; ++index) { VersusEnableTimeScheduleParam timeScheduleParam = new VersusEnableTimeScheduleParam(); if (timeScheduleParam.Deserialize(json.schedule[index])) { this.mSchedule.Add(timeScheduleParam); } } this.mDraftType = (VersusDraftType)json.draft_type; return(true); }
private void RefreshMap() { if (!UnityEngine.Object.op_Implicit((UnityEngine.Object) this.GoMapInfo)) { return; } GameManager instance = MonoSingleton <GameManager> .Instance; PlayerData player = instance.Player; if (UnityEngine.Object.op_Implicit((UnityEngine.Object)instance) && player != null) { DataSource component = (DataSource)this.GoMapInfo.GetComponent <DataSource>(); if (UnityEngine.Object.op_Implicit((UnityEngine.Object)component)) { component.Clear(); } DataSource.Bind <QuestParam>(this.GoMapInfo, instance.FindQuest(GlobalVars.SelectedQuestID)); GameParameter.UpdateAll(this.GoMapInfo); this.mIsUpdateMapInfoEndAt = this.RefreshMapInfoEndAt(); } List <VersusEnableTimeScheduleParam> versusRankMapSchedule = instance.GetVersusRankMapSchedule(instance.RankMatchScheduleId); if (versusRankMapSchedule == null) { return; } List <VersusEnableTimeScheduleParam> timeScheduleParamList = new List <VersusEnableTimeScheduleParam>(); int num1 = TimeManager.ServerTime.Year * 10000 + TimeManager.ServerTime.Month * 100 + TimeManager.ServerTime.Day; using (List <VersusEnableTimeScheduleParam> .Enumerator enumerator1 = versusRankMapSchedule.GetEnumerator()) { while (enumerator1.MoveNext()) { VersusEnableTimeScheduleParam current1 = enumerator1.Current; if (current1.AddDateList == null || current1.AddDateList.Count == 0) { timeScheduleParamList.Add(current1); } else { using (List <DateTime> .Enumerator enumerator2 = current1.AddDateList.GetEnumerator()) { while (enumerator2.MoveNext()) { DateTime current2 = enumerator2.Current; int num2 = current2.Year * 10000 + current2.Month * 100 + current2.Day; if (num1 == num2) { timeScheduleParamList.Add(current1); } } } } } } bool flag = false; int num3 = TimeManager.ServerTime.Hour * 100 + TimeManager.ServerTime.Minute; using (List <VersusEnableTimeScheduleParam> .Enumerator enumerator = timeScheduleParamList.GetEnumerator()) { while (enumerator.MoveNext()) { VersusEnableTimeScheduleParam current = enumerator.Current; DateTime dateTime1 = DateTime.Parse(TimeManager.ServerTime.ToShortDateString() + " " + current.Begin + ":00"); TimeSpan timeSpan = TimeSpan.Parse(current.Open); DateTime dateTime2 = dateTime1 + timeSpan; int num2 = dateTime1.Hour * 100 + dateTime1.Minute; int num4 = dateTime2.Hour * 100 + dateTime2.Minute; if (num2 <= num3 && num3 < num4) { this.TextMapInfoSchedule.set_text(dateTime1.ToString("HH:mm") + "-" + dateTime2.ToString("HH:mm")); flag = true; break; } } } if (flag) { return; } VersusEnableTimeScheduleParam timeScheduleParam = (VersusEnableTimeScheduleParam)null; using (List <VersusEnableTimeScheduleParam> .Enumerator enumerator = timeScheduleParamList.GetEnumerator()) { while (enumerator.MoveNext()) { VersusEnableTimeScheduleParam current = enumerator.Current; DateTime dateTime = DateTime.Parse(TimeManager.ServerTime.ToShortDateString() + " " + current.Begin + ":00"); if (dateTime.Hour * 100 + dateTime.Minute > num3) { timeScheduleParam = current; break; } } } if (timeScheduleParam == null) { DateTime serverTime = TimeManager.ServerTime; serverTime.AddDays(1.0); int num2 = serverTime.Year * 10000 + serverTime.Month * 100 + serverTime.Day; using (List <VersusEnableTimeScheduleParam> .Enumerator enumerator1 = versusRankMapSchedule.GetEnumerator()) { while (enumerator1.MoveNext()) { VersusEnableTimeScheduleParam current1 = enumerator1.Current; if (current1.AddDateList == null || current1.AddDateList.Count == 0) { timeScheduleParam = current1; break; } using (List <DateTime> .Enumerator enumerator2 = current1.AddDateList.GetEnumerator()) { while (enumerator2.MoveNext()) { DateTime current2 = enumerator2.Current; int num4 = current2.Year * 10000 + current2.Month * 100 + current2.Day; if (num2 == num4) { timeScheduleParam = current1; break; } } } } } } if (timeScheduleParam == null) { return; } DateTime dateTime3 = DateTime.Parse(TimeManager.ServerTime.ToShortDateString() + " " + timeScheduleParam.Begin + ":00"); TimeSpan timeSpan1 = TimeSpan.Parse(timeScheduleParam.Open); DateTime dateTime4 = dateTime3 + timeSpan1; this.TextMapInfoSchedule.set_text(dateTime3.ToString("HH:mm") + "-" + dateTime4.ToString("HH:mm")); }