Files
ichni_Official/Assets/Scripts/UI/Settings/SettingsUIPage.cs

43 lines
1.4 KiB
C#
Raw Normal View History

2025-08-11 14:04:06 -04:00
using Ichni.UI;
using UnityEngine.UI;
2025-06-03 02:42:28 -04:00
2025-08-11 14:04:06 -04:00
namespace Ichni.Menu
2025-06-03 02:42:28 -04:00
{
2025-06-06 10:14:55 -04:00
public class SettingsUIPage : UIPageBase
2025-06-03 02:42:28 -04:00
{
2026-07-19 16:44:58 -04:00
SettingsSaveData gameSettings => SettingsManager.instance.settingsSaveData;
2025-06-03 02:42:28 -04:00
2025-08-11 14:04:06 -04:00
public Button backButton;
public SettingsWindowController settingsWindowController;
public OffsetEditor offsetEditor;
2026-07-21 15:24:42 -04:00
// 设置页不再假定只能从章节选择页进入。该引用只保存本次打开设置时的来源,
// 不需要写入存档;关闭设置页后即清空。
private UIPageBase _returnPage;
2025-08-11 14:04:06 -04:00
protected override void Awake()
{
base.Awake();
backButton.onClick.AddListener(() =>
{
FadeOut();
SettingsManager.instance.SaveGameSettings();
2026-07-21 15:24:42 -04:00
(_returnPage ?? MenuManager.instance.chapterSelectionUIPage)?.FadeIn();
_returnPage = null;
2025-08-11 14:04:06 -04:00
});
}
2026-07-21 15:24:42 -04:00
/// <summary>
/// 由独立的 <see cref="SettingsButton"/> 调用,记录打开设置页的来源并切换页面。
/// 这样章节选择页、剧情页及未来其它页面都可复用同一个设置按钮逻辑。
/// </summary>
public void OpenFrom(UIPageBase sourcePage)
{
_returnPage = sourcePage;
sourcePage?.FadeOut();
FadeIn();
}
2025-06-03 02:42:28 -04:00
}
2026-07-19 16:44:58 -04:00
}