剧情+对话完善
This commit is contained in:
36
Assets/Scripts/NewStorySystem/UI/DialogueHistoryEntryView.cs
Normal file
36
Assets/Scripts/NewStorySystem/UI/DialogueHistoryEntryView.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using TMPro;
|
||||
using Ichni.Story.Dialogue;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Story.UI
|
||||
{
|
||||
/// <summary>DialogHistoryPage 中单条记录的 Prefab 视图。</summary>
|
||||
public class DialogueHistoryEntryView : MonoBehaviour
|
||||
{
|
||||
[Tooltip("普通台词显示的说话者文本;选项记录会自动隐藏。")]
|
||||
[SerializeField] private TMP_Text speakerText;
|
||||
|
||||
[Tooltip("台词或玩家已采用选项的正文文本。")]
|
||||
[SerializeField] private TMP_Text contentText;
|
||||
|
||||
[Tooltip("可选:仅在玩家选项记录时显示的视觉标识。")]
|
||||
[SerializeField] private GameObject choiceIndicator;
|
||||
|
||||
/// <summary>将一条临时对话记录映射到该视图。</summary>
|
||||
public void SetUp(DialogueHistoryEntry entry)
|
||||
{
|
||||
bool isChoice = entry != null && entry.isChoice;
|
||||
if (speakerText != null)
|
||||
{
|
||||
speakerText.gameObject.SetActive(!isChoice && !string.IsNullOrEmpty(entry?.speakerName));
|
||||
speakerText.text = entry?.speakerName ?? string.Empty;
|
||||
}
|
||||
|
||||
if (contentText != null)
|
||||
contentText.text = entry?.content ?? string.Empty;
|
||||
|
||||
if (choiceIndicator != null)
|
||||
choiceIndicator.SetActive(isChoice);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user