Пример #1
0
 public void OpenJournalAndSelect(QuestArc targetQuest)
 {
     if (Time.timeScale == 0)
     {
         return;                     //player seeing another menu
     }
     pauseMenu.PauseGame(true);
     tabMenu.SelectContent(questMenu.gameObject);
     questMenu.SearchAndSelectQuest(targetQuest);
 }
Пример #2
0
    public void UpdateItem(QuestArc target, QuestHUDList hudList)
    {
        targetQuest     = target;
        owner           = hudList;
        questLabel.text = target.questName;
        if (target.completed)
        {
            buttonText.gameObject.SetActive(false);
            buttonText.text = "Completed. Click here for Rewards.";
            buttonText.ForceMeshUpdate();
            buttonText.gameObject.SetActive(true);
            buttonText.color = completedButtonColor;
        }
        else
        {
            Mission m = target.GetCurrentMission();
            if (m == null)
            {
                Debug.Log("Ongoing QuestArc does not have active missions: " + target.questName);
            }
            else
            {
                buttonText.gameObject.SetActive(false);
                buttonText.text = "";
                for (int i = 0; i < m.outcomes.Length; i++)
                {
                    for (int y = 0; y < m.outcomes[i].goals.Length; y++)
                    {
                        buttonText.text += m.outcomes[i].goals[y].shortDescription;
                        if (m.outcomes[i].goals[y].showCounter)
                        {
                            buttonText.text += " " + m.outcomes[i].goals[y].goalCounter.currentAmount + "/" + m.outcomes[i].goals[y].goalCounter.targetAmount;
                        }
                        if (y < m.outcomes[i].goals.Length - 1)
                        {
                            buttonText.text += "\n";
                        }
                    }
                    if (i < m.outcomes.Length - 1)
                    {
                        buttonText.text += "\nor\n";
                    }
                }
                buttonText.color = defaultButtonColor;
                buttonText.ForceMeshUpdate();
                buttonText.gameObject.SetActive(true);
            }
        }
        Vector2 textSize = buttonText.GetPreferredValues(buttonText.text);

        buttonText.rectTransform.sizeDelta = textSize;
        layoutElement.preferredHeight      = buttonText.rectTransform.rect.height;
    }
Пример #3
0
 public void SetupItem(QuestArc quest, QuestMenu questMenu)
 {
     targetQuest = quest;
     targetMenu  = questMenu;
     if (quest.rewarded)
     {
         itemText.text = "<s>" + quest.questName + "</s>";
     }
     else
     {
         itemText.text = quest.questName;
     }
 }
Пример #4
0
 public bool SearchAndSelectQuest(QuestArc target)
 {
     for (int i = 0; i < categories.Length; i++)
     {
         QuestMenuItem item = categories[i].SearchItem(target, true); //method will open category if found
         if (item != null)
         {
             ViewQuest(item.targetQuest);
             EventSystem.current.SetSelectedGameObject(item.itemButton.gameObject);
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
    private void TryToInsertItem(QuestArc targetQuest)
    {
        for (int i = itemList.Count - 1; i >= 0; i--)
        {
            if (itemList[i].targetQuest == targetQuest)
            {
                itemList[i].UpdateItem(targetQuest, this);
                return;
            }
        }
        QuestHUDItem item = pooler.SpawnTargetObject(hudItem, 10, itemContainer).GetComponent <QuestHUDItem>();

        itemList.Add(item);
        item.UpdateItem(targetQuest, this);
    }
Пример #6
0
 public QuestMenuItem SearchItem(QuestArc targetQuest, bool openIfFound = false)
 {
     for (int i = 0; i < itemList.Count; i++)
     {
         if (itemList[i].targetQuest == targetQuest)
         {
             if (openIfFound && !open)
             {
                 Open(false);
             }
             return(itemList[i]);
         }
     }
     return(null);
 }
Пример #7
0
    public void ViewQuest(QuestArc target)
    {
        if (target == null)
        {
            questDescription.text       = "";
            completeButton.interactable = false;
            completeText.text           = "NO SELECTION";
            completeText.color          = completedTextColor;
            return;
        }
        selectedQuest         = target;
        questDescription.text =
            "<size=200%>" + selectedQuest.questName +
            "\n<size=100%>" + selectedQuest.questDescription +
            "\n<indent=15%>";

        for (int i = 0; i < selectedQuest.missions.Count; i++)
        {
            Mission m = selectedQuest.missions[i];
            if (!m.isActive) //if is on QuestArc and it's not active, it's already completed
            //show goals from completed outcome
            {
                Mission.Outcome outcome = m.GetCompletedOutcome();
                if (outcome == null)
                {
                    questDescription.text += "\n- Error</indent>";
                    break;
                }
                for (int y = 0; y < outcome.goals.Length; y++)
                {
                    questDescription.text += "\n<s>- " + outcome.goals[y].shortDescription;
                    if (outcome.goals[y].showCounter)
                    {
                        questDescription.text += " " + outcome.goals[y].goalCounter.currentAmount + "/" + outcome.goals[y].goalCounter.targetAmount;
                    }
                    questDescription.text += "</s>";
                }
            }
            else  //is the current not completed mission
            {
                for (int y = 0; y < m.outcomes.Length; y++)
                {
                    for (int yi = 0; yi < m.outcomes[y].goals.Length; yi++)
                    {
                        questDescription.text += "\n- " + m.outcomes[y].goals[yi].shortDescription;
                        if (m.outcomes[y].goals[yi].showCounter)
                        {
                            questDescription.text += " " + m.outcomes[y].goals[yi].goalCounter.currentAmount + "/" + m.outcomes[y].goals[yi].goalCounter.targetAmount;
                        }
                    }
                    if (y < m.outcomes.Length - 1)
                    {
                        questDescription.text += "\nor";
                    }
                }
            }
        }
        questDescription.text += "<indent=0%>\n\n\nReward: " + target.reward.rewardName;

        completeButton.interactable = (selectedQuest.completed && !selectedQuest.rewarded);
        if (completeButton.interactable)
        {
            completeText.text  = "COMPLETE";
            completeText.color = toCompleteTextColor;
        }
        else
        {
            if (selectedQuest.rewarded)
            {
                completeText.text = "COMPLETED";
            }
            else
            {
                completeText.text = "IN PROGRESS";
            }
            completeText.color = completedTextColor;
        }
    }
Пример #8
0
 public void BeginNewQuest(QuestArc targetQuest)
 {
     quests.Add(targetQuest);
     targetQuest.InitializeQuest();
     targetQuest.questUpdateEvent.Raise();
 }