From 1053225b1397fb9e5d57dc7c9656fac04e6fd5c3 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Mon, 31 Mar 2025 16:26:58 +0000
Subject: [PATCH] #14 added item delete in inventoryUI
---
Assets/Scenes/GameplayScene.unity | 425 +++++++++++++++++++++++++++++++++++++++++++++++++++-
Assets/Scripts/Inventory/InventoryDisplay.cs | 19 ++
Assets/Prefabs/UI/ItemUI.prefab | 11
3 files changed, 436 insertions(+), 19 deletions(-)
diff --git a/Assets/Prefabs/UI/ItemUI.prefab b/Assets/Prefabs/UI/ItemUI.prefab
index 5f4e2ea..1b49567 100644
--- a/Assets/Prefabs/UI/ItemUI.prefab
+++ b/Assets/Prefabs/UI/ItemUI.prefab
@@ -120,9 +120,9 @@
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
- m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
- m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
- m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_HighlightedColor: {r: 0.6698113, g: 0.6698113, b: 0.6698113, a: 1}
+ m_PressedColor: {r: 0.4056604, g: 0.4056604, b: 0.4056604, a: 1}
+ m_SelectedColor: {r: 0.6886792, g: 0.6886792, b: 0.6886792, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
@@ -138,7 +138,7 @@
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
- m_TargetGraphic: {fileID: 0}
+ m_TargetGraphic: {fileID: 3979763182058059211}
m_OnClick:
m_PersistentCalls:
m_Calls: []
@@ -154,6 +154,7 @@
m_Script: {fileID: 11500000, guid: 519c952913e3ff344a7b23eb0020d6ca, type: 3}
m_Name:
m_EditorClassIdentifier:
+ itemUIType: 0
--- !u!1 &4844031224436336669
GameObject:
m_ObjectHideFlags: 0
@@ -474,7 +475,7 @@
m_Sprite: {fileID: 21300000, guid: ee4fb235c7b0280489a009cd8810dfd7, type: 3}
m_Type: 1
m_PreserveAspect: 0
- m_FillCenter: 1
+ m_FillCenter: 0
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
diff --git a/Assets/Scenes/GameplayScene.unity b/Assets/Scenes/GameplayScene.unity
index 7d51027..ccee56c 100644
--- a/Assets/Scenes/GameplayScene.unity
+++ b/Assets/Scenes/GameplayScene.unity
@@ -361,6 +361,269 @@
m_CameraActivatedEvent:
m_PersistentCalls:
m_Calls: []
+--- !u!1 &530984087
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 530984088}
+ - component: {fileID: 530984091}
+ - component: {fileID: 530984090}
+ - component: {fileID: 530984089}
+ m_Layer: 0
+ m_Name: DeleteItem
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &530984088
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 530984087}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children:
+ - {fileID: 1317463991}
+ m_Father: {fileID: 574500702}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 1, y: 0.5}
+ m_AnchorMax: {x: 1, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 50, y: 50}
+ m_Pivot: {x: 1, y: 0.5}
+--- !u!114 &530984089
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 530984087}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_WrapAround: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 1}
+ m_PressedColor: {r: 0.3207547, g: 0.3207547, b: 0.3207547, a: 1}
+ m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_SelectedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_SelectedTrigger: Selected
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 530984090}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 7398061984209721034}
+ m_TargetAssemblyTypeName: InventoryDisplay, Assembly-CSharp
+ m_MethodName: OnItemDeleteClick
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &530984090
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 530984087}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: 6d3aa117382ad23488982f3a37e18466, type: 3}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+ m_PixelsPerUnitMultiplier: 1
+--- !u!222 &530984091
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 530984087}
+ m_CullTransparentMesh: 1
+--- !u!1 &574500701
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 574500702}
+ - component: {fileID: 574500704}
+ - component: {fileID: 574500703}
+ m_Layer: 0
+ m_Name: Flexalon Object
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &574500702
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 574500701}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children:
+ - {fileID: 530984088}
+ m_Father: {fileID: 7994983637574174860}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: -310.0759}
+ m_SizeDelta: {x: 440.00003, y: 50}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &574500703
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 574500701}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 00b0da67f6b3c9a4e84ed47af9da4884, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ _version: 4
+ _widthType: 1
+ _width: 1
+ _widthOfParent: 1
+ _heightType: 0
+ _height: 50
+ _heightOfParent: 1
+ _depthType: 2
+ _depth: 1
+ _depthOfParent: 1
+ _minWidthType: 0
+ _minWidth: 0
+ _minWidthOfParent: 0
+ _minHeightType: 0
+ _minHeight: 0
+ _minHeightOfParent: 0
+ _minDepthType: 0
+ _minDepth: 0
+ _minDepthOfParent: 0
+ _maxWidthType: 0
+ _maxWidth: 1
+ _maxWidthOfParent: 1
+ _maxHeightType: 0
+ _maxHeight: 1
+ _maxHeightOfParent: 1
+ _maxDepthType: 0
+ _maxDepth: 1
+ _maxDepthOfParent: 1
+ _offset: {x: 0, y: 0, z: 0}
+ _scale: {x: 1, y: 1, z: 1}
+ _rotation: {x: 0, y: 0, z: 0, w: 1}
+ _marginLeft: 0
+ _marginRight: 0
+ _marginTop: 0
+ _marginBottom: 0
+ _marginFront: 0
+ _marginBack: 0
+ _paddingLeft: 0
+ _paddingRight: 0
+ _paddingTop: 0
+ _paddingBottom: 0
+ _paddingFront: 0
+ _paddingBack: 0
+ _skipLayout: 0
+--- !u!114 &574500704
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 574500701}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 994c66b6148109b489689ed705d244cd, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Parent: {fileID: 7994983637574174860}
+ SiblingIndex: 2
+ LayoutPosition: {x: 0, y: -310.0759, z: 0}
+ LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
+ AdapterBounds:
+ m_Center: {x: 0, y: 0, z: 0}
+ m_Extent: {x: 220.00002, y: 25, z: 0}
+ LayoutBounds:
+ m_Center: {x: 0, y: 0, z: 0}
+ m_Extent: {x: 220.00002, y: 25, z: 0}
+ RotatedAndScaledBounds:
+ m_Center: {x: 0, y: 0, z: 0}
+ m_Extent: {x: 220.00002, y: 25, z: 0}
+ ComponentScale: {x: 1, y: 1, z: 1}
+ FillSize: {x: 440.00003, y: 0, z: 0}
+ ShrinkSize: {x: 999999, y: 999999, z: 999999}
+ TargetPosition: {x: 0, y: -310.0759, z: 0}
+ TargetRotation: {x: 0, y: 0, z: 0, w: 1}
+ TargetScale: {x: 1, y: 1, z: 1}
+ TargetRectSize: {x: 440.00003, y: 50, z: 0}
+ TransformPosition: {x: 0, y: -310.0759, z: 0}
+ TransformRotation: {x: 0, y: 0, z: 0, w: 1}
+ TransformScale: {x: 1, y: 1, z: 1}
+ TransformRectSize: {x: 440.00003, y: 50}
--- !u!1 &619394800
GameObject:
m_ObjectHideFlags: 0
@@ -2053,6 +2316,140 @@
e31: 0
e32: 0
e33: 1
+--- !u!1 &1317463990
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1317463991}
+ - component: {fileID: 1317463993}
+ - component: {fileID: 1317463992}
+ m_Layer: 0
+ m_Name: Text (TMP)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1317463991
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1317463990}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 530984088}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1317463992
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1317463990}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_text: X
+ m_isRightToLeft: 0
+ m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+ m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+ m_fontSharedMaterials: []
+ m_fontMaterial: {fileID: 0}
+ m_fontMaterials: []
+ m_fontColor32:
+ serializedVersion: 2
+ rgba: 4283716858
+ m_fontColor: {r: 0.9811321, g: 0.32858673, b: 0.32858673, a: 1}
+ m_enableVertexGradient: 0
+ m_colorMode: 3
+ m_fontColorGradient:
+ topLeft: {r: 1, g: 1, b: 1, a: 1}
+ topRight: {r: 1, g: 1, b: 1, a: 1}
+ bottomLeft: {r: 1, g: 1, b: 1, a: 1}
+ bottomRight: {r: 1, g: 1, b: 1, a: 1}
+ m_fontColorGradientPreset: {fileID: 0}
+ m_spriteAsset: {fileID: 0}
+ m_tintAllSprites: 0
+ m_StyleSheet: {fileID: 0}
+ m_TextStyleHashCode: -1183493901
+ m_overrideHtmlColors: 0
+ m_faceColor:
+ serializedVersion: 2
+ rgba: 4294967295
+ m_fontSize: 11
+ m_fontSizeBase: 11
+ m_fontWeight: 400
+ m_enableAutoSizing: 0
+ m_fontSizeMin: 18
+ m_fontSizeMax: 72
+ m_fontStyle: 1
+ m_HorizontalAlignment: 2
+ m_VerticalAlignment: 1024
+ m_textAlignment: 65535
+ m_characterSpacing: 0
+ m_wordSpacing: 0
+ m_lineSpacing: 0
+ m_lineSpacingMax: 0
+ m_paragraphSpacing: 0
+ m_charWidthMaxAdj: 0
+ m_enableWordWrapping: 1
+ m_wordWrappingRatios: 0.4
+ m_overflowMode: 0
+ m_linkedTextComponent: {fileID: 0}
+ parentLinkedComponent: {fileID: 0}
+ m_enableKerning: 1
+ m_enableExtraPadding: 0
+ checkPaddingRequired: 0
+ m_isRichText: 1
+ m_parseCtrlCharacters: 1
+ m_isOrthographic: 1
+ m_isCullingEnabled: 0
+ m_horizontalMapping: 0
+ m_verticalMapping: 0
+ m_uvLineOffset: 0
+ m_geometrySortingOrder: 0
+ m_IsTextObjectScaleStatic: 0
+ m_VertexBufferAutoSizeReduction: 0
+ m_useMaxVisibleDescender: 1
+ m_pageToDisplay: 1
+ m_margin: {x: 0, y: 0, z: 0, w: 0}
+ m_isUsingLegacyAnimationComponent: 0
+ m_isVolumetricText: 0
+ m_hasFontAssetChanged: 0
+ m_baseMaterial: {fileID: 0}
+ m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!222 &1317463993
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1317463990}
+ m_CullTransparentMesh: 1
--- !u!1 &1406521042
GameObject:
m_ObjectHideFlags: 0
@@ -4263,28 +4660,28 @@
m_EditorClassIdentifier:
Parent: {fileID: 7994983637574174860}
SiblingIndex: 1
- LayoutPosition: {x: 0, y: -47.5, z: 0}
+ LayoutPosition: {x: 0, y: -12.5, z: 0}
LayoutRotation: {x: 0, y: 0, z: 0, w: 1}
AdapterBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 287.5759, z: 0}
+ m_Extent: {x: 220.00002, y: 252.5759, z: 0}
LayoutBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 287.5759, z: 0}
+ m_Extent: {x: 220.00002, y: 252.5759, z: 0}
RotatedAndScaledBounds:
m_Center: {x: 0, y: 0, z: 0}
- m_Extent: {x: 220.00002, y: 287.5759, z: 0}
+ m_Extent: {x: 220.00002, y: 252.5759, z: 0}
ComponentScale: {x: 1, y: 1, z: 1}
- FillSize: {x: 440.00003, y: 575.1518, z: 0}
+ FillSize: {x: 440.00003, y: 505.1518, z: 0}
ShrinkSize: {x: 999999, y: 999999, z: 999999}
- TargetPosition: {x: 0, y: -47.5, z: 0}
+ TargetPosition: {x: 0, y: -12.5, z: 0}
TargetRotation: {x: 0, y: 0, z: 0, w: 1}
TargetScale: {x: 1, y: 1, z: 1}
- TargetRectSize: {x: 440.00003, y: 575.1518, z: 0}
- TransformPosition: {x: 0, y: -47.5, z: 0}
+ TargetRectSize: {x: 440.00003, y: 505.1518, z: 0}
+ TransformPosition: {x: 0, y: -12.5, z: 0}
TransformRotation: {x: 0, y: 0, z: 0, w: 1}
TransformScale: {x: 1, y: 1, z: 1}
- TransformRectSize: {x: 440.00003, y: 575.1518}
+ TransformRectSize: {x: 440.00003, y: 505.1518}
--- !u!114 &1179163092344749656
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -4332,8 +4729,8 @@
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 0, y: -47.5}
- m_SizeDelta: {x: 440.00003, y: 575.1518}
+ m_AnchoredPosition: {x: 0, y: -12.5}
+ m_SizeDelta: {x: 440.00003, y: 505.1518}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1264119802676118300
GameObject:
@@ -4709,7 +5106,7 @@
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5518989482989945374}
- m_Enabled: 1
+ m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
@@ -6799,7 +7196,7 @@
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5479754380044115795}
- m_Enabled: 1
+ m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
@@ -9622,6 +10019,7 @@
itemUIPrefab: {fileID: 1536595002982607090, guid: e3c75e717a72154478a8806cd96eb126, type: 3}
itemNameDescription: {fileID: 5479754380044115795}
itemDescription: {fileID: 5518989482989945374}
+ itemDeleteButton: {fileID: 530984087}
itemUIs: []
--- !u!114 &7412360115378337142
MonoBehaviour:
@@ -10440,6 +10838,7 @@
m_Children:
- {fileID: 1900878124533168998}
- {fileID: 1249761801454750281}
+ - {fileID: 574500702}
m_Father: {fileID: 1056274434389685418}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8020712890274763815
diff --git a/Assets/Scripts/Inventory/InventoryDisplay.cs b/Assets/Scripts/Inventory/InventoryDisplay.cs
index a5ed7cf..a7d3fad 100644
--- a/Assets/Scripts/Inventory/InventoryDisplay.cs
+++ b/Assets/Scripts/Inventory/InventoryDisplay.cs
@@ -16,6 +16,7 @@
public GameObject itemUIPrefab;
public GameObject itemNameDescription;
public GameObject itemDescription;
+ public GameObject itemDeleteButton;
public List<GameObject> itemUIs = new List<GameObject>();
@@ -152,15 +153,29 @@
if (itemNameDescription.GetComponent<ItemUIScript>()?.InventorySlot?.item?.itemName == inventorySlot.item.itemName)
{
itemDescription.SetActive(!itemNameDescription.activeSelf);
+ itemDeleteButton.SetActive(!itemNameDescription.activeSelf);
itemNameDescription.SetActive(!itemNameDescription.activeSelf);
}
- else {
+ else
+ {
itemDescription.SetActive(true);
+ itemDeleteButton.SetActive(true);
itemNameDescription.SetActive(true);
}
itemNameDescription.GetComponent<ItemUIScript>().InventorySlot = inventorySlot;
itemDescription.GetComponent<ItemUIScript>().InventorySlot = inventorySlot;
}
+ public void OnItemDeleteClick()
+ {
+ InventorySlot inventorySlot = itemNameDescription.GetComponent<ItemUIScript>()?.InventorySlot;
+ if (inventorySlot?.item?.itemName != null)
+ {
+ inventory.RemoveItem(inventorySlot.item, inventorySlot.quantity);
+ itemNameDescription.SetActive(false);
+ itemDeleteButton.SetActive(false);
+ itemDescription.SetActive(false);
+ }
+ }
private void UpdateItemContentList()
{
@@ -194,7 +209,9 @@
// Add click event listener only if the itemUI was just created
if (isCreated)
+ {
itemUI.GetComponent<Button>().onClick.AddListener(() => OnItemClick(itemUIScript.InventorySlot));
+ }
else
{
// Update the itemUIScript of the itemNameDescription panel if the item is already selected
--
Gitblit v1.10.0