完成设置按键绑定和取消绑定
This commit is contained in:
@@ -25,8 +25,8 @@ namespace NBF.Setting
|
|||||||
public override void Apply()
|
public override void Apply()
|
||||||
{
|
{
|
||||||
// 保存绑定
|
// 保存绑定
|
||||||
PlayerPrefs.SetString(SaveKey, InputAction.SaveBindingOverridesAsJson());
|
InputSaveValue = InputAction.SaveBindingOverridesAsJson();
|
||||||
SaveValue = Value;
|
PlayerPrefs.SetString(SaveKey, InputSaveValue);
|
||||||
OnApply();
|
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()
|
public override string GetDisplayString()
|
||||||
{
|
{
|
||||||
if (InputAction != null)
|
if (InputAction != null)
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ namespace NBF.Setting
|
|||||||
Value = DefaultValue;
|
Value = DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void Cancel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual string GetDisplayString()
|
public virtual string GetDisplayString()
|
||||||
{
|
{
|
||||||
return GetValue().ToString();
|
return GetValue().ToString();
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ namespace NBF
|
|||||||
{
|
{
|
||||||
option.Apply();
|
option.Apply();
|
||||||
}
|
}
|
||||||
|
Notices.Success("TEXT_OP_SUCCESS");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnResetSettings()
|
private void OnResetSettings()
|
||||||
@@ -240,6 +241,7 @@ namespace NBF
|
|||||||
{
|
{
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
|
CancelAndBack();
|
||||||
Hide();
|
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()
|
protected override void OnHide()
|
||||||
{
|
{
|
||||||
base.OnHide();
|
base.OnHide();
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user