插线系统更新

This commit is contained in:
2025-05-21 21:03:52 +08:00
parent 576de0c719
commit 250dda0436
34 changed files with 19081 additions and 4937 deletions
@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using AibisDream.Framework;
@@ -19,7 +18,6 @@ namespace AibisDream.FixSystem
[SerializeField] private TMP_Text title;
[SerializeField] private RectTransform textRoot;
[SerializeField] private TMP_Text textForEstimation;
private Action _nextStep;
private GameObject _textItemPrefab;
private Queue<TypewriterByCharacter> _lineQueue;
@@ -63,14 +61,6 @@ namespace AibisDream.FixSystem
{
title.text = targetTitle;
}
public IEnumerator ShowText(string targetText)
{
EnumEventSystem.Global.Send(DialogEventEnum.LineShown);
yield return new WaitForSeconds(0.5f);
EnumEventSystem.Global.Send(DialogEventEnum.LineEnd);
_nextStep.Invoke();
}
public void ClearTextScreen()
{
@@ -79,6 +69,8 @@ namespace AibisDream.FixSystem
var text = _lineQueue.Dequeue();
Destroy(text.gameObject);
}
ShowTitle(string.Empty);
}
#endregion
@@ -87,6 +79,10 @@ namespace AibisDream.FixSystem
public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, string lineId, bool isAutoSkip = false)
{
if (string.IsNullOrWhiteSpace(dialogLine))
{
dialogLine = " ";
}
ShowTitle(character.GetActorName());
// 生成新文本组件
var textItem = Instantiate(_textItemPrefab, textRoot);
@@ -102,17 +98,20 @@ namespace AibisDream.FixSystem
// 播放文本
textItemTypewriter.ShowText(dialogLine);
// 播放完成后,顿0.3秒执行下一步
textItemTypewriter.onTextShowed.AddListener(AutoNextStep);
// 每行自动跳过
_nextStep = nextStep;
textItemTypewriter.onTextShowed.AddListener(() => AfterLineShown(textItemTypewriter, nextStep));
// 强制更新布局
LayoutRebuilder.ForceRebuildLayoutImmediate(textRoot);
}
private void AutoNextStep()
private void AfterLineShown(TypewriterByCharacter typewriter, Action nextStop)
{
EnumEventSystem.Global.Send(DialogEventEnum.LineShown);
ActionKit.Delay(0.3f, () =>
{
EnumEventSystem.Global.Send(DialogEventEnum.LineEnd);
nextStop.Invoke();
}).StartGlobal();
typewriter.onTextShowed.RemoveAllListeners();
}
public void ShowOptions(DialogOption[] dialogueOptions)