you can now undo a purchase after buying an item from the shop
This commit is contained in:
parent
efc7a3deaf
commit
64b25a2029
12 changed files with 359 additions and 56 deletions
|
|
@ -655,6 +655,141 @@ CanvasRenderer:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 131335458}
|
m_GameObject: {fileID: 131335458}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &144989857
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 144989858}
|
||||||
|
- component: {fileID: 144989860}
|
||||||
|
- component: {fileID: 144989859}
|
||||||
|
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 &144989858
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 144989857}
|
||||||
|
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: 1785473025}
|
||||||
|
m_RootOrder: 0
|
||||||
|
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 &144989859
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 144989857}
|
||||||
|
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: Undo Purchase
|
||||||
|
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: 4280045691
|
||||||
|
m_fontColor: {r: 0.48235297, g: 0.3137255, b: 0.10980393, 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: 20
|
||||||
|
m_fontSizeBase: 20
|
||||||
|
m_fontWeight: 400
|
||||||
|
m_enableAutoSizing: 0
|
||||||
|
m_fontSizeMin: 18
|
||||||
|
m_fontSizeMax: 72
|
||||||
|
m_fontStyle: 1
|
||||||
|
m_HorizontalAlignment: 2
|
||||||
|
m_VerticalAlignment: 512
|
||||||
|
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 &144989860
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 144989857}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1001 &156055821
|
--- !u!1001 &156055821
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -849,7 +984,7 @@ RectTransform:
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1520388888}
|
- {fileID: 1520388888}
|
||||||
m_Father: {fileID: 1203044072}
|
m_Father: {fileID: 1203044072}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
|
@ -1505,7 +1640,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Navigation:
|
m_Navigation:
|
||||||
m_Mode: 3
|
m_Mode: 0
|
||||||
m_WrapAround: 0
|
m_WrapAround: 0
|
||||||
m_SelectOnUp: {fileID: 0}
|
m_SelectOnUp: {fileID: 0}
|
||||||
m_SelectOnDown: {fileID: 0}
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
|
@ -1536,7 +1671,7 @@ MonoBehaviour:
|
||||||
m_HandleRect: {fileID: 2006577138}
|
m_HandleRect: {fileID: 2006577138}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 1
|
||||||
m_Size: 0.59324205
|
m_Size: 0.5386614
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
|
|
@ -1783,8 +1918,8 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -35.4193}
|
m_AnchoredPosition: {x: 0, y: -90}
|
||||||
m_SizeDelta: {x: -17, y: -35.4193}
|
m_SizeDelta: {x: -17, y: -89.99993}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!114 &610140155
|
--- !u!114 &610140155
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
|
@ -2867,7 +3002,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Navigation:
|
m_Navigation:
|
||||||
m_Mode: 3
|
m_Mode: 0
|
||||||
m_WrapAround: 0
|
m_WrapAround: 0
|
||||||
m_SelectOnUp: {fileID: 0}
|
m_SelectOnUp: {fileID: 0}
|
||||||
m_SelectOnDown: {fileID: 0}
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
|
@ -3394,7 +3529,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Navigation:
|
m_Navigation:
|
||||||
m_Mode: 3
|
m_Mode: 0
|
||||||
m_WrapAround: 0
|
m_WrapAround: 0
|
||||||
m_SelectOnUp: {fileID: 0}
|
m_SelectOnUp: {fileID: 0}
|
||||||
m_SelectOnDown: {fileID: 0}
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
|
@ -3512,7 +3647,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 1}
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 1}
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
m_AnchoredPosition: {x: -290, y: -350}
|
m_AnchoredPosition: {x: -466, y: -554}
|
||||||
m_SizeDelta: {x: 250, y: 100}
|
m_SizeDelta: {x: 250, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &1040033585
|
--- !u!114 &1040033585
|
||||||
|
|
@ -4428,6 +4563,7 @@ RectTransform:
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 656110741}
|
- {fileID: 656110741}
|
||||||
|
- {fileID: 1785473025}
|
||||||
- {fileID: 157569880}
|
- {fileID: 157569880}
|
||||||
m_Father: {fileID: 1671356617}
|
m_Father: {fileID: 1671356617}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
|
|
@ -6320,8 +6456,7 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
itemsParent: {fileID: 610140154}
|
itemsParent: {fileID: 610140154}
|
||||||
shopUI: {fileID: 1671356616}
|
shopUI: {fileID: 1671356616}
|
||||||
shopIsOpen: 0
|
inventoryUI: {fileID: 971652020}
|
||||||
inventoryUI: {fileID: 1609015285}
|
|
||||||
--- !u!224 &1551890462 stripped
|
--- !u!224 &1551890462 stripped
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_CorrespondingSourceObject: {fileID: 3510585822996971025, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3}
|
m_CorrespondingSourceObject: {fileID: 3510585822996971025, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3}
|
||||||
|
|
@ -6516,6 +6651,7 @@ MonoBehaviour:
|
||||||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
||||||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
||||||
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
||||||
|
itemWasSold: 0
|
||||||
--- !u!1001 &1701153146
|
--- !u!1001 &1701153146
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -6621,6 +6757,140 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3}
|
||||||
|
--- !u!1 &1785473024
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1785473025}
|
||||||
|
- component: {fileID: 1785473028}
|
||||||
|
- component: {fileID: 1785473027}
|
||||||
|
- component: {fileID: 1785473026}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Undo Purchase Button
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1785473025
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1785473024}
|
||||||
|
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: 144989858}
|
||||||
|
m_Father: {fileID: 1203044072}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: -10, y: 255}
|
||||||
|
m_SizeDelta: {x: -100, y: -590}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1785473026
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1785473024}
|
||||||
|
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: 1785473027}
|
||||||
|
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 &1785473027
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1785473024}
|
||||||
|
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 &1785473028
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1785473024}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1001 &1794784497
|
--- !u!1001 &1794784497
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -6802,12 +7072,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 05183797fdda4aa9ac518eee0d2d85d4, type: 3}
|
m_Script: {fileID: 11500000, guid: 05183797fdda4aa9ac518eee0d2d85d4, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
allItems:
|
|
||||||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
|
||||||
- {fileID: 11400000, guid: d651d57ba97a4246a0094409e29fe56a, type: 2}
|
|
||||||
- {fileID: 11400000, guid: 430db451ae959f34b8fba8d8b17276fd, type: 2}
|
|
||||||
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
|
||||||
- {fileID: 11400000, guid: ea1a26b19bc34a0ba29bad77253c7266, type: 2}
|
|
||||||
--- !u!1001 &1805366398
|
--- !u!1001 &1805366398
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,13 @@ public class InventorySlot : ItemStorageSlot {
|
||||||
* Gets called when the Inventory Slot is clicked
|
* Gets called when the Inventory Slot is clicked
|
||||||
*/
|
*/
|
||||||
public override void UseItem() {
|
public override void UseItem() {
|
||||||
|
if(Item){
|
||||||
if(Item.GetType() == typeof(UsableItem)) {
|
if(Item.GetType() == typeof(UsableItem)) {
|
||||||
((UsableItem) Item).Select();
|
((UsableItem)Item).Select();
|
||||||
Debug.Log("using " + Item.displayName);
|
Debug.Log("using " + Item.displayName);
|
||||||
} else {
|
} else {
|
||||||
Debug.Log("Item not usable " + Item.displayName);
|
Debug.Log("Item not usable " + Item.displayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,12 +40,13 @@ public class InventoryUI : MonoBehaviour {
|
||||||
* Is called when something in the Inventory UI should update
|
* Is called when something in the Inventory UI should update
|
||||||
*/
|
*/
|
||||||
private void UpdateUI() {
|
private void UpdateUI() {
|
||||||
// Add all items to the correct slots and clear the ones where no item should be
|
// 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++) {
|
for(int i = 0; i < _slots.Length; i++) {
|
||||||
if(i < _inventory.items.Count) {
|
if(i < _inventory.items.Count) {
|
||||||
_slots[i].AddItem(_inventory.items.ElementAt(i).Key);
|
_slots[i].AddItem(_inventory.items.ElementAt(i).Key);
|
||||||
if(_inventory.items[_inventory.items.ElementAt(i).Key] > 1) {
|
|
||||||
_slots[i].amountText.text = "" + _inventory.items[_inventory.items.ElementAt(i).Key];
|
_slots[i].amountText.text = "" + _inventory.items[_inventory.items.ElementAt(i).Key];
|
||||||
|
if(_inventory.items[_inventory.items.ElementAt(i).Key] == 1) {
|
||||||
|
_slots[i].amountText.text = "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_slots[i].ClearSlot();
|
_slots[i].ClearSlot();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ public class Item : ScriptableObject, IComparable<Item> {
|
||||||
public Sprite selectedSprite;
|
public Sprite selectedSprite;
|
||||||
public Sprite defaultSprite;
|
public Sprite defaultSprite;
|
||||||
public int cost;
|
public int cost;
|
||||||
|
public int SellPrice => Convert.ToInt32(cost * 0.8);
|
||||||
|
|
||||||
public Item(string displayName, string description, int id) {
|
public Item(string displayName, string description, int id) {
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class ItemStorage : MonoBehaviour {
|
||||||
/**
|
/**
|
||||||
* Removes the specified amount of items in the Item Storage
|
* Removes the specified amount of items in the Item Storage
|
||||||
*/
|
*/
|
||||||
public void RemoveItem(Item item, int amount) {
|
public virtual void RemoveItem(Item item, int amount) {
|
||||||
if(items[item]-amount <= 0) {
|
if(items[item]-amount <= 0) {
|
||||||
items.Remove(item);
|
items.Remove(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,15 @@ public class PlayerController : MonoBehaviour {
|
||||||
|
|
||||||
public int Money => _money;
|
public int Money => _money;
|
||||||
|
|
||||||
|
public delegate void OnMoneyChanged();
|
||||||
|
public OnMoneyChanged onMoneyChangedCallback;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
private void Start() {
|
private void Start() {
|
||||||
_money = startMoney;
|
_money = startMoney;
|
||||||
_inventory = Inventory.instance;
|
_inventory = Inventory.instance;
|
||||||
moneyTextMeshProUGUI.text = _money + "µ";
|
|
||||||
|
onMoneyChangedCallback += UpdateMoneyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSelectedItem(UsableItem item) {
|
public void SetSelectedItem(UsableItem item) {
|
||||||
|
|
@ -52,6 +56,10 @@ public class PlayerController : MonoBehaviour {
|
||||||
|
|
||||||
public void ChangeMoney(int amount) {
|
public void ChangeMoney(int amount) {
|
||||||
_money += amount;
|
_money += amount;
|
||||||
|
onMoneyChangedCallback?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateMoneyUI() {
|
||||||
moneyTextMeshProUGUI.text = _money + "µ";
|
moneyTextMeshProUGUI.text = _money + "µ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,4 +14,36 @@ public class Shop : ItemStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public bool itemWasBought;
|
||||||
|
|
||||||
|
private PlayerController _playerController;
|
||||||
|
private Inventory _inventory;
|
||||||
|
private Item _lastBoughtItem;
|
||||||
|
private int _lastBoughtItemAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls ItemStorage.RemoveItem() and sets 2 Variables to remember the last bought item
|
||||||
|
*/
|
||||||
|
public override void RemoveItem(Item item, int amount) {
|
||||||
|
base.RemoveItem(item, amount);
|
||||||
|
if(itemWasBought){
|
||||||
|
_lastBoughtItem = item;
|
||||||
|
_lastBoughtItemAmount = amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UndoLastPurchase() {
|
||||||
|
if(itemWasBought){
|
||||||
|
_inventory = Inventory.instance;
|
||||||
|
_playerController = PlayerController.instance;
|
||||||
|
|
||||||
|
if(_lastBoughtItem) {
|
||||||
|
_playerController.ChangeMoney(_lastBoughtItem.cost);
|
||||||
|
_inventory.RemoveItem(_lastBoughtItem, _lastBoughtItemAmount);
|
||||||
|
AddItem(_lastBoughtItem, _lastBoughtItemAmount);
|
||||||
|
itemWasBought = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,13 +32,14 @@ public class ShopSlot : ItemStorageSlot {
|
||||||
public override void UseItem() {
|
public override void UseItem() {
|
||||||
if(Item) {
|
if(Item) {
|
||||||
if(_playerController.Money >= Item.cost) {
|
if(_playerController.Money >= Item.cost) {
|
||||||
_inventory.AddItem(Item, 1);
|
|
||||||
_shop.RemoveItem(Item, 1);
|
|
||||||
if(Item) {
|
if(Item) {
|
||||||
_playerController.ChangeMoney(-Item.cost);
|
_playerController.ChangeMoney(-Item.cost);
|
||||||
|
_shop.itemWasBought = true;
|
||||||
|
|
||||||
Debug.Log("Buying Item: " + Item.displayName);
|
Debug.Log("Buying Item: " + Item.displayName);
|
||||||
}
|
}
|
||||||
|
_inventory.AddItem(Item, 1);
|
||||||
|
_shop.RemoveItem(Item, 1);
|
||||||
} else {
|
} else {
|
||||||
Debug.Log("Not enough money to buy item.");
|
Debug.Log("Not enough money to buy item.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ using UnityEngine;
|
||||||
public class ShopUI : MonoBehaviour {
|
public class ShopUI : MonoBehaviour {
|
||||||
public Transform itemsParent;
|
public Transform itemsParent;
|
||||||
public GameObject shopUI;
|
public GameObject shopUI;
|
||||||
public bool shopIsOpen;
|
|
||||||
public GameObject inventoryUI;
|
public GameObject inventoryUI;
|
||||||
|
|
||||||
private Shop _shop;
|
private Shop _shop;
|
||||||
|
|
@ -17,7 +16,6 @@ public class ShopUI : MonoBehaviour {
|
||||||
|
|
||||||
// Add all ShopSlot GameObjects to _slots and turn off the Shop UI
|
// Add all ShopSlot GameObjects to _slots and turn off the Shop UI
|
||||||
_slots = itemsParent.GetComponentsInChildren<ShopSlot>();
|
_slots = itemsParent.GetComponentsInChildren<ShopSlot>();
|
||||||
shopIsOpen = false;
|
|
||||||
ToggleShop();
|
ToggleShop();
|
||||||
|
|
||||||
// Set the icon to not be a raycast target for the Description Hovering to work
|
// Set the icon to not be a raycast target for the Description Hovering to work
|
||||||
|
|
@ -29,7 +27,6 @@ public class ShopUI : MonoBehaviour {
|
||||||
private void Update() {
|
private void Update() {
|
||||||
// When "Shop" button is pressed turn on/off Shop UI
|
// When "Shop" button is pressed turn on/off Shop UI
|
||||||
if (Input.GetButtonDown("Shop")) {
|
if (Input.GetButtonDown("Shop")) {
|
||||||
shopIsOpen = true;
|
|
||||||
ToggleShop();
|
ToggleShop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +35,7 @@ public class ShopUI : MonoBehaviour {
|
||||||
* Turn on/off the Shop UI
|
* Turn on/off the Shop UI
|
||||||
*/
|
*/
|
||||||
private void ToggleShop() {
|
private void ToggleShop() {
|
||||||
inventoryUI.gameObject.SetActive(!shopUI.activeSelf);
|
// TODO: geht ned oda so: inventoryUI.gameObject.SetActive(!shopUI.activeSelf);
|
||||||
shopUI.SetActive(!shopUI.activeSelf);
|
shopUI.SetActive(!shopUI.activeSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@ using System;
|
||||||
using Tiles;
|
using Tiles;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class TileBehaviour : MonoBehaviour
|
public class TileBehaviour : MonoBehaviour {
|
||||||
{
|
|
||||||
private BaseTile _tile;
|
private BaseTile _tile;
|
||||||
private SpriteRenderer _hoverIndicatorSpriteRenderer;
|
private SpriteRenderer _hoverIndicatorSpriteRenderer;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start() {
|
||||||
{
|
|
||||||
//_hoverIndicatorSpriteRenderer = gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
//_hoverIndicatorSpriteRenderer = gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
||||||
//SetHoverIndicatorVisibility(false);
|
//SetHoverIndicatorVisibility(false);
|
||||||
SetTile(new GrassTile());
|
SetTile(new GrassTile());
|
||||||
|
|
@ -17,32 +15,22 @@ public class TileBehaviour : MonoBehaviour
|
||||||
HouseController.NewDayEvent.AddListener(_tile.DayLightStep);
|
HouseController.NewDayEvent.AddListener(_tile.DayLightStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
void OnMouseDown() {
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnMouseDown()
|
|
||||||
{
|
|
||||||
UsableItem usable = null;
|
UsableItem usable = null;
|
||||||
BaseTile tileToSetTo = null;
|
BaseTile tileToSetTo = null;
|
||||||
|
|
||||||
if (PlayerController.instance.GetSelectedItem() != null)
|
if(PlayerController.instance.GetSelectedItem() != null) {
|
||||||
{
|
|
||||||
usable = PlayerController.instance.GetSelectedItem();
|
usable = PlayerController.instance.GetSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
tileToSetTo = _tile.Clicked(usable);
|
tileToSetTo = _tile.Clicked(usable);
|
||||||
|
|
||||||
if (tileToSetTo != null)
|
if(tileToSetTo != null) {
|
||||||
{
|
|
||||||
SetTile(tileToSetTo);
|
SetTile(tileToSetTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTile(BaseTile tileToSet)
|
void SetTile(BaseTile tileToSet) {
|
||||||
{
|
|
||||||
_tile = tileToSet;
|
_tile = tileToSet;
|
||||||
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
GetComponent<SpriteRenderer>().sprite = _tile.Sprite;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,21 @@
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
"com.unity.nuget.newtonsoft-json": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"depth": 2,
|
||||||
|
"source": "registry",
|
||||||
|
"dependencies": {},
|
||||||
|
"url": "https://packages.unity.com"
|
||||||
|
},
|
||||||
"com.unity.services.core": {
|
"com.unity.services.core": {
|
||||||
"version": "1.0.1",
|
"version": "1.3.1",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||||
|
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||||
|
"com.unity.modules.androidjni": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
m_EditorVersion: 2021.3.1f1
|
m_EditorVersion: 2021.3.2f1
|
||||||
m_EditorVersionWithRevision: 2021.3.1f1 (3b70a0754835)
|
m_EditorVersionWithRevision: 2021.3.2f1 (d6360bedb9a0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue