public EpisodeController() { this.CurrentEpisodeData = null; this.CurrentWidgetData = null; this.nextScheduledRefreshDate = DateTime.MinValue; Service.EpisodeController = this; EventManager eventManager = Service.EventManager; eventManager.RegisterObserver(this, EventId.WorldLoadComplete); this.RefreshEpisodeStates(); }
private void RefreshEpisodeStates() { this.RefreshEpisodeData(); this.CurrentWidgetData = (EpisodeWidgetDataVO)this.RefreshEpisodeItem <EpisodeWidgetDataVO>(this.CurrentWidgetData); if (this.CurrentWidgetData != null) { Service.Logger.Debug(string.Concat(new string[] { "Current Widget: ", this.CurrentWidgetData.Uid, " is active: ", this.CurrentWidgetData.StartTime.ToString(), " ---> ", this.CurrentWidgetData.EndTime.ToString() })); } this.ScheduleNextRefresh(); Service.EventManager.SendEvent(EventId.EpisodeDataRefreshed, null); }
public void SetWidgetData(EpisodeWidgetDataVO vo, DateTime endDate, bool isCurrentTaskProgressComplete, bool isCurrentTaskTimeGated, bool isTimeGateActive, bool isTaskTimeGateComplete, int currentTaskTimeGate, uint taskProgressInfoEndTime, bool isNewEpisode) { this.currentWidgetVO = vo; StaticDataController staticDataController = Service.StaticDataController; EpisodeWidgetStateVO optional = staticDataController.GetOptional <EpisodeWidgetStateVO>(this.currentWidgetVO.StateId); if (optional == null) { Service.Logger.Warn("Could not find EpisodeWidgetState: " + this.currentWidgetVO.StateId + " for EpisodeWidget: " + this.currentWidgetVO.Uid); return; } this.expirationDate = endDate; FactionType faction = Service.CurrentPlayer.Faction; this.titleLabel.Visible = true; this.titleLabel.Text = this.lang.Get(optional.GetTitleString(faction), new object[0]); this.titleLabelComplete.Text = this.lang.Get(optional.GetTitleString(faction), new object[0]); string backgroundTextureId = optional.GetBackgroundTextureId(faction); if (!string.IsNullOrEmpty(backgroundTextureId)) { Service.AssetManager.RegisterPreloadableAsset(backgroundTextureId); this.LoadTexture(this.bgTexture, backgroundTextureId); } string text = optional.GetIconTextureId(faction); if (this.noticeCC != null) { this.noticeCC.Destroy(); this.noticeCC = null; } this.iconTexture.Visible = false; this.noticeLabel.Visible = false; this.widgetCircleTimer.Visible = false; string text2 = string.Empty; string text3 = string.Empty; string text4 = this.lang.Get("TIMEGATE_ENDED_COLLECT_REWARDS", new object[0]); this.HideTimerIcon(); this.needToShowCTA = false; if (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && !isTimeGateActive && !isTaskTimeGateComplete) { text3 = this.lang.Get("TIMEGATE_TASK_COMPLETE_START_RESEARCH", new object[0]); this.needToShowCTA = true; } else if (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && isTimeGateActive && !isTaskTimeGateComplete) { this.timeGateEndTimestamp = taskProgressInfoEndTime; uint time = ServerTime.Time; int num = (int)(this.timeGateEndTimestamp - time); float value = 1f * (float)(currentTaskTimeGate - num) / (float)currentTaskTimeGate; string text5 = this.lang.Get("RESEARCH_ENDS_IN", new object[0]); string timeLabelFromSeconds = GameUtils.GetTimeLabelFromSeconds(num); this.pBarCircleTimer.Value = value; text = null; this.widgetCircleTimer.Visible = true; this.noticeCC = new CountdownControl(this.pBarCircleTimer, this.noticeLabel, text5, (int)this.timeGateEndTimestamp, currentTaskTimeGate, text4); text2 = string.Format(text5, timeLabelFromSeconds); this.ShowTimerIcon(); Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f); } else if ((isCurrentTaskProgressComplete && !isCurrentTaskTimeGated) || (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && isTimeGateActive && isTaskTimeGateComplete)) { text3 = text4; this.needToShowCTA = true; text = this.GetTaskCrateIcon(); if (string.Compare(this.loadedIconTextureId, text) != 0) { this.iconTexture.MainTexture = null; } } else if (optional.ShowTimer) { this.noticeLabel.Visible = true; this.noticeCC = new CountdownControl(this.noticeLabel, this.lang.Get("ENDS_IN", new object[0]), DateUtils.GetSecondsFromEpoch(this.expirationDate)); } else if (isNewEpisode) { text3 = this.lang.Get("EPISODE_NEW_EPISODE_CTA", new object[0]); this.needToShowCTA = true; } if (!string.IsNullOrEmpty(text2)) { this.noticeLabel.Visible = true; this.noticeLabel.Text = text2; } this.noticeLabelComplete.Text = text3; if (!string.IsNullOrEmpty(text)) { this.iconTexture.Visible = true; Service.AssetManager.RegisterPreloadableAsset(text); this.LoadTexture(this.iconTexture, text); this.loadedIconTextureId = text; this.ReadjustAnchors(true); } else { this.ReadjustAnchors(false); } if (this.needToShowCTA) { if (!this.showingCTA) { this.ShowCTA(); } } else if (this.showingCTA) { bool flag = this.ResetAnims(); this.showingCTA = !flag; } }