diff --git a/Assets/Obvious/Soap/Core/Editor/Resources/SoapSettings.asset b/Assets/Obvious/Soap/Core/Editor/Resources/SoapSettings.asset index 8bdba4dad..8cb4e1f09 100644 --- a/Assets/Obvious/Soap/Core/Editor/Resources/SoapSettings.asset +++ b/Assets/Obvious/Soap/Core/Editor/Resources/SoapSettings.asset @@ -11,7 +11,7 @@ MonoBehaviour: m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4b7ca52a950d1494aa1184cdc7700c3d, type: 3} m_Name: SoapSettings - m_EditorClassIdentifier: + m_EditorClassIdentifier: Obvious.Soap.Editor::Obvious.Soap.Editor.SoapSettings VariableDisplayMode: 0 NamingOnCreationMode: 0 CreatePathMode: 0 diff --git a/Assets/ResRaw/Fgui/Common/Common_fui.bytes b/Assets/ResRaw/Fgui/Common/Common_fui.bytes index bae87818f..75f644d85 100644 Binary files a/Assets/ResRaw/Fgui/Common/Common_fui.bytes and b/Assets/ResRaw/Fgui/Common/Common_fui.bytes differ diff --git a/Assets/ResRaw/Fgui/Main/Main_atlas0.png b/Assets/ResRaw/Fgui/Main/Main_atlas0.png index 9a2b6a96e..97d59d0ad 100644 Binary files a/Assets/ResRaw/Fgui/Main/Main_atlas0.png and b/Assets/ResRaw/Fgui/Main/Main_atlas0.png differ diff --git a/Assets/ResRaw/Fgui/Main/Main_fui.bytes b/Assets/ResRaw/Fgui/Main/Main_fui.bytes index 08b33aa81..79f9f3d0c 100644 Binary files a/Assets/ResRaw/Fgui/Main/Main_fui.bytes and b/Assets/ResRaw/Fgui/Main/Main_fui.bytes differ diff --git a/Assets/Scenes/StartUp.unity b/Assets/Scenes/StartUp.unity index 7663fb9b2..b6066d7d3 100644 --- a/Assets/Scenes/StartUp.unity +++ b/Assets/Scenes/StartUp.unity @@ -909,6 +909,85 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &869065583 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 869065584} + - component: {fileID: 869065586} + - component: {fileID: 869065585} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &869065584 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869065583} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1439106037} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -20.035} + m_SizeDelta: {x: 160, y: 70.0701} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &869065585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869065583} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Text + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 9ca2618301686b342867f34f731938f0, type: 3} + m_FontSize: 32 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u9009\u9879" +--- !u!222 &869065586 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869065583} + m_CullTransparentMesh: 1 --- !u!1 &884989002 GameObject: m_ObjectHideFlags: 0 @@ -1128,6 +1207,121 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1439106032 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1439106037} + - component: {fileID: 1439106036} + - component: {fileID: 1439106035} + - component: {fileID: 1439106034} + - component: {fileID: 1439106033} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1439106033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1439106032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b189222c6db8433db1239d314f92cf9f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::DontDestroy +--- !u!114 &1439106034 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1439106032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4513599 +--- !u!114 &1439106035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1439106032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1439106036 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1439106032} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1439106037 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1439106032} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 869065584} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} --- !u!1 &1729919008 GameObject: m_ObjectHideFlags: 0 @@ -1629,8 +1823,8 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.1 - far clip plane: 3000 + near clip plane: 0.01 + far clip plane: 5000 field of view: 60.000004 orthographic: 0 orthographic size: 5 @@ -1858,3 +2052,4 @@ SceneRoots: - {fileID: 1199298675} - {fileID: 646846706} - {fileID: 159075240} + - {fileID: 1439106037} diff --git a/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs b/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs new file mode 100644 index 000000000..81c63c129 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs @@ -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 KeyboardIcons = new Dictionary(); + + public string GetIcon(string actionName) + { + if (KeyboardIcons.TryGetValue(actionName, out var keyboardIcon)) + { + return keyboardIcon; + } + + return string.Empty; + } + + + public void CacheInputActionIcons(ReadOnlyArray 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}"); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs.meta b/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs.meta new file mode 100644 index 000000000..2bfb4dba7 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Input/InputIconData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6eb3efcd3474440ea2c7d6549db02c4c +timeCreated: 1770015242 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Input/InputManager.cs b/Assets/Scripts/Common/Common/Services/Input/InputManager.cs index cda262661..88eb4f1b1 100644 --- a/Assets/Scripts/Common/Common/Services/Input/InputManager.cs +++ b/Assets/Scripts/Common/Common/Services/Input/InputManager.cs @@ -41,6 +41,9 @@ namespace NBF public static bool IsOp2; + public const string InputMapUI = "UI"; + public const string InputMapPlayer = "Player"; + public static event Action OnOp1Action; public static event Action 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> _panelActions = new Dictionary>(); - private Dictionary _keyboardIcons = new Dictionary(); + // private Dictionary _keyboardIcons = new Dictionary(); + + private Dictionary InputIconData = new Dictionary(); 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 actions) + private void CacheInputActionIcons(ReadOnlyArray 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; } } diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs new file mode 100644 index 000000000..7835cbd4f --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs.meta new file mode 100644 index 000000000..917b28883 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputInfoSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a8d104a89f6949538773fd9600f9e5ea +timeCreated: 1770014466 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs new file mode 100644 index 000000000..621e9fa76 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs.meta new file mode 100644 index 000000000..7311b7284 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputKeepnetSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7c725fd5631a48b4832ea6b7ff4b6c02 +timeCreated: 1770014596 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs new file mode 100644 index 000000000..90a4dc4b0 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs.meta new file mode 100644 index 000000000..c1c39c131 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMakeSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 80f08e4bc7bd46928cdee1bcfc91d818 +timeCreated: 1770014640 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs new file mode 100644 index 000000000..9edbbdddf --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs.meta new file mode 100644 index 000000000..9d9ff645a --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputMapSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b5002a562cc44982993e36995f5e13a4 +timeCreated: 1770014702 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs new file mode 100644 index 000000000..eab75a218 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs.meta new file mode 100644 index 000000000..22425ff52 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenBagSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 80ac633ee5a5464f9f2baf871c03f25b +timeCreated: 1770014552 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs new file mode 100644 index 000000000..c7e4e8306 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs.meta new file mode 100644 index 000000000..dd9f239b1 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputOpenQuickSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f07900d8fce94aa8bcc7a2baf2f19b5a +timeCreated: 1770014735 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs new file mode 100644 index 000000000..cb497c8d2 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs.meta new file mode 100644 index 000000000..5f46708ec --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectBaitSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 299babdb703341829075f9ff4b762c7b +timeCreated: 1770014278 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs new file mode 100644 index 000000000..ca2ed6936 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs.meta new file mode 100644 index 000000000..214c926b3 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectFoodSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 75643d3acb5146839b78b714cf014ee1 +timeCreated: 1770014339 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs new file mode 100644 index 000000000..b64ec0892 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs.meta new file mode 100644 index 000000000..53d02748f --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSelectItemSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: acc89667bf654d73b827e4f61d206056 +timeCreated: 1770014227 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs new file mode 100644 index 000000000..3f11a0060 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs.meta new file mode 100644 index 000000000..4eba30a3a --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputSkillSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 203702381cd040fabe806fa585e02ee7 +timeCreated: 1770014495 \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs new file mode 100644 index 000000000..a8172e23a --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs @@ -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() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs.meta b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs.meta new file mode 100644 index 000000000..04bcae585 --- /dev/null +++ b/Assets/Scripts/Common/Common/Services/Settings/Options/Input/InputUseBrailSetting.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7cd4bb63bb664dfaa9422503493e9767 +timeCreated: 1770014382 \ No newline at end of file diff --git a/Assets/Scripts/NBC/Asset/Runtime/Assets.cs b/Assets/Scripts/NBC/Asset/Runtime/Assets.cs index 6b3614aac..1c2ddc13d 100644 --- a/Assets/Scripts/NBC/Asset/Runtime/Assets.cs +++ b/Assets/Scripts/NBC/Asset/Runtime/Assets.cs @@ -61,6 +61,7 @@ namespace NBC.Asset { return assetProvider.Asset as T; } + return null; } @@ -385,6 +386,9 @@ namespace NBC.Asset _monoGameObject = new GameObject("Assets", typeof(Mono)); Mono.AddUpdate(Update); InitializationTask task; +#if UNITY_STANDALONE_WIN + Const.NotCache = true; +#endif if (Const.Simulate) { task = new EditorInitializationTask(); diff --git a/Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs b/Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs index d772fba1c..16037c158 100644 --- a/Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs +++ b/Assets/Scripts/NBC/Asset/Runtime/Const/Const.cs @@ -9,7 +9,8 @@ namespace NBC.Asset public const string VersionFileName = "version.json"; public static bool IsWebGLPlatform => Application.platform == RuntimePlatform.WebGLPlayer; - + + public static readonly string SavePath = $"{Application.persistentDataPath}{Path.DirectorySeparatorChar}{BundleDirName}{Path.DirectorySeparatorChar}"; @@ -20,9 +21,10 @@ namespace NBC.Asset public static bool Offline; public static bool Simulate; + public static bool NotCache; public static int DownloadTimeOut = 10; - + public static string GetStreamingPath(string file) { @@ -31,6 +33,11 @@ namespace NBC.Asset public static string GetCachePath(string file) { + if (NotCache) + { + return GetStreamingPath(file); + } + return $"{SavePath}{file}"; } @@ -45,6 +52,7 @@ namespace NBC.Asset { return $"{RemoteUrl}/{file}"; } + return $"{RemoteUrl}{BundleDirName}/{file}"; } } diff --git a/Assets/Scripts/NBC/Asset/Runtime/Tasks/Initialization/OfflineInitializationTask.cs b/Assets/Scripts/NBC/Asset/Runtime/Tasks/Initialization/OfflineInitializationTask.cs index d66a731d7..4191d7b28 100644 --- a/Assets/Scripts/NBC/Asset/Runtime/Tasks/Initialization/OfflineInitializationTask.cs +++ b/Assets/Scripts/NBC/Asset/Runtime/Tasks/Initialization/OfflineInitializationTask.cs @@ -1,7 +1,7 @@ namespace NBC.Asset { /// - /// 离线模式初始化任务 + /// 移动端离线模式初始化任务 /// internal sealed class OfflineInitializationTask : InitializationTask { @@ -10,9 +10,13 @@ protected override void OnStart() { - _taskList.AddTask(new CheckCoverInstallTask()); - _taskList.AddTask(new UnpackVersionTask()); - _taskList.AddTask(new CheckUnpackPackageTask()); + if (!Const.NotCache) + { + _taskList.AddTask(new CheckCoverInstallTask()); + _taskList.AddTask(new UnpackVersionTask()); + _taskList.AddTask(new CheckUnpackPackageTask()); + } + _taskList.AddTask(new RunFunctionTask(Addressable.Load)); _taskList.Run(TaskRunner.Def); } diff --git a/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs b/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs index 8cf5e579a..4dd8df827 100644 --- a/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs +++ b/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs @@ -14,7 +14,7 @@ namespace NBC new Dictionary>(); /// - /// 当前语言图片配置键值对 + /// 当前语言和字体 /// private Dictionary _currentLanguageDictionary = new Dictionary(); @@ -31,26 +31,26 @@ namespace NBC public void AddLanguage(SystemLanguage language) { var configDic = Lan.Inst.GetLanguageFontConfig(LanguageConst.languageMap[language]); - string fontLocation = "Fonts/";//"Assets/Resources/Fonts/"; + // string fontLocation = "Fonts/";//"Assets/Resources/Fonts/"; //字体使用前需要先注册 foreach (var config in configDic.Values) { - if (config.Type == "1") - { - DynamicFont font = new DynamicFont(); - font.name = config.Name; - font.nativeFont = Resources.Load(fontLocation + config.RelativePath); - FontManager.RegisterFont(font); - } - else if (config.Type == "2") - { - TMP_FontAsset fontAsset = - Resources.Load(fontLocation + config.RelativePath) as TMP_FontAsset; - TMPFont font = new TMPFont(); - font.name = config.Name; //这个名字要和编辑器里字体资源的名字一致 - font.fontAsset = fontAsset; - FontManager.RegisterFont(font); - } + // if (config.Type == "1") + // { + // DynamicFont font = new DynamicFont(); + // font.name = config.Name; + // font.nativeFont = Resources.Load(fontLocation + config.RelativePath); + // FontManager.RegisterFont(font); + // } + // else if (config.Type == "2") + // { + // TMP_FontAsset fontAsset = + // Resources.Load(fontLocation + config.RelativePath) as TMP_FontAsset; + // TMPFont font = new TMPFont(); + // font.name = config.Name; //这个名字要和编辑器里字体资源的名字一致 + // font.fontAsset = fontAsset; + // FontManager.RegisterFont(font); + // } } var font2KeyDic = Lan.Inst.GetFont2KeyDic(); @@ -59,11 +59,8 @@ namespace NBC { keys.Add(pair.Key, configDic[pair.Value].Name); } - - if (keys != null) - { - _languages[language] = keys; - } + + _languages[language] = keys; } public bool UseLanguage(SystemLanguage language) diff --git a/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs b/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs index 94331243d..00689f6c5 100644 --- a/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs +++ b/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs @@ -14,10 +14,11 @@ namespace NBC private Dictionary _lanModuleDic = new Dictionary(); + /// /// 变化通知事件 /// - private Action _changeAction; + public event Action ChangeAction; public LanguageManager() { @@ -79,7 +80,7 @@ namespace NBC value.UseLanguage(language); } - _changeAction?.Invoke(); + ChangeAction?.Invoke(); } public void AddLanguage(SystemLanguage language, bool isDefault = false) @@ -95,16 +96,6 @@ namespace NBC } } - public void OnChange(Action callback) - { - _changeAction += callback; - } - - public void OffChange(Action callback) - { - _changeAction -= callback; - } - #region config private readonly Dictionary _languageConfigs = new Dictionary(); diff --git a/Assets/Scripts/NBC/UI/Runtime/Component/IUIPanel.cs b/Assets/Scripts/NBC/UI/Runtime/Component/IUIPanel.cs index 4baadeba6..2510c67c7 100644 --- a/Assets/Scripts/NBC/UI/Runtime/Component/IUIPanel.cs +++ b/Assets/Scripts/NBC/UI/Runtime/Component/IUIPanel.cs @@ -16,11 +16,7 @@ namespace NBC bool IsShowing { get; } bool IsCanVisible { get; } bool IsDotDel { get; } - - /// - /// 不能返回 - /// - bool IsDontBack { get; } + bool IsModal { get; } @@ -30,6 +26,7 @@ namespace NBC void SetData(object args); object GetData(); string[] GetDependPackages(); + void SetLanguage(); void Init(); void Show(); diff --git a/Assets/Scripts/NBC/UI/Runtime/Component/UIPanel.cs b/Assets/Scripts/NBC/UI/Runtime/Component/UIPanel.cs index d4f2f3b44..96786947a 100644 --- a/Assets/Scripts/NBC/UI/Runtime/Component/UIPanel.cs +++ b/Assets/Scripts/NBC/UI/Runtime/Component/UIPanel.cs @@ -190,6 +190,7 @@ namespace NBC Show(); } + /// /// 设置刷新多语言 /// diff --git a/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs b/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs index fe1cf9d9a..7b0415e73 100644 --- a/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs +++ b/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs @@ -137,7 +137,14 @@ namespace NBC if (curField == null) return; var textFormat = curField.textFormat; - var font = Lan.GetLanFontByCurFont(textFormat.font); + Log.Info($"font={textFormat.font}"); + var fontName = textFormat.font; + if (string.IsNullOrEmpty(fontName)) + { + fontName = UIConfig.defaultFont; + } + + var font = Lan.GetLanFontByCurFont(fontName); if (font == null) return; textFormat.font = font; curField.textFormat = textFormat; diff --git a/Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs b/Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs index e790b8c8b..e1e317156 100644 --- a/Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs +++ b/Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs @@ -8,7 +8,7 @@ namespace NBF public string ActionName; public string ShowName; - public virtual void SetData(string actionName, string showName) + public virtual void SetData(string actionName, string showName, string map = InputManager.InputMapUI) { this.ActionName = actionName; this.ShowName = showName; @@ -21,7 +21,7 @@ namespace NBF title = Lan.Get(actionName); } - var iconName = InputManager.Instance.GetUIKeyCode(ActionName); + var iconName = InputManager.Instance.GetInputIcon(map, ActionName); icon = UIPackage.GetItemURL(UIDef.Pack.Common, iconName); } } diff --git a/Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs b/Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs index b50c656d4..023fd6520 100644 --- a/Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs +++ b/Assets/Scripts/UI/Common/Panel/CommonTopPanel.cs @@ -1,5 +1,6 @@ // 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 +using System.Collections.Generic; using UnityEngine; using NBC; @@ -11,6 +12,7 @@ namespace NBF { ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel; IsShowCursor = false; + Lan.Inst.ChangeAction += ChangeLanguageConfirm; } protected override void OnShow() @@ -26,21 +28,34 @@ namespace NBF } } - private void OnUICanceled(string action) + + private void ChangeLanguageConfirm() { - if (action == InputDef.UI.Back) + var uis = UI.Inst.GetAllUI(); + List panels = new List(); + foreach (var ui in uis) { - var uis = UI.Inst.GetAllUI(); - foreach (var ui in uis) + if (!ui.IsShowing && !ui.IsDotDel) { - if (ui.ContentPane.sortingOrder > 0) continue; - if (ui.IsTop && !ui.IsDontBack) - { - UI.Inst.HideUI(ui.GetType()); - break; - } + UI.Inst.DestroyUI(ui.GetType()); + } + else + { + panels.Add(ui); } } + + //打开的页面重刷多语言 + foreach (var panel in panels) + { + panel.SetLanguage(); + _ui.TrySetPanelLanguage(panel.ContentPane); + } + + // Net.Inst.Send(EnmCmdValue.EcvCsAcSetLanguageReq, new CS_AC_SetLanguageReq() + // { + // AppLanguage = Lan.Inst.GetCurrentCustomLanguageName() + // }); } protected override void OnHide() @@ -49,7 +64,7 @@ namespace NBF protected override void OnDestroy() { - base.OnDestroy(); + Lan.Inst.ChangeAction -= ChangeLanguageConfirm; } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Settings/SettingInputItem.cs b/Assets/Scripts/UI/Settings/SettingInputItem.cs index c583a6d9a..c09dced7a 100644 --- a/Assets/Scripts/UI/Settings/SettingInputItem.cs +++ b/Assets/Scripts/UI/Settings/SettingInputItem.cs @@ -30,17 +30,18 @@ namespace NBF { // InputWaitingPanel.Show(true); // UI.Inst.OpenUI(); - // 取消当前绑定 - var settingPanel = UI.Inst.GetUI(); - settingPanel.InputWait.visible = true; - Option.InputAction.Disable(); - - // 开始重绑定操作 - rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex) - .OnMatchWaitForAnother(0.1f) - .OnComplete(operation => RebindComplete()) - .OnCancel(operation => RebindCanceled()) - .Start(); + SettingWaitInputPanel.Show(); + // // 取消当前绑定 + // var settingPanel = UI.Inst.GetUI(); + // settingPanel.InputWait.visible = true; + // Option.InputAction.Disable(); + // + // // 开始重绑定操作 + // rebindingOperation = Option.InputAction.PerformInteractiveRebinding(Option.BindingIndex) + // .OnMatchWaitForAnother(0.1f) + // .OnComplete(operation => RebindComplete()) + // .OnCancel(operation => RebindCanceled()) + // .Start(); } private void RebindComplete() @@ -48,12 +49,6 @@ namespace NBF rebindingOperation.Dispose(); UpdateValueText(); Option.InputAction.Enable(); - - var settingPanel = UI.Inst.GetUI(); - settingPanel.InputWait.visible = false; - // UI.Inst.HideUI(); - // startRebindObject.SetActive(true); - // waitingForInputObject.SetActive(false); } private void RebindCanceled() diff --git a/Assets/Scripts/UI/Settings/SettingItem.cs b/Assets/Scripts/UI/Settings/SettingItem.cs index 5a2ca2432..88dae7c07 100644 --- a/Assets/Scripts/UI/Settings/SettingItem.cs +++ b/Assets/Scripts/UI/Settings/SettingItem.cs @@ -15,6 +15,7 @@ namespace NBF { BtnPrev.onClick.Set(OnPrev); BtnNext.onClick.Set(OnNext); + BtnControl.onClick.Set(OnControl); Slider.onChanged.Set(OnSliderChanged); ComboBox.onChanged.Set(OnComboBoxChanged); } @@ -163,7 +164,12 @@ namespace NBF } } - private void UpdateValueText() + public void OnControl() + { + SettingWaitInputPanel.Show(this); + } + + public void UpdateValueText() { Pages.visible = false; if (Option is RangeOption range) @@ -183,6 +189,17 @@ namespace NBF Pages.SetCurrent(multiOption.GetValue()); } + else if (Option is KeyBoardOption keyBoardOption) + { + UpdateControlInfo(); + } + } + + private void UpdateControlInfo() + { + // BtnControl + if (Option is not KeyBoardOption keyBoardOption) return; + BtnControl.SetData(keyBoardOption.InputAction.name, keyBoardOption.Name, InputManager.InputMapPlayer); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Settings/SettingPanel.Designer.cs b/Assets/Scripts/UI/Settings/SettingPanel.Designer.cs index 646299706..e9d4c6ff7 100644 --- a/Assets/Scripts/UI/Settings/SettingPanel.Designer.cs +++ b/Assets/Scripts/UI/Settings/SettingPanel.Designer.cs @@ -24,8 +24,8 @@ namespace NBF public BottomMenu BottomMenu; [AutoFind(Name = "Mask")] public GLabel Mask; - [AutoFind(Name = "InputWait")] - public GComponent InputWait; + [AutoFind(Name = "Title")] + public GComponent Title; public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; } public static void Show(object param = null){ UI.Inst.OpenUI(param); } diff --git a/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs new file mode 100644 index 000000000..962710067 --- /dev/null +++ b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs @@ -0,0 +1,30 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + +using FairyGUI; +using FairyGUI.Utils; +using NBC; +using System.Collections.Generic; + +namespace NBF +{ + /// + public partial class SettingWaitInputPanel + { + public GObject this[string aKey] => ContentPane.GetChild(aKey); + public override string UIPackName => "Main"; + public override string UIResName => "SettingWaitInputPanel"; + + [AutoFind(Name = "TextTime")] + public GTextField TextTime; + [AutoFind(Name = "BtnCancel")] + public BtnTitleInputControl BtnCancel; + public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; } + + public static void Show(object param = null){ UI.Inst.OpenUI(param); } + + public static void Hide(){ UI.Inst.HideUI(); } + + public static void Del(){ UI.Inst.DestroyUI(); } + + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs.meta b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs.meta new file mode 100644 index 000000000..aebc5a1c8 --- /dev/null +++ b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 516cf8ed4abe3a14a8e101f8ec0d6924 \ No newline at end of file diff --git a/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs new file mode 100644 index 000000000..0f3d01a2a --- /dev/null +++ b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs @@ -0,0 +1,73 @@ +// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 + +using UnityEngine; +using NBC; +using NBF.Setting; +using UnityEngine.InputSystem; + +namespace NBF +{ + public partial class SettingWaitInputPanel : UIPanel + { + private SettingItem _settingItem; + private InputOption _inputOption; + private InputActionRebindingExtensions.RebindingOperation rebindingOperation; + + protected override void OnShow() + { + _settingItem = GetData() as SettingItem; + if (_settingItem == null) + { + Hide(); + return; + } + + if (_settingItem.Option is InputOption inputOption) + { + _inputOption = inputOption; + OnRebinding(); + } + } + + #region 按键绑定 + + private void OnRebinding() + { + // 开始重绑定操作 + rebindingOperation = _inputOption.InputAction.PerformInteractiveRebinding(_inputOption.BindingIndex) + .OnMatchWaitForAnother(0.1f) + .OnComplete(operation => RebindComplete()) + .OnCancel(operation => RebindCanceled()) + .Start(); + } + + private void RebindComplete() + { + rebindingOperation.Dispose(); + _inputOption.InputAction.Enable(); + UpdateValueText(); + } + + private void RebindCanceled() + { + rebindingOperation.Dispose(); + _inputOption.InputAction.Enable(); + Hide(); + } + + private void UpdateValueText() + { + _settingItem.UpdateValueText(); + Hide(); + } + + #endregion + + + [InputInvoke(InputDef.UI.Back)] + private void OnBack() + { + Hide(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs.meta b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs.meta new file mode 100644 index 000000000..8c057ac7d --- /dev/null +++ b/Assets/Scripts/UI/Settings/SettingWaitInputPanel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ebd4baa307d417f48ade9e2c8255ace9 \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/Back/Back1.xml b/FGUIProject/assets/Common/Com/Back/Back1.xml index 9dda3edd9..1c809245e 100644 --- a/FGUIProject/assets/Common/Com/Back/Back1.xml +++ b/FGUIProject/assets/Common/Com/Back/Back1.xml @@ -1,7 +1,7 @@ - + diff --git a/FGUIProject/assets/Common/Com/Buttons/BtnInputControl.xml b/FGUIProject/assets/Common/Com/Buttons/BtnInputControl.xml index f05575e83..b2ccee59a 100644 --- a/FGUIProject/assets/Common/Com/Buttons/BtnInputControl.xml +++ b/FGUIProject/assets/Common/Com/Buttons/BtnInputControl.xml @@ -1,8 +1,10 @@ - + - + + +