public override void Progress(BaseGoalProcessor processor, int amount, object cookie) { if (cookie == null) { CurrentPlayer currentPlayer = Service.CurrentPlayer; EpisodeProgressInfo episodeProgressInfo = currentPlayer.EpisodeProgressInfo; EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask; EpisodeProgressData episodeProgressData = new EpisodeProgressData(episodeProgressInfo.uid, currentTask.uid, amount, currentTask.count, EventId.EpisodeComplexTask, 1); cookie = episodeProgressData; } Service.EventManager.SendEvent(EventId.EpisodeProgressMade, cookie); if (Service.PlanetRelocationController.IsRelocationInProgress()) { return; } if (!this.processorMap.ContainsKey(processor)) { return; } EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress(); if (currentEpisodeTaskProgress != null && processor.GetGoalUid() == currentEpisodeTaskProgress.uid) { currentEpisodeTaskProgress.count = Math.Min(currentEpisodeTaskProgress.count + amount, currentEpisodeTaskProgress.target); if (currentEpisodeTaskProgress.count == currentEpisodeTaskProgress.target && currentEpisodeTaskProgress.type != "EpisodePoint") { currentEpisodeTaskProgress.completed = true; } } if (currentEpisodeTaskProgress == null || currentEpisodeTaskProgress.count >= currentEpisodeTaskProgress.target || processor.GetGoalUid() != currentEpisodeTaskProgress.uid) { this.processorMap.Remove(processor); processor.Destroy(); } }
private void ShowProgress(EpisodeProgressData progressData, bool showReward) { EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo; EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask; if (progressData != null && progressData.progress > 0 && progressData.episodeUid == episodeProgressInfo.uid && progressData.taskUid == currentTask.uid) { if (progressData.progressType != EventId.EpisodeComplexTask) { this.progressQueue.Enqueue(progressData); } else { EpisodeProgressData episodeProgressData = null; foreach (EpisodeProgressData current in this.progressQueue) { if (current.taskUid == progressData.taskUid) { episodeProgressData = current; break; } } if (episodeProgressData != null) { episodeProgressData.progress += progressData.progress; } else { this.progressQueue.Enqueue(progressData); } } } if (this.widget != null) { if (this.progressQueue.Count > 0) { bool flag = this.widget.ShowProgress(this.progressQueue.Peek()); if (flag) { this.progressQueue.Dequeue(); } } else if (showReward) { Service.EpisodeController.ForceRefreshState(); this.widget.HideProgress(); this.widget.ShowCTA(); } else { this.widget.HideProgress(); } } }
public bool ShowProgress(EpisodeProgressData progressData) { Animator component = this.widgetBtn.Root.GetComponent <Animator>(); if (!this.widgetBtn.Visible || !component.isActiveAndEnabled) { return(false); } if (this.lastState != "Show") { return(false); } if (Service.WorldTransitioner.IsTransitioning()) { return(false); } EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo; EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask; if (progressData == null || progressData.progress <= 0 || progressData.episodeUid != episodeProgressInfo.uid || progressData.taskUid != currentTask.uid) { return(false); } if (this.hideProgressTimerId != 0u || this.hideProgressCompleteTimerId != 0u) { return(false); } if (!this.UpdateTaskProgressUI(progressData)) { return(false); } if (!this.progressEarnedToast.Visible) { this.ResetAllAnims(); this.AnimSetTrigger(component, "ShowProgress"); this.progressEarnedToast.Visible = true; } return(true); }
private bool UpdateTaskProgressUI(EpisodeProgressData progressData) { if (progressData == null) { Service.Logger.Error("EpisodeWidgetView: no progress data given to show"); return(false); } string arg = string.Empty; EventId progressType = progressData.progressType; if (progressType != EventId.PvpBattleWon) { if (progressType != EventId.TournamentTierReached) { if (progressType != EventId.RaidComplete) { if (progressType != EventId.ObjectiveCompleted) { if (progressType != EventId.EpisodeComplexTask) { Service.Logger.ErrorFormat("Unknown event type {0} when displaying episode points", new object[] { progressData.progressType }); return(false); } arg = "epw_event_points_generic_"; } else { arg = "epw_event_point_obje_"; } } else { arg = "epw_event_point_raid_"; } } else { arg = "epw_event_point_conf_"; } } else { arg = "epw_event_point_pvp_"; } this.progressLabel.Text = this.lang.Get(arg + progressData.progressIndex, new object[] { progressData.progress }); EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo; EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask; int target = currentTask.target; this.animatingProgress = new HUDResourceView("episodeProgress", this.progressSlider, null, null); this.animatingProgress.SetAmount(progressData.prevProgress, target, false); float delay = 0f; if (!this.progressEarnedToast.Visible) { this.progressSliderGoal.Value = (float)progressData.prevProgress / (float)target; delay = 1.5f; } KeyValuePair <int, int> keyValuePair = new KeyValuePair <int, int>(progressData.prevProgress + progressData.progress, target); this.animateProgressTimerId = Service.ViewTimerManager.CreateViewTimer(delay, false, new TimerDelegate(this.AnimateProgressStartCallback), keyValuePair); return(true); }
private void DelayedShowProgress(EpisodeProgressData progressData, bool showReward) { Service.ViewTimerManager.CreateViewTimer(1f, false, new TimerDelegate(this.ShowProgressCallback), new KeyValuePair <EpisodeProgressData, bool>(progressData, showReward)); }