Page 1 of 1

HUB group not showing player name or portrait

Posted: Wed May 12, 2021 5:03 pm
by cptscrimshaw
Hi Tony,

I ran into a little bit of an odd issue with an NPC HUB group, where at the outset of the conversation, it isn't showing the player's portrait or name, even though the correct response panel text is coming up. Attached are some screenshots that hopefully will reveal what I've missed.

https://ibb.co/MVRj7m6
https://ibb.co/4jwJCGh
https://ibb.co/D54s2Vv
https://ibb.co/zG7Jyc4
https://ibb.co/pvPD2JK

Not sure if this is a factor at all, but I'm using a custom StandardUISubtitlePanel (code below), however this appears to be working just fine everywhere except for the use case described above.

Code: Select all

public class CustomSubtitlePanel : StandardUISubtitlePanel
{
    public Image namePlate;
    private Image factionBadge;
    private string namePlateColorString;
    private string factionBadgeString;
    private Color namePlateColor;

    public override void SetContent(Subtitle subtitle)
    {
        base.SetContent(subtitle);

        namePlate = GameObjectUtility.GameObjectHardFind("Name Panel").GetComponent<Image>();
        factionBadge = GameObjectUtility.GameObjectHardFind("Faction Dialogue Badge").GetComponent<Image>();

        DialogueActor myDialogueActor = subtitle.speakerInfo.transform?.GetComponent<DialogueActor>();
        Debug.Log(myDialogueActor);
        namePlateColorString = DialogueLua.GetActorField(myDialogueActor.name, "Name Plate Color").asString;
        factionBadgeString = DialogueLua.GetActorField(myDialogueActor.name, "Faction Badge").asString;

        //Update Name Plate Color
        if (ColorUtility.TryParseHtmlString(namePlateColorString, out namePlateColor))
        {
            namePlate.color = namePlateColor;
        }

        //Update Faction Badge
        factionBadge.sprite = RoomManager.Instance.GetFactionBadge(factionBadgeString);

        //Fix for Inn badge placement
        if(factionBadgeString == "Inn")
        {
            factionBadge.rectTransform.anchoredPosition = new Vector3(0, 30, 0);
        }
        else
        {
            factionBadge.rectTransform.anchoredPosition = new Vector3(0, 0, 0);
        }
    }
}
Thanks!

Re: HUB group not showing player name or portrait

Posted: Wed May 12, 2021 5:28 pm
by Tony Li
Hi,

Check your conversations' properties. In all of the conversations, is the conversation's Actor dropdown set to the Player actor?

Re: HUB group not showing player name or portrait

Posted: Wed May 12, 2021 7:08 pm
by cptscrimshaw
Thanks for the quick reply. Yes, it's set to the Player actor in all instances.

Re: HUB group not showing player name or portrait

Posted: Wed May 12, 2021 9:44 pm
by Tony Li
You may also need to write a corresponding custom subclass for StandardUIMenuPanel. The StandardUIMenuPanel shows the PC Image and PC Name when showing a response menu.