using Febucci.UI; using Febucci.UI.Core; using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; namespace AibisDream { public class DialogUiViewer : Singleton { #region 对话框UI private GameObject dialogBox; private TypewriterByCharacter dialogText; private TextMeshProUGUI actorName; private Button nextButton; #endregion private Action nextStepAction; private void Start() { // 获取子物体 dialogBox = transform.GetChild(0).gameObject; GetDialogComponentInBox(dialogBox); } /// /// 显示文字 /// /// 对话内容 /// 名称 /// 下一步 public void ShowLine(string dialogLine, string actor, Action nextStep) { dialogBox.SetActive(true); actorName.text = actor; dialogText.ShowText(dialogLine); nextStepAction = nextStep; } public void ShowNextButton() { nextButton.gameObject.SetActive(true); } public void ClickNextStep() { Action temp = nextStepAction; nextStepAction = null; temp?.Invoke(); nextButton.gameObject.SetActive(false); } private void GetDialogComponentInBox(GameObject box) { actorName = box.transform.GetChild(0).gameObject.GetComponent(); dialogText = box.transform.GetChild(1).gameObject.GetComponent(); nextButton = box.transform.GetChild(2).GetComponent