Page 3 of 3

Re: How Can I Refresh UI Language After Change Language?

Posted: Tue Mar 28, 2023 5:11 pm
by elektronische
Tony Li wrote: Mon Mar 27, 2023 6:31 pm You could tell the subtitle panel to update its content:

Code: Select all

var subtitle = DialogueManager.currentConversationState.subtitle;
subtitle.formattedText = FormattedText.Parse(subtitle.dialogueEntry.currentDialogueText);
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);
It works perfect, thanks!

Re: How Can I Refresh UI Language After Change Language?

Posted: Tue Mar 28, 2023 7:21 pm
by Tony Li
Glad to help!

Re: How Can I Refresh UI Language After Change Language?

Posted: Wed Apr 05, 2023 6:04 pm
by elektronische
Tony Li wrote: Mon Mar 27, 2023 6:31 pm You could tell the subtitle panel to update its content:

Code: Select all

var subtitle = DialogueManager.currentConversationState.subtitle;
subtitle.formattedText = FormattedText.Parse(subtitle.dialogueEntry.currentDialogueText);
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);
Thanks, it works properly :D

Do you know if there is something similar that I can use to update the response texts without using DialogueManager.UpdateResponses? Specifically, I would like to update the button texts when the response panel is open.

Re: How Can I Refresh UI Language After Change Language?

Posted: Wed Apr 05, 2023 7:51 pm
by Tony Li
If you don't want to use DialogueManager.UpdateResponses() to re-evaluate conditions and re-process the dialogue entry text, you can just loop through the menu's instantiatedButtons list -- or the buttons list if you're using predesigned buttons instead of the Button Template. Example:

Code: Select all

// Apply italics to all response button text:
var menuPanel = DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel;
foreach (var buttonGO in menuPanel.instantiatedButtons)
{
    var button = buttonGO.GetComponent<StandardUIResponseButton>();
    button.label.text = $"<i>{button.label.text}</i>";
}

Re: How Can I Refresh UI Language After Change Language?

Posted: Sat Dec 09, 2023 11:35 am
by forrestuv
elektronische wrote: Mon Mar 27, 2023 4:55 pm
Tony Li wrote: Mon Mar 27, 2023 4:30 pm Hi,

If you're showing a subtitle, you can replay the same dialogue entry:

Code: Select all

var state = DialogueManager.converationModel.GetState(DialogueManager.currentConversationState.subtitle.dialogueEntry);
DialogueManager.conversationController.GotoState(state);
If you're showing a response menu, just call DialogueManager.UpdateResponses().
Thanks for the quick response! :D

Is this the only way? I ask because besides the subtitles, I also use sequences in the dialogue nodes that trigger other things like sounds, animations, etc. So it doesn't seem very efficient to replay the entire dialogue node just to update the subtitles' language.
How to know if I'm displaying responses or a dialogue subtitle?

Re: How Can I Refresh UI Language After Change Language?

Posted: Sat Dec 09, 2023 12:23 pm
by Tony Li
Hi,

You can check if the dialogue UI's menu panel is open:

Code: Select all

bool isShowingMenu = DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel.isOpen;