Bugfix/master
This commit is contained in:
@@ -96,6 +96,9 @@ namespace AibisDream
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId,
|
||||
bool isAutoSkip = false)
|
||||
{
|
||||
Debug.Log($"[BubbleGroup] ShowLine - 开始显示对话: {lineId}");
|
||||
Debug.Log($"[BubbleGroup] ShowLine - nextStep是否为null: {nextStep == null}");
|
||||
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (TryGetBubble(character.role, character.bubbleIdx, out var bubble))
|
||||
@@ -114,6 +117,8 @@ namespace AibisDream
|
||||
// 保留信息
|
||||
_nextStep = nextStep;
|
||||
_curBubble = bubble;
|
||||
|
||||
Debug.Log($"[BubbleGroup] ShowLine - 设置完成,_nextStep是否为null: {_nextStep == null}");
|
||||
}
|
||||
|
||||
public void ShowOptions(DialogOption[] dialogueOptions)
|
||||
@@ -161,16 +166,26 @@ namespace AibisDream
|
||||
|
||||
public void NextStep()
|
||||
{
|
||||
if (_nextStep == null) return;
|
||||
Debug.Log($"[BubbleGroup] NextStep - _nextStep是否为null: {_nextStep == null}");
|
||||
|
||||
if (_nextStep == null)
|
||||
{
|
||||
Debug.Log("[BubbleGroup] NextStep - _nextStep为null,提前返回");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("[BubbleGroup] NextStep - 发送LineEnd事件");
|
||||
EnumEventSystem.Global.Send(DialogEventEnum.LineEnd);
|
||||
|
||||
var next = _nextStep;
|
||||
_nextStep = null;
|
||||
|
||||
_curBubble?.Hide();
|
||||
_curBubble = null;
|
||||
|
||||
Debug.Log("[BubbleGroup] NextStep - 调用回调");
|
||||
next?.Invoke();
|
||||
Debug.Log("[BubbleGroup] NextStep - 回调调用完成");
|
||||
}
|
||||
|
||||
public void OnLocalizationChanged(string value)
|
||||
|
||||
@@ -75,22 +75,32 @@ namespace AibisDream
|
||||
|
||||
private void OnTextShown()
|
||||
{
|
||||
// 阻塞部分
|
||||
Debug.Log("[事件处理] OnTextShown - 文本显示完成事件");
|
||||
|
||||
// 在快速模式下,不设置阻塞,因为快速模式会立即处理
|
||||
if (DialogController.Instance.quickRunMode)
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextShown - 快速模式,跳过阻塞设置");
|
||||
return;
|
||||
}
|
||||
|
||||
// 阻塞部分 - 只在非快速模式下阻塞,确保文本能够显示
|
||||
_isNextBlocked = true;
|
||||
_block = ActionKit.Delay(blockDuration, () =>
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextShown - 阻塞时间结束");
|
||||
_isNextBlocked = false;
|
||||
_block = null;
|
||||
}
|
||||
).Start(this);
|
||||
|
||||
// 自动跳过部分
|
||||
if (DialogController.Instance.quickRunMode) return;
|
||||
|
||||
// 自动跳过部分 - 只在非快速模式下执行
|
||||
if (DialogController.Instance.autoRunMode || _isNextAutoSkip)
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextShown - 设置自动跳过定时器");
|
||||
_autoNext = ActionKit.Delay(autoSkipDelay, () =>
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextShown - 自动跳过定时器触发");
|
||||
_autoNext = null;
|
||||
NextStep();
|
||||
}).Start(this);
|
||||
@@ -100,12 +110,26 @@ namespace AibisDream
|
||||
|
||||
private void OnTextEnd()
|
||||
{
|
||||
_block?.Deinit();
|
||||
_block = null;
|
||||
Debug.Log("[事件处理] OnTextEnd - 文本结束事件");
|
||||
|
||||
// 清理阻塞定时器
|
||||
if (_block != null)
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextEnd - 清理阻塞定时器");
|
||||
_block.Deinit();
|
||||
_block = null;
|
||||
}
|
||||
_isNextBlocked = false;
|
||||
|
||||
_autoNext?.Deinit();
|
||||
_autoNext = null;
|
||||
// 清理自动跳过定时器
|
||||
if (_autoNext != null)
|
||||
{
|
||||
Debug.Log("[事件处理] OnTextEnd - 清理自动跳过定时器");
|
||||
_autoNext.Deinit();
|
||||
_autoNext = null;
|
||||
}
|
||||
|
||||
Debug.Log("[事件处理] OnTextEnd - 清理完成");
|
||||
}
|
||||
|
||||
public override void OnSingletonDestroy()
|
||||
@@ -156,10 +180,14 @@ namespace AibisDream
|
||||
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId,
|
||||
bool isAutoSkip = false)
|
||||
{
|
||||
Debug.Log($"[DialogCanvasManager] ShowLine - 角色对话框类型: {character.dialogViewType}");
|
||||
Debug.Log($"[DialogCanvasManager] ShowLine - nextStep是否为null: {nextStep == null}");
|
||||
|
||||
_isNextAutoSkip = isAutoSkip;
|
||||
// 根据DialogViewType确定在哪个对话框显示
|
||||
if (character.dialogViewType == DialogViewType.Default)
|
||||
{
|
||||
Debug.Log("[DialogCanvasManager] ShowLine - 使用默认对话框");
|
||||
if (_showingView != _defaultView)
|
||||
{
|
||||
_showingView?.HideDialog();
|
||||
@@ -176,6 +204,7 @@ namespace AibisDream
|
||||
}
|
||||
else if (_dialogViewDict.TryGetValue(character.dialogViewType, out var view))
|
||||
{
|
||||
Debug.Log($"[DialogCanvasManager] ShowLine - 使用指定对话框: {view.GetType().Name}");
|
||||
if (_showingView != view)
|
||||
{
|
||||
_showingView?.HideDialog();
|
||||
@@ -195,6 +224,8 @@ namespace AibisDream
|
||||
{
|
||||
Debug.Log($"{character.dialogViewType.ToString()}类型对话框不存在");
|
||||
}
|
||||
|
||||
Debug.Log($"[DialogCanvasManager] ShowLine - 当前_showingView类型: {_showingView?.GetType().Name}");
|
||||
}
|
||||
|
||||
public void ShowOptions(DialogOption[] dialogueOptions)
|
||||
@@ -239,23 +270,51 @@ namespace AibisDream
|
||||
|
||||
public bool TrySkipLine(bool isForceSkip = false)
|
||||
{
|
||||
string skipType = isForceSkip ? "强制跳过" : "用户跳过";
|
||||
Debug.Log($"[跳过操作] {skipType} - 阻塞状态: {_isNextBlocked}");
|
||||
|
||||
if (_isNextBlocked)
|
||||
{
|
||||
Debug.Log("[跳过操作] ❌ 被阻塞,返回true");
|
||||
return true;
|
||||
}
|
||||
|
||||
return _showingView != null && _showingView.TrySkipLine(isForceSkip);
|
||||
bool result = _showingView != null && _showingView.TrySkipLine(isForceSkip);
|
||||
Debug.Log($"[跳过操作] {skipType} - 结果: {(result ? "✅ 成功" : "❌ 失败")}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public void NextStep()
|
||||
{
|
||||
var view = _showingView;
|
||||
_hideDialog = ActionKit.Delay(autoHideDuration, () =>
|
||||
Debug.Log("[对话继续] ===== NextStep开始 =====");
|
||||
Debug.Log($"[对话继续] 当前显示的对话框类型: {_showingView?.GetType().Name}");
|
||||
|
||||
// 在快速模式下,不设置延迟隐藏,避免定时器冲突
|
||||
if (!DialogController.Instance.quickRunMode)
|
||||
{
|
||||
_hideDialog = null;
|
||||
view.HideDialog();
|
||||
}).Start(this);
|
||||
var view = _showingView;
|
||||
_hideDialog = ActionKit.Delay(autoHideDuration, () =>
|
||||
{
|
||||
Debug.Log("[对话继续] 延迟隐藏对话框");
|
||||
_hideDialog = null;
|
||||
view.HideDialog();
|
||||
}).Start(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[对话继续] 快速模式,跳过延迟隐藏设置");
|
||||
// 清理可能存在的延迟隐藏定时器
|
||||
if (_hideDialog != null)
|
||||
{
|
||||
_hideDialog.Deinit();
|
||||
_hideDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("[对话继续] 调用对话框NextStep");
|
||||
_showingView?.NextStep();
|
||||
|
||||
Debug.Log("[对话继续] ===== NextStep完成 =====");
|
||||
}
|
||||
|
||||
public void OnLocalizationChanged(string value)
|
||||
|
||||
Reference in New Issue
Block a user