diff --git a/Assets/Scripts/Common/Services/Settings/Base/InputOption.cs b/Assets/Scripts/Common/Services/Settings/Base/InputOption.cs index bc4829e87..2956f5bd8 100644 --- a/Assets/Scripts/Common/Services/Settings/Base/InputOption.cs +++ b/Assets/Scripts/Common/Services/Settings/Base/InputOption.cs @@ -25,8 +25,8 @@ namespace NBF.Setting public override void Apply() { // 保存绑定 - PlayerPrefs.SetString(SaveKey, InputAction.SaveBindingOverridesAsJson()); - SaveValue = Value; + InputSaveValue = InputAction.SaveBindingOverridesAsJson(); + PlayerPrefs.SetString(SaveKey, InputSaveValue); OnApply(); } @@ -66,6 +66,18 @@ namespace NBF.Setting } } + public override void Cancel() + { + if (!string.IsNullOrEmpty(InputSaveValue)) + { + InputAction.LoadBindingOverridesFromJson(InputSaveValue); + } + else + { + Reset(); + } + } + public override string GetDisplayString() { if (InputAction != null) diff --git a/Assets/Scripts/Common/Services/Settings/Base/OptionBase.cs b/Assets/Scripts/Common/Services/Settings/Base/OptionBase.cs index 612fc4f74..9be244d6b 100644 --- a/Assets/Scripts/Common/Services/Settings/Base/OptionBase.cs +++ b/Assets/Scripts/Common/Services/Settings/Base/OptionBase.cs @@ -83,6 +83,12 @@ namespace NBF.Setting Value = DefaultValue; } + public virtual void Cancel() + { + + } + + public virtual string GetDisplayString() { return GetValue().ToString(); diff --git a/Assets/Scripts/UI/Settings/SettingPanel.cs b/Assets/Scripts/UI/Settings/SettingPanel.cs index f3ffa540b..4aea1d956 100644 --- a/Assets/Scripts/UI/Settings/SettingPanel.cs +++ b/Assets/Scripts/UI/Settings/SettingPanel.cs @@ -131,6 +131,7 @@ namespace NBF { option.Apply(); } + Notices.Success("TEXT_OP_SUCCESS"); } private void OnResetSettings() @@ -240,6 +241,7 @@ namespace NBF { if (b) { + CancelAndBack(); Hide(); } }); @@ -250,6 +252,23 @@ namespace NBF } } + private void CancelAndBack() + { + + var groupNames = Settings.Instance.GetAllTabs(); + foreach (var group in groupNames) + { + var options = Settings.Instance.GetOptionsByTab(group); + foreach (var option in options) + { + if (option.HaveNotApple()) + { + option.Cancel(); + } + } + } + } + protected override void OnHide() { base.OnHide(); diff --git a/Config/language/Language.xlsx b/Config/language/Language.xlsx index 9051766c8..776c81703 100644 Binary files a/Config/language/Language.xlsx and b/Config/language/Language.xlsx differ