完成按键输入按键显示

This commit is contained in:
2026-02-01 23:46:11 +08:00
parent e05561ff43
commit ebef45c4a3
95 changed files with 426 additions and 341 deletions

View File

@@ -79,13 +79,14 @@ namespace NBF
{
public string Name;
public string Key;
public bool ShowLeft;
public UIInputButtonShowMode Mode;
public InputInvokeAttribute(string name, string key = "", bool showLeft = true)
public InputInvokeAttribute(string name, UIInputButtonShowMode mode = UIInputButtonShowMode.None,
string key = "")
{
Name = name;
Key = key;
ShowLeft = showLeft;
Mode = mode;
}
}
}

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using FairyGUI;
using NBC;
// using Rewired;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
namespace NBF
{
@@ -14,10 +17,22 @@ namespace NBF
GamePad = 1
}
public struct UIInputInvoke
public enum UIInputButtonShowMode
{
None,
MenuLeft,
MenuRight,
SubMenuLeft,
SubMenuRight,
BottomLeft,
BottomRight,
}
public class UIInputInvoke
{
public object UIObject;
public InputInvokeAttribute InputInvoke;
public MethodInfo MethodInfo;
}
public class InputManager : MonoService<InputManager>
@@ -25,6 +40,7 @@ namespace NBF
public static bool IsOp1;
public static bool IsOp2;
public static event Action<bool> OnOp1Action;
public static event Action<bool> OnOp2Action;
@@ -63,6 +79,9 @@ namespace NBF
/// </summary>
public static event Action<InteractiveObject> OnInteractiveObjectAction;
public static event Action OnUIInvokeChange;
public static PlayerInputControl PlayerInputControl { get; private set; }
/// <summary>
@@ -77,6 +96,9 @@ namespace NBF
public static ControllerType ControllerType = ControllerType.KeyboardMouse;
private InputActionMap _uiInputActionMap;
protected override void OnAwake()
{
InputCursorExtension.InputInit();
@@ -140,6 +162,8 @@ namespace NBF
actionMap.Enable();
if (actionMap.name == "UI")
{
_uiInputActionMap = actionMap;
CacheInputActionIcons(actionMap.actions);
foreach (var action in actionMap.actions)
{
if (action.type == InputActionType.Button)
@@ -147,6 +171,8 @@ namespace NBF
action.performed += OnUIButtonPerformed;
action.canceled += OnUIButtonCanceled;
}
//var fileName = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
}
}
else if (actionMap.name == "Player")
@@ -184,6 +210,7 @@ namespace NBF
private void OnUIButtonCanceled(InputAction.CallbackContext context)
{
OnUICanceled?.Invoke(context.action.name);
InvokeUIInput(context.action.name);
}
private void OnPlayerButtonPerformed(InputAction.CallbackContext context)
@@ -243,6 +270,7 @@ namespace NBF
{
OnUIPerformed?.Invoke(actionName);
OnUICanceled?.Invoke(actionName);
InvokeUIInput(actionName);
}
#region UI界面按键管理
@@ -250,12 +278,107 @@ namespace NBF
private readonly Dictionary<object, List<UIInputInvoke>> _panelActions =
new Dictionary<object, List<UIInputInvoke>>();
private Dictionary<string, string> _keyboardIcons = new Dictionary<string, string>();
public void On(object obj)
{
var ms = Reflection.GetMethodsAttribute<InputInvokeAttribute>(obj.GetType());
List<UIInputInvoke> inputInvokes = new List<UIInputInvoke>();
foreach (var kv in ms)
{
var invokeData = new UIInputInvoke()
{
MethodInfo = kv.Key,
UIObject = obj,
InputInvoke = kv.Value
};
inputInvokes.Add(invokeData);
}
if (inputInvokes.Count > 0)
{
_panelActions[obj] = inputInvokes;
}
OnUIInvokeChange?.Invoke();
}
public void Off(object obj)
{
_panelActions.Remove(obj, out List<UIInputInvoke> inputInvokes);
OnUIInvokeChange?.Invoke();
}
public void InvokeUIInput(string actionName)
{
foreach (var obj in _panelActions.Keys)
{
var invokes = _panelActions[obj];
foreach (var uiInputInvoke in invokes)
{
if (uiInputInvoke.InputInvoke.Name != actionName) continue;
if (uiInputInvoke.UIObject is IUIPanel panel)
{
if (!panel.IsShowing) continue;
if (!panel.IsTop) continue;
}
else if (uiInputInvoke.UIObject is GObject gObject)
{
if (!gObject.visible) continue;
}
uiInputInvoke.MethodInfo.Invoke(uiInputInvoke.UIObject, null);
}
}
}
public List<UIInputInvoke> GetUsableInvokes()
{
List<UIInputInvoke> ret = new List<UIInputInvoke>();
foreach (var keyValuePair in _panelActions.Values)
{
foreach (var uiInputInvoke in keyValuePair)
{
if (uiInputInvoke.UIObject is IUIPanel { IsTop: true })
{
ret.Add(uiInputInvoke);
}
}
}
return ret;
}
public string GetUIKeyCode(string actionName)
{
if (_keyboardIcons.TryGetValue(actionName, out var keyboardIcon))
{
return keyboardIcon;
}
return string.Empty;
}
private void CacheInputActionIcons(ReadOnlyArray<InputAction> actions)
{
_keyboardIcons.Clear();
foreach (var inputAction in actions)
{
foreach (var binding in inputAction.bindings)
{
var path = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
if (path.Contains("Keyboard") || path.Contains("keyboard"))
{
path = path.Replace("Keyboard", "keyboard");
_keyboardIcons.TryAdd(inputAction.name, path);
Log.Info($"ActionIcons {inputAction.name}={path}");
}
}
}
}
#endregion

View File

@@ -16,7 +16,7 @@ namespace NBF.Setting
public override string Group => SettingsDef.Group.Graphic;
protected override int DefaultValue => _defaultResolution;
public override string Tab => SettingsDef.Tab.Graphic;
public override bool IsDropdown => true;
// public override bool IsDropdown => true;
static readonly (int w, int h)[] Classic16_9 =

View File

@@ -1,33 +0,0 @@
using System;
using FairyGUI;
using NBC;
using UIPanel = NBC.UIPanel;
namespace NBF
{
[AttributeUsage(AttributeTargets.Method)]
public class UIInputListenAttribute : BaseAttribute
{
}
public static class UIInputExtensions
{
public static void AutoListenInput(this GComponent panel)
{
var ms = Reflection.GetMethodsWithUIInputAttribute(panel.GetType(), typeof(UIInputListenAttribute));
foreach (var method in ms)
{
Log.Error(method.Name);
}
}
public static void AutoListenInput(this UIPanel panel)
{
var ms = Reflection.GetMethodsWithUIInputAttribute(panel.GetType(), typeof(UIInputListenAttribute));
foreach (var method in ms)
{
Log.Error(method.Name);
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e9bfb9f042814fb787428551c801aada
timeCreated: 1748944711

View File

@@ -54,7 +54,8 @@ namespace NBF
}
// 获取所有方法,包括公共、非公共、实例和静态方法
MethodInfo[] allMethods = classType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic);
MethodInfo[] allMethods =
classType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo method in allMethods)
{
@@ -66,5 +67,35 @@ namespace NBF
return methodsWithAttribute;
}
/// <summary>
/// 获取所有标记指定特性的方法
/// </summary>
/// <param name="classType">查找类</param>
/// <returns></returns>
public static Dictionary<MethodInfo, T> GetMethodsAttribute<T>(Type classType) where T : Attribute
{
Dictionary<MethodInfo, T> methodsWithAttribute = new Dictionary<MethodInfo, T>();
if (classType == null)
{
return methodsWithAttribute;
}
// 获取所有方法,包括公共、非公共、实例和静态方法
MethodInfo[] allMethods =
classType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo method in allMethods)
{
var attribute = method.GetCustomAttribute<T>();
if (attribute != null)
{
methodsWithAttribute[method] = attribute;
}
}
return methodsWithAttribute;
}
}
}

View File

@@ -1116,6 +1116,15 @@ namespace NBF
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Test"",
""type"": ""Button"",
""id"": ""23651163-b9ce-4bed-9636-1b816c87524f"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -1339,17 +1348,6 @@ namespace NBF
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ec9eb0c2-a2e0-47eb-ac8b-52cb0ef46101"",
""path"": ""<Keyboard>/rightArrow"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Right"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""031b930d-59b6-4a26-9dfe-97764c3e8b37"",
@@ -1372,17 +1370,6 @@ namespace NBF
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""680b36f2-5797-4257-83a7-3a498891d856"",
""path"": ""<Keyboard>/leftArrow"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Left"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""45f78626-cbf2-4e1f-904d-d82e4c2a2f41"",
@@ -1405,17 +1392,6 @@ namespace NBF
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""40501ac1-9d3e-4059-8e8f-ff7035f6e32e"",
""path"": ""<Keyboard>/downArrow"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Down"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f1a47b3c-e79f-4ab3-86b6-fcc0a6470114"",
@@ -1438,17 +1414,6 @@ namespace NBF
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9996c4e1-f7fb-4793-ab51-da569bdbab09"",
""path"": ""<Keyboard>/upArrow"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Up"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""3069f356-c73e-4bac-88f5-88bd6d746bc2"",
@@ -1459,6 +1424,17 @@ namespace NBF
""action"": ""Reset"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""52d8aeb1-8b70-4dfd-b645-496d47098926"",
""path"": ""<Keyboard>/f1"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Test"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -1578,6 +1554,7 @@ namespace NBF
m_UI_Down = m_UI.FindAction("Down", throwIfNotFound: true);
m_UI_Up = m_UI.FindAction("Up", throwIfNotFound: true);
m_UI_Reset = m_UI.FindAction("Reset", throwIfNotFound: true);
m_UI_Test = m_UI.FindAction("Test", throwIfNotFound: true);
}
~@PlayerInputControl()
@@ -2152,6 +2129,7 @@ namespace NBF
private readonly InputAction m_UI_Down;
private readonly InputAction m_UI_Up;
private readonly InputAction m_UI_Reset;
private readonly InputAction m_UI_Test;
/// <summary>
/// Provides access to input actions defined in input action map "UI".
/// </summary>
@@ -2212,6 +2190,10 @@ namespace NBF
/// </summary>
public InputAction @Reset => m_Wrapper.m_UI_Reset;
/// <summary>
/// Provides access to the underlying input action "UI/Test".
/// </summary>
public InputAction @Test => m_Wrapper.m_UI_Test;
/// <summary>
/// Provides access to the underlying input action map instance.
/// </summary>
public InputActionMap Get() { return m_Wrapper.m_UI; }
@@ -2273,6 +2255,9 @@ namespace NBF
@Reset.started += instance.OnReset;
@Reset.performed += instance.OnReset;
@Reset.canceled += instance.OnReset;
@Test.started += instance.OnTest;
@Test.performed += instance.OnTest;
@Test.canceled += instance.OnTest;
}
/// <summary>
@@ -2320,6 +2305,9 @@ namespace NBF
@Reset.started -= instance.OnReset;
@Reset.performed -= instance.OnReset;
@Reset.canceled -= instance.OnReset;
@Test.started -= instance.OnTest;
@Test.performed -= instance.OnTest;
@Test.canceled -= instance.OnTest;
}
/// <summary>
@@ -2769,6 +2757,13 @@ namespace NBF
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnReset(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Test" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnTest(InputAction.CallbackContext context);
}
}
}

View File

@@ -13,16 +13,13 @@ namespace NBF
{
base.OnInit();
}
protected override void OnShow()
{
ItemList.List.OnClickItem += OnClickItem;
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
List<TabItemData> tabItemList = new List<TabItemData>();
var dic = RoleModel.Instance.GetItemsByType();
foreach (var (type, list) in dic)
{
@@ -36,25 +33,8 @@ namespace NBF
ItemList.SetPanel(this);
ItemList.SetData(tabItemList, true, true);
}
private void OnUICanceled(string action)
{
if (!IsTop) return;
if (action == InputDef.UI.SubPrev)
{
}
else if (action == InputDef.UI.SubNext)
{
}
else if (action == InputDef.UI.Up)
{
}
else if (action == InputDef.UI.Down)
{
}
}
private void OnClickItem(object item)
{
@@ -63,14 +43,8 @@ namespace NBF
ItemDetailsPanel.Show(bagItem.ItemInfo);
}
private void UseBottomMenu()
{
BottomMenu.Use(this);
}
protected override void OnHide()
{
InputManager.OnUICanceled -= OnUICanceled;
ItemList.List.OnClickItem -= OnClickItem;
}

View File

@@ -6,7 +6,7 @@ using NBC;
namespace NBF
{
public partial class BtnInputControl : GButton
public partial class BtnInputControl : BtnInputControlBase
{
private void OnInited()
{

View File

@@ -0,0 +1,28 @@
using FairyGUI;
using NBC;
namespace NBF
{
public abstract class BtnInputControlBase : GButton
{
public string ActionName;
public string ShowName;
public virtual void SetData(string actionName, string showName)
{
this.ActionName = actionName;
this.ShowName = showName;
if (!string.IsNullOrEmpty(showName))
{
title = Lan.Get(showName);
}
else
{
title = Lan.Get(actionName);
}
var iconName = InputManager.Instance.GetUIKeyCode(ActionName);
icon = UIPackage.GetItemURL(UIDef.Pack.Common, iconName);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4da865139cbb401a91f63bcf30d233c4
timeCreated: 1769960386

View File

@@ -7,19 +7,10 @@ using NBC;
namespace NBF
{
public partial class BtnTitleInputControl : GButton
public partial class BtnTitleInputControl : BtnInputControlBase
{
public string ActionName;
public string ShowName;
private void OnInited()
{
}
public void SetData(string actionName, string showName)
{
this.ActionName = actionName;
this.ShowName = showName;
}
}
}

View File

@@ -18,7 +18,6 @@ namespace NBF
public void SetPanel(UIPanel panel)
{
Menu.SetPanel(panel);
SubMenu.SetPanel(panel);
}
private void OnInited()

View File

@@ -15,6 +15,14 @@ namespace NBF
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
LeftList.onClickItem.Add(OnClickItem);
InputManager.OnUIInvokeChange += OnUIInvokeChange;
}
public override void Dispose()
{
InputManager.OnUIInvokeChange -= OnUIInvokeChange;
base.Dispose();
}
private void OnClickItem(EventContext context)
@@ -25,29 +33,26 @@ namespace NBF
Debug.Log("模拟点击===");
}
public void Use(UIPanel panel)
private void OnUIInvokeChange()
{
_panel = panel;
List.RemoveChildrenToPool();
LeftList.RemoveChildrenToPool();
// AddButtonItem(OnUse, "");
// AddButtonItem(OnTab, InputDef.UI.Tab);
// AddButtonItem(OnEnter, InputDef.UI.Enter);
// AddButtonItem(OnBack, InputDef.UI.Back);
var invokes = InputManager.Instance.GetUsableInvokes();
foreach (var uiInputInvoke in invokes)
{
var invokeData = uiInputInvoke.InputInvoke;
if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomLeft)
{
AddButton(invokeData.Name, invokeData.Key, false);
}
else if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomRight)
{
AddButton(invokeData.Name, invokeData.Key);
}
}
}
public void AddRightButton(string inputName, string showName = "")
{
AddButton(inputName, string.Empty, true);
}
public void AddLeftButton(string inputName, string showName = "")
{
AddButton(inputName, string.Empty, false);
}
public void AddButton(string inputName, string showName = "", bool isRight = true)
{
if (isRight)

View File

@@ -79,7 +79,7 @@ namespace NBF
OnTabChange?.Invoke(List.selectedIndex);
}
private void OnClickBtnPrev()
public void OnClickBtnPrev()
{
if (List.selectedIndex > 0)
{
@@ -93,7 +93,7 @@ namespace NBF
OnClickItem();
}
private void OnClickBtnNext()
public void OnClickBtnNext()
{
if (List.selectedIndex < List.numItems - 1)
{

View File

@@ -12,12 +12,9 @@ namespace NBF
public partial class CommonSubMenu : GComponent
{
public event Action<int> OnTabChange;
private UIPanel _panel;
public void SetPanel(UIPanel panel)
{
_panel = panel;
}
private string _leftActionName;
private string _rightActionName;
private void OnInited()
{
@@ -25,31 +22,22 @@ namespace NBF
BtnPrev.onClick.Add(OnClickBtnPrev);
BtnNext.onClick.Add(OnClickBtnNext);
InputManager.OnUICanceled += OnUICanceled;
// CommonSubMenu
}
public void SetBtnActionName(string leftActionName, string rightActionName)
{
_leftActionName = leftActionName;
_rightActionName = rightActionName;
BtnPrev.SetData(leftActionName, string.Empty);
BtnNext.SetData(rightActionName, string.Empty);
}
public override void Dispose()
{
InputManager.OnUICanceled -= OnUICanceled;
base.Dispose();
}
private void OnUICanceled(string action)
{
if (_panel == null) return;
if (!_panel.IsShowing) return;
if (!_panel.IsTop) return;
if (action == InputDef.UI.SubPrev)
{
OnClickBtnPrev();
}
else if (action == InputDef.UI.SubNext)
{
OnClickBtnNext();
}
}
public void SetTabs(List<TabItemData> subItems, int selectIndex = 0)
{
List.RemoveChildrenToPool();
@@ -79,7 +67,7 @@ namespace NBF
OnTabChange?.Invoke(List.selectedIndex);
}
private void OnClickBtnPrev()
public void OnClickBtnPrev()
{
if (List.selectedIndex > 0)
{
@@ -93,7 +81,7 @@ namespace NBF
OnClickItem();
}
private void OnClickBtnNext()
public void OnClickBtnNext()
{
if (List.selectedIndex < List.numItems - 1)
{

View File

@@ -15,7 +15,6 @@ namespace NBF
protected override void OnShow()
{
InputManager.OnUICanceled += OnUICanceled;
}
protected override void OnUpdate()
@@ -39,7 +38,6 @@ namespace NBF
{
UI.Inst.HideUI(ui.GetType());
break;
// ui.Hide();
}
}
}
@@ -47,7 +45,6 @@ namespace NBF
protected override void OnHide()
{
InputManager.OnUICanceled -= OnUICanceled;
}
protected override void OnDestroy()

View File

@@ -24,13 +24,11 @@ namespace NBF
// buttons.Add(BtnTest);
navigate = new ButtonNavigate(buttons);
this.AutoListenInput();
}
protected override void OnShow()
{
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
// Model.LoadAsset(0);
// Model.SetBackground(Panel.Back.GetChild("back"));//, Panel.Back.GetChild("icon")
@@ -72,13 +70,5 @@ namespace NBF
navigate.Click();
}
}
private void UseBottomMenu()
{
BottomMenu.Use(Panel);
BottomMenu.AddRightButton(InputDef.UI.Enter);
BottomMenu.AddRightButton(InputDef.UI.Back);
}
}
}

View File

@@ -22,7 +22,6 @@ namespace NBF
public void SetData(OptionBase option)
{
Option = option;
if (option is IMultiOption multiOption)
{
if (multiOption.IsDropdown)

View File

@@ -42,10 +42,10 @@ namespace NBF
protected override void OnShow()
{
InputManager.Instance.Off(this);
InputManager.Instance.On(this);
SetActionIcon();
Settings.Instance.LoadAllSettings();
MenuList.SetTabs(tabList);
UseBottomMenu();
}
private void ChangeTab(int index)
@@ -109,11 +109,6 @@ namespace NBF
}
}
private void UseBottomMenu()
{
BottomMenu.Use(this);
}
private void OnResetSettings()
{
@@ -173,6 +168,15 @@ namespace NBF
Introduce.TextIntroduce.SetLanguage(item.Option.Name);
// Introduce.
}
for (var i = 0; i < _canSelectIndex.Count; i++)
{
var targetIndex = _canSelectIndex[i];
if (targetIndex == index)
{
_nowSelectIndex = i;
}
}
}
@@ -194,8 +198,26 @@ namespace NBF
#region Input Evnet
[InputInvoke(InputDef.UI.SubPrev)]
private void OnSubPrev()
private void SetActionIcon()
{
MenuList.SetBtnActionName(InputDef.UI.Prev, InputDef.UI.Next);
}
[InputInvoke(InputDef.UI.Prev, UIInputButtonShowMode.MenuLeft)]
private void OnPrev()
{
MenuList.OnClickBtnPrev();
}
[InputInvoke(InputDef.UI.Next, UIInputButtonShowMode.MenuRight)]
private void OnNext()
{
MenuList.OnClickBtnNext();
}
[InputInvoke(InputDef.UI.Left, UIInputButtonShowMode.BottomLeft)]
private void OnLeft()
{
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
{
@@ -203,8 +225,8 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.SubNext)]
private void OnSubNext()
[InputInvoke(InputDef.UI.Right, UIInputButtonShowMode.BottomLeft)]
private void OnRight()
{
if (List.GetChildAt(List.selectedIndex) is SettingItem item)
{
@@ -212,19 +234,42 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.Up)]
[InputInvoke(InputDef.UI.Up, UIInputButtonShowMode.BottomLeft)]
private void OnUp()
{
ChangeListSelected();
}
[InputInvoke(InputDef.UI.Down)]
[InputInvoke(InputDef.UI.Down, UIInputButtonShowMode.BottomLeft)]
private void OnDown()
{
ChangeListSelected(false);
}
[InputInvoke(InputDef.UI.Back)]
[InputInvoke(InputDef.UI.Enter, UIInputButtonShowMode.BottomRight, "保存")]
private void OnApplySettings()
{
var options = Settings.Instance.GetOptionsByTab(_currentTab);
Log.Info("OnApplySettings");
foreach (var option in options)
{
option.Apply();
}
Notices.Success("TEXT_OP_SUCCESS");
}
[InputInvoke(InputDef.UI.Reset, UIInputButtonShowMode.BottomRight, "重置")]
private void OnReset()
{
MessageBox.Show("是否重置为默认?", (ret) =>
{
if (ret) OnResetSettings();
});
}
[InputInvoke(InputDef.UI.Back, UIInputButtonShowMode.BottomRight, "返回")]
private void OnBack()
{
if (Settings.Instance.HaveNotAppleSettings())
@@ -244,28 +289,6 @@ namespace NBF
}
}
[InputInvoke(InputDef.UI.Enter)]
private void OnApplySettings()
{
var options = Settings.Instance.GetOptionsByTab(_currentTab);
Log.Info("OnApplySettings");
foreach (var option in options)
{
option.Apply();
}
Notices.Success("TEXT_OP_SUCCESS");
}
[InputInvoke(InputDef.UI.Reset)]
private void OnReset()
{
MessageBox.Show("是否重置为默认?", (ret) =>
{
if (ret) OnResetSettings();
});
}
#endregion
protected override void OnHide()

View File

@@ -21,7 +21,6 @@ namespace NBF
{
ItemList.List.OnClickItem += OnClickItem;
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
List<TabItemData> tabItemList = GoodsConfigHelper.TabItemList;
@@ -53,12 +52,7 @@ namespace NBF
// ItemDetailsPanel.Show(bagItem.ItemInfo);
ShopDetailsPanel.Show(gearItem.Config);
}
private void UseBottomMenu()
{
BottomMenu.Use(this);
}
protected override void OnHide()
{
InputManager.OnUICanceled -= OnUICanceled;