Setting dialogue line color with [panel] tag
Posted: Mon Oct 09, 2023 11:45 am
Currently I'm using [panel=#] tag to override default panel for speaker. Also I use DialogueActor to set text color.
I notice that if I use [panel] tag, the color setting is not working. I looked at the code:
Notice that in GetPanel() function if we have [panel] tag we will not reach GetActorTransformPanel() and actor will be null, so setting color in DialogueActor not works in this case.
Is it a bug? Can you advice some workaround for this?
I notice that if I use [panel] tag, the color setting is not working. I looked at the code:
Code: Select all
// StandardUISubtitleControls.cs
// line 439
public override void ShowSubtitle(Subtitle subtitle)
{
if (subtitle == null) return;
DialogueActor dialogueActor;
var panel = GetPanel(subtitle, out dialogueActor); // Here dialogueActor is set
// (omit not relevant code)
// Here actor used to adjust color
if (dialogueActor != null && dialogueActor.standardDialogueUISettings.setSubtitleColor)
{
subtitle.formattedText.text = dialogueActor.AdjustSubtitleColor(subtitle);
}
SupercedeOtherPanels(panel);
panel.ShowSubtitle(subtitle);
}
}
Code: Select all
// StandardUISubtitleControls.cs
// line 202
public virtual StandardUISubtitlePanel GetPanel(Subtitle subtitle, out DialogueActor dialogueActor)
{
dialogueActor = null;
if (subtitle == null) return m_defaultNPCPanel;
// Check if we have a forced override:
if (m_forcedOverridePanel != null) return m_forcedOverridePanel;
// Check [panel=#] tag:
var overrideIndex = subtitle.formattedText.subtitlePanelNumber;
if (0 <= overrideIndex && overrideIndex < m_builtinPanels.Count)
{
var overridePanel = m_builtinPanels[overrideIndex];
overridePanel.actorOverridingPanel = subtitle.speakerInfo.transform;
return overridePanel;
}
// Check actor ID override:
if (m_actorIdOverridePanel.ContainsKey(subtitle.speakerInfo.id))
{
var overridePanel = m_actorIdOverridePanel[subtitle.speakerInfo.id];
overridePanel.actorOverridingPanel = subtitle.speakerInfo.transform;
return overridePanel;
}
// Get actor's panel:
var speakerTransform = subtitle.speakerInfo.transform;
var panel = GetActorTransformPanel(speakerTransform, subtitle.speakerInfo.isNPC ? m_defaultNPCPanel : m_defaultPCPanel, out dialogueActor);
return panel;
}
Is it a bug? Can you advice some workaround for this?