72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
using Ichni.Story.Dialogue;
|
|
using Ichni.UI;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace Ichni.Story.UI
|
|
{
|
|
/// <summary>
|
|
/// 对话系统专用的 UI 页面容器。
|
|
/// 接管整个对话面板的淡入淡出及交互状态控制,
|
|
/// 将显示生命周期与对话流逻辑 (VNDialoguePresenter) 彻底解耦。
|
|
/// </summary>
|
|
public class DialogUIPage : UIPageBase
|
|
{
|
|
public static DialogUIPage instance;
|
|
|
|
[Header("立绘舞台")]
|
|
public VNPortraitStage portraitStage;
|
|
|
|
[Header("台词区")]
|
|
public TMPro.TextMeshProUGUI dialogueText;
|
|
public GameObject speakerContainer;
|
|
public TMPro.TextMeshProUGUI speakerText;
|
|
|
|
[Header("推进按钮")]
|
|
public UnityEngine.UI.Button advanceButton;
|
|
[Tooltip("点击后自动快进,直到遇到选项")]
|
|
public UnityEngine.UI.Button fastForwardButton;
|
|
|
|
[Header("选项区")]
|
|
public GameObject choiceFrame;
|
|
public ChoiceButton[] choiceButtons = new ChoiceButton[4];
|
|
|
|
[Header("动态组件")]
|
|
public DialogWheel dialogWheel;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
|
|
if (instance == null)
|
|
{
|
|
instance = this;
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
// 默认启动时强制隐藏
|
|
if (mainCanvasGroup != null)
|
|
{
|
|
mainCanvasGroup.alpha = 0f;
|
|
mainCanvasGroup.interactable = false;
|
|
mainCanvasGroup.blocksRaycasts = false;
|
|
mainCanvasGroup.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void PlayFadeIn(UnityAction onComplete = null)
|
|
{
|
|
FadeIn(0.2f, false, onComplete);
|
|
}
|
|
|
|
public void PlayFadeOut(UnityAction onComplete = null)
|
|
{
|
|
FadeOut(0.2f, false, onComplete);
|
|
}
|
|
}
|
|
}
|