using TMPro; using UnityEngine; namespace NightclubArcadia.UI.Dialogue { /// /// One message row in the dialogue stream: optional speaker name + body text. /// public sealed class DialogueMessageRow : MonoBehaviour { [SerializeField] TMP_Text speakerText; [SerializeField] TMP_Text bodyText; [SerializeField] GameObject speakerLabel; public TMP_Text BodyText => bodyText; public void SetContent(string speaker, string body) { if (string.IsNullOrWhiteSpace(speaker)) { if (speakerLabel != null) { speakerLabel.SetActive(false); } else if (speakerText != null) { speakerText.gameObject.SetActive(false); } } else { if (speakerLabel != null) { speakerLabel.SetActive(true); } else if (speakerText != null) { speakerText.gameObject.SetActive(true); } if (speakerText != null) { speakerText.text = speaker; } } if (bodyText != null) { bodyText.text = body ?? string.Empty; } } } }