按键绑定和重置以及加载功能
This commit is contained in:
@@ -10,6 +10,7 @@ using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[UIBind(UIDef.ID.SettingPanel)]
|
||||
public partial class SettingPanel : UIPanel
|
||||
{
|
||||
public override string UIPackName => "Main";
|
||||
@@ -64,7 +65,7 @@ namespace NBF
|
||||
{
|
||||
// TextTitle.text = Lan.Get(_currentGroup);
|
||||
_nowSelectIndex = -1;
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(_currentTab)) return;
|
||||
var options = Settings.Instance.GetOptionsByTab(_currentTab);
|
||||
Dictionary<string, List<OptionBase>> groupOptions = new Dictionary<string, List<OptionBase>>();
|
||||
@@ -82,8 +83,8 @@ namespace NBF
|
||||
_canSelectIndex.Clear();
|
||||
|
||||
List.RemoveChildrenToPool();
|
||||
|
||||
|
||||
|
||||
|
||||
var url = UIPackage.GetItemURL(UIPackName, "SettingSubTitleItem");
|
||||
foreach (var key in groupOptions.Keys)
|
||||
{
|
||||
@@ -99,7 +100,7 @@ namespace NBF
|
||||
{
|
||||
if (List.AddItemFromPool(SettingInputItem.URL) is SettingInputItem item)
|
||||
{
|
||||
item.SetData(option);
|
||||
item.SetData(option as InputOption);
|
||||
var index = List.GetChildIndex(item);
|
||||
_canSelectIndex.Add(index);
|
||||
}
|
||||
@@ -125,7 +126,7 @@ namespace NBF
|
||||
private void OnApplySettings()
|
||||
{
|
||||
var options = Settings.Instance.GetOptionsByTab(_currentTab);
|
||||
|
||||
Log.Info("OnApplySettings");
|
||||
foreach (var option in options)
|
||||
{
|
||||
option.Apply();
|
||||
@@ -140,6 +141,8 @@ namespace NBF
|
||||
{
|
||||
option.Reset();
|
||||
}
|
||||
|
||||
ResetSettingList();
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
@@ -174,6 +177,13 @@ namespace NBF
|
||||
{
|
||||
OnApplySettings();
|
||||
}
|
||||
else if (action == InputDef.UI.Reset)
|
||||
{
|
||||
MessageBox.Show("是否重置为默认?", (ret) =>
|
||||
{
|
||||
if (ret) OnResetSettings();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user