diff --git a/Assets/Scripts/SaveSystem/SaveRestoreOrchestrator.cs b/Assets/Scripts/SaveSystem/SaveRestoreOrchestrator.cs index 5c1ce171c..8c2ffa159 100644 --- a/Assets/Scripts/SaveSystem/SaveRestoreOrchestrator.cs +++ b/Assets/Scripts/SaveSystem/SaveRestoreOrchestrator.cs @@ -260,7 +260,7 @@ namespace AibisDream.SaveSystem /// /// 读档前对齐「已进入游戏」的 UI 与输入状态。 - /// 编辑器测试工具等路径可能跳过 ,导致 StartPanel 未关闭、 + /// 编辑器测试工具等路径可能跳过 ,导致 TerminalPanel 未关闭、 /// 为 false,从而无法推进对话。 /// private static void PrepareGameSessionForRestore() @@ -276,9 +276,8 @@ namespace AibisDream.SaveSystem var ui = UIManager.Instance; if (ui != null) { - ui.HidePreferredStartPanel(); + ui.HideTerminal(); ui.ShowPanel(); - ui.HidePreferredChapterPanel(); ui.HidePanel(); ui.HidePanel(); } diff --git a/Assets/Scripts/UI/DialogUI/DialogUIManager.cs b/Assets/Scripts/UI/DialogUI/DialogUIManager.cs index fd83c626f..85b7e059a 100644 --- a/Assets/Scripts/UI/DialogUI/DialogUIManager.cs +++ b/Assets/Scripts/UI/DialogUI/DialogUIManager.cs @@ -29,20 +29,6 @@ namespace AibisDream EnumEventSystem.Global.UnRegister(GameLoopEnum.GameQuit, CleanDialogHistory); } - private RecordPanel RecordPanel => UIManager.Instance.GetPanel(); - private TerminalRecordPanel TerminalRecordPanel - { - get - { - UIManager.Instance.TryGetPanel(out var panel); - return panel; - } - } - - /// - /// 记录对话 - /// - /// 对话 private void AddDialogueLine(LineInfo line) { if (line.character.dialogViewType == DialogViewType.Task) @@ -50,14 +36,12 @@ namespace AibisDream return; } - RecordPanel?.AppendDialogLine(line); - TerminalRecordPanel?.AppendDialogLine(line); + UIManager.Instance.GetPanel()?.AppendDialogLine(line); } private void CleanDialogHistory() { - RecordPanel?.ClearDialog(); - TerminalRecordPanel?.ClearDialog(); + UIManager.Instance.GetPanel()?.ClearDialog(); } public void CloseCanvas() diff --git a/Assets/Scripts/UI/Panel/ChapterPanel.cs b/Assets/Scripts/UI/Panel/ChapterPanel.cs deleted file mode 100644 index 9f73ce559..000000000 --- a/Assets/Scripts/UI/Panel/ChapterPanel.cs +++ /dev/null @@ -1,146 +0,0 @@ -using AibisDream.Kit; -using AibisDream.Utility; -using TMPro; -using UnityEngine; -using UnityEngine.UI; - -namespace AibisDream.UI -{ - public class ChapterPanel : MonoBehaviour, IUIPanel - { - #region 索引 - - public ChapterController chapterController; - public Animator animator; - public Image background; - - public RectTransform chapterContentRect; - public TMP_Text errorInfo; - - public GameObject chapterDetail; - public TMP_Text chapterDetailText; - public Button continueButton; - public Button restartButton; - - public GameObject chapterItemPrefab; - - #endregion - - private GameObject _background; - - private ChapterVo _curChapterVo; - - public void Show() - { - gameObject.SetActive(true); - - AddBackground(); - animator.Play("Open", 0, 0); - ActionKit.Delay(ConstRef.PanelDelayDuration, DrawContent).Start(this); - } - - public void Hide() - { - RemoveBackground(); - animator.Play("Close", 0, 0); - ActionKit.Delay(ConstRef.PanelDelayDuration, DestroyContent).Start(this); - } - - private void AddBackground() - { - background.canvasRenderer.SetAlpha(0.0f); - background.gameObject.SetActive(true); - background.CrossFadeAlpha(1.0f, 0.4f, false); - } - - private void RemoveBackground() - { - background.CrossFadeAlpha(0.0f, 0.2f, false); - } - - #region 绘制关卡信息部分 - - private void DrawContent() - { - chapterContentRect.DestroyAllChildren(); - chapterDetail.SetActive(false); - - continueButton.onClick.AddListener(OnContinueClick); - restartButton.onClick.AddListener(OnRestartClick); - - var chapterList = chapterController.GetChapterList(); - if (chapterList.Count <= 0) - { - errorInfo.gameObject.SetActive(true); - } - else - { - errorInfo.gameObject.SetActive(false); - foreach (var chapterVo in chapterList) - { - var chapterItem = Instantiate(chapterItemPrefab, chapterContentRect).GetComponent(); - chapterItem.Init(chapterVo); - chapterItem.OnClick += OnChapterSelected; - } - } - } - - private void DestroyContent() - { - chapterDetail.SetActive(false); - _curChapterVo = default; - - continueButton.onClick.RemoveListener(OnContinueClick); - restartButton.onClick.RemoveListener(OnRestartClick); - - chapterContentRect.DestroyAllChildren(); - gameObject.SetActive(false); - Destroy(_background); - - background.gameObject.SetActive(false); - } - - private void OnChapterSelected(ChapterVo chapterVo) - { - chapterDetail.SetActive(true); - - chapterDetailText.text = chapterVo.desc; - continueButton.gameObject.SetActive(chapterVo.hasSaveFile); - - _curChapterVo = chapterVo; - } - - private void OnContinueClick() - { - if (!_curChapterVo.hasSaveFile) - { - Debug.LogWarning("存档与关联篇章不匹配,请查找问题"); - } - - chapterController.StartWithSaveFile(); - - Close(); - } - - private void OnRestartClick() - { - chapterController.StartWithChapter(_curChapterVo); - - Close(); - } - - #endregion - - #region panel属性 - - public bool IsOpen => gameObject.activeSelf; - public bool IsCloseable => true; - - public void Close() - { - UIManager.Instance.HidePanel(); - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/Panel/ChapterPanel.cs.meta b/Assets/Scripts/UI/Panel/ChapterPanel.cs.meta deleted file mode 100644 index 823d2b50d..000000000 --- a/Assets/Scripts/UI/Panel/ChapterPanel.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1ebbdd8010b4400089d20c1b556e7b5f -timeCreated: 1756194127 \ No newline at end of file diff --git a/Assets/Scripts/UI/Panel/MainPanel.cs b/Assets/Scripts/UI/Panel/MainPanel.cs index b6e679dba..5e5777386 100644 --- a/Assets/Scripts/UI/Panel/MainPanel.cs +++ b/Assets/Scripts/UI/Panel/MainPanel.cs @@ -91,12 +91,12 @@ namespace AibisDream.UI private void OpenSettingPanel() { - UIManager.Instance.ShowPreferredSettingPanel(); + UIManager.Instance.ShowTerminalSetting(); } private void OpenRecordPanel() { - UIManager.Instance.ShowPreferredRecordPanel(); + UIManager.Instance.ShowTerminalRecord(); } } } diff --git a/Assets/Scripts/UI/Panel/Record/RecordPanel.cs b/Assets/Scripts/UI/Panel/Record/RecordPanel.cs deleted file mode 100644 index b02c40acc..000000000 --- a/Assets/Scripts/UI/Panel/Record/RecordPanel.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using AibisDream.Kit; -using AibisDream.Utility; -using UnityEngine; -using UnityEngine.UI; - -namespace AibisDream.UI -{ - public class RecordPanel : MonoBehaviour, IUIPanel - { - public bool IsOpen => gameObject.activeSelf; - public bool IsCloseable => true; - - #region 索引 - - [SerializeField] private Image popupBackground; - [SerializeField] private Animator animator; - [SerializeField] private Button closeBtn; - [SerializeField] private ScrollRect scrollRect; - [SerializeField] private Transform recordRoot; - [SerializeField] private GameObject recordPrefab; - - #endregion - - private readonly List _recordDataList = new(); - - public void Show() - { - GameManager.Instance.PauseGame(); - gameObject.SetActive(true); - - AddBackground(); - animator.Play("Open", 0, 0); - closeBtn.onClick.AddListener(ReturnGame); - - // 打开场景 - ShowRecord(); - } - - public void Hide() - { - gameObject.SetActive(false); - GameManager.Instance.ContinueGame(); - // 关闭背景 - RemoveBackground(); - animator.Play("Close", 0, 0); - ActionKit.Delay(ConstRef.PanelDelayDuration, () => popupBackground.gameObject.SetActive(false)).Start(this); - - // 关闭时停止渲染 - closeBtn.onClick.RemoveAllListeners(); - - HideRecord(); - } - - private void AddBackground() - { - popupBackground.canvasRenderer.SetAlpha(0.0f); - popupBackground.gameObject.SetActive(true); - popupBackground.CrossFadeAlpha(1.0f, 0.4f, true); - } - - private void RemoveBackground() - { - popupBackground.CrossFadeAlpha(0.0f, 0.2f, false); - } - - public void AppendDialogLine(LineInfo lineInfo) - { - _recordDataList.Add(lineInfo); - } - - public void ClearDialog() - { - _recordDataList.Clear(); - } - - private void ShowRecord() - { - foreach (var recordData in _recordDataList) - { - var record = Instantiate(recordPrefab, recordRoot); - record.GetComponent().Init(recordData); - } - - scrollRect.verticalNormalizedPosition = 0; - } - - private void HideRecord() - { - // TODO 可能有性能问题 - recordRoot.DestroyAllChildren(); - } - - private void ReturnGame() - { - UIManager.Instance.HidePanel(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/Panel/Record/RecordPanel.cs.meta b/Assets/Scripts/UI/Panel/Record/RecordPanel.cs.meta deleted file mode 100644 index a8dff528f..000000000 --- a/Assets/Scripts/UI/Panel/Record/RecordPanel.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: dc6a1b2ccb564028b69d821ab33778f5 -timeCreated: 1744779271 \ No newline at end of file diff --git a/Assets/Scripts/UI/Panel/SettingPanel.cs b/Assets/Scripts/UI/Panel/SettingPanel.cs deleted file mode 100644 index 2a6679ca7..000000000 --- a/Assets/Scripts/UI/Panel/SettingPanel.cs +++ /dev/null @@ -1,124 +0,0 @@ -using AibisDream.Kit; -using UnityEngine; -using UnityEngine.UI; -using AibisDream.Utility; - -namespace AibisDream.UI -{ - public class SettingPanel : MonoBehaviour, IUIPanel - { - public bool IsOpen => gameObject.activeSelf; - public bool IsCloseable => true; - - #region 索引 - - [SerializeField] private Image background; - [SerializeField] private Animator animator; - - [Space] - [SerializeField] private Button continueBtn; - [SerializeField] private Button backToMainBtn; - [SerializeField] private Button quitBtn; - [SerializeField] private Button wishlistBtn; - [SerializeField] private Button bugBtn; - - #endregion - - #region 打开和关闭 - - public void Show() - { - GameManager.Instance.PauseGame(); - gameObject.SetActive(true); - AddBackground(); - animator.Play("Open", 0, 0); - - // 更新表单内容 - var form = GetComponentInChildren(); - form.Init(); - // 注册函数 - RegisterButton(); - } - - public void Hide() - { - // 更新表单内容 - var form = GetComponentInChildren(); - form.UnInit(); - UnRegisterButton(); - - RemoveBackground(); - animator.Play("Close", 0, 0); - - GameManager.Instance.ContinueGame(); - ActionKit.Delay(ConstRef.PanelDelayDuration, () => - { - gameObject.SetActive(false); - // 继续游戏 - }).Start(this); - } - - #endregion - - private void AddBackground() - { - background.canvasRenderer.SetAlpha(0.0f); - background.gameObject.SetActive(true); - background.CrossFadeAlpha(1.0f, 0.4f, true); - } - - private void RemoveBackground() - { - background.CrossFadeAlpha(0.0f, 0.2f, false); - } - - private void RegisterButton() - { - continueBtn.onClick.AddListener(BackToGame); - backToMainBtn.onClick.AddListener(BackToMain); - quitBtn.onClick.AddListener(Quit); - - wishlistBtn.onClick.AddListener(OpenWishlist); - bugBtn.onClick.AddListener(OpenBugReport); - } - - private void UnRegisterButton() - { - continueBtn.onClick.RemoveAllListeners(); - backToMainBtn.onClick.RemoveAllListeners(); - quitBtn.onClick.RemoveAllListeners(); - - wishlistBtn.onClick.RemoveAllListeners(); - bugBtn.onClick.RemoveAllListeners(); - } - - private void BackToGame() - { - // 关闭Setting面板 - UIManager.Instance.HidePanel(); - } - - private void BackToMain() - { - // 关闭Setting面板 - UIManager.Instance.HidePanel(); - // 重启 - GameManager.Instance.QuitGame(); - } - - private void Quit() - { - Application.Quit(); - } - - private void OpenWishlist() - { - Application.OpenURL(ConstRef.WishlistURL); - } - - private void OpenBugReport() - { - Application.OpenURL(ConstRef.BugSurveyURL); - } - } -} diff --git a/Assets/Scripts/UI/Panel/SettingPanel.cs.meta b/Assets/Scripts/UI/Panel/SettingPanel.cs.meta deleted file mode 100644 index 674cf6204..000000000 --- a/Assets/Scripts/UI/Panel/SettingPanel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ff78a14b28070864692582ecc5db824c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UI/Panel/StartPanel.cs b/Assets/Scripts/UI/Panel/StartPanel.cs deleted file mode 100644 index 2dea2ea57..000000000 --- a/Assets/Scripts/UI/Panel/StartPanel.cs +++ /dev/null @@ -1,90 +0,0 @@ -using AibisDream.Utility; -using UnityEngine; -using UnityEngine.UI; - -namespace AibisDream.UI -{ - public class StartPanel : MonoBehaviour, IUIPanel - { - public bool IsOpen => gameObject.activeSelf; - public bool IsCloseable => false; - - #region 开启和关闭 - - public void Show() - { - gameObject.SetActive(true); - } - - public void Hide() - { - gameObject.SetActive(false); - } - - #endregion - - private void Awake() - { - RegisterButton(); - } - - private void RegisterButton() - { - // 开始界面按钮 - var tabs = transform.Find("Tabs"); - tabs.Find("Start").GetComponent