微调
This commit is contained in:
@@ -92,8 +92,10 @@ namespace Ichni.Story.Dialogue
|
||||
|
||||
// ── DialoguePresenterBase 实现 ───────────────────────────────────────────
|
||||
|
||||
public override async YarnTask OnDialogueStartedAsync()
|
||||
public override YarnTask OnDialogueStartedAsync()
|
||||
{
|
||||
Debug.Log("[YarnDiag] VNDialoguePresenter.OnDialogueStartedAsync 开始。");
|
||||
|
||||
// 快进是一次 Yarn 对话会话的临时操作,绝不能遗留到下一次进入 TextBlock。
|
||||
_isFastForwarding = false;
|
||||
_typewriterComplete = false;
|
||||
@@ -101,18 +103,17 @@ namespace Ichni.Story.Dialogue
|
||||
// 对话记录只保留当前一次 TextBlock;每次 Yarn 对话真正开始时清空上一段残留内容。
|
||||
DialogueHistory.BeginSession();
|
||||
|
||||
if (Page != null)
|
||||
{
|
||||
var tcs = new YarnTaskCompletionSource<bool>();
|
||||
Page.PlayFadeIn(() => tcs.TrySetResult(true));
|
||||
await tcs.Task;
|
||||
}
|
||||
Page.PlayFadeIn();
|
||||
Debug.Log("[YarnDiag] VNDialoguePresenter.OnDialogueStartedAsync 完成。");
|
||||
return YarnTask.CompletedTask;
|
||||
}
|
||||
|
||||
public override async YarnTask RunLineAsync(LocalizedLine line, LineCancellationToken token)
|
||||
{
|
||||
if (Page == null) return;
|
||||
|
||||
Debug.Log($"[YarnDiag] VNDialoguePresenter.RunLineAsync: LineID='{line.TextID}', Speaker='{line.CharacterName}', Text='{line.TextWithoutCharacterName.Text}', RawText='{line.RawText}'");
|
||||
|
||||
// 确保选项区不可见;台词区始终可见
|
||||
if (Page.choiceFrame != null) Page.choiceFrame.SetActive(false);
|
||||
|
||||
@@ -126,6 +127,11 @@ namespace Ichni.Story.Dialogue
|
||||
|
||||
// ── 打字效果 ──
|
||||
string fullText = line.TextWithoutCharacterName.Text;
|
||||
if (string.IsNullOrEmpty(fullText) && !string.IsNullOrEmpty(line.RawText))
|
||||
{
|
||||
fullText = line.RawText;
|
||||
Debug.LogWarning($"[YarnDiag] [WARNING] 台词 '{line.TextID}' 本地化解析结果为空,回退使用 RawText: '{fullText}'");
|
||||
}
|
||||
// 记录的是本次实际展示时已经解析完成的本地化文本,而非 Yarn Key。
|
||||
DialogueHistory.AddLine(line.CharacterName, fullText);
|
||||
_typewriterComplete = false;
|
||||
@@ -285,23 +291,39 @@ namespace Ichni.Story.Dialogue
|
||||
|
||||
private void OnAdvanceButtonClicked()
|
||||
{
|
||||
Debug.Log($"[YarnDiag] OnAdvanceButtonClicked 推进按钮被点击!_runner={(_runner != null ? _runner.name : "null")}, _typewriterComplete={_typewriterComplete}, _isFastForwarding={_isFastForwarding}, _optionTcs={(_optionTcs != null)}");
|
||||
|
||||
// 未记忆选项必须由 ChoiceButton 明确选择;推进按钮不能越过当前选择。
|
||||
if (_optionTcs != null)
|
||||
{
|
||||
Debug.LogWarning("[YarnDiag] OnAdvanceButtonClicked 被拦截:正在等待选项选择。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果玩家在快进时点击屏幕/推进键,则打断快进状态并停止当前动作
|
||||
if (_isFastForwarding)
|
||||
{
|
||||
Debug.Log("[YarnDiag] OnAdvanceButtonClicked 打断快进模式。");
|
||||
_isFastForwarding = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_runner == null) return;
|
||||
if (_runner == null)
|
||||
{
|
||||
Debug.LogError("[YarnDiag] [ERROR] OnAdvanceButtonClicked 拦截:_runner 为 null!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_typewriterComplete)
|
||||
{
|
||||
Debug.Log("[YarnDiag] RequestHurryUpLine (跳过打字效果)");
|
||||
_runner.RequestHurryUpLine(); // 第一次点击:跳过打字效果
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[YarnDiag] RequestNextLine (推进下一行)");
|
||||
_runner.RequestNextLine(); // 第二次点击:推进到下一行
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFastForwardButtonClicked()
|
||||
|
||||
Reference in New Issue
Block a user