对话框

This commit is contained in:
2025-02-15 14:15:33 +08:00
parent 496f538b9f
commit 5166b15b96
21 changed files with 1281 additions and 122 deletions
+18 -15
View File
@@ -28,7 +28,7 @@ namespace AibisDream
private GameObject _choiceBox;
#endregion
private bool _skipLineDelay;
private Action _nextStep;
@@ -43,11 +43,6 @@ namespace AibisDream
AddSomeListener();
}
private void OnDestroy()
{
OnDialogViewerDestroy();
}
private void AddSomeListener()
{
// 对话显示后有一段延时不可跳过
@@ -62,15 +57,11 @@ namespace AibisDream
private void InitComponents()
{
_actorName = transform.Find(ActorName)?.gameObject.GetComponent<TextMeshProUGUI>();
_actorName = transform.Find(ActorName)?.gameObject.GetComponentInChildren<TextMeshProUGUI>();
_dialogText = transform.Find(DialogText)?.gameObject.GetComponent<TypewriterByCharacter>();
_nextArray = transform.Find(NextArray)?.gameObject;
_choiceBox = transform.Find(ChoiceBox)?.gameObject;
}
protected virtual void OnDialogViewerDestroy()
{
}
#endregion
@@ -109,9 +100,9 @@ namespace AibisDream
_dialogText.onTextShowed.AddListener(() => _nextArray.gameObject.SetActive(true));
_dialogText.onTextShowed.AddListener(() => onTextShowed?.Invoke());
_dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShowed));
_nextStep = nextStep;
// 执行自动跳过结局
if (isAutoSkip)
{
@@ -122,7 +113,7 @@ namespace AibisDream
public virtual void NextStep()
{
if (_nextStep == null) return;
EnumEventSystem.Global.Send(DialogEventEnum.LineEnd);
var next = _nextStep;
_nextStep = null;
@@ -200,7 +191,19 @@ namespace AibisDream
private void ShowActorName(CharacterVo character)
{
if (!_actorName) return;
_actorName.text = character.GetActorName();
if (string.IsNullOrWhiteSpace(character.GetActorName()))
{
_actorName.transform.parent.gameObject.SetActive(false);
}
else
{
_actorName.transform.parent.localPosition =
character.key == "me" ? new Vector3(460, -125, 0) : new Vector3(-630, 150, 0);
_actorName.transform.parent.gameObject.SetActive(true);
_actorName.text = character.GetActorName();
}
}
}
}