setting change
This commit is contained in:
43
Assets/Scripts/Common/Common/Services/Input/InputIconData.cs
Normal file
43
Assets/Scripts/Common/Common/Services/Input/InputIconData.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using NBC;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InputIconData
|
||||
{
|
||||
public string MapName;
|
||||
public Dictionary<string, string> KeyboardIcons = new Dictionary<string, string>();
|
||||
|
||||
public string GetIcon(string actionName)
|
||||
{
|
||||
if (KeyboardIcons.TryGetValue(actionName, out var keyboardIcon))
|
||||
{
|
||||
return keyboardIcon;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public 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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6eb3efcd3474440ea2c7d6549db02c4c
|
||||
timeCreated: 1770015242
|
||||
@@ -41,6 +41,9 @@ namespace NBF
|
||||
public static bool IsOp2;
|
||||
|
||||
|
||||
public const string InputMapUI = "UI";
|
||||
public const string InputMapPlayer = "Player";
|
||||
|
||||
public static event Action<bool> OnOp1Action;
|
||||
public static event Action<bool> OnOp2Action;
|
||||
|
||||
@@ -157,13 +160,13 @@ namespace NBF
|
||||
|
||||
private void AddEvent()
|
||||
{
|
||||
CacheInputActionIcons(PlayerInputControl.asset.actionMaps);
|
||||
foreach (var actionMap in PlayerInputControl.asset.actionMaps)
|
||||
{
|
||||
actionMap.Enable();
|
||||
if (actionMap.name == "UI")
|
||||
if (actionMap.name == InputMapUI)
|
||||
{
|
||||
_uiInputActionMap = actionMap;
|
||||
CacheInputActionIcons(actionMap.actions);
|
||||
foreach (var action in actionMap.actions)
|
||||
{
|
||||
if (action.type == InputActionType.Button)
|
||||
@@ -175,7 +178,7 @@ namespace NBF
|
||||
//var fileName = binding.effectivePath.Replace("<", "").Replace(">", "").Replace("/", "_");
|
||||
}
|
||||
}
|
||||
else if (actionMap.name == "Player")
|
||||
else if (actionMap.name == InputMapPlayer)
|
||||
{
|
||||
foreach (var action in actionMap.actions)
|
||||
{
|
||||
@@ -278,7 +281,9 @@ namespace NBF
|
||||
private readonly Dictionary<object, List<UIInputInvoke>> _panelActions =
|
||||
new Dictionary<object, List<UIInputInvoke>>();
|
||||
|
||||
private Dictionary<string, string> _keyboardIcons = new Dictionary<string, string>();
|
||||
// private Dictionary<string, string> _keyboardIcons = new Dictionary<string, string>();
|
||||
|
||||
private Dictionary<string, InputIconData> InputIconData = new Dictionary<string, InputIconData>();
|
||||
|
||||
public void On(object obj)
|
||||
{
|
||||
@@ -350,34 +355,26 @@ namespace NBF
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public string GetUIKeyCode(string actionName)
|
||||
public string GetInputIcon(string map, string actionName)
|
||||
{
|
||||
if (_keyboardIcons.TryGetValue(actionName, out var keyboardIcon))
|
||||
if (InputIconData.TryGetValue(map, out var data))
|
||||
{
|
||||
return keyboardIcon;
|
||||
return data.GetIcon(actionName);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
private void CacheInputActionIcons(ReadOnlyArray<InputAction> actions)
|
||||
private void CacheInputActionIcons(ReadOnlyArray<InputActionMap> actionMaps)
|
||||
{
|
||||
_keyboardIcons.Clear();
|
||||
foreach (var inputAction in actions)
|
||||
foreach (var actionMap in actionMaps)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
var data = new InputIconData();
|
||||
data.CacheInputActionIcons(actionMap.actions);
|
||||
InputIconData[actionMap.name] = data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputInfoSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputInfo";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Info;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8d104a89f6949538773fd9600f9e5ea
|
||||
timeCreated: 1770014466
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputKeepnetSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputKeepnet";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Keepnet;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c725fd5631a48b4832ea6b7ff4b6c02
|
||||
timeCreated: 1770014596
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputMakeSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputMake";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Make;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80f08e4bc7bd46928cdee1bcfc91d818
|
||||
timeCreated: 1770014640
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputMapSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputMap";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Map;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5002a562cc44982993e36995f5e13a4
|
||||
timeCreated: 1770014702
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputOpenBagSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputOpenBag";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.OpenBag;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80ac633ee5a5464f9f2baf871c03f25b
|
||||
timeCreated: 1770014552
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputOpenQuickSetting: KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputMap";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Map;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f07900d8fce94aa8bcc7a2baf2f19b5a
|
||||
timeCreated: 1770014735
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputSelectBaitSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputSelectBait";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectBait;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 299babdb703341829075f9ff4b762c7b
|
||||
timeCreated: 1770014278
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputSelectFoodSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputSelectFood";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectFood;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75643d3acb5146839b78b714cf014ee1
|
||||
timeCreated: 1770014339
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputSelectItemSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputSelectItem";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.SelectItem;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acc89667bf654d73b827e4f61d206056
|
||||
timeCreated: 1770014227
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputSkillSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputSkill";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.Skill;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 203702381cd040fabe806fa585e02ee7
|
||||
timeCreated: 1770014495
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF.Setting
|
||||
{
|
||||
public class InputUseBrailSetting : KeyBoardOption
|
||||
{
|
||||
public override string Name => "InputUseBrail";
|
||||
public override string Group => SettingsDef.Group.Keyboard;
|
||||
public override string Tab => SettingsDef.Tab.Keyboard;
|
||||
|
||||
public override InputAction InputAction => InputManager.PlayerInputControl.Player.UseBrail;
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd4bb63bb664dfaa9422503493e9767
|
||||
timeCreated: 1770014382
|
||||
Reference in New Issue
Block a user