using System; using AibisDream.Framework; using AibisDream.Kit; using TMPro; using UnityEngine; using UnityEngine.UI; namespace AibisDream { public class CenterOption : MonoBehaviour, IDialogView { #region 索引 public GameObject choiceButtonPrefab; #endregion private void Awake() { EnumEventSystem.Global.Register(DialogEventEnum.OptionSelected, _ => HideDialog()); } public void ShowLine(string dialogLine, CharacterVo character, Action nextStep, Action onTextShowed = null, bool isAutoSkip = false) { Debug.Log("CenterOption只显示选项"); } public void ShowOptions(DialogOption[] dialogueOptions) { gameObject.SetActive(true); // 销毁原来的按钮 foreach (Transform child in transform) { Destroy(child.gameObject); } // 生成新按钮 foreach (var option in dialogueOptions) { if (!option.IsAvailable) continue; var choiceInstance = Instantiate(choiceButtonPrefab, transform); choiceInstance.GetComponentInChildren().text = option.Line; choiceInstance.GetComponent