Page 1 of 1
Change UI on runtime
Posted: Mon Sep 16, 2019 2:46 am
by KakimaAkuma
I've read up on SetPanel() and other Set_() Sequences
I have questions regarding on setting Panels for Responses
EG: I have a set of choices that I change dynamically by using DialogueManager.UpdateResponses();
My question is how can I update my Panel (Button and Layout) at runtime.
Edit: Change panel at the current dialogue node and not at the next node.
Re: Change UI on runtime
Posted: Mon Sep 16, 2019 10:23 am
by Tony Li
Hi,
The dialogue UI scripts aren't really designed for that, but it's possible with a little scripting. You can hide the current panel by calling the dialogue UI's HideSubtitle() and/or HideResponses() methods. Then show a panel by calling ShowSubtitle() and/or ShowResponses().
Or, if you think it would be simpler, you can provide your own UI implementation of the IDialogueUI C# interface. It just has a few methods such as ShowSubtitles and ShowResponses that you'd need to implement.
Re: Change UI on runtime
Posted: Wed Sep 18, 2019 2:50 am
by KakimaAkuma
After I make my own script, which is a better approach.
Should I subscribe my newly written stuff to Lua, or should I make a new Sequencer?
Re: Change UI on runtime
Posted: Wed Sep 18, 2019 4:15 am
by KakimaAkuma
Follow-up question: Also what script actually runs when a dialogue is being run?
Re: Change UI on runtime
Posted: Wed Sep 18, 2019 10:54 am
by Tony Li
I'm not sure I follow. For the most part, the dialogue UI runs independently of Lua and the sequencer. When the Dialogue System plays a dialogue entry, it calls the dialogue UI's ShowSubtitle() method. Independently, it calls the sequencer's PlaySequence() method, which is not part of the dialogue UI.
There are some exceptions. The SetPanel() sequencer command will check the current dialogue UI for a StandardDialogueUI component and make changes to it (e.g., show or hide a panel).
But, in general, if you write your own IDialogueUI implementation, you don't have to worry about the sequencer or Lua.
However, if you want to write a custom sequencer command to control your IDialogueUI implementation (for example, or change a subtitle panel), you can do that.