diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index d44131d..68417ff 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -248,7 +248,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 6 + value: 5 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -573,11 +573,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3} ---- !u!224 &109441210 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - m_PrefabInstance: {fileID: 5121261192963321214} - m_PrefabAsset: {fileID: 0} --- !u!1 &131335458 GameObject: m_ObjectHideFlags: 0 @@ -973,7 +968,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -1042,7 +1037,7 @@ RectTransform: m_Children: - {fileID: 1520388888} m_Father: {fileID: 1203044072} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1988,8 +1983,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 2006577139} m_HandleRect: {fileID: 2006577138} m_Direction: 2 - m_Value: 0.9999999 - m_Size: 0.5386614 + m_Value: 0.9999998 + m_Size: 0.59851277 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -2848,7 +2843,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 7 + value: 6 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -3604,7 +3599,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 5 + value: 4 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -5170,7 +5165,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 3 + value: 2 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -5344,6 +5339,7 @@ RectTransform: m_Children: - {fileID: 656110741} - {fileID: 1785473025} + - {fileID: 1566847388} - {fileID: 157569880} m_Father: {fileID: 1671356617} m_RootOrder: 0 @@ -5621,7 +5617,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -5798,6 +5794,82 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 3510585822996971025, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3} m_PrefabInstance: {fileID: 1197657129} m_PrefabAsset: {fileID: 0} +--- !u!1 &1271600640 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1271600641} + - component: {fileID: 1271600643} + - component: {fileID: 1271600642} + m_Layer: 0 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1271600641 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1271600640} + 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: 1566847388} + m_RootOrder: 0 + 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: 0} + m_SizeDelta: {x: 16, y: 16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1271600642 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1271600640} + 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: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e2bde586482642d44a270276574c0129, 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 &1271600643 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1271600640} + m_CullTransparentMesh: 1 --- !u!1 &1278234712 GameObject: m_ObjectHideFlags: 0 @@ -6654,7 +6726,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 8 + value: 7 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -6956,7 +7028,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 9 + value: 8 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -7379,6 +7451,155 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 3510585822996971025, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3} m_PrefabInstance: {fileID: 1126497628} m_PrefabAsset: {fileID: 0} +--- !u!1 &1566847387 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1566847388} + - component: {fileID: 1566847392} + - component: {fileID: 1566847391} + - component: {fileID: 1566847390} + - component: {fileID: 1566847389} + m_Layer: 0 + m_Name: SwitchShopButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1566847388 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566847387} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0640067, y: 1.0640067, z: 1.0640067} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1271600641} + m_Father: {fileID: 1203044072} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 82.5, y: 292.75} + m_SizeDelta: {x: -225, y: -604.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1566847389 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566847387} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 47545d0c6734b804c9407d5752a08ee4, type: 3} + m_Name: + m_EditorClassIdentifier: + animalShopSprite: {fileID: 0} + itemShopSprite: {fileID: 0} +--- !u!114 &1566847390 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566847387} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + 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.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_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: 1566847391} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1671356619} + m_TargetAssemblyTypeName: Shop, Assembly-CSharp + m_MethodName: UndoLastPurchase + 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 &1566847391 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566847387} + 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: 349d3f5d7a4156146b8e923d5c06314d, type: 3} + m_Type: 1 + 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 &1566847392 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566847387} + m_CullTransparentMesh: 1 --- !u!1 &1609015285 GameObject: m_ObjectHideFlags: 0 @@ -8927,7 +9148,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 109441210} - {fileID: 1222314751} - {fileID: 156055822} - {fileID: 1195314499} @@ -9858,7 +10078,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_RootOrder - value: 4 + value: 3 objectReference: {fileID: 0} - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} propertyPath: m_AnchorMax.y @@ -9895,104 +10115,3 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} m_PrefabInstance: {fileID: 2142219637} m_PrefabAsset: {fileID: 0} ---- !u!1001 &5121261192963321214 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 1985691912} - m_Modifications: - - target: {fileID: 5121261193055935939, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: UseItem - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5121261193055935943, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} - propertyPath: m_Name - value: ShopSlot - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3} diff --git a/Assets/Scripts/ElementStorage.cs b/Assets/Scripts/ElementStorage.cs index 7e4f812..b907c1c 100644 --- a/Assets/Scripts/ElementStorage.cs +++ b/Assets/Scripts/ElementStorage.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; using UnityEngine; public class ElementStorage : MonoBehaviour { - public Dictionary elements; + private Dictionary _elements; + public Dictionary Elements => _elements; public T[] startElements; /** @@ -12,7 +13,7 @@ public class ElementStorage : MonoBehaviour { public OnElementChanged onElementChangedCallback; private void Start() { - elements ??= new Dictionary(); + _elements ??= new Dictionary(); foreach(T element in startElements) { AddElement(element, 1); } @@ -22,10 +23,10 @@ public class ElementStorage : MonoBehaviour { * Adds the specified amount of elements to the Element Storage */ public virtual void AddElement(T element, int amount) { - if(!elements.ContainsKey(element)) { - elements.Add(element, amount); + if(!_elements.ContainsKey(element)) { + _elements.Add(element, amount); } else { - elements[element] += amount; + _elements[element] += amount; } onElementChangedCallback?.Invoke(); @@ -35,10 +36,10 @@ public class ElementStorage : MonoBehaviour { * Removes the specified amount of elements in the Element Storage */ public virtual void RemoveElement(T element, int amount) { - if(elements[element]-amount <= 0) { - elements.Remove(element); + if(_elements[element]-amount <= 0) { + _elements.Remove(element); } else { - elements[element] -= amount; + _elements[element] -= amount; } onElementChangedCallback?.Invoke(); diff --git a/Assets/Scripts/ElementStorageSlot.cs b/Assets/Scripts/ElementStorageSlot.cs index 7f8e348..62c9b9f 100644 --- a/Assets/Scripts/ElementStorageSlot.cs +++ b/Assets/Scripts/ElementStorageSlot.cs @@ -73,7 +73,7 @@ public class ElementStorageSlot : MonoBehaviour, IPointerEnterHandler, IPoint * Clears the Element Storage Slot */ public virtual void ClearSlot() { - _element = default(T); + _element = default; icon.sprite = null; icon.enabled = false; amountText.text = ""; diff --git a/Assets/Scripts/FishingController.cs b/Assets/Scripts/FishingController.cs index 6a462ce..dd57fef 100644 --- a/Assets/Scripts/FishingController.cs +++ b/Assets/Scripts/FishingController.cs @@ -97,7 +97,7 @@ public class FishingController : MonoBehaviour { } public void StartFishing() { - if (!_iv.elements.ContainsKey(_ic.GetItemByName("Bait"))) { + if (!_iv.Elements.ContainsKey(_ic.GetItemByName("Bait"))) { _messageView.SendMessage("No bait!", 1.0f); return; } diff --git a/Assets/Scripts/Inventory.cs b/Assets/Scripts/Inventory.cs index f60d8fe..6b431e5 100644 --- a/Assets/Scripts/Inventory.cs +++ b/Assets/Scripts/Inventory.cs @@ -23,14 +23,14 @@ public class Inventory : ElementStorage { * Adds the specified amount of items to the Inventory */ public override void AddElement(Item item, int amount) { - if (elements.Count >= _InventorySpace) { + if (Elements.Count >= _InventorySpace) { Debug.Log("Not enough inventory space!"); return; } // Sell overflowing Items - if (elements.ContainsKey(item) && elements[item] + amount >= _MaxItemStack) { - SellItem(item, amount - (_MaxItemStack - elements[item])); - amount = _MaxItemStack - elements[item]; + if (Elements.ContainsKey(item) && Elements[item] + amount >= _MaxItemStack) { + SellItem(item, amount - (_MaxItemStack - Elements[item])); + amount = _MaxItemStack - Elements[item]; } base.AddElement(item, amount); } @@ -40,7 +40,7 @@ public class Inventory : ElementStorage { */ public override void RemoveElement(Item item, int amount) { base.RemoveElement(item, amount); - if (!elements.ContainsKey(item) && PlayerController.instance.SelectedItem == item) { + if (!Elements.ContainsKey(item) && PlayerController.instance.SelectedItem == item) { PlayerController.instance.DeselectItem(); } } diff --git a/Assets/Scripts/InventoryUI.cs b/Assets/Scripts/InventoryUI.cs index 9c5536f..e0d7bb3 100644 --- a/Assets/Scripts/InventoryUI.cs +++ b/Assets/Scripts/InventoryUI.cs @@ -48,10 +48,10 @@ public class InventoryUI : MonoBehaviour { private void UpdateUI() { // Add all items to the correct slots, clear the ones where no item should be and set the number of how many items are in the slot for(int i = 0; i < _slots.Length; i++) { - if(i < _inventory.elements.Count) { - _slots[i].AddElement(_inventory.elements.ElementAt(i).Key); - _slots[i].amountText.text = "" + _inventory.elements[_inventory.elements.ElementAt(i).Key]; - if(_inventory.elements[_inventory.elements.ElementAt(i).Key] == 1) { + if(i < _inventory.Elements.Count) { + _slots[i].AddElement(_inventory.Elements.ElementAt(i).Key); + _slots[i].amountText.text = "" + _inventory.Elements[_inventory.Elements.ElementAt(i).Key]; + if(_inventory.Elements[_inventory.Elements.ElementAt(i).Key] == 1) { _slots[i].amountText.text = ""; } } else { diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index e88d110..10ca063 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -33,7 +33,7 @@ public class PlayerController : MonoBehaviour { public UsableItem SelectedItem { get => _selectedItem; set { - if(_inventory.elements.ContainsKey(value)) { + if(_inventory.Elements.ContainsKey(value)) { _selectedItem = value; Cursor.SetCursor(value.defaultSprite.texture, Vector2.zero, CursorMode.Auto); } else { diff --git a/Assets/Scripts/ShopSlot.cs b/Assets/Scripts/ShopSlot.cs index 2167aaf..14564ef 100644 --- a/Assets/Scripts/ShopSlot.cs +++ b/Assets/Scripts/ShopSlot.cs @@ -22,7 +22,6 @@ public class ShopSlot : ElementStorageSlot { nameText.text = ""; costText.text = ""; amountText.text = ""; - // _shop.RemoveItem(Item, 1); base.ClearSlot(); } diff --git a/Assets/Scripts/ShopSwitcher.cs b/Assets/Scripts/ShopSwitcher.cs new file mode 100644 index 0000000..eeb059e --- /dev/null +++ b/Assets/Scripts/ShopSwitcher.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +public class ShopSwitcher : MonoBehaviour { + public Sprite animalShopSprite; + public Sprite itemShopSprite; + + public void SwitchShops() { + // switch text in Shop Title + // switch image on switch Button + // turn off one content and turn on the other + // remove undo purchase button when switching to an animal shop + } +} diff --git a/Assets/Scripts/ShopSwitcher.cs.meta b/Assets/Scripts/ShopSwitcher.cs.meta new file mode 100644 index 0000000..f59c2a3 --- /dev/null +++ b/Assets/Scripts/ShopSwitcher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 47545d0c6734b804c9407d5752a08ee4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ShopUI.cs b/Assets/Scripts/ShopUI.cs index 6dd5928..0bc2184 100644 --- a/Assets/Scripts/ShopUI.cs +++ b/Assets/Scripts/ShopUI.cs @@ -46,11 +46,11 @@ public class ShopUI : MonoBehaviour { private void UpdateUI() { // Add all items to the correct slots and clear the ones where no item should be for (int i = 0; i < _slots.Length; i++) { - if (i < _shop.elements.Count) { - _slots[i].AddElement(_shop.elements.ElementAt(i).Key); + if (i < _shop.Elements.Count) { + _slots[i].AddElement(_shop.Elements.ElementAt(i).Key); _slots[i].nameText.text = _slots[i].Element.displayName; _slots[i].costText.text = _slots[i].Element.price + " ยต"; - _slots[i].amountText.text = _shop.elements[_shop.elements.ElementAt(i).Key] + " #"; + _slots[i].amountText.text = _shop.Elements[_shop.Elements.ElementAt(i).Key] + " #"; } else { _slots[i].ClearSlot();