Hello there,
I'm trying to create my own implementation of VR Dialogue UI.
For now I have a NPC Subtitle Panel that appears next to the NPC head.
And I also have 3 buttons for the PC responses in worldspace. For now when the player selects a response, all the buttons disappear. I would like the selected response to stay (during the audio) while the other buttons fade away.
How could I do that? I checked "Allow PC Subtitle Reminders" but I believe it would use the same UI component to display the PC subtitle, while I would like to use the selected button (which can be either of the 3)
Thank you
Keeping only selected PC response button
Re: Keeping only selected PC response button
Hi,
You'll need to do a little coding to change the menu panel's behavior in this way.
Make a subclass of StandardUIMenuPanel that overrides the HideResponses(). Something like this, which assume you're using buttons instantiated from the menu panel's Button Template:
If you're using buttons assigned to the menu panel's Buttons list, you'll need to adjust the HideAllResponseButtonsExcept() method.
You'll need to do a little coding to change the menu panel's behavior in this way.
Make a subclass of StandardUIMenuPanel that overrides the HideResponses(). Something like this, which assume you're using buttons instantiated from the menu panel's Button Template:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class ShowChoiceDialogueUI : StandardDialogueUI
{
public override void OnClick(object data)
{
base.OnClick(data);
HideAllResponseButtonsExcept(data as Response);
}
protected void HideAllResponseButtonsExcept(Response response)
{
foreach (var button in conversationUIElements.defaultMenuPanel.instantiatedButtons)
{
var responseButton = button.GetComponent<StandardUIResponseButton>();
responseButton.gameObject.SetActive(responseButton.response == response);
}
}
public override void HideResponses()
{
//--- Don't hide responses yet: base.HideResponses();
}
public override void ShowSubtitle(Subtitle subtitle)
{
HideResponses();
base.ShowSubtitle(subtitle);
}
public override void Close()
{
base.HideResponses();
base.Close();
}
}
Re: Keeping only selected PC response button
This is working perfectly, thank you for this quick reply!
Re: Keeping only selected PC response button
Glad to help!