Page 1 of 1

Quest Journal UI Customization

Posted: Mon Apr 04, 2022 6:49 pm
by cptscrimshaw
Hi Tony,

I've mostly completed revamping the Quest Journal for my game, but I have a few outstanding items I'm hoping you might be able to offer some insight on.

https://ibb.co/bR7sgWR

#1 - I haven't touched UnityUIQuestJournalUI up to this point, because I wanted to ask you about a best approach first. Instead, I have a separate class I'm using to handle input, UI display, etc. I'm currently just reordering the UI elements once they are instantiated, but this leads to a very small "blip" in graphics as items are moved around since I have to wait for a frame for everything to be drawn initially. Any suggestions on how to avoid that?

#2 - I'd like to list all completed quests (with a divider) below the active ones. Should I use a group for this, or is there any easier way to put completed ones at the bottom?

Let me know if I need to clarify anything, and thanks!

Re: Quest Journal UI Customization

Posted: Mon Apr 04, 2022 9:15 pm
by Tony Li
Hi,
cptscrimshaw wrote: Mon Apr 04, 2022 6:49 pm#1 - I haven't touched UnityUIQuestJournalUI up to this point, because I wanted to ask you about a best approach first. Instead, I have a separate class I'm using to handle input, UI display, etc. I'm currently just reordering the UI elements once they are instantiated, but this leads to a very small "blip" in graphics as items are moved around since I have to wait for a frame for everything to be drawn initially. Any suggestions on how to avoid that?
Try using Canvas.ForceUpdateCanvases() to refresh the UI layout of all canvases.
cptscrimshaw wrote: Mon Apr 04, 2022 6:49 pm#2 - I'd like to list all completed quests (with a divider) below the active ones. Should I use a group for this, or is there any easier way to put completed ones at the bottom?
Iterate through the quests and check each quest's state using the GetState() method. Some ideas:
  • Loop through the quests twice, first listing only quests whose GetState() == QuestState.Active, then listing quests whose GetState() == QuestState.Successful.
  • Or you can loop once and store the quests in two lists (active and complete), then add UI elements for both lists.
  • Or set up two UI containers, one for active, one for complete. As you loop through the quests, put them in the appropriate container based on GetState().