浏览代码

Change Tab in inventory with Left/right shoulder and T/Y keyboard buttons

/UI
uChema 4 年前
当前提交
9ac17dff
共有 9 个文件被更改,包括 396 次插入148 次删除
  1. 6
      UOP1_Project/Assets/Prefabs/UI/IngredientTypeTab.prefab
  2. 328
      UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab
  3. 84
      UOP1_Project/Assets/Scripts/Input/GameInput.cs
  4. 8
      UOP1_Project/Assets/Scripts/Input/InputReader.cs
  5. 3
      UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs
  6. 33
      UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs
  7. 6
      UOP1_Project/Assets/Scripts/UI/InventoryTypeTabFiller.cs
  8. 2
      UOP1_Project/Assets/Scripts/UI/InventoryTypeTabsFiller.cs
  9. 74
      UOP1_Project/Assets/Settings/Input/GameInput.inputactions

6
UOP1_Project/Assets/Prefabs/UI/IngredientTypeTab.prefab


m_Material: {fileID: 0}
m_Color: {r: 0.7176471, g: 0.61960787, b: 0.48235297, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 0.8470589, g: 0.8117648, b: 0.6784314, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

m_Material: {fileID: 0}
m_Color: {r: 0.93725497, g: 0.89019614, b: 0.75294125, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

328
UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab


type: 2}
OnInteractionEndedEvent: {fileID: 11400000, guid: c499d87f35465124f8fb2751b150430d,
type: 2}
_inputReader: {fileID: 11400000, guid: 945ec0365077176418488737deed54be, type: 2}
--- !u!1001 &26049570273333792
PrefabInstance:
m_ObjectHideFlags: 0

- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}

- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
value: 209.712
value: 0
value: 86.98242
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}

- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 515.28
value: 0
value: -43.49121
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}

m_Modification:
m_TransformParent: {fileID: 3398811818344379138}
m_Modifications:
- target: {fileID: 1450876744703651131, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1770665521570306422, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_fontSize

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
value: 0
value: 769.824
value: 0
value: 138.96478
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 384.912
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4053715063122458854, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 483.63998
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 5663074510775698892, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 6117516323272882909, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 88.728
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 6284766384174538896, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 8684897513429970688, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 286.184
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 8886944926927287629, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 9095186734729422978, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 681.09595
value: 0
value: -69.48239
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3899a1f923ed45d9a4474970d199c2d, type: 3}

m_Modification:
m_TransformParent: {fileID: 3398811818344379138}
m_Modifications:
- target: {fileID: 1450876744703651131, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1770665521570306422, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_fontSize

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
value: 0
value: 769.824
value: 0
value: 138.96478
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 384.912
value: 0
value: -546.3767
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 5166989485288387228, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 483.63998
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 5663074510775698892, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 6117516323272882909, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 88.728
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 6284766384174538896, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 8684897513429970688, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 286.184
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 8886944926927287629, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 9095186734729422978, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 681.09595
value: 0
value: -69.48239
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3899a1f923ed45d9a4474970d199c2d, type: 3}

m_Modification:
m_TransformParent: {fileID: 3398811818344379138}
m_Modifications:
- target: {fileID: 536932857582462330, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1450876744703651131, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1770665521570306422, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_fontSize

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
value: 0
value: 769.824
value: 0
value: 138.96478
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 384.912
value: 0
value: -228.44717
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4053715063122458854, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4539589103189933924, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 483.63998
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 5663074510775698892, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 6117516323272882909, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 88.728
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 6284766384174538896, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 8684897513429970688, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 286.184
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 8886944926927287629, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 9095186734729422978, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 681.09595
value: 0
value: -69.48239
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3899a1f923ed45d9a4474970d199c2d, type: 3}

propertyPath: m_AnchoredPosition.y
value: -8.200001
objectReference: {fileID: 0}
- target: {fileID: 6416758842641707247, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_Colors.m_DisabledColor.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6416758842641707247, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_Colors.m_DisabledColor.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6416758842641707247, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_Colors.m_DisabledColor.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6492197638988460448, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
propertyPath: m_AnchoredPosition.y

m_Modification:
m_TransformParent: {fileID: 3398811818344379138}
m_Modifications:
- target: {fileID: 1450876744703651131, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1770665521570306422, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_fontSize

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
value: 0
value: 769.824
value: 0
value: 138.96478
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 384.912
value: 0
value: -387.41196
objectReference: {fileID: 0}
- target: {fileID: 3187641457548150208, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 5166989485288387228, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 483.63998
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 5663074510775698892, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 6117516323272882909, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 88.728
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 6284766384174538896, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 8684897513429970688, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 286.184
value: 0
value: -69.48239
objectReference: {fileID: 0}
- target: {fileID: 8886944926927287629, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}

- target: {fileID: 9095186734729422978, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 177.456
value: 0
value: 138.96478
value: 0
value: 681.09595
value: 0
value: -69.48239
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3899a1f923ed45d9a4474970d199c2d, type: 3}

m_Modification:
m_TransformParent: {fileID: 5474758}
m_Modifications:
- target: {fileID: 3075151336614838516, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
propertyPath: m_UpdateString.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: TMPro.TextMeshProUGUI, Unity.TextMeshPro
objectReference: {fileID: 0}
- target: {fileID: 5165518043205338994, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
propertyPath: m_text
value: No translation found for 'New Entry' in Scene Names
objectReference: {fileID: 0}
- target: {fileID: 5985630588229285392, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
propertyPath: m_UpdateString.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: TMPro.TextMeshProUGUI, Unity.TextMeshPro
objectReference: {fileID: 0}
- target: {fileID: 7499314617860786457, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
propertyPath: m_Pivot.x

type: 3}
propertyPath: m_Name
value: Inventory Inspector
objectReference: {fileID: 0}
- target: {fileID: 7702129798801179661, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
propertyPath: m_text
value: No translation found for 'New Entry' in Scene Names
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b1676cd460f4f4cc7a197021499c80d8, type: 3}

84
UOP1_Project/Assets/Scripts/Input/GameInput.cs


""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""ChangeTab"",
""type"": ""Button"",
""id"": ""abff37db-1fb3-4f26-bceb-8ecdfc99fdef"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [

""action"": ""MouseMove"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""LeftRight Shoulder"",
""id"": ""97d06ecb-7982-4ca0-8cc2-3b6ad8c1a4da"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""ChangeTab"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""Negative"",
""id"": ""d5251bc5-8e6d-4a72-ae0d-daf1dfb91ec1"",
""path"": ""<Gamepad>/leftShoulder"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""ChangeTab"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""Positive"",
""id"": ""7ef21289-1815-4412-9169-7c38cb932530"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""ChangeTab"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""LeftRight [Keyboard]"",
""id"": ""f5ee1475-34c9-440e-97c2-81c7ba9165c9"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""ChangeTab"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""bffa4ad8-a1e1-492b-bcad-c12571cac8c4"",
""path"": ""<Keyboard>/t"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""ChangeTab"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""23952932-013c-4b7c-ae49-c5c1fd00f5e8"",
""path"": ""<Keyboard>/y"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardOrGamepad"",
""action"": ""ChangeTab"",
""isComposite"": false,
""isPartOfComposite"": true
}
]
},

m_Menus_Cancel = m_Menus.FindAction("Cancel", throwIfNotFound: true);
m_Menus_MouseMove = m_Menus.FindAction("MouseMove", throwIfNotFound: true);
m_Menus_Unpause = m_Menus.FindAction("Unpause", throwIfNotFound: true);
m_Menus_ChangeTab = m_Menus.FindAction("ChangeTab", throwIfNotFound: true);
// Dialogues
m_Dialogues = asset.FindActionMap("Dialogues", throwIfNotFound: true);
m_Dialogues_MoveSelection = m_Dialogues.FindAction("MoveSelection", throwIfNotFound: true);

private readonly InputAction m_Menus_Cancel;
private readonly InputAction m_Menus_MouseMove;
private readonly InputAction m_Menus_Unpause;
private readonly InputAction m_Menus_ChangeTab;
public struct MenusActions
{
private @GameInput m_Wrapper;

public InputAction @Cancel => m_Wrapper.m_Menus_Cancel;
public InputAction @MouseMove => m_Wrapper.m_Menus_MouseMove;
public InputAction @Unpause => m_Wrapper.m_Menus_Unpause;
public InputAction @ChangeTab => m_Wrapper.m_Menus_ChangeTab;
public InputActionMap Get() { return m_Wrapper.m_Menus; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }

@Unpause.started -= m_Wrapper.m_MenusActionsCallbackInterface.OnUnpause;
@Unpause.performed -= m_Wrapper.m_MenusActionsCallbackInterface.OnUnpause;
@Unpause.canceled -= m_Wrapper.m_MenusActionsCallbackInterface.OnUnpause;
@ChangeTab.started -= m_Wrapper.m_MenusActionsCallbackInterface.OnChangeTab;
@ChangeTab.performed -= m_Wrapper.m_MenusActionsCallbackInterface.OnChangeTab;
@ChangeTab.canceled -= m_Wrapper.m_MenusActionsCallbackInterface.OnChangeTab;
}
m_Wrapper.m_MenusActionsCallbackInterface = instance;
if (instance != null)

@Unpause.started += instance.OnUnpause;
@Unpause.performed += instance.OnUnpause;
@Unpause.canceled += instance.OnUnpause;
@ChangeTab.started += instance.OnChangeTab;
@ChangeTab.performed += instance.OnChangeTab;
@ChangeTab.canceled += instance.OnChangeTab;
}
}
}

void OnCancel(InputAction.CallbackContext context);
void OnMouseMove(InputAction.CallbackContext context);
void OnUnpause(InputAction.CallbackContext context);
void OnChangeTab(InputAction.CallbackContext context);
}
public interface IDialoguesActions
{

8
UOP1_Project/Assets/Scripts/Input/InputReader.cs


public event UnityAction menuCancelEvent = delegate { };
public event UnityAction menuUnpauseEvent = delegate { };
public event UnityAction<float> menuSwitchTab = delegate { };
private GameInput gameInput;

gameInput.Gameplay.Disable();
gameInput.Menus.Disable();
gameInput.Dialogues.Disable();
}
public void OnChangeTab(InputAction.CallbackContext context)
{
if (context.phase == InputActionPhase.Performed)
menuSwitchTab.Invoke(context.ReadValue<float>());
}
public bool LeftMouseDown() => Mouse.current.leftButton.isPressed;

3
UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs


_currentItem = itemStack;
_imgSelected.gameObject.SetActive(isSelected);
if (itemStack.Item.IsLocalized)
{
_bgLocalizedImage.enabled = true;

public void SelectFirstElement()
{
_itemButton.Select();
SelectItem();
}
public void HoverItem()

}
public void SelectItem()
{
_imgSelected.gameObject.SetActive(true);
_currentItemEvent.RaiseEvent(_currentItem.Item);

33
UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs


List<InventoryTabType> tabTypesList = new List<InventoryTabType>();
private int selectedItemId = -1;
[SerializeField]
private List<InventoryItemFiller> _instanciatedItems = default;

[SerializeField]
private VoidEventChannelSO OnInteractionEndedEvent = default;
[SerializeField]
private InputReader _inputReader = default;
private void OnEnable()
{
//Check if the event exists to avoid errors

{
OnInteractionEndedEvent.OnEventRaised += InteractionEnded;
}
_inputReader.menuSwitchTab += SwitchTab;
}
private void OnDisable()

}
}
public void SwitchTab(float orientation)
{
if(orientation!=0)
{
bool isLeft = orientation < 0;
int initialIndex = tabTypesList.FindIndex(o => o == selectedTab);
if (initialIndex != -1)
{
if (isLeft)
{
initialIndex--;
}
else
{
initialIndex++;
}
initialIndex= Mathf.Clamp(initialIndex, 0, tabTypesList.Count-1);
}
ChangeTabEventRaised(tabTypesList[initialIndex]);
}
}
bool isNearPot = false;
public void FillInventory(TabType _selectedTabType = TabType.none, bool _isNearPot = false)

{
_instanciatedItems[0].SelectFirstElement();
}
}
public void UpdateOnItemInInventory(ItemStack itemToUpdate, bool removeItem)
{

6
UOP1_Project/Assets/Scripts/UI/InventoryTypeTabFiller.cs


[SerializeField] private Color _deselectedIconColor = default;
public void fillTab(InventoryTabType tabType, bool isSelected, TabEventChannelSO changeTabEvent)
public void fillTab(InventoryTabType tabType, bool isSelected)
{
_tabImage.sprite = tabType.TabIcon;

_tabImage.color = _deselectedIconColor;
}
_actionButton.onClick.RemoveAllListeners();
_actionButton.onClick.AddListener(() => changeTabEvent.RaiseEvent(tabType));
/* _actionButton.onClick.RemoveAllListeners();
_actionButton.onClick.AddListener(() => changeTabEvent.RaiseEvent(tabType));*/
}
}

2
UOP1_Project/Assets/Scripts/UI/InventoryTypeTabsFiller.cs


}
bool isSelected = typesList[i] == selectedType;
//fill
instantiatedGameObjects[i].fillTab(typesList[i], isSelected, changeTabEvent);
instantiatedGameObjects[i].fillTab(typesList[i], isSelected);
instantiatedGameObjects[i].gameObject.SetActive(true);
}

74
UOP1_Project/Assets/Settings/Input/GameInput.inputactions


"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "ChangeTab",
"type": "Button",
"id": "abff37db-1fb3-4f26-bceb-8ecdfc99fdef",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [

"action": "MouseMove",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "LeftRight Shoulder",
"id": "97d06ecb-7982-4ca0-8cc2-3b6ad8c1a4da",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "ChangeTab",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "d5251bc5-8e6d-4a72-ae0d-daf1dfb91ec1",
"path": "<Gamepad>/leftShoulder",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "ChangeTab",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "7ef21289-1815-4412-9169-7c38cb932530",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "ChangeTab",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "LeftRight [Keyboard]",
"id": "f5ee1475-34c9-440e-97c2-81c7ba9165c9",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "ChangeTab",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "bffa4ad8-a1e1-492b-bcad-c12571cac8c4",
"path": "<Keyboard>/t",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "ChangeTab",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "23952932-013c-4b7c-ae49-c5c1fd00f5e8",
"path": "<Keyboard>/y",
"interactions": "",
"processors": "",
"groups": "KeyboardOrGamepad",
"action": "ChangeTab",
"isComposite": false,
"isPartOfComposite": true
}
]
},

正在加载...
取消
保存