67 lines
1.4 KiB
C#
67 lines
1.4 KiB
C#
using System;
|
|
using AibisDream.Kit;
|
|
using Febucci.UI;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class CenterBubble : MonoBehaviour, IBubble
|
|
{
|
|
[SerializeField] private TypewriterByCharacter dialogText;
|
|
|
|
public ActorRole Role => ActorRole.Center;
|
|
public int Idx => 0;
|
|
public event Action OnLineShown;
|
|
|
|
private void Awake()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
dialogText.onTextShowed.AddListener(InvokeLineShown);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
dialogText.onTextShowed.RemoveAllListeners();
|
|
}
|
|
|
|
private void InvokeLineShown()
|
|
{
|
|
OnLineShown?.Invoke();
|
|
OnLineShown = null;
|
|
}
|
|
|
|
public void ShowActorName(CharacterVo characterVo)
|
|
{
|
|
// 不显示名称
|
|
}
|
|
|
|
public void ShowLine(string line)
|
|
{
|
|
dialogText.TextAnimator.SetText("");
|
|
gameObject.SetActive(true);
|
|
dialogText.ShowText(line);
|
|
}
|
|
|
|
public bool SkipLine()
|
|
{
|
|
if (dialogText.isShowingText)
|
|
{
|
|
dialogText.SkipTypewriter();
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |