2 questions regarding Quest Log Window

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

2 questions regarding Quest Log Window

Post by Stalker_EG »

Good day!
I have 2 small questions :?: :?: for you:
I was able to independently add an image to the description of the quest. Did this by overriding the method: RepaintSelectedQuest
below code:

Code: Select all

// Image:

            var ImageTransform = questDetailsContentContainer.transform.Find("QuestImage");
            var questImage = (ImageTransform != null) ? ImageTransform.GetComponent<UnityEngine.UI.Image>() : null;

            if (questImage != null)
            {
                var spriteName = DialogueLua.GetQuestField(quest.Title, "Pictures").AsString;
                var isSpriteNameSet = !string.IsNullOrEmpty(spriteName) && !string.Equals(spriteName, "nil");
                var sprite = isSpriteNameSet ? DialogueManager.LoadAsset(spriteName, typeof(Sprite)) as Sprite : null;
                if (isSpriteNameSet && sprite == null)
                {
                    Debug.LogWarning("Dialogue System: " + name + " couldn't load image '" + spriteName + "' for quest '" + quest.Title + "'.", this);
                }
                questImage.gameObject.SetActive(sprite != null);
                questImage.sprite = sprite;
            }
Now I need to add an image to the group button and the buttons of the quest itself. so that it would be attached directly to the group or quest. I define it in the database. How can I do it? already rummaged the entire forum.

and the second question: I really need to list not only active, but also completed and failed quests, how to do this without buttons?

Thanks in advance for your reply.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2 questions regarding Quest Log Window

Post by Tony Li »

Hi,
Stalker_EG wrote: Mon Dec 02, 2019 2:19 pmNow I need to add an image to the group button and the buttons of the quest itself. so that it would be attached directly to the group or quest. I define it in the database. How can I do it?
You can override the OnQuestListUpdated() method. The base method has a section that adds group foldouts:

Code: Select all

            // Add quests by group:
            foreach (var groupName in groupNames)
            {
                var groupFoldout = selectionPanelContentManager.Instantiate<StandardUIFoldoutTemplate>(questGroupTemplate);
                selectionPanelContentManager.Add(groupFoldout, questSelectionContentContainer);
                groupFoldout.Assign(groupName, IsGroupExpanded(groupName));
In that section, you can set up an image on groupFoldout.

Stalker_EG wrote: Mon Dec 02, 2019 2:19 pmand the second question: I really need to list not only active, but also completed and failed quests, how to do this without buttons?
Override the ShowQuests method:

Code: Select all

protected override void ShowQuests(QuestState questStateMask)
{
    // Always show active, success, and failure.
    base.ShowQuests(QuestState.Active | QuestState.Success | QuestState.Failure);
    currentQuestState = questStateMask; // Maybe you want to also remember the actual state requested to show.
}
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: 2 questions regarding Quest Log Window

Post by Stalker_EG »

Override the ShowQuests method:

Code: Select all

protected override void ShowQuests(QuestState questStateMask)
{
    // Always show active, success, and failure.
    base.ShowQuests(QuestState.Active | QuestState.Success | QuestState.Failure);
    currentQuestState = questStateMask; // Maybe you want to also remember the actual state requested to show.
}
Yes thank you! I did just that. but after that the template ceases to determine the quest state. Highlights everything in gray as if they were all done. In this case, quests have different states. And templates are all defined
01.png
01.png (21.11 KiB) Viewed 604 times
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2 questions regarding Quest Log Window

Post by Tony Li »

Hi,

In that case, since you're using different templates for active and completed quests, you'll need to override OnQuestListUpdated(). You can copy the code in StandardUIQuestLogWindow.OnQuestListUpdated and then customize it in your subclass. This method assumes it will use the same template (active or completed) for all of the quests, so it sets questTitleTemplate and selectedQuestTitleTemplate once at the start of the method. You'll need to change your overridden method to set them for each quest based on the quest state.
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: 2 questions regarding Quest Log Window

Post by Stalker_EG »

Thank you so much for your help) I already figured it out. It was not at all difficult. :shock: 8-)
Post Reply