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