using UnityEngine; using AibisDream.UI; using System.Globalization; using TMPro; namespace AibisDream.FixSystem { public class ScreenPanel : MonoBehaviour, ILineView { [SerializeField] private TMP_Text title; [SerializeField] private TerminalText logText; // ---------------------- 对话框功能 ---------------------- public void RunLine(LineSyncToken token) { if (logText != null) { logText.OnTextShown += () => token.TextShown(); title.text = token.lineInfo.character.GetActorName(); logText.SetTypewriterSpeed(GetTextSpeedValue()); logText.AddText(token.lineInfo.lineText); token.TextStart(); } else { Debug.LogError("UniversalScreen: logText 为空"); } } private float GetTextSpeedValue() { var textSpeedStr = SettingLoader.Instance.TryRead("TextSpeed", out string textSpeed) ? textSpeed : "1"; return float.TryParse(textSpeedStr, NumberStyles.Float, CultureInfo.InvariantCulture, out float result) ? result : 1f; } public void ClearScreen() { logText.Clear(); title.text = string.Empty; } } }