public void OnDebugCompleteClick() { if (!progress_.IsCompleted(quest_.Id)) { GameProgressData.CurrentProgress.QuestProgress.CompleteQuest(quest_.Id); SetQuest(quest_, progress_); } }
public void SetQuest(Quest quest, QuestProgress progress) { // Types: // Active quest // Active quest with activate button // Completed quest with collect button // Completed and collected quest quest_ = quest; progress_ = progress; bool isCompleted = progress.IsCompleted(quest.Id); bool isCollected = progress.IsCollected(quest.Id); bool mustBeActivated = quest.ActivationFunc != null; if (Application.isEditor && !isCompleted) { DebugButton.SetActive(true); } QuestText.text = quest.GetDisplayText(progress); RewardText.text = quest.GetRewardText(progress); DescriptionText.text = quest.Description; var buttonImage = Button.GetComponent <Image>(); var buttontext = Button.GetComponentInChildren <TextMeshProUGUI>(); var backgroundImage = GetComponent <Image>(); Button.gameObject.SetActive(false); QuestText.color = quest_.ApplyReward == null ? QuestGiverScript.Instance.AchievementColor : QuestGiverScript.Instance.QuestColor; if (isCollected) { // Quest is completed and collected backgroundImage.color = QuestGiverScript.Instance.CollectedColor; QuestText.text += " <color=#00ff00>(COMPLETE)</color>"; } else if (isCompleted && !isCollected) { // Quest is completed but not yet collected backgroundImage.color = QuestGiverScript.Instance.CompletedColor; QuestText.text += " <color=#00ff00>(COMPLETE)</color>"; buttontext.text = "Complete"; buttonImage.color = QuestGiverScript.Instance.CollectButtonColor; Button.gameObject.SetActive(true); completionPending_ = true; Timing.RunCoroutine(CollectMeCo(buttonImage).CancelWith(this.gameObject)); } else { // Quest is not completed if (mustBeActivated) { buttontext.text = "I'm ready!"; buttonImage.color = QuestGiverScript.Instance.ActivateButtonColor; activateQuestOnButtonPress_ = true; Button.gameObject.SetActive(true); } } }