diff --git a/Assets/PlayerInputControl.inputactions b/Assets/PlayerInputControl.inputactions index 5b80b73f3..07986a7b7 100644 --- a/Assets/PlayerInputControl.inputactions +++ b/Assets/PlayerInputControl.inputactions @@ -2,7 +2,7 @@ "name": "PlayerInputControl", "maps": [ { - "name": "Normal", + "name": "Player", "id": "df70fa95-8a34-4494-b137-73ab6b9c7d37", "actions": [ { @@ -68,24 +68,6 @@ "interactions": "", "initialStateCheck": false }, - { - "name": "Use", - "type": "Button", - "id": "7372f7e2-b3d2-4e91-b8e6-2f0ccde6fc1f", - "expectedControlType": "", - "processors": "", - "interactions": "", - "initialStateCheck": false - }, - { - "name": "Use2", - "type": "Button", - "id": "45a833e1-2aaf-4907-ae1e-1d97ee260b18", - "expectedControlType": "", - "processors": "", - "interactions": "", - "initialStateCheck": false - }, { "name": "SelectItem", "type": "Button", @@ -321,9 +303,18 @@ "initialStateCheck": false }, { - "name": "Back", + "name": "Use1", "type": "Button", - "id": "6b649cc4-0104-4234-bfe9-2d647df3862d", + "id": "5f9c0896-f98f-442f-b9f1-9f3ac33bcfde", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Use2", + "type": "Button", + "id": "6b94216d-9977-4d4a-ad3b-51e187da640e", "expectedControlType": "", "processors": "", "interactions": "", @@ -595,17 +586,6 @@ "isComposite": false, "isPartOfComposite": false }, - { - "name": "", - "id": "01d704a4-4abb-4832-a338-6ecc59ac4c75", - "path": "/e", - "interactions": "", - "processors": "", - "groups": "", - "action": "Use", - "isComposite": false, - "isPartOfComposite": false - }, { "name": "", "id": "211b10df-e7a6-4128-a2a9-f8d3817914e4", @@ -894,18 +874,18 @@ }, { "name": "", - "id": "9f16f60c-4749-4672-bdaf-9fb804c0b6f1", - "path": "/escape", + "id": "09257b2e-f9bf-4dc8-a805-d9ae8167ce4c", + "path": "/e", "interactions": "", "processors": "", "groups": "", - "action": "Back", + "action": "Use1", "isComposite": false, "isPartOfComposite": false }, { "name": "", - "id": "7e0ce3aa-9cf2-4b1e-9995-756ccbdeeda4", + "id": "ff8df6be-dab1-42c1-8431-d479ab9477b1", "path": "/y", "interactions": "", "processors": "", @@ -928,6 +908,114 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Back", + "type": "Button", + "id": "401f71b2-4e5e-4157-91d4-b5d582f3a05e", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Enter", + "type": "Button", + "id": "7f14a5b4-f3b7-4f7e-b580-6e872739a8a8", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Tab", + "type": "Button", + "id": "fef7976b-b6a3-4a42-a774-52cde704f619", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Prev", + "type": "Button", + "id": "43ccf3ef-746f-4dd7-b21c-d4c6db069938", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Next", + "type": "Button", + "id": "cda4c3e5-6ca3-44c6-b378-3c31b1d7f3f6", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "SubPrev", + "type": "Button", + "id": "884769f9-3abc-4fae-9a67-825c30770143", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "SubNext", + "type": "Button", + "id": "aba7119c-4211-4c6d-918b-a75ca20c2f7f", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Right", + "type": "Button", + "id": "348bd961-a6a0-4d13-b414-83b43201bc10", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Left", + "type": "Button", + "id": "da1344ed-a4b5-43ef-bad6-a3f6bb06ff23", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Down", + "type": "Button", + "id": "dafd152b-aa0a-48bb-890d-289ab3a3e713", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Up", + "type": "Button", + "id": "e0dbeebd-c69d-44bd-83de-94fcce8c6727", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "New action", + "type": "Button", + "id": "a21da899-9653-49b5-8fd8-73934d7f180c", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -941,6 +1029,138 @@ "action": "Roll", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "89052787-93ee-47da-ae8f-5bd86adfb2ff", + "path": "/escape", + "interactions": "", + "processors": "", + "groups": "", + "action": "Back", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "a6e94404-e896-4fec-b3bf-affd31b12571", + "path": "/enter", + "interactions": "", + "processors": "", + "groups": "", + "action": "Enter", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "23dac47b-935f-4261-8044-a8612edf3fda", + "path": "/tab", + "interactions": "", + "processors": "", + "groups": "", + "action": "Tab", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "1a7adfe5-f5a6-498f-8a9a-f6dd4f0c6c05", + "path": "/q", + "interactions": "", + "processors": "", + "groups": "", + "action": "Prev", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "2661bf5d-0afe-4f8c-a4e8-2aa6150c724d", + "path": "/e", + "interactions": "", + "processors": "", + "groups": "", + "action": "Next", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "487ceb23-336d-45f6-a782-3b4e9d9f0cd1", + "path": "/z", + "interactions": "", + "processors": "", + "groups": "", + "action": "SubPrev", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "463ec073-6e9d-4b1d-9956-8ec19838aa3e", + "path": "/c", + "interactions": "", + "processors": "", + "groups": "", + "action": "SubNext", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "053ddbac-9f73-4672-be59-abfdb6037aea", + "path": "/d", + "interactions": "", + "processors": "", + "groups": "", + "action": "Right", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "031b930d-59b6-4a26-9dfe-97764c3e8b37", + "path": "/a", + "interactions": "", + "processors": "", + "groups": "", + "action": "Left", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "45f78626-cbf2-4e1f-904d-d82e4c2a2f41", + "path": "/s", + "interactions": "", + "processors": "", + "groups": "", + "action": "Down", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "f1a47b3c-e79f-4ab3-86b6-fcc0a6470114", + "path": "/w", + "interactions": "", + "processors": "", + "groups": "", + "action": "Up", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "393f1eb9-d10d-4cd1-87e7-ea299f92b2da", + "path": "", + "interactions": "", + "processors": "", + "groups": "", + "action": "New action", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Resources/Fgui/Common/Common_atlas0.png b/Assets/Resources/Fgui/Common/Common_atlas0.png index d9d4dbbd8..29b8ed796 100644 Binary files a/Assets/Resources/Fgui/Common/Common_atlas0.png and b/Assets/Resources/Fgui/Common/Common_atlas0.png differ diff --git a/Assets/Resources/Fgui/Common/Common_fui.bytes b/Assets/Resources/Fgui/Common/Common_fui.bytes index baf4eb628..2c3c198af 100644 Binary files a/Assets/Resources/Fgui/Common/Common_fui.bytes and b/Assets/Resources/Fgui/Common/Common_fui.bytes differ diff --git a/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png b/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png new file mode 100644 index 000000000..de986b890 Binary files /dev/null and b/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png differ diff --git a/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png.meta b/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png.meta new file mode 100644 index 000000000..fe4a9dc64 --- /dev/null +++ b/Assets/Resources/Fgui/Shop/Shop_atlas_9lmcv.png.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: c5656eb4b7b00d748854cd3cf6b90426 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Fgui/Shop/Shop_fui.bytes b/Assets/Resources/Fgui/Shop/Shop_fui.bytes index 0fe55438a..079f4308f 100644 Binary files a/Assets/Resources/Fgui/Shop/Shop_fui.bytes and b/Assets/Resources/Fgui/Shop/Shop_fui.bytes differ diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta index 491267362..8d517d83e 100644 --- a/Assets/Scripts/Data.meta +++ b/Assets/Scripts/Data.meta @@ -1,3 +1,3 @@ -fileFormatVersion: 2 -guid: 53d4b4ea733e48a3b1324345029f2bc2 -timeCreated: 1747967959 \ No newline at end of file +fileFormatVersion: 2 +guid: 9f40e3fa2b734184858dde08f66c6590 +timeCreated: 1748091942 \ No newline at end of file diff --git a/Assets/Scripts/Data/ListClassifyData.cs b/Assets/Scripts/Data/ListClassifyData.cs deleted file mode 100644 index d88b51124..000000000 --- a/Assets/Scripts/Data/ListClassifyData.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace NBF -{ - public class ListClassifyData - { - public string Title; - - public ListClassifyData(string title) - { - this.Title = title; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Data/ListClassifyData.cs.meta b/Assets/Scripts/Data/ListClassifyData.cs.meta deleted file mode 100644 index d1dd58e52..000000000 --- a/Assets/Scripts/Data/ListClassifyData.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: edbbd6c0c6004af8924e5b8f2ec39039 -timeCreated: 1747969245 \ No newline at end of file diff --git a/Assets/Scripts/Data/TabListData.cs b/Assets/Scripts/Data/TabListData.cs new file mode 100644 index 000000000..ebd367ca4 --- /dev/null +++ b/Assets/Scripts/Data/TabListData.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NBF +{ + public class TabItemData + { + public string Name; + public string Icon; + } + + public class TabSubItemData : TabItemData + { + public List Items = new List(); + } + + public class TabListData + { + public TabItemData Tab; + public List SubTab = new List(); + + public void AddTestData(int index) + { + Tab = new TabItemData(); + Tab.Name = $"标题-{index + 1}"; + string[] testIcon = { "Globe", "Granade", "Gun" }; + var count1 = Random.Range(5, 10); + var count2 = Random.Range(90, 200); + for (int i = 0; i < count1; i++) + { + TabSubItemData subTab = new TabSubItemData(); + subTab.Name = $"类型-{i}"; + subTab.Icon = testIcon[Random.Range(0, testIcon.Length)]; + // ListData.Add(new ListClassifyData($"Title-{i}")); + for (int j = 0; j < count2; j++) + { + var item = new ShopGearData(); + item.title = $"Item {index}-{i}-" + j; + subTab.Items.Add(item); + } + + SubTab.Add(subTab); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/TabListData.cs.meta b/Assets/Scripts/Data/TabListData.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/Items/TabListData.cs.meta rename to Assets/Scripts/Data/TabListData.cs.meta diff --git a/Assets/Scripts/Def/InputDef.cs b/Assets/Scripts/Def/InputDef.cs new file mode 100644 index 000000000..b7480eec5 --- /dev/null +++ b/Assets/Scripts/Def/InputDef.cs @@ -0,0 +1,27 @@ +namespace NBF +{ + public class InputDef + { + public class UI + { + public const string Back = "Back"; + public const string Enter = "Enter"; + public const string Tab = "Tab"; + public const string Prev = "Prev"; + public const string Next = "Next"; + public const string SubPrev = "SubPrev"; + public const string SubNext = "SubNext"; + public const string Left = "Left"; + public const string Right = "Right"; + public const string Up = "Up"; + public const string Down = "Down"; + } + + public class Player + { + public const string Run = "Run"; + public const string Use1 = "Use1"; + public const string Use2 = "Use2"; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Def/InputDef.cs.meta b/Assets/Scripts/Def/InputDef.cs.meta new file mode 100644 index 000000000..3bb87fea0 --- /dev/null +++ b/Assets/Scripts/Def/InputDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3c1d17072df749909ccc26de605346d1 +timeCreated: 1748104048 \ No newline at end of file diff --git a/Assets/Scripts/Fishing/InputManager.cs b/Assets/Scripts/Fishing/InputManager.cs index b77f95b52..860918191 100644 --- a/Assets/Scripts/Fishing/InputManager.cs +++ b/Assets/Scripts/Fishing/InputManager.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.InteropServices; +using NBC; // using Rewired; using UnityEngine; using UnityEngine.InputSystem; @@ -13,95 +14,28 @@ namespace NBF public static bool IsOp1; public static bool IsOp2; - public static event Action OnOp1Action; public static event Action OnOp2Action; - public static event Action OnUseAction; - public static event Action OnUse2Action; - public static event Action OnSelectItemAction; - public static event Action OnSelectBaitAction; - public static event Action OnSelectFoodAction; /// - /// 快速选择数值 + /// 执行输入事件 /// - public static event Action OnQuickIndexAction; + public static event Action OnUIPerformed; /// - /// 使用手电筒 + /// 执行输入事件完毕 /// - public static event Action OnUseTorchAction; + public static event Action OnUICanceled; /// - /// 使用抄网 + /// 执行输入事件 /// - public static event Action OnUseBrailAction; + public static event Action OnPlayerPerformed; /// - /// 使用望远镜 + /// 执行输入事件完毕 /// - public static event Action OnUseTelescopeAction; - - /// - /// 添加浮漂 - /// - public static event Action OnAddBobAction; - - /// - /// 减少浮漂 - /// - public static event Action OnSubBobAction; - - /// - /// 返回背包 - /// - public static event Action OnToBagAction; - - - /// - /// 帮助 - /// - public static event Action OnHelpAction; - - /// - /// 聊天 - /// - public static event Action OnChatAction; - - /// - /// 物品信息 - /// - public static event Action OnInfoAction; - - /// - /// 技能 - /// - public static event Action OnSkillAction; - - /// - /// 打开背包 - /// - public static event Action OnOpenBagAction; - - /// - /// 打开鱼护 - /// - public static event Action OnKeepnetAction; - - /// - /// 打开制造 - /// - public static event Action OnMakeAction; - - /// - /// 打开地图 - /// - public static event Action OnMapAction; - - /// - /// 奔跑 - /// - public static event Action OnRunAction; + public static event Action OnPlayerCanceled; /// /// 触发交互游戏对象 @@ -110,6 +44,11 @@ namespace NBF public static PlayerInputControl PlayerInputControl { get; private set; } + /// + /// ui阻止游戏输入 + /// + public static bool IsUIStopInput; + private void Awake() { Instance = this; @@ -118,19 +57,20 @@ namespace NBF public static Vector2 GetMovementInput() { - return PlayerInputControl.Normal.Move?.ReadValue() ?? Vector2.zero; + if (IsUIStopInput) return Vector2.zero; + return PlayerInputControl.Player.Move?.ReadValue() ?? Vector2.zero; } public static Vector2 GetLookInput() { - return PlayerInputControl.Normal.Look?.ReadValue() ?? Vector2.zero; + if (IsUIStopInput) return Vector2.zero; + return PlayerInputControl.Player.Look?.ReadValue() ?? Vector2.zero; } private void Start() { PlayerInputControl = new PlayerInputControl(); PlayerInputControl.Enable(); - PlayerInputControl.Normal.Enable(); AddEvent(); } @@ -141,348 +81,85 @@ namespace NBF private void AddEvent() { - PlayerInputControl.Normal.Run.performed += OnRun; - PlayerInputControl.Normal.Run.canceled += OnRun; - PlayerInputControl.Normal.Op1.performed += OnOp1; - PlayerInputControl.Normal.Op1.canceled += OnOp1; - PlayerInputControl.Normal.Op2.performed += OnOp2; - PlayerInputControl.Normal.Op2.canceled += OnOp2; - PlayerInputControl.Normal.Use.performed += OnUse; - PlayerInputControl.Normal.Use.canceled += OnUse; - PlayerInputControl.Normal.Use2.performed += OnUse2; - PlayerInputControl.Normal.Use2.canceled += OnUse2; - - PlayerInputControl.Normal.SelectItem.performed += OnSelectItem; - PlayerInputControl.Normal.SelectItem.canceled += OnSelectItem; - - PlayerInputControl.Normal.SelectFood.performed += OnSelectFood; - PlayerInputControl.Normal.SelectFood.canceled += OnSelectFood; - - PlayerInputControl.Normal.SelectBait.performed += OnSelectBait; - PlayerInputControl.Normal.SelectBait.canceled += OnSelectBait; - - PlayerInputControl.Normal.UseTorch.performed += OnUseTorch; - PlayerInputControl.Normal.UseTorch.canceled += OnUseTorch; - - PlayerInputControl.Normal.UseTelescope.performed += OnUseTelescope; - PlayerInputControl.Normal.UseTelescope.canceled += OnUseTelescope; - - PlayerInputControl.Normal.UseBrail.performed += OnUseBrail; - PlayerInputControl.Normal.UseBrail.canceled += OnUseBrail; - - PlayerInputControl.Normal.AddBob.performed += OnAddBob; - PlayerInputControl.Normal.AddBob.canceled += OnAddBob; - - PlayerInputControl.Normal.SubBob.performed += OnSubBob; - PlayerInputControl.Normal.SubBob.canceled += OnSubBob; - - PlayerInputControl.Normal.ToBag.performed += OnToBag; - PlayerInputControl.Normal.ToBag.canceled += OnToBag; - - PlayerInputControl.Normal.Help.performed += OnHelp; - PlayerInputControl.Normal.Help.canceled += OnHelp; - - PlayerInputControl.Normal.Chat.performed += OnChat; - PlayerInputControl.Normal.Chat.canceled += OnChat; - - PlayerInputControl.Normal.Info.performed += OnInfo; - PlayerInputControl.Normal.Info.canceled += OnInfo; - - PlayerInputControl.Normal.Skill.performed += OnSkill; - PlayerInputControl.Normal.Skill.canceled += OnSkill; - - PlayerInputControl.Normal.OpenBag.performed += OnOpenBag; - PlayerInputControl.Normal.OpenBag.canceled += OnOpenBag; - - PlayerInputControl.Normal.Keepnet.performed += OnKeepnet; - PlayerInputControl.Normal.Keepnet.canceled += OnKeepnet; - - PlayerInputControl.Normal.Make.performed += OnMake; - PlayerInputControl.Normal.Make.canceled += OnMake; - - PlayerInputControl.Normal.Map.performed += OnMap; - PlayerInputControl.Normal.Map.canceled += OnMap; - - PlayerInputControl.Normal.Quick1.performed += OnQuick1; - PlayerInputControl.Normal.Quick2.performed += OnQuick2; - PlayerInputControl.Normal.Quick3.performed += OnQuick3; - PlayerInputControl.Normal.Quick4.performed += OnQuick4; - PlayerInputControl.Normal.Quick5.performed += OnQuick5; - PlayerInputControl.Normal.Quick6.performed += OnQuick6; - PlayerInputControl.Normal.Quick7.performed += OnQuick7; - PlayerInputControl.Normal.Quick8.performed += OnQuick8; - PlayerInputControl.Normal.Quick9.performed += OnQuick9; + foreach (var actionMap in PlayerInputControl.asset.actionMaps) + { + actionMap.Enable(); + if (actionMap.name == "UI") + { + foreach (var action in actionMap.actions) + { + if (action.type == InputActionType.Button) + { + action.performed += OnUIButtonPerformed; + action.canceled += OnUIButtonCanceled; + } + } + } + else if (actionMap.name == "Normal") + { + foreach (var action in actionMap.actions) + { + if (action.type == InputActionType.Button) + { + action.performed += OnPlayerButtonPerformed; + action.canceled += OnPlayerButtonCanceled; + } + } + } + } } private void RemoveEvent() { - PlayerInputControl.Normal.Run.performed -= OnRun; - PlayerInputControl.Normal.Run.canceled -= OnRun; - PlayerInputControl.Normal.Op1.performed -= OnOp1; - PlayerInputControl.Normal.Op1.canceled -= OnOp1; - PlayerInputControl.Normal.Op2.performed -= OnOp2; - PlayerInputControl.Normal.Op2.canceled -= OnOp2; - PlayerInputControl.Normal.Use.performed -= OnUse; - PlayerInputControl.Normal.Use.canceled -= OnUse; - PlayerInputControl.Normal.Use2.performed -= OnUse2; - PlayerInputControl.Normal.Use2.canceled -= OnUse2; - - PlayerInputControl.Normal.SelectItem.performed -= OnSelectItem; - PlayerInputControl.Normal.SelectItem.canceled -= OnSelectItem; - - PlayerInputControl.Normal.SelectFood.performed -= OnSelectFood; - PlayerInputControl.Normal.SelectFood.canceled -= OnSelectFood; - - PlayerInputControl.Normal.SelectBait.performed -= OnSelectBait; - PlayerInputControl.Normal.SelectBait.canceled -= OnSelectBait; - - PlayerInputControl.Normal.UseTorch.performed -= OnUseTorch; - PlayerInputControl.Normal.UseTorch.canceled -= OnUseTorch; - - PlayerInputControl.Normal.UseTelescope.performed -= OnUseTelescope; - PlayerInputControl.Normal.UseTelescope.canceled -= OnUseTelescope; - - PlayerInputControl.Normal.UseBrail.performed -= OnUseBrail; - PlayerInputControl.Normal.UseBrail.canceled -= OnUseBrail; - - PlayerInputControl.Normal.AddBob.performed -= OnAddBob; - PlayerInputControl.Normal.AddBob.canceled -= OnAddBob; - - PlayerInputControl.Normal.SubBob.performed -= OnSubBob; - PlayerInputControl.Normal.SubBob.canceled -= OnSubBob; - - PlayerInputControl.Normal.ToBag.performed -= OnToBag; - PlayerInputControl.Normal.ToBag.canceled -= OnToBag; - - PlayerInputControl.Normal.Help.performed -= OnHelp; - PlayerInputControl.Normal.Help.canceled -= OnHelp; - - PlayerInputControl.Normal.Chat.performed -= OnChat; - PlayerInputControl.Normal.Chat.canceled -= OnChat; - - PlayerInputControl.Normal.Info.performed -= OnInfo; - PlayerInputControl.Normal.Info.canceled -= OnInfo; - - PlayerInputControl.Normal.Skill.performed -= OnSkill; - PlayerInputControl.Normal.Skill.canceled -= OnSkill; - - PlayerInputControl.Normal.OpenBag.performed -= OnOpenBag; - PlayerInputControl.Normal.OpenBag.canceled -= OnOpenBag; - - PlayerInputControl.Normal.Keepnet.performed -= OnKeepnet; - PlayerInputControl.Normal.Keepnet.canceled -= OnKeepnet; - - PlayerInputControl.Normal.Make.performed -= OnMake; - PlayerInputControl.Normal.Make.canceled -= OnMake; - - PlayerInputControl.Normal.Map.performed -= OnMap; - PlayerInputControl.Normal.Map.canceled -= OnMap; - - PlayerInputControl.Normal.Quick1.performed -= OnQuick1; - PlayerInputControl.Normal.Quick2.performed -= OnQuick2; - PlayerInputControl.Normal.Quick3.performed -= OnQuick3; - PlayerInputControl.Normal.Quick4.performed -= OnQuick4; - PlayerInputControl.Normal.Quick5.performed -= OnQuick5; - PlayerInputControl.Normal.Quick6.performed -= OnQuick6; - PlayerInputControl.Normal.Quick7.performed -= OnQuick7; - PlayerInputControl.Normal.Quick8.performed -= OnQuick8; - PlayerInputControl.Normal.Quick9.performed -= OnQuick9; + OnUIPerformed = null; + OnUICanceled = null; + OnPlayerPerformed = null; + OnPlayerCanceled = null; } + private void OnUIButtonPerformed(InputAction.CallbackContext context) + { + OnUIPerformed?.Invoke(context.action.name); + } + + private void OnUIButtonCanceled(InputAction.CallbackContext context) + { + OnUICanceled?.Invoke(context.action.name); + } + + private void OnPlayerButtonPerformed(InputAction.CallbackContext context) + { + if (IsUIStopInput) return; + var actionName = context.action.name; + if (actionName == "Op1") + { + OnOp1Action?.Invoke(true); + } + else if (actionName == "Op2") + { + OnOp2Action?.Invoke(true); + } + } + + private void OnPlayerButtonCanceled(InputAction.CallbackContext context) + { + if (IsUIStopInput) return; + var actionName = context.action.name; + if (actionName == "Op1") + { + OnOp1Action?.Invoke(false); + } + else if (actionName == "Op2") + { + OnOp2Action?.Invoke(false); + } + } + + public void OnInteractiveObject(InteractiveObject interactiveObject) { Debug.LogError($"OnInteractiveObject {interactiveObject != null}"); OnInteractiveObjectAction?.Invoke(interactiveObject); } - - private void OnRun(InputAction.CallbackContext context) - { - OnRunAction?.Invoke(context.performed); - } - - private void OnOp1(InputAction.CallbackContext context) - { - IsOp1 = context.performed; - OnOp1Action?.Invoke(IsOp1); - } - - private void OnOp2(InputAction.CallbackContext context) - { - IsOp2 = context.performed; - OnOp2Action?.Invoke(IsOp2); - } - - private void OnUse(InputAction.CallbackContext context) - { - if (context.performed) - { - OnUseAction?.Invoke(); - } - } - - private void OnUse2(InputAction.CallbackContext context) - { - if (context.performed) - { - OnUse2Action?.Invoke(); - } - } - - private void OnSelectItem(InputAction.CallbackContext context) - { - OnSelectItemAction?.Invoke(context.performed); - } - - private void OnSelectFood(InputAction.CallbackContext context) - { - OnSelectFoodAction?.Invoke(context.performed); - } - - private void OnSelectBait(InputAction.CallbackContext context) - { - OnSelectBaitAction?.Invoke(context.performed); - } - - private void OnUseTorch(InputAction.CallbackContext context) - { - OnUseTorchAction?.Invoke(context.performed); - } - - private void OnUseTelescope(InputAction.CallbackContext context) - { - OnUseTelescopeAction?.Invoke(context.performed); - } - - private void OnUseBrail(InputAction.CallbackContext context) - { - OnUseBrailAction?.Invoke(context.performed); - } - - private void OnAddBob(InputAction.CallbackContext context) - { - OnSubBobAction?.Invoke(context.performed); - } - - private void OnSubBob(InputAction.CallbackContext context) - { - OnSubBobAction?.Invoke(context.performed); - } - - private void OnToBag(InputAction.CallbackContext context) - { - OnToBagAction?.Invoke(context.performed); - } - - private void OnHelp(InputAction.CallbackContext context) - { - OnHelpAction?.Invoke(context.performed); - } - - private void OnChat(InputAction.CallbackContext context) - { - OnChatAction?.Invoke(context.performed); - } - - private void OnInfo(InputAction.CallbackContext context) - { - OnInfoAction?.Invoke(context.performed); - } - - private void OnSkill(InputAction.CallbackContext context) - { - OnSkillAction?.Invoke(context.performed); - } - - private void OnOpenBag(InputAction.CallbackContext context) - { - OnOpenBagAction?.Invoke(context.performed); - } - - private void OnKeepnet(InputAction.CallbackContext context) - { - OnKeepnetAction?.Invoke(context.performed); - } - - private void OnMake(InputAction.CallbackContext context) - { - OnMakeAction?.Invoke(context.performed); - } - - private void OnMap(InputAction.CallbackContext context) - { - OnMapAction?.Invoke(context.performed); - } - - private void OnQuick1(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(1); - } - } - - private void OnQuick2(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(2); - } - } - - private void OnQuick3(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(3); - } - } - - private void OnQuick4(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(4); - } - } - - private void OnQuick5(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(5); - } - } - - private void OnQuick6(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(6); - } - } - - private void OnQuick7(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(7); - } - } - - private void OnQuick8(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(8); - } - } - - private void OnQuick9(InputAction.CallbackContext context) - { - if (context.performed) - { - OnQuickIndexAction?.Invoke(9); - } - } } } \ No newline at end of file diff --git a/Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs b/Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs index b3218af8c..1af3c67d7 100644 --- a/Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs +++ b/Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerCharacter.cs @@ -56,10 +56,12 @@ namespace NBF transform.rotation = _player.Data.rotation; App.Inst.SetMouseCurrsor(false); - InputManager.OnRunAction += OnRunAction; - InputManager.OnQuickIndexAction += OnQuickIndexAction; - InputManager.OnUseTorchAction += OnUseTorchAction; - InputManager.OnUseTelescopeAction += OnUseTelescopeAction; + InputManager.OnPlayerCanceled += OnPlayerCanceled; + InputManager.OnPlayerPerformed += OnPlayerPerformed; + // InputManager.OnRunAction += OnRunAction; + // InputManager.OnQuickIndexAction += OnQuickIndexAction; + // InputManager.OnUseTorchAction += OnUseTorchAction; + // InputManager.OnUseTelescopeAction += OnUseTelescopeAction; interactableLayer = LayerMask.GetMask("Interactive"); } @@ -93,9 +95,8 @@ namespace NBF private void OnDestroy() { - InputManager.OnQuickIndexAction -= OnQuickIndexAction; - InputManager.OnUseTorchAction -= OnUseTorchAction; - InputManager.OnUseTelescopeAction -= OnUseTelescopeAction; + InputManager.OnPlayerCanceled -= OnPlayerCanceled; + InputManager.OnPlayerPerformed -= OnPlayerPerformed; } #region 交互检测 @@ -283,28 +284,29 @@ namespace NBF #region 按键输入事件 - private void OnRunAction(bool performed) + private void OnPlayerPerformed(string action) { - if (performed) Sprint(); - else StopSprinting(); - } - - private void OnQuickIndexAction(int index) - { - nextShowSlotIndex = index; - } - - private void OnUseTorchAction(bool ret) - { - if (!ret) + if (action == "Run") { - _player.Data.openLight = !_player.Data.openLight; + Sprint(); } } - private void OnUseTelescopeAction(bool ret) + private void OnPlayerCanceled(string action) { - if (!ret) + if (action == "Run") + { + StopSprinting(); + } + else if (action.StartsWith("Quick")) + { + nextShowSlotIndex = int.Parse(action.Substring("Quick".Length)); + } + else if (action == "UseTorch") + { + _player.Data.openLight = !_player.Data.openLight; + } + else if (action == "UseTelescope") { _player.Data.openTelescope = !_player.Data.openTelescope; _player.ToggleTelescope(); diff --git a/Assets/Scripts/Fishing/PlayerInputControl.cs b/Assets/Scripts/Fishing/PlayerInputControl.cs index ce73e49f0..b7cb55a66 100644 --- a/Assets/Scripts/Fishing/PlayerInputControl.cs +++ b/Assets/Scripts/Fishing/PlayerInputControl.cs @@ -90,7 +90,7 @@ namespace NBF ""name"": ""PlayerInputControl"", ""maps"": [ { - ""name"": ""Normal"", + ""name"": ""Player"", ""id"": ""df70fa95-8a34-4494-b137-73ab6b9c7d37"", ""actions"": [ { @@ -156,24 +156,6 @@ namespace NBF ""interactions"": """", ""initialStateCheck"": false }, - { - ""name"": ""Use"", - ""type"": ""Button"", - ""id"": ""7372f7e2-b3d2-4e91-b8e6-2f0ccde6fc1f"", - ""expectedControlType"": """", - ""processors"": """", - ""interactions"": """", - ""initialStateCheck"": false - }, - { - ""name"": ""Use2"", - ""type"": ""Button"", - ""id"": ""45a833e1-2aaf-4907-ae1e-1d97ee260b18"", - ""expectedControlType"": """", - ""processors"": """", - ""interactions"": """", - ""initialStateCheck"": false - }, { ""name"": ""SelectItem"", ""type"": ""Button"", @@ -409,9 +391,18 @@ namespace NBF ""initialStateCheck"": false }, { - ""name"": ""Back"", + ""name"": ""Use1"", ""type"": ""Button"", - ""id"": ""6b649cc4-0104-4234-bfe9-2d647df3862d"", + ""id"": ""5f9c0896-f98f-442f-b9f1-9f3ac33bcfde"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Use2"", + ""type"": ""Button"", + ""id"": ""6b94216d-9977-4d4a-ad3b-51e187da640e"", ""expectedControlType"": """", ""processors"": """", ""interactions"": """", @@ -683,17 +674,6 @@ namespace NBF ""isComposite"": false, ""isPartOfComposite"": false }, - { - ""name"": """", - ""id"": ""01d704a4-4abb-4832-a338-6ecc59ac4c75"", - ""path"": ""/e"", - ""interactions"": """", - ""processors"": """", - ""groups"": """", - ""action"": ""Use"", - ""isComposite"": false, - ""isPartOfComposite"": false - }, { ""name"": """", ""id"": ""211b10df-e7a6-4128-a2a9-f8d3817914e4"", @@ -982,18 +962,18 @@ namespace NBF }, { ""name"": """", - ""id"": ""9f16f60c-4749-4672-bdaf-9fb804c0b6f1"", - ""path"": ""/escape"", + ""id"": ""09257b2e-f9bf-4dc8-a805-d9ae8167ce4c"", + ""path"": ""/e"", ""interactions"": """", ""processors"": """", ""groups"": """", - ""action"": ""Back"", + ""action"": ""Use1"", ""isComposite"": false, ""isPartOfComposite"": false }, { ""name"": """", - ""id"": ""7e0ce3aa-9cf2-4b1e-9995-756ccbdeeda4"", + ""id"": ""ff8df6be-dab1-42c1-8431-d479ab9477b1"", ""path"": ""/y"", ""interactions"": """", ""processors"": """", @@ -1016,6 +996,114 @@ namespace NBF ""processors"": """", ""interactions"": """", ""initialStateCheck"": false + }, + { + ""name"": ""Back"", + ""type"": ""Button"", + ""id"": ""401f71b2-4e5e-4157-91d4-b5d582f3a05e"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Enter"", + ""type"": ""Button"", + ""id"": ""7f14a5b4-f3b7-4f7e-b580-6e872739a8a8"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Tab"", + ""type"": ""Button"", + ""id"": ""fef7976b-b6a3-4a42-a774-52cde704f619"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Prev"", + ""type"": ""Button"", + ""id"": ""43ccf3ef-746f-4dd7-b21c-d4c6db069938"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Next"", + ""type"": ""Button"", + ""id"": ""cda4c3e5-6ca3-44c6-b378-3c31b1d7f3f6"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""SubPrev"", + ""type"": ""Button"", + ""id"": ""884769f9-3abc-4fae-9a67-825c30770143"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""SubNext"", + ""type"": ""Button"", + ""id"": ""aba7119c-4211-4c6d-918b-a75ca20c2f7f"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Right"", + ""type"": ""Button"", + ""id"": ""348bd961-a6a0-4d13-b414-83b43201bc10"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Left"", + ""type"": ""Button"", + ""id"": ""da1344ed-a4b5-43ef-bad6-a3f6bb06ff23"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Down"", + ""type"": ""Button"", + ""id"": ""dafd152b-aa0a-48bb-890d-289ab3a3e713"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""Up"", + ""type"": ""Button"", + ""id"": ""e0dbeebd-c69d-44bd-83de-94fcce8c6727"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""New action"", + ""type"": ""Button"", + ""id"": ""a21da899-9653-49b5-8fd8-73934d7f180c"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false } ], ""bindings"": [ @@ -1029,6 +1117,138 @@ namespace NBF ""action"": ""Roll"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""89052787-93ee-47da-ae8f-5bd86adfb2ff"", + ""path"": ""/escape"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Back"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a6e94404-e896-4fec-b3bf-affd31b12571"", + ""path"": ""/enter"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Enter"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""23dac47b-935f-4261-8044-a8612edf3fda"", + ""path"": ""/tab"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Tab"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1a7adfe5-f5a6-498f-8a9a-f6dd4f0c6c05"", + ""path"": ""/q"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Prev"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""2661bf5d-0afe-4f8c-a4e8-2aa6150c724d"", + ""path"": ""/e"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Next"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""487ceb23-336d-45f6-a782-3b4e9d9f0cd1"", + ""path"": ""/z"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""SubPrev"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""463ec073-6e9d-4b1d-9956-8ec19838aa3e"", + ""path"": ""/c"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""SubNext"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""053ddbac-9f73-4672-be59-abfdb6037aea"", + ""path"": ""/d"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Right"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""031b930d-59b6-4a26-9dfe-97764c3e8b37"", + ""path"": ""/a"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Left"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""45f78626-cbf2-4e1f-904d-d82e4c2a2f41"", + ""path"": ""/s"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Down"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""f1a47b3c-e79f-4ab3-86b6-fcc0a6470114"", + ""path"": ""/w"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""Up"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""393f1eb9-d10d-4cd1-87e7-ea299f92b2da"", + ""path"": """", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""New action"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -1096,52 +1316,63 @@ namespace NBF } ] }"); - // Normal - m_Normal = asset.FindActionMap("Normal", throwIfNotFound: true); - m_Normal_Move = m_Normal.FindAction("Move", throwIfNotFound: true); - m_Normal_Look = m_Normal.FindAction("Look", throwIfNotFound: true); - m_Normal_Zoom = m_Normal.FindAction("Zoom", throwIfNotFound: true); - m_Normal_Jump = m_Normal.FindAction("Jump", throwIfNotFound: true); - m_Normal_Run = m_Normal.FindAction("Run", throwIfNotFound: true); - m_Normal_Op1 = m_Normal.FindAction("Op1", throwIfNotFound: true); - m_Normal_Op2 = m_Normal.FindAction("Op2", throwIfNotFound: true); - m_Normal_Use = m_Normal.FindAction("Use", throwIfNotFound: true); - m_Normal_Use2 = m_Normal.FindAction("Use2", throwIfNotFound: true); - m_Normal_SelectItem = m_Normal.FindAction("SelectItem", throwIfNotFound: true); - m_Normal_SelectBait = m_Normal.FindAction("SelectBait", throwIfNotFound: true); - m_Normal_SelectFood = m_Normal.FindAction("SelectFood", throwIfNotFound: true); - m_Normal_UseTorch = m_Normal.FindAction("UseTorch", throwIfNotFound: true); - m_Normal_UseTelescope = m_Normal.FindAction("UseTelescope", throwIfNotFound: true); - m_Normal_UseBrail = m_Normal.FindAction("UseBrail", throwIfNotFound: true); - m_Normal_AddBob = m_Normal.FindAction("AddBob", throwIfNotFound: true); - m_Normal_SubBob = m_Normal.FindAction("SubBob", throwIfNotFound: true); - m_Normal_ToBag = m_Normal.FindAction("ToBag", throwIfNotFound: true); - m_Normal_Help = m_Normal.FindAction("Help", throwIfNotFound: true); - m_Normal_Chat = m_Normal.FindAction("Chat", throwIfNotFound: true); - m_Normal_Info = m_Normal.FindAction("Info", throwIfNotFound: true); - m_Normal_Skill = m_Normal.FindAction("Skill", throwIfNotFound: true); - m_Normal_OpenBag = m_Normal.FindAction("OpenBag", throwIfNotFound: true); - m_Normal_Keepnet = m_Normal.FindAction("Keepnet", throwIfNotFound: true); - m_Normal_Make = m_Normal.FindAction("Make", throwIfNotFound: true); - m_Normal_Map = m_Normal.FindAction("Map", throwIfNotFound: true); - m_Normal_Quick1 = m_Normal.FindAction("Quick1", throwIfNotFound: true); - m_Normal_Quick2 = m_Normal.FindAction("Quick2", throwIfNotFound: true); - m_Normal_Quick3 = m_Normal.FindAction("Quick3", throwIfNotFound: true); - m_Normal_Quick4 = m_Normal.FindAction("Quick4", throwIfNotFound: true); - m_Normal_Quick5 = m_Normal.FindAction("Quick5", throwIfNotFound: true); - m_Normal_Quick6 = m_Normal.FindAction("Quick6", throwIfNotFound: true); - m_Normal_Quick7 = m_Normal.FindAction("Quick7", throwIfNotFound: true); - m_Normal_Quick8 = m_Normal.FindAction("Quick8", throwIfNotFound: true); - m_Normal_Quick9 = m_Normal.FindAction("Quick9", throwIfNotFound: true); - m_Normal_Back = m_Normal.FindAction("Back", throwIfNotFound: true); + // Player + m_Player = asset.FindActionMap("Player", throwIfNotFound: true); + m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true); + m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true); + m_Player_Zoom = m_Player.FindAction("Zoom", throwIfNotFound: true); + m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true); + m_Player_Run = m_Player.FindAction("Run", throwIfNotFound: true); + m_Player_Op1 = m_Player.FindAction("Op1", throwIfNotFound: true); + m_Player_Op2 = m_Player.FindAction("Op2", throwIfNotFound: true); + m_Player_SelectItem = m_Player.FindAction("SelectItem", throwIfNotFound: true); + m_Player_SelectBait = m_Player.FindAction("SelectBait", throwIfNotFound: true); + m_Player_SelectFood = m_Player.FindAction("SelectFood", throwIfNotFound: true); + m_Player_UseTorch = m_Player.FindAction("UseTorch", throwIfNotFound: true); + m_Player_UseTelescope = m_Player.FindAction("UseTelescope", throwIfNotFound: true); + m_Player_UseBrail = m_Player.FindAction("UseBrail", throwIfNotFound: true); + m_Player_AddBob = m_Player.FindAction("AddBob", throwIfNotFound: true); + m_Player_SubBob = m_Player.FindAction("SubBob", throwIfNotFound: true); + m_Player_ToBag = m_Player.FindAction("ToBag", throwIfNotFound: true); + m_Player_Help = m_Player.FindAction("Help", throwIfNotFound: true); + m_Player_Chat = m_Player.FindAction("Chat", throwIfNotFound: true); + m_Player_Info = m_Player.FindAction("Info", throwIfNotFound: true); + m_Player_Skill = m_Player.FindAction("Skill", throwIfNotFound: true); + m_Player_OpenBag = m_Player.FindAction("OpenBag", throwIfNotFound: true); + m_Player_Keepnet = m_Player.FindAction("Keepnet", throwIfNotFound: true); + m_Player_Make = m_Player.FindAction("Make", throwIfNotFound: true); + m_Player_Map = m_Player.FindAction("Map", throwIfNotFound: true); + m_Player_Quick1 = m_Player.FindAction("Quick1", throwIfNotFound: true); + m_Player_Quick2 = m_Player.FindAction("Quick2", throwIfNotFound: true); + m_Player_Quick3 = m_Player.FindAction("Quick3", throwIfNotFound: true); + m_Player_Quick4 = m_Player.FindAction("Quick4", throwIfNotFound: true); + m_Player_Quick5 = m_Player.FindAction("Quick5", throwIfNotFound: true); + m_Player_Quick6 = m_Player.FindAction("Quick6", throwIfNotFound: true); + m_Player_Quick7 = m_Player.FindAction("Quick7", throwIfNotFound: true); + m_Player_Quick8 = m_Player.FindAction("Quick8", throwIfNotFound: true); + m_Player_Quick9 = m_Player.FindAction("Quick9", throwIfNotFound: true); + m_Player_Use1 = m_Player.FindAction("Use1", throwIfNotFound: true); + m_Player_Use2 = m_Player.FindAction("Use2", throwIfNotFound: true); // UI m_UI = asset.FindActionMap("UI", throwIfNotFound: true); m_UI_Roll = m_UI.FindAction("Roll", throwIfNotFound: true); + m_UI_Back = m_UI.FindAction("Back", throwIfNotFound: true); + m_UI_Enter = m_UI.FindAction("Enter", throwIfNotFound: true); + m_UI_Tab = m_UI.FindAction("Tab", throwIfNotFound: true); + m_UI_Prev = m_UI.FindAction("Prev", throwIfNotFound: true); + m_UI_Next = m_UI.FindAction("Next", throwIfNotFound: true); + m_UI_SubPrev = m_UI.FindAction("SubPrev", throwIfNotFound: true); + m_UI_SubNext = m_UI.FindAction("SubNext", throwIfNotFound: true); + m_UI_Right = m_UI.FindAction("Right", throwIfNotFound: true); + m_UI_Left = m_UI.FindAction("Left", throwIfNotFound: true); + m_UI_Down = m_UI.FindAction("Down", throwIfNotFound: true); + m_UI_Up = m_UI.FindAction("Up", throwIfNotFound: true); + m_UI_Newaction = m_UI.FindAction("New action", throwIfNotFound: true); } ~@PlayerInputControl() { - UnityEngine.Debug.Assert(!m_Normal.enabled, "This will cause a leak and performance issues, PlayerInputControl.Normal.Disable() has not been called."); + UnityEngine.Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, PlayerInputControl.Player.Disable() has not been called."); UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, PlayerInputControl.UI.Disable() has not been called."); } @@ -1215,204 +1446,199 @@ namespace NBF return asset.FindBinding(bindingMask, out action); } - // Normal - private readonly InputActionMap m_Normal; - private List m_NormalActionsCallbackInterfaces = new List(); - private readonly InputAction m_Normal_Move; - private readonly InputAction m_Normal_Look; - private readonly InputAction m_Normal_Zoom; - private readonly InputAction m_Normal_Jump; - private readonly InputAction m_Normal_Run; - private readonly InputAction m_Normal_Op1; - private readonly InputAction m_Normal_Op2; - private readonly InputAction m_Normal_Use; - private readonly InputAction m_Normal_Use2; - private readonly InputAction m_Normal_SelectItem; - private readonly InputAction m_Normal_SelectBait; - private readonly InputAction m_Normal_SelectFood; - private readonly InputAction m_Normal_UseTorch; - private readonly InputAction m_Normal_UseTelescope; - private readonly InputAction m_Normal_UseBrail; - private readonly InputAction m_Normal_AddBob; - private readonly InputAction m_Normal_SubBob; - private readonly InputAction m_Normal_ToBag; - private readonly InputAction m_Normal_Help; - private readonly InputAction m_Normal_Chat; - private readonly InputAction m_Normal_Info; - private readonly InputAction m_Normal_Skill; - private readonly InputAction m_Normal_OpenBag; - private readonly InputAction m_Normal_Keepnet; - private readonly InputAction m_Normal_Make; - private readonly InputAction m_Normal_Map; - private readonly InputAction m_Normal_Quick1; - private readonly InputAction m_Normal_Quick2; - private readonly InputAction m_Normal_Quick3; - private readonly InputAction m_Normal_Quick4; - private readonly InputAction m_Normal_Quick5; - private readonly InputAction m_Normal_Quick6; - private readonly InputAction m_Normal_Quick7; - private readonly InputAction m_Normal_Quick8; - private readonly InputAction m_Normal_Quick9; - private readonly InputAction m_Normal_Back; + // Player + private readonly InputActionMap m_Player; + private List m_PlayerActionsCallbackInterfaces = new List(); + private readonly InputAction m_Player_Move; + private readonly InputAction m_Player_Look; + private readonly InputAction m_Player_Zoom; + private readonly InputAction m_Player_Jump; + private readonly InputAction m_Player_Run; + private readonly InputAction m_Player_Op1; + private readonly InputAction m_Player_Op2; + private readonly InputAction m_Player_SelectItem; + private readonly InputAction m_Player_SelectBait; + private readonly InputAction m_Player_SelectFood; + private readonly InputAction m_Player_UseTorch; + private readonly InputAction m_Player_UseTelescope; + private readonly InputAction m_Player_UseBrail; + private readonly InputAction m_Player_AddBob; + private readonly InputAction m_Player_SubBob; + private readonly InputAction m_Player_ToBag; + private readonly InputAction m_Player_Help; + private readonly InputAction m_Player_Chat; + private readonly InputAction m_Player_Info; + private readonly InputAction m_Player_Skill; + private readonly InputAction m_Player_OpenBag; + private readonly InputAction m_Player_Keepnet; + private readonly InputAction m_Player_Make; + private readonly InputAction m_Player_Map; + private readonly InputAction m_Player_Quick1; + private readonly InputAction m_Player_Quick2; + private readonly InputAction m_Player_Quick3; + private readonly InputAction m_Player_Quick4; + private readonly InputAction m_Player_Quick5; + private readonly InputAction m_Player_Quick6; + private readonly InputAction m_Player_Quick7; + private readonly InputAction m_Player_Quick8; + private readonly InputAction m_Player_Quick9; + private readonly InputAction m_Player_Use1; + private readonly InputAction m_Player_Use2; /// - /// Provides access to input actions defined in input action map "Normal". + /// Provides access to input actions defined in input action map "Player". /// - public struct NormalActions + public struct PlayerActions { private @PlayerInputControl m_Wrapper; /// /// Construct a new instance of the input action map wrapper class. /// - public NormalActions(@PlayerInputControl wrapper) { m_Wrapper = wrapper; } + public PlayerActions(@PlayerInputControl wrapper) { m_Wrapper = wrapper; } /// - /// Provides access to the underlying input action "Normal/Move". + /// Provides access to the underlying input action "Player/Move". /// - public InputAction @Move => m_Wrapper.m_Normal_Move; + public InputAction @Move => m_Wrapper.m_Player_Move; /// - /// Provides access to the underlying input action "Normal/Look". + /// Provides access to the underlying input action "Player/Look". /// - public InputAction @Look => m_Wrapper.m_Normal_Look; + public InputAction @Look => m_Wrapper.m_Player_Look; /// - /// Provides access to the underlying input action "Normal/Zoom". + /// Provides access to the underlying input action "Player/Zoom". /// - public InputAction @Zoom => m_Wrapper.m_Normal_Zoom; + public InputAction @Zoom => m_Wrapper.m_Player_Zoom; /// - /// Provides access to the underlying input action "Normal/Jump". + /// Provides access to the underlying input action "Player/Jump". /// - public InputAction @Jump => m_Wrapper.m_Normal_Jump; + public InputAction @Jump => m_Wrapper.m_Player_Jump; /// - /// Provides access to the underlying input action "Normal/Run". + /// Provides access to the underlying input action "Player/Run". /// - public InputAction @Run => m_Wrapper.m_Normal_Run; + public InputAction @Run => m_Wrapper.m_Player_Run; /// - /// Provides access to the underlying input action "Normal/Op1". + /// Provides access to the underlying input action "Player/Op1". /// - public InputAction @Op1 => m_Wrapper.m_Normal_Op1; + public InputAction @Op1 => m_Wrapper.m_Player_Op1; /// - /// Provides access to the underlying input action "Normal/Op2". + /// Provides access to the underlying input action "Player/Op2". /// - public InputAction @Op2 => m_Wrapper.m_Normal_Op2; + public InputAction @Op2 => m_Wrapper.m_Player_Op2; /// - /// Provides access to the underlying input action "Normal/Use". + /// Provides access to the underlying input action "Player/SelectItem". /// - public InputAction @Use => m_Wrapper.m_Normal_Use; + public InputAction @SelectItem => m_Wrapper.m_Player_SelectItem; /// - /// Provides access to the underlying input action "Normal/Use2". + /// Provides access to the underlying input action "Player/SelectBait". /// - public InputAction @Use2 => m_Wrapper.m_Normal_Use2; + public InputAction @SelectBait => m_Wrapper.m_Player_SelectBait; /// - /// Provides access to the underlying input action "Normal/SelectItem". + /// Provides access to the underlying input action "Player/SelectFood". /// - public InputAction @SelectItem => m_Wrapper.m_Normal_SelectItem; + public InputAction @SelectFood => m_Wrapper.m_Player_SelectFood; /// - /// Provides access to the underlying input action "Normal/SelectBait". + /// Provides access to the underlying input action "Player/UseTorch". /// - public InputAction @SelectBait => m_Wrapper.m_Normal_SelectBait; + public InputAction @UseTorch => m_Wrapper.m_Player_UseTorch; /// - /// Provides access to the underlying input action "Normal/SelectFood". + /// Provides access to the underlying input action "Player/UseTelescope". /// - public InputAction @SelectFood => m_Wrapper.m_Normal_SelectFood; + public InputAction @UseTelescope => m_Wrapper.m_Player_UseTelescope; /// - /// Provides access to the underlying input action "Normal/UseTorch". + /// Provides access to the underlying input action "Player/UseBrail". /// - public InputAction @UseTorch => m_Wrapper.m_Normal_UseTorch; + public InputAction @UseBrail => m_Wrapper.m_Player_UseBrail; /// - /// Provides access to the underlying input action "Normal/UseTelescope". + /// Provides access to the underlying input action "Player/AddBob". /// - public InputAction @UseTelescope => m_Wrapper.m_Normal_UseTelescope; + public InputAction @AddBob => m_Wrapper.m_Player_AddBob; /// - /// Provides access to the underlying input action "Normal/UseBrail". + /// Provides access to the underlying input action "Player/SubBob". /// - public InputAction @UseBrail => m_Wrapper.m_Normal_UseBrail; + public InputAction @SubBob => m_Wrapper.m_Player_SubBob; /// - /// Provides access to the underlying input action "Normal/AddBob". + /// Provides access to the underlying input action "Player/ToBag". /// - public InputAction @AddBob => m_Wrapper.m_Normal_AddBob; + public InputAction @ToBag => m_Wrapper.m_Player_ToBag; /// - /// Provides access to the underlying input action "Normal/SubBob". + /// Provides access to the underlying input action "Player/Help". /// - public InputAction @SubBob => m_Wrapper.m_Normal_SubBob; + public InputAction @Help => m_Wrapper.m_Player_Help; /// - /// Provides access to the underlying input action "Normal/ToBag". + /// Provides access to the underlying input action "Player/Chat". /// - public InputAction @ToBag => m_Wrapper.m_Normal_ToBag; + public InputAction @Chat => m_Wrapper.m_Player_Chat; /// - /// Provides access to the underlying input action "Normal/Help". + /// Provides access to the underlying input action "Player/Info". /// - public InputAction @Help => m_Wrapper.m_Normal_Help; + public InputAction @Info => m_Wrapper.m_Player_Info; /// - /// Provides access to the underlying input action "Normal/Chat". + /// Provides access to the underlying input action "Player/Skill". /// - public InputAction @Chat => m_Wrapper.m_Normal_Chat; + public InputAction @Skill => m_Wrapper.m_Player_Skill; /// - /// Provides access to the underlying input action "Normal/Info". + /// Provides access to the underlying input action "Player/OpenBag". /// - public InputAction @Info => m_Wrapper.m_Normal_Info; + public InputAction @OpenBag => m_Wrapper.m_Player_OpenBag; /// - /// Provides access to the underlying input action "Normal/Skill". + /// Provides access to the underlying input action "Player/Keepnet". /// - public InputAction @Skill => m_Wrapper.m_Normal_Skill; + public InputAction @Keepnet => m_Wrapper.m_Player_Keepnet; /// - /// Provides access to the underlying input action "Normal/OpenBag". + /// Provides access to the underlying input action "Player/Make". /// - public InputAction @OpenBag => m_Wrapper.m_Normal_OpenBag; + public InputAction @Make => m_Wrapper.m_Player_Make; /// - /// Provides access to the underlying input action "Normal/Keepnet". + /// Provides access to the underlying input action "Player/Map". /// - public InputAction @Keepnet => m_Wrapper.m_Normal_Keepnet; + public InputAction @Map => m_Wrapper.m_Player_Map; /// - /// Provides access to the underlying input action "Normal/Make". + /// Provides access to the underlying input action "Player/Quick1". /// - public InputAction @Make => m_Wrapper.m_Normal_Make; + public InputAction @Quick1 => m_Wrapper.m_Player_Quick1; /// - /// Provides access to the underlying input action "Normal/Map". + /// Provides access to the underlying input action "Player/Quick2". /// - public InputAction @Map => m_Wrapper.m_Normal_Map; + public InputAction @Quick2 => m_Wrapper.m_Player_Quick2; /// - /// Provides access to the underlying input action "Normal/Quick1". + /// Provides access to the underlying input action "Player/Quick3". /// - public InputAction @Quick1 => m_Wrapper.m_Normal_Quick1; + public InputAction @Quick3 => m_Wrapper.m_Player_Quick3; /// - /// Provides access to the underlying input action "Normal/Quick2". + /// Provides access to the underlying input action "Player/Quick4". /// - public InputAction @Quick2 => m_Wrapper.m_Normal_Quick2; + public InputAction @Quick4 => m_Wrapper.m_Player_Quick4; /// - /// Provides access to the underlying input action "Normal/Quick3". + /// Provides access to the underlying input action "Player/Quick5". /// - public InputAction @Quick3 => m_Wrapper.m_Normal_Quick3; + public InputAction @Quick5 => m_Wrapper.m_Player_Quick5; /// - /// Provides access to the underlying input action "Normal/Quick4". + /// Provides access to the underlying input action "Player/Quick6". /// - public InputAction @Quick4 => m_Wrapper.m_Normal_Quick4; + public InputAction @Quick6 => m_Wrapper.m_Player_Quick6; /// - /// Provides access to the underlying input action "Normal/Quick5". + /// Provides access to the underlying input action "Player/Quick7". /// - public InputAction @Quick5 => m_Wrapper.m_Normal_Quick5; + public InputAction @Quick7 => m_Wrapper.m_Player_Quick7; /// - /// Provides access to the underlying input action "Normal/Quick6". + /// Provides access to the underlying input action "Player/Quick8". /// - public InputAction @Quick6 => m_Wrapper.m_Normal_Quick6; + public InputAction @Quick8 => m_Wrapper.m_Player_Quick8; /// - /// Provides access to the underlying input action "Normal/Quick7". + /// Provides access to the underlying input action "Player/Quick9". /// - public InputAction @Quick7 => m_Wrapper.m_Normal_Quick7; + public InputAction @Quick9 => m_Wrapper.m_Player_Quick9; /// - /// Provides access to the underlying input action "Normal/Quick8". + /// Provides access to the underlying input action "Player/Use1". /// - public InputAction @Quick8 => m_Wrapper.m_Normal_Quick8; + public InputAction @Use1 => m_Wrapper.m_Player_Use1; /// - /// Provides access to the underlying input action "Normal/Quick9". + /// Provides access to the underlying input action "Player/Use2". /// - public InputAction @Quick9 => m_Wrapper.m_Normal_Quick9; - /// - /// Provides access to the underlying input action "Normal/Back". - /// - public InputAction @Back => m_Wrapper.m_Normal_Back; + public InputAction @Use2 => m_Wrapper.m_Player_Use2; /// /// Provides access to the underlying input action map instance. /// - public InputActionMap Get() { return m_Wrapper.m_Normal; } + public InputActionMap Get() { return m_Wrapper.m_Player; } /// public void Enable() { Get().Enable(); } /// @@ -1420,9 +1646,9 @@ namespace NBF /// public bool enabled => Get().enabled; /// - /// Implicitly converts an to an instance. + /// Implicitly converts an to an instance. /// - public static implicit operator InputActionMap(NormalActions set) { return set.Get(); } + public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); } /// /// Adds , and callbacks provided via on all input actions contained in this map. /// @@ -1430,11 +1656,11 @@ namespace NBF /// /// If is null or have already been added this method does nothing. /// - /// - public void AddCallbacks(INormalActions instance) + /// + public void AddCallbacks(IPlayerActions instance) { - if (instance == null || m_Wrapper.m_NormalActionsCallbackInterfaces.Contains(instance)) return; - m_Wrapper.m_NormalActionsCallbackInterfaces.Add(instance); + if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance); @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @@ -1456,12 +1682,6 @@ namespace NBF @Op2.started += instance.OnOp2; @Op2.performed += instance.OnOp2; @Op2.canceled += instance.OnOp2; - @Use.started += instance.OnUse; - @Use.performed += instance.OnUse; - @Use.canceled += instance.OnUse; - @Use2.started += instance.OnUse2; - @Use2.performed += instance.OnUse2; - @Use2.canceled += instance.OnUse2; @SelectItem.started += instance.OnSelectItem; @SelectItem.performed += instance.OnSelectItem; @SelectItem.canceled += instance.OnSelectItem; @@ -1540,9 +1760,12 @@ namespace NBF @Quick9.started += instance.OnQuick9; @Quick9.performed += instance.OnQuick9; @Quick9.canceled += instance.OnQuick9; - @Back.started += instance.OnBack; - @Back.performed += instance.OnBack; - @Back.canceled += instance.OnBack; + @Use1.started += instance.OnUse1; + @Use1.performed += instance.OnUse1; + @Use1.canceled += instance.OnUse1; + @Use2.started += instance.OnUse2; + @Use2.performed += instance.OnUse2; + @Use2.canceled += instance.OnUse2; } /// @@ -1551,8 +1774,8 @@ namespace NBF /// /// Calling this method when have not previously been registered has no side-effects. /// - /// - private void UnregisterCallbacks(INormalActions instance) + /// + private void UnregisterCallbacks(IPlayerActions instance) { @Move.started -= instance.OnMove; @Move.performed -= instance.OnMove; @@ -1575,12 +1798,6 @@ namespace NBF @Op2.started -= instance.OnOp2; @Op2.performed -= instance.OnOp2; @Op2.canceled -= instance.OnOp2; - @Use.started -= instance.OnUse; - @Use.performed -= instance.OnUse; - @Use.canceled -= instance.OnUse; - @Use2.started -= instance.OnUse2; - @Use2.performed -= instance.OnUse2; - @Use2.canceled -= instance.OnUse2; @SelectItem.started -= instance.OnSelectItem; @SelectItem.performed -= instance.OnSelectItem; @SelectItem.canceled -= instance.OnSelectItem; @@ -1659,18 +1876,21 @@ namespace NBF @Quick9.started -= instance.OnQuick9; @Quick9.performed -= instance.OnQuick9; @Quick9.canceled -= instance.OnQuick9; - @Back.started -= instance.OnBack; - @Back.performed -= instance.OnBack; - @Back.canceled -= instance.OnBack; + @Use1.started -= instance.OnUse1; + @Use1.performed -= instance.OnUse1; + @Use1.canceled -= instance.OnUse1; + @Use2.started -= instance.OnUse2; + @Use2.performed -= instance.OnUse2; + @Use2.canceled -= instance.OnUse2; } /// - /// Unregisters and unregisters all input action callbacks via . + /// Unregisters and unregisters all input action callbacks via . /// - /// - public void RemoveCallbacks(INormalActions instance) + /// + public void RemoveCallbacks(IPlayerActions instance) { - if (m_Wrapper.m_NormalActionsCallbackInterfaces.Remove(instance)) + if (m_Wrapper.m_PlayerActionsCallbackInterfaces.Remove(instance)) UnregisterCallbacks(instance); } @@ -1680,26 +1900,38 @@ namespace NBF /// /// If is null, calling this method will only unregister all existing callbacks but not register any new callbacks. /// - /// - /// - /// - public void SetCallbacks(INormalActions instance) + /// + /// + /// + public void SetCallbacks(IPlayerActions instance) { - foreach (var item in m_Wrapper.m_NormalActionsCallbackInterfaces) + foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces) UnregisterCallbacks(item); - m_Wrapper.m_NormalActionsCallbackInterfaces.Clear(); + m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear(); AddCallbacks(instance); } } /// - /// Provides a new instance referencing this action map. + /// Provides a new instance referencing this action map. /// - public NormalActions @Normal => new NormalActions(this); + public PlayerActions @Player => new PlayerActions(this); // UI private readonly InputActionMap m_UI; private List m_UIActionsCallbackInterfaces = new List(); private readonly InputAction m_UI_Roll; + private readonly InputAction m_UI_Back; + private readonly InputAction m_UI_Enter; + private readonly InputAction m_UI_Tab; + private readonly InputAction m_UI_Prev; + private readonly InputAction m_UI_Next; + private readonly InputAction m_UI_SubPrev; + private readonly InputAction m_UI_SubNext; + private readonly InputAction m_UI_Right; + private readonly InputAction m_UI_Left; + private readonly InputAction m_UI_Down; + private readonly InputAction m_UI_Up; + private readonly InputAction m_UI_Newaction; /// /// Provides access to input actions defined in input action map "UI". /// @@ -1716,6 +1948,54 @@ namespace NBF /// public InputAction @Roll => m_Wrapper.m_UI_Roll; /// + /// Provides access to the underlying input action "UI/Back". + /// + public InputAction @Back => m_Wrapper.m_UI_Back; + /// + /// Provides access to the underlying input action "UI/Enter". + /// + public InputAction @Enter => m_Wrapper.m_UI_Enter; + /// + /// Provides access to the underlying input action "UI/Tab". + /// + public InputAction @Tab => m_Wrapper.m_UI_Tab; + /// + /// Provides access to the underlying input action "UI/Prev". + /// + public InputAction @Prev => m_Wrapper.m_UI_Prev; + /// + /// Provides access to the underlying input action "UI/Next". + /// + public InputAction @Next => m_Wrapper.m_UI_Next; + /// + /// Provides access to the underlying input action "UI/SubPrev". + /// + public InputAction @SubPrev => m_Wrapper.m_UI_SubPrev; + /// + /// Provides access to the underlying input action "UI/SubNext". + /// + public InputAction @SubNext => m_Wrapper.m_UI_SubNext; + /// + /// Provides access to the underlying input action "UI/Right". + /// + public InputAction @Right => m_Wrapper.m_UI_Right; + /// + /// Provides access to the underlying input action "UI/Left". + /// + public InputAction @Left => m_Wrapper.m_UI_Left; + /// + /// Provides access to the underlying input action "UI/Down". + /// + public InputAction @Down => m_Wrapper.m_UI_Down; + /// + /// Provides access to the underlying input action "UI/Up". + /// + public InputAction @Up => m_Wrapper.m_UI_Up; + /// + /// Provides access to the underlying input action "UI/Newaction". + /// + public InputAction @Newaction => m_Wrapper.m_UI_Newaction; + /// /// Provides access to the underlying input action map instance. /// public InputActionMap Get() { return m_Wrapper.m_UI; } @@ -1744,6 +2024,42 @@ namespace NBF @Roll.started += instance.OnRoll; @Roll.performed += instance.OnRoll; @Roll.canceled += instance.OnRoll; + @Back.started += instance.OnBack; + @Back.performed += instance.OnBack; + @Back.canceled += instance.OnBack; + @Enter.started += instance.OnEnter; + @Enter.performed += instance.OnEnter; + @Enter.canceled += instance.OnEnter; + @Tab.started += instance.OnTab; + @Tab.performed += instance.OnTab; + @Tab.canceled += instance.OnTab; + @Prev.started += instance.OnPrev; + @Prev.performed += instance.OnPrev; + @Prev.canceled += instance.OnPrev; + @Next.started += instance.OnNext; + @Next.performed += instance.OnNext; + @Next.canceled += instance.OnNext; + @SubPrev.started += instance.OnSubPrev; + @SubPrev.performed += instance.OnSubPrev; + @SubPrev.canceled += instance.OnSubPrev; + @SubNext.started += instance.OnSubNext; + @SubNext.performed += instance.OnSubNext; + @SubNext.canceled += instance.OnSubNext; + @Right.started += instance.OnRight; + @Right.performed += instance.OnRight; + @Right.canceled += instance.OnRight; + @Left.started += instance.OnLeft; + @Left.performed += instance.OnLeft; + @Left.canceled += instance.OnLeft; + @Down.started += instance.OnDown; + @Down.performed += instance.OnDown; + @Down.canceled += instance.OnDown; + @Up.started += instance.OnUp; + @Up.performed += instance.OnUp; + @Up.canceled += instance.OnUp; + @Newaction.started += instance.OnNewaction; + @Newaction.performed += instance.OnNewaction; + @Newaction.canceled += instance.OnNewaction; } /// @@ -1758,6 +2074,42 @@ namespace NBF @Roll.started -= instance.OnRoll; @Roll.performed -= instance.OnRoll; @Roll.canceled -= instance.OnRoll; + @Back.started -= instance.OnBack; + @Back.performed -= instance.OnBack; + @Back.canceled -= instance.OnBack; + @Enter.started -= instance.OnEnter; + @Enter.performed -= instance.OnEnter; + @Enter.canceled -= instance.OnEnter; + @Tab.started -= instance.OnTab; + @Tab.performed -= instance.OnTab; + @Tab.canceled -= instance.OnTab; + @Prev.started -= instance.OnPrev; + @Prev.performed -= instance.OnPrev; + @Prev.canceled -= instance.OnPrev; + @Next.started -= instance.OnNext; + @Next.performed -= instance.OnNext; + @Next.canceled -= instance.OnNext; + @SubPrev.started -= instance.OnSubPrev; + @SubPrev.performed -= instance.OnSubPrev; + @SubPrev.canceled -= instance.OnSubPrev; + @SubNext.started -= instance.OnSubNext; + @SubNext.performed -= instance.OnSubNext; + @SubNext.canceled -= instance.OnSubNext; + @Right.started -= instance.OnRight; + @Right.performed -= instance.OnRight; + @Right.canceled -= instance.OnRight; + @Left.started -= instance.OnLeft; + @Left.performed -= instance.OnLeft; + @Left.canceled -= instance.OnLeft; + @Down.started -= instance.OnDown; + @Down.performed -= instance.OnDown; + @Down.canceled -= instance.OnDown; + @Up.started -= instance.OnUp; + @Up.performed -= instance.OnUp; + @Up.canceled -= instance.OnUp; + @Newaction.started -= instance.OnNewaction; + @Newaction.performed -= instance.OnNewaction; + @Newaction.canceled -= instance.OnNewaction; } /// @@ -1857,11 +2209,11 @@ namespace NBF } } /// - /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Normal" which allows adding and removing callbacks. + /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Player" which allows adding and removing callbacks. /// - /// - /// - public interface INormalActions + /// + /// + public interface IPlayerActions { /// /// Method invoked when associated input action "Move" is either , or . @@ -1913,20 +2265,6 @@ namespace NBF /// void OnOp2(InputAction.CallbackContext context); /// - /// Method invoked when associated input action "Use" is either , or . - /// - /// - /// - /// - void OnUse(InputAction.CallbackContext context); - /// - /// Method invoked when associated input action "Use2" is either , or . - /// - /// - /// - /// - void OnUse2(InputAction.CallbackContext context); - /// /// Method invoked when associated input action "SelectItem" is either , or . /// /// @@ -2109,12 +2447,19 @@ namespace NBF /// void OnQuick9(InputAction.CallbackContext context); /// - /// Method invoked when associated input action "Back" is either , or . + /// Method invoked when associated input action "Use1" is either , or . /// /// /// /// - void OnBack(InputAction.CallbackContext context); + void OnUse1(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Use2" is either , or . + /// + /// + /// + /// + void OnUse2(InputAction.CallbackContext context); } /// /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks. @@ -2130,6 +2475,90 @@ namespace NBF /// /// void OnRoll(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Back" is either , or . + /// + /// + /// + /// + void OnBack(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Enter" is either , or . + /// + /// + /// + /// + void OnEnter(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Tab" is either , or . + /// + /// + /// + /// + void OnTab(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Prev" is either , or . + /// + /// + /// + /// + void OnPrev(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Next" is either , or . + /// + /// + /// + /// + void OnNext(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "SubPrev" is either , or . + /// + /// + /// + /// + void OnSubPrev(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "SubNext" is either , or . + /// + /// + /// + /// + void OnSubNext(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Right" is either , or . + /// + /// + /// + /// + void OnRight(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Left" is either , or . + /// + /// + /// + /// + void OnLeft(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Down" is either , or . + /// + /// + /// + /// + void OnDown(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "Up" is either , or . + /// + /// + /// + /// + void OnUp(InputAction.CallbackContext context); + /// + /// Method invoked when associated input action "New action" is either , or . + /// + /// + /// + /// + void OnNewaction(InputAction.CallbackContext context); } } } diff --git a/Assets/Scripts/UI/Binders/CommonBinder.cs b/Assets/Scripts/UI/Binders/CommonBinder.cs index f4c98622e..e98c30322 100644 --- a/Assets/Scripts/UI/Binders/CommonBinder.cs +++ b/Assets/Scripts/UI/Binders/CommonBinder.cs @@ -8,9 +8,12 @@ namespace NBF { public static void BindAll() { + UIObjectFactory.SetPackageItemExtension(BottomMenu.URL, typeof(BottomMenu)); UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList)); UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu)); - UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem)); + UIObjectFactory.SetPackageItemExtension(BtnTitleInputControl.URL, typeof(BtnTitleInputControl)); + UIObjectFactory.SetPackageItemExtension(CommonSubMenu.URL, typeof(CommonSubMenu)); + UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl)); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button.meta b/Assets/Scripts/UI/Common/Button.meta new file mode 100644 index 000000000..e47e2f3d8 --- /dev/null +++ b/Assets/Scripts/UI/Common/Button.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e421fb97db2b48ccb37e75b8766265de +timeCreated: 1748071593 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs b/Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs similarity index 72% rename from Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs rename to Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs index f568b9ea2..d85ec69f6 100644 --- a/Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs +++ b/Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs @@ -7,17 +7,17 @@ using NBC; namespace NBF { - public partial class ListTitleItem + public partial class BtnInputControl { - public const string URL = "ui://6hgkvlauoomea"; + public const string URL = "ui://6hgkvlaur03ut"; - public GImage back; + public Controller show; public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); - back = (GImage)GetChild("back"); + show = GetController("show"); OnInited(); UILanguage.TrySetComponentLanguage(this); } diff --git a/Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs.meta b/Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs.meta new file mode 100644 index 000000000..6226cee6a --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: dfab5a485e648254dad616e988d7a17e \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnInputControl.cs b/Assets/Scripts/UI/Common/Button/BtnInputControl.cs new file mode 100644 index 000000000..3fbddb422 --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnInputControl.cs @@ -0,0 +1,15 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class BtnInputControl : GButton + { + private void OnInited() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnInputControl.cs.meta b/Assets/Scripts/UI/Common/Button/BtnInputControl.cs.meta new file mode 100644 index 000000000..9059df82c --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnInputControl.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9bc3045114c90ef4888ae8cd51aa1e2e \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs new file mode 100644 index 000000000..888385513 --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs @@ -0,0 +1,25 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + + +using FairyGUI; +using FairyGUI.Utils; +using NBC; + +namespace NBF +{ + public partial class BtnTitleInputControl + { + public const string URL = "ui://6hgkvlaur03uj0"; + + public Controller show; + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + show = GetController("show"); + OnInited(); + UILanguage.TrySetComponentLanguage(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs.meta b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs.meta new file mode 100644 index 000000000..ee85817e9 --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3a4cdcb09978fcd47b043fa05e53e433 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs new file mode 100644 index 000000000..abb81e718 --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs @@ -0,0 +1,19 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using System; +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class BtnTitleInputControl : GButton + { + public Action OnAction; + public string ActionName; + + private void OnInited() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs.meta b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs.meta new file mode 100644 index 000000000..fb9d3e2fa --- /dev/null +++ b/Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 15ebd24da667f9146bc2cfbfec56a512 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/ClassifyList.cs b/Assets/Scripts/UI/Common/ClassifyList.cs index 05d48d1fa..71489110d 100644 --- a/Assets/Scripts/UI/Common/ClassifyList.cs +++ b/Assets/Scripts/UI/Common/ClassifyList.cs @@ -11,18 +11,65 @@ namespace NBF public partial class ClassifyList : GComponent { private readonly List _listData = new List(); - + public event Action OnClickItem; - + + private int _columnsCount; + private void OnInited() { - List.itemProvider = GetListItemResource; - List.itemRenderer = OnRenderItem; - List.onClickItem.Add(OnClickListItem); + InputManager.OnUICanceled += OnUICanceled; } - public void SetListData(List listData,ListSelectionMode selectionMode = ListSelectionMode.Single) + public override void Dispose() { + InputManager.OnUICanceled -= OnUICanceled; + base.Dispose(); + } + + private void OnUICanceled(string action) + { + if (action == InputDef.UI.Right) + { + SetListSelected(List.selectedIndex + 1); + } + else if (action == InputDef.UI.Left) + { + SetListSelected(List.selectedIndex - 1); + } + else if (action == InputDef.UI.Up) + { + SetListSelected(List.selectedIndex - _columnsCount); + } + else if (action == InputDef.UI.Down) + { + if (List.selectedIndex < 0) + { + SetListSelected(0); + } + else + { + SetListSelected(List.selectedIndex + _columnsCount); + } + } + } + + private void SetListSelected(int selectedIndex) + { + if (selectedIndex >= 0 && selectedIndex < _listData.Count) + { + List.selectedIndex = selectedIndex; + List.ScrollToView(List.selectedIndex); + } + } + + public void SetListData(List listData, ListSelectionMode selectionMode = ListSelectionMode.Single) + { + List.selectedIndex = -1; + List.defaultItem = GetListDefaultItemResource(listData); + List.itemRenderer = OnRenderItem; + List.onClickItem.Add(OnClickListItem); + List.SetVirtual(); _listData.Clear(); foreach (var obj in listData) { @@ -32,13 +79,14 @@ namespace NBF List.selectionMode = selectionMode; List.numItems = _listData.Count; List.ScrollToView(0); + _columnsCount = 5; } void OnClickListItem(EventContext context) { OnClickItem?.Invoke(context.data); } - + void OnRenderItem(int index, GObject obj) { if (obj is ListItemBase item) @@ -48,20 +96,15 @@ namespace NBF } //根据索引的不同,返回不同的资源URL - string GetListItemResource(int index) + string GetListDefaultItemResource(List listData) { - var itemData = _listData[index]; - - if (itemData is ShopGearData shopItem) + var itemData = listData.Find(t => t != null); + + if (itemData is ShopGearData) { return ShopGearItem.URL; } - if (itemData is ListClassifyData item) - { - return ListTitleItem.URL; - } - return List.defaultItem; } } diff --git a/Assets/Scripts/UI/Common/CommonMenu.cs b/Assets/Scripts/UI/Common/CommonMenu.cs deleted file mode 100644 index 97ed54a47..000000000 --- a/Assets/Scripts/UI/Common/CommonMenu.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 - -using System; -using System.Collections.Generic; -using UnityEngine; -using FairyGUI; -using NBC; - -namespace NBF -{ - public partial class CommonMenu : GLabel - { - public event Action OnClose; - public event Action OnTabChange; - private void OnInited() - { - BtnClose.onClick.Add(OnClickClose); - List.onClickItem.Add(OnClickItem); - } - - public void SetTabs(List tabList,int selectIndex = 0) - { - List.RemoveChildrenToPool(); - for (int i = 0; i < tabList.Count; i++) - { - var tabData = tabList[i]; - var tabItem = List.AddItemFromPool().asButton; - tabItem.title = tabData.TabName; - } - Log.Info($"Set tab index={List.selectedIndex}"); - List.selectedIndex = selectIndex; - OnClickItem(); - } - - - private void OnClickItem() - { - OnTabChange?.Invoke(List.selectedIndex); - } - - private void OnClickClose() - { - OnClose?.Invoke(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/GMPanel.Designer.cs b/Assets/Scripts/UI/Common/GMPanel.Designer.cs index 5425cf8fb..35680f8bd 100644 --- a/Assets/Scripts/UI/Common/GMPanel.Designer.cs +++ b/Assets/Scripts/UI/Common/GMPanel.Designer.cs @@ -17,7 +17,7 @@ namespace NBF public GButton BtnOk; [AutoFind(Name = "Dir")] public GComboBox Dir; - public override string[] GetDependPackages(){ return new string[] {"Main"}; } + public override string[] GetDependPackages(){ return new string[] {}; } } diff --git a/Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs.meta b/Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs.meta deleted file mode 100644 index 755046038..000000000 --- a/Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 8042079334b43394ca275c4a2189dbfb \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/ListTitleItem.cs b/Assets/Scripts/UI/Common/Items/ListTitleItem.cs deleted file mode 100644 index b5605fb8a..000000000 --- a/Assets/Scripts/UI/Common/Items/ListTitleItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 - -using UnityEngine; -using FairyGUI; -using NBC; - -namespace NBF -{ - public partial class ListTitleItem : ListItemBase - { - public ListClassifyData ClassifyData; - private void OnInited() - { - } - - protected override void OnSetData(object showData) - { - width = parent.width - 40; - ClassifyData = showData as ListClassifyData; - if (ClassifyData == null) - { - ClassifyData = new ListClassifyData(string.Empty); - } - title = ClassifyData.Title; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/ListTitleItem.cs.meta b/Assets/Scripts/UI/Common/Items/ListTitleItem.cs.meta deleted file mode 100644 index b6211f138..000000000 --- a/Assets/Scripts/UI/Common/Items/ListTitleItem.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: d1c42293e0f4ae546ba4419aa2ed199c \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Items/TabListData.cs b/Assets/Scripts/UI/Common/Items/TabListData.cs deleted file mode 100644 index 1f55719d6..000000000 --- a/Assets/Scripts/UI/Common/Items/TabListData.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NBF -{ - public class TabListData - { - public string TabName; - public bool Selected; - public List ListData; - - public void AddTestData(int index) - { - ListData = new List(); - TabName = $"标题-{index + 1}"; - var count1 = Random.Range(5, 10); - var count2 = Random.Range(10, 30); - for (int i = 0; i < count1; i++) - { - ListData.Add(new ListClassifyData($"Title-{i}")); - for (int j = 0; j < count2; j++) - { - var item = new ShopGearData(); - item.title = $"Item {i}-" + j; - ListData.Add(item); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu.meta b/Assets/Scripts/UI/Common/Menu.meta new file mode 100644 index 000000000..9618d9660 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5d49e5e796ac4b4487b72a164e22ba73 +timeCreated: 1748093228 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs b/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs new file mode 100644 index 000000000..27824912a --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs @@ -0,0 +1,27 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + + +using FairyGUI; +using FairyGUI.Utils; +using NBC; + +namespace NBF +{ + public partial class BottomMenu + { + public const string URL = "ui://6hgkvlau9mf1z"; + + public GList List; + public GList LeftList; + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + List = (GList)GetChild("List"); + LeftList = (GList)GetChild("LeftList"); + OnInited(); + UILanguage.TrySetComponentLanguage(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs.meta b/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs.meta new file mode 100644 index 000000000..fc0a8718c --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 172ed53c6c409e04c8a993c9fae4c820 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/BottomMenu.cs b/Assets/Scripts/UI/Common/Menu/BottomMenu.cs new file mode 100644 index 000000000..68ed60fb4 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/BottomMenu.cs @@ -0,0 +1,79 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using System; +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class BottomMenu : GComponent + { + public event Action OnBack; + public event Action OnEnter; + public event Action OnTab; + public event Action OnUse; + + private void OnInited() + { + List.onClickItem.Add(OnClickItem); + } + + private void OnClickItem(EventContext context) + { + var item = context.data as BtnTitleInputControl; + if (item == null) return; + item.OnAction?.Invoke(); + } + + public void UnUse() + { + OnBack = null; + OnEnter = null; + OnTab = null; + OnUse = null; + + InputManager.OnUICanceled -= OnAction; + } + + public void Use() + { + List.RemoveChildrenToPool(); + LeftList.RemoveChildrenToPool(); + + InputManager.OnUICanceled += OnAction; + + AddButtonItem(OnUse, ""); + AddButtonItem(OnTab, InputDef.UI.Tab); + AddButtonItem(OnEnter, InputDef.UI.Enter); + AddButtonItem(OnBack, InputDef.UI.Back); + } + + private void AddButtonItem(Action action, string actionName) + { + if (action != null) + { + if (List.AddItemFromPool() is BtnTitleInputControl item) + { + item.OnAction = action; + item.ActionName = actionName; + } + } + } + + private void OnAction(string action) + { + var children = List.GetChildren(); + foreach (var child in children) + { + if (child is BtnTitleInputControl item) + { + if (action == item.ActionName) + { + item.OnAction?.Invoke(); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/BottomMenu.cs.meta b/Assets/Scripts/UI/Common/Menu/BottomMenu.cs.meta new file mode 100644 index 000000000..1fd6b3477 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/BottomMenu.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 94c5df4d4f05c2b40ad72c5c90008295 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/CommonMenu.Designer.cs b/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs similarity index 58% rename from Assets/Scripts/UI/Common/CommonMenu.Designer.cs rename to Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs index 3ef51e45f..4e79dcd2e 100644 --- a/Assets/Scripts/UI/Common/CommonMenu.Designer.cs +++ b/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs @@ -11,23 +11,19 @@ namespace NBF { public const string URL = "ui://6hgkvlaufcfggr"; - public GImage LongLine; public GList List; - public GButton Head; - public GTextField TextName; - public GComponent Currency; - public GButton BtnClose; + public GButton BtnUserHead; + public BtnInputControl BtnPrev; + public BtnInputControl BtnNext; public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); - LongLine = (GImage)GetChild("LongLine"); List = (GList)GetChild("List"); - Head = (GButton)GetChild("Head"); - TextName = (GTextField)GetChild("TextName"); - Currency = (GComponent)GetChild("Currency"); - BtnClose = (GButton)GetChild("BtnClose"); + BtnUserHead = (GButton)GetChild("BtnUserHead"); + BtnPrev = (BtnInputControl)GetChild("BtnPrev"); + BtnNext = (BtnInputControl)GetChild("BtnNext"); OnInited(); UILanguage.TrySetComponentLanguage(this); } diff --git a/Assets/Scripts/UI/Common/CommonMenu.Designer.cs.meta b/Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/CommonMenu.Designer.cs.meta rename to Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs.meta diff --git a/Assets/Scripts/UI/Common/Menu/CommonMenu.cs b/Assets/Scripts/UI/Common/Menu/CommonMenu.cs new file mode 100644 index 000000000..c5abdf08e --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/CommonMenu.cs @@ -0,0 +1,98 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using System; +using System.Collections.Generic; +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class CommonMenu : GLabel + { + public event Action OnTabChange; + + private void OnInited() + { + List.onClickItem.Add(OnClickItem); + BtnPrev.onClick.Add(OnClickBtnPrev); + BtnNext.onClick.Add(OnClickBtnNext); + + InputManager.OnUICanceled += OnUICanceled; + } + + public override void Dispose() + { + InputManager.OnUICanceled -= OnUICanceled; + base.Dispose(); + } + + private void OnUICanceled(string action) + { + if (action == InputDef.UI.Prev) + { + OnClickBtnPrev(); + } + else if (action == InputDef.UI.Next) + { + OnClickBtnNext(); + } + } + + public void SetTabs(List tabList, int selectIndex = 0) + { + List.RemoveChildrenToPool(); + var width = 0f; + for (int i = 0; i < tabList.Count; i++) + { + var tabData = tabList[i]; + var tabItem = List.AddItemFromPool().asButton; + tabItem.title = tabData.Tab.Name; + width += tabItem.width; + if (i > 0) + { + width += List.columnGap; + } + } + + Log.Info($"Set tab index={List.selectedIndex}"); + List.selectedIndex = selectIndex; + List.width = width; + OnClickItem(); + } + + + private void OnClickItem() + { + OnTabChange?.Invoke(List.selectedIndex); + } + + private void OnClickBtnPrev() + { + if (List.selectedIndex > 0) + { + List.selectedIndex -= 1; + } + else + { + List.selectedIndex = List.numItems - 1; + } + + OnClickItem(); + } + + private void OnClickBtnNext() + { + if (List.selectedIndex < List.numItems - 1) + { + List.selectedIndex += 1; + } + else + { + List.selectedIndex = 0; + } + + OnClickItem(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/CommonMenu.cs.meta b/Assets/Scripts/UI/Common/Menu/CommonMenu.cs.meta similarity index 100% rename from Assets/Scripts/UI/Common/CommonMenu.cs.meta rename to Assets/Scripts/UI/Common/Menu/CommonMenu.cs.meta diff --git a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs new file mode 100644 index 000000000..c9ba0b165 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs @@ -0,0 +1,29 @@ +/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/ + + +using FairyGUI; +using FairyGUI.Utils; +using NBC; + +namespace NBF +{ + public partial class CommonSubMenu + { + public const string URL = "ui://6hgkvlaur03us"; + + public GList List; + public BtnInputControl BtnPrev; + public BtnInputControl BtnNext; + + public override void ConstructFromXML(XML xml) + { + base.ConstructFromXML(xml); + + List = (GList)GetChild("List"); + BtnPrev = (BtnInputControl)GetChild("BtnPrev"); + BtnNext = (BtnInputControl)GetChild("BtnNext"); + OnInited(); + UILanguage.TrySetComponentLanguage(this); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs.meta b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs.meta new file mode 100644 index 000000000..d268ddbee --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4b9116bdcaaf42e4ea12741ceab85742 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs new file mode 100644 index 000000000..18ab2da27 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs @@ -0,0 +1,98 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using System; +using System.Collections.Generic; +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class CommonSubMenu : GComponent + { + public event Action OnTabChange; + + private void OnInited() + { + List.onClickItem.Add(OnClickItem); + BtnPrev.onClick.Add(OnClickBtnPrev); + BtnNext.onClick.Add(OnClickBtnNext); + + InputManager.OnUICanceled += OnUICanceled; + } + + public override void Dispose() + { + InputManager.OnUICanceled -= OnUICanceled; + base.Dispose(); + } + + private void OnUICanceled(string action) + { + if (action == InputDef.UI.SubPrev) + { + OnClickBtnPrev(); + } + else if (action == InputDef.UI.SubNext) + { + OnClickBtnNext(); + } + } + + public void SetTabs(List subItems, int selectIndex = 0) + { + List.RemoveChildrenToPool(); + var width = 0f; + for (int i = 0; i < subItems.Count; i++) + { + var tabData = subItems[i]; + var tabItem = List.AddItemFromPool().asButton; + tabItem.title = tabData.Name; + width += tabItem.width; + if (i > 0) + { + width += List.columnGap; + } + } + + Log.Info($"Set tab index={List.selectedIndex}"); + List.selectedIndex = selectIndex; + List.width = width; + OnClickItem(); + } + + + private void OnClickItem() + { + OnTabChange?.Invoke(List.selectedIndex); + } + + private void OnClickBtnPrev() + { + if (List.selectedIndex > 0) + { + List.selectedIndex -= 1; + } + else + { + List.selectedIndex = List.numItems - 1; + } + + OnClickItem(); + } + + private void OnClickBtnNext() + { + if (List.selectedIndex < List.numItems - 1) + { + List.selectedIndex += 1; + } + else + { + List.selectedIndex = 0; + } + + OnClickItem(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs.meta b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs.meta new file mode 100644 index 000000000..2f160e530 --- /dev/null +++ b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 93621bc99ea075a4089f13224578d4ef \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/MessageBox.Designer.cs b/Assets/Scripts/UI/Common/MessageBox.Designer.cs new file mode 100644 index 000000000..197578865 --- /dev/null +++ b/Assets/Scripts/UI/Common/MessageBox.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 MessageBox + { + public GObject this[string aKey] => ContentPane.GetChild(aKey); + [AutoFind(Name = "back")] + public GImage back; + [AutoFind(Name = "box")] + public GImage box; + [AutoFind(Name = "TextTitle")] + public GTextField TextTitle; + [AutoFind(Name = "TextContent")] + public GTextField TextContent; + [AutoFind(Name = "BtnConfirm")] + public BtnTitleInputControl BtnConfirm; + [AutoFind(Name = "BtnCancel")] + public BtnTitleInputControl BtnCancel; + public override string[] GetDependPackages(){ return new string[] {}; } + + + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/MessageBox.Designer.cs.meta b/Assets/Scripts/UI/Common/MessageBox.Designer.cs.meta new file mode 100644 index 000000000..b3f6afbb9 --- /dev/null +++ b/Assets/Scripts/UI/Common/MessageBox.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7ce689c460bfe8245948899939807a59 \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/MessageBox.cs b/Assets/Scripts/UI/Common/MessageBox.cs index 2cb76111c..68a4b03d8 100644 --- a/Assets/Scripts/UI/Common/MessageBox.cs +++ b/Assets/Scripts/UI/Common/MessageBox.cs @@ -1,9 +1,33 @@ -namespace NBF +// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 + +using UnityEngine; +using NBC; + +namespace NBF { - public class MessageBox + public partial class MessageBox : UIPanel { - public static void Show(string text) + public override string UIPackName => "Common"; + public override string UIResName => "MessageBox"; + + protected override void OnInit() { + base.OnInit(); + } + + protected override void OnShow() + { + base.OnShow(); + } + + protected override void OnHide() + { + base.OnHide(); + } + + protected override void OnDestroy() + { + base.OnDestroy(); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Common/MessageBox.cs.meta b/Assets/Scripts/UI/Common/MessageBox.cs.meta index f82d04628..91cf86eaa 100644 --- a/Assets/Scripts/UI/Common/MessageBox.cs.meta +++ b/Assets/Scripts/UI/Common/MessageBox.cs.meta @@ -1,3 +1,2 @@ fileFormatVersion: 2 -guid: 8e4609ff88d94fa8ad77c3cb17641809 -timeCreated: 1742483434 \ No newline at end of file +guid: 8e4609ff88d94fa8ad77c3cb17641809 \ No newline at end of file diff --git a/Assets/Scripts/UI/Fishing/FishingPanel.cs b/Assets/Scripts/UI/Fishing/FishingPanel.cs index 0fccbe55b..3fde7ddf6 100644 --- a/Assets/Scripts/UI/Fishing/FishingPanel.cs +++ b/Assets/Scripts/UI/Fishing/FishingPanel.cs @@ -15,8 +15,9 @@ namespace NBF { base.OnShow(); InputManager.OnInteractiveObjectAction += OnInteractiveObjectAction; - InputManager.OnUseAction += OnUseAction; - InputManager.OnUse2Action += OnUse2Action; + InputManager.OnPlayerCanceled += OnPlayerCanceled; + // InputManager.OnUseAction += OnUseAction; + // InputManager.OnUse2Action += OnUse2Action; } protected override void OnUpdate() @@ -38,28 +39,27 @@ namespace NBF } } - private void OnUseAction() + private void OnPlayerCanceled(string action) { if (Interactive.visible) { - Interactive.Use1(); + if (action == "Use1") + { + Interactive.Use1(); + } + else if (action == "Use2") + { + Interactive.Use2(); + } } } - private void OnUse2Action() - { - if (Interactive.visible) - { - Interactive.Use2(); - } - } protected override void OnHide() { base.OnHide(); InputManager.OnInteractiveObjectAction -= OnInteractiveObjectAction; - InputManager.OnUseAction -= OnUseAction; - InputManager.OnUse2Action -= OnUse2Action; + InputManager.OnUICanceled -= OnPlayerCanceled; } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs b/Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs index 32b1b893f..91d28edbc 100644 --- a/Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs +++ b/Assets/Scripts/UI/Shops/FishingShopPanel.Designer.cs @@ -15,10 +15,14 @@ namespace NBF public GImage back; [AutoFind(Name = "Menu")] public CommonMenu Menu; - [AutoFind(Name = "divisionLine")] - public GImage divisionLine; + [AutoFind(Name = "SubMenu")] + public CommonSubMenu SubMenu; [AutoFind(Name = "List")] public ClassifyList List; + [AutoFind(Name = "Currencys")] + public GComponent Currencys; + [AutoFind(Name = "BottomMenu")] + public BottomMenu BottomMenu; public override string[] GetDependPackages(){ return new string[] {"Common"}; } diff --git a/Assets/Scripts/UI/Shops/FishingShopPanel.cs b/Assets/Scripts/UI/Shops/FishingShopPanel.cs index 54b505f8d..f56aff711 100644 --- a/Assets/Scripts/UI/Shops/FishingShopPanel.cs +++ b/Assets/Scripts/UI/Shops/FishingShopPanel.cs @@ -7,7 +7,6 @@ using UIPanel = NBC.UIPanel; namespace NBF { - public class ShopGearData { public string title; @@ -18,14 +17,13 @@ namespace NBF public override string UIPackName => "Shop"; public override string UIResName => "FishingShopPanel"; - private List _tabList = new List(); - + private TabListData _currentTab; + protected override void OnInit() { base.OnInit(); this.AutoAddClick(OnClick); - Menu.OnClose += Hide; for (int i = 0; i < 10; i++) { @@ -35,7 +33,7 @@ namespace NBF } Menu.OnTabChange += ChangeTab; - + SubMenu.OnTabChange += ChangeSubTab; List.OnClickItem += OnClickItem; } @@ -43,23 +41,35 @@ namespace NBF { base.OnShow(); Menu.SetTabs(_tabList); + UseBottomMenu(); } + private void UseBottomMenu() + { + BottomMenu.OnBack += Hide; + BottomMenu.Use(); + } private void ChangeTab(int index) { Log.Info($"Change tab index={index}"); - var listData = _tabList[index]; - List.SetListData(listData.ListData); + var tabListData = _tabList[index]; + _currentTab = tabListData; + SubMenu.SetTabs(_currentTab.SubTab); } + private void ChangeSubTab(int index) + { + var subList = _currentTab.SubTab[index]; + List.SetListData(subList.Items); + } private void OnClickItem(object item) { - if(item is not ShopGearItem shopGearItem) return; + if (item is not ShopGearItem shopGearItem) return; Log.Info($"click item ={shopGearItem.GearData.title}"); } - + private void OnClick(GComponent btn) { // if (btn == BtnClose) @@ -71,11 +81,14 @@ namespace NBF protected override void OnHide() { base.OnHide(); + BottomMenu.UnUse(); } protected override void OnDestroy() { base.OnDestroy(); + Menu.OnTabChange -= ChangeTab; + SubMenu.OnTabChange -= ChangeSubTab; } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs index 726c5f1a9..cc2fc04ef 100644 --- a/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs +++ b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs @@ -11,15 +11,15 @@ namespace NBF { public const string URL = "ui://146ra2lqoome9"; - public GGraph select; - public GGraph over; + public GImage back; + public GImage ba; public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); - select = (GGraph)GetChild("select"); - over = (GGraph)GetChild("over"); + back = (GImage)GetChild("back"); + ba = (GImage)GetChild("ba"); OnInited(); UILanguage.TrySetComponentLanguage(this); } diff --git a/FGUIProject/assets/Common/Com/Buttons/BtnIcon.xml b/FGUIProject/assets/Common/Com/Buttons/BtnIcon.xml index a445cf0fb..7acbc937e 100644 --- a/FGUIProject/assets/Common/Com/Buttons/BtnIcon.xml +++ b/FGUIProject/assets/Common/Com/Buttons/BtnIcon.xml @@ -1,7 +1,7 @@ - + - + diff --git a/FGUIProject/assets/Common/Com/Buttons/BtnIcon2.xml b/FGUIProject/assets/Common/Com/Buttons/BtnIcon2.xml index 8e2a17c51..fa4ce501f 100644 --- a/FGUIProject/assets/Common/Com/Buttons/BtnIcon2.xml +++ b/FGUIProject/assets/Common/Com/Buttons/BtnIcon2.xml @@ -1,12 +1,15 @@ - + + - + + + - + -