NGUI Dialogue UI: More than two speaker

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

NGUI Dialogue UI: More than two speaker

Post by fbit »

Hello everyone!

Is it possible to assign more than two subtitle panels to the NGUI dialogue UI provided by the integration package? I'm looking for a functionality like the one in the Unity standard Dialogue UI shown here: https://youtu.be/jC451ATbwfE?t=496.

Hopefully I have not missed any discussion about that topic.

Kind regards,
Franca
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: NGUI Dialogue UI: More than two speaker

Post by Tony Li »

Hi,

Sorry, not without customizing the NGUI dialogue UI scripts yourself.
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Re: NGUI Dialogue UI: More than two speaker

Post by fbit »

Alright! I just wanted to ask because I did not want to miss something.
Thanks for the quick response!

Cheers,
Franca
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Re: NGUI Dialogue UI: More than two speaker

Post by fbit »

Hello again!

As I started implementing this feature for my NGUIDialogueUI, I realized there is a sequencer command named SetPanel(actorName, panelID) to set the dialogue actor's subtitle panel number. However, I think the used Dialogue UI has to derive from StandardDialogueUI, which does not use NGUI elements.

From Sequencer.cs (line 1695):

Code: Select all

/// <summary>
/// Handles the "SetPanel(actorName, panelNum)" action.
///
/// Arguments:
/// -# The name of a GameObject or actor in the dialogue database. Default: speaker.
/// -# The panel number or 'default' or 'bark'.
/// </summary>
private bool HandleSetPanelInternally(string commandName, string[] args)
{
string actorName = SequencerTools.GetParameter(args, 0);
var actorTransform = CharacterInfo.GetRegisteredActorTransform(actorName) ?? SequencerTools.GetSubject(actorName, speaker, listener, speaker);
string panelID = SequencerTools.GetParameter(args, 1);
var subtitlePanelNumber = string.Equals(panelID, "default", StringComparison.OrdinalIgnoreCase) ? SubtitlePanelNumber.Default
: string.Equals(panelID, "bark", StringComparison.OrdinalIgnoreCase) ? SubtitlePanelNumber.UseBarkUI
: PanelNumberUtility.IntToSubtitlePanelNumber(Tools.StringToInt(panelID));
var dialogueActor = (actorTransform != null) ? actorTransform.GetComponent<DialogueActor>() : null;
if (dialogueActor != null)
{
if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: SetPanel({1}, {2})", new System.Object[] { DialogueDebug.Prefix, actorTransform, subtitlePanelNumber }), actorTransform);
dialogueActor.SetSubtitlePanelNumber(subtitlePanelNumber);
return true;
}
else
{
var actor = DialogueManager.masterDatabase.GetActor(actorName);
if (actor == null)
{
if (DialogueDebug.logWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: SetPanel({1}, {2}): No actor named {1}", new System.Object[] { DialogueDebug.Prefix, actorName, subtitlePanelNumber }));
}
else
{
if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: SetPanel({1}, {2})", new System.Object[] { DialogueDebug.Prefix, name, subtitlePanelNumber }));
var standardDialogueUI = DialogueManager.dialogueUI as StandardDialogueUI;
if (standardDialogueUI != null)
{
standardDialogueUI.conversationUIElements.standardSubtitleControls.OverrideActorPanel(actor, subtitlePanelNumber);
}
}
return true;
}
}
You can also find this condition in DialogueActor.cs (line 191):

Code: Select all

/// <summary>
/// Changes a dialogue actor's subtitle panel number. If a conversation is active, updates
/// the dialogue UI.
/// </summary>
public void SetSubtitlePanelNumber(SubtitlePanelNumber newSubtitlePanelNumber)
{
standardDialogueUISettings.subtitlePanelNumber = newSubtitlePanelNumber;
if (DialogueManager.isConversationActive && DialogueManager.dialogueUI is StandardDialogueUI)
{
(DialogueManager.dialogueUI as StandardDialogueUI).SetActorSubtitlePanelNumber(this, newSubtitlePanelNumber);
}
}
That's why I was wondering if it might make sense to add the interface IStandardDialogueUI. I think it would make it easier for me to implement the same logic for my NGUI layout.

But as always, I might be mistaken! Let me know what you think about this.

Kind regards,
Franca
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: NGUI Dialogue UI: More than two speaker

Post by Tony Li »

Hi Franca,

That makes perfect sense. I'll try to get it added in the next release and get a patch out in a few days.
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Re: NGUI Dialogue UI: More than two speaker

Post by fbit »

Great! Thanks a lot, Tony!

Greetings,
Franca
fbit
Posts: 30
Joined: Fri Nov 30, 2018 9:30 am

Re: NGUI Dialogue UI: More than two speaker

Post by fbit »

Hi Tony!

Have you already released a new patch? I am not sure if I have missed it.

Kind regards,
Franca
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: NGUI Dialogue UI: More than two speaker

Post by Tony Li »

Hi Franca,

It's in the next release. I'm working to get it released by the end of the week. If you need a copy immediately, let me know. I'm only updating third party integrations right now. The core update is done.
Post Reply