From d7c142590c0feaa5312383752e3180207891f39b Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Fri, 4 Sep 2020 20:45:03 +0100 Subject: [PATCH] Have started the chance and community chest cards. --- Assets/Scenes/monopoly.unity | 720 ++++++++++++++++++++++- Assets/Scripts/menu/MainMenu.cs | 35 +- Assets/Scripts/menu/PropertiesHandler.cs | 38 +- Assets/Scripts/monopoly/ButtonHandler.cs | 9 + Assets/Scripts/monopoly/Cards.cs | 13 + Assets/Scripts/monopoly/Cards.cs.meta | 11 + Assets/Scripts/monopoly/FileHandler.cs | 23 +- Assets/Scripts/monopoly/Main.cs | 69 ++- Assets/Scripts/monopoly/Movement.cs | 3 +- Assets/Scripts/monopoly/TextHandler.cs | 35 +- Assets/cards.csv | 33 ++ Assets/cards.csv.meta | 7 + Assets/cards.xlsx | Bin 0 -> 9945 bytes Assets/cards.xlsx.meta | 7 + chance.txt | 16 + community chest.txt | 16 + definitions of functions for cards.txt | 15 + 17 files changed, 1022 insertions(+), 28 deletions(-) create mode 100644 Assets/Scripts/monopoly/Cards.cs create mode 100644 Assets/Scripts/monopoly/Cards.cs.meta create mode 100644 Assets/cards.csv create mode 100644 Assets/cards.csv.meta create mode 100644 Assets/cards.xlsx create mode 100644 Assets/cards.xlsx.meta create mode 100644 chance.txt create mode 100644 community chest.txt create mode 100644 definitions of functions for cards.txt diff --git a/Assets/Scenes/monopoly.unity b/Assets/Scenes/monopoly.unity index 7fd41e4..5b9546e 100644 --- a/Assets/Scenes/monopoly.unity +++ b/Assets/Scenes/monopoly.unity @@ -1220,6 +1220,7 @@ RectTransform: - {fileID: 1029953937} - {fileID: 1111531777} - {fileID: 1871971151} + - {fileID: 929752267} - {fileID: 653887086} m_Father: {fileID: 0} m_RootOrder: 6 @@ -1244,6 +1245,9 @@ MonoBehaviour: propertyInfo: {fileID: 943791161} Roll: {fileID: 1628500264} Money: {fileID: 398680385} + card: {fileID: 929752266} + cardGroup: {fileID: 1017986388} + cardText: {fileID: 976489958} --- !u!114 &310476699 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1265,6 +1269,8 @@ MonoBehaviour: PropertyUI: {fileID: 1871971150} inventory: {fileID: 1029953938} inventoryText: {fileID: 985089324} + card: {fileID: 929752266} + cardButton: {fileID: 2007862499} --- !u!114 &310476700 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3104,7 +3110,7 @@ RectTransform: m_Children: - {fileID: 1977242781} m_Father: {fileID: 310476697} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4655,6 +4661,42 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &929752266 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 929752267} + m_Layer: 5 + m_Name: Card + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &929752267 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 929752266} + 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_Children: + - {fileID: 1110544714} + m_Father: {fileID: 310476697} + m_RootOrder: 4 + 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!1 &932880231 GameObject: m_ObjectHideFlags: 0 @@ -5015,6 +5057,140 @@ Transform: m_Father: {fileID: 758519666} m_RootOrder: 20 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &976489956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 976489957} + - component: {fileID: 976489959} + - component: {fileID: 976489958} + m_Layer: 5 + m_Name: Card Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &976489957 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976489956} + 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_Children: [] + m_Father: {fileID: 1110544714} + m_RootOrder: 1 + 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: -9.1} + m_SizeDelta: {x: 377.93292, y: 149.77313} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &976489958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976489956} + 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: Card Text + 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: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, 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: 72 + m_fontSizeBase: 25 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + 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: 1 + 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 &976489959 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976489956} + m_CullTransparentMesh: 0 --- !u!1 &983314464 GameObject: m_ObjectHideFlags: 0 @@ -5520,6 +5696,140 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 999209431} m_CullTransparentMesh: 0 +--- !u!1 &1017986386 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1017986387} + - component: {fileID: 1017986389} + - component: {fileID: 1017986388} + m_Layer: 5 + m_Name: Name + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1017986387 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1017986386} + 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_Children: [] + m_Father: {fileID: 1235795231} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0.037475586, y: -0.09592438} + m_SizeDelta: {x: 350.1863, y: -0.19188118} + m_Pivot: {x: 0, y: 0.5} +--- !u!114 &1017986388 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1017986386} + 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: Type of card + 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: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, 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: 0 + m_HorizontalAlignment: 1 + 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: 1 + 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 &1017986389 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1017986386} + m_CullTransparentMesh: 0 --- !u!1 &1029953936 GameObject: m_ObjectHideFlags: 0 @@ -6087,6 +6397,83 @@ Transform: m_Father: {fileID: 758519666} m_RootOrder: 23 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1110544713 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1110544714} + - component: {fileID: 1110544716} + - component: {fileID: 1110544715} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1110544714 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1110544713} + 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_Children: + - {fileID: 1235795231} + - {fileID: 976489957} + m_Father: {fileID: 929752267} + 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: -730.0671, y: -408.9817} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1110544715 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1110544713} + 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: 0.392} + 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: 10907, guid: 0000000000000000f000000000000000, type: 0} + 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 &1110544716 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1110544713} + m_CullTransparentMesh: 0 --- !u!1 &1111531776 GameObject: m_ObjectHideFlags: 0 @@ -6277,6 +6664,140 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1119948345} m_CullTransparentMesh: 0 +--- !u!1 &1157611928 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1157611929} + - component: {fileID: 1157611931} + - component: {fileID: 1157611930} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1157611929 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157611928} + 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_Children: [] + m_Father: {fileID: 2007862498} + 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 &1157611930 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157611928} + 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: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + 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: 1 + 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 &1157611931 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157611928} + m_CullTransparentMesh: 0 --- !u!1 &1199958678 GameObject: m_ObjectHideFlags: 0 @@ -6464,6 +6985,83 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1209577817} m_CullTransparentMesh: 0 +--- !u!1 &1235795230 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1235795231} + - component: {fileID: 1235795233} + - component: {fileID: 1235795232} + m_Layer: 5 + m_Name: Top + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1235795231 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1235795230} + 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_Children: + - {fileID: 2007862498} + - {fileID: 1017986387} + m_Father: {fileID: 1110544714} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 21.62259} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &1235795232 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1235795230} + 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: 0} + 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 &1235795233 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1235795230} + m_CullTransparentMesh: 0 --- !u!1 &1238945411 GameObject: m_ObjectHideFlags: 0 @@ -9908,6 +10506,126 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1983981045} m_CullTransparentMesh: 0 +--- !u!1 &2007862497 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2007862498} + - component: {fileID: 2007862501} + - component: {fileID: 2007862500} + - component: {fileID: 2007862499} + m_Layer: 5 + m_Name: Close Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2007862498 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2007862497} + 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_Children: + - {fileID: 1157611929} + m_Father: {fileID: 1235795231} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 1.0859985, y: 0} + m_SizeDelta: {x: 22.386719, y: 21.624939} + m_Pivot: {x: 1, y: 1} +--- !u!114 &2007862499 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2007862497} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + 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: 2007862500} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2007862500 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2007862497} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + 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 &2007862501 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2007862497} + m_CullTransparentMesh: 0 --- !u!1 &2040913807 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/menu/MainMenu.cs b/Assets/Scripts/menu/MainMenu.cs index 03b17cf..dfb8f46 100644 --- a/Assets/Scripts/menu/MainMenu.cs +++ b/Assets/Scripts/menu/MainMenu.cs @@ -11,12 +11,17 @@ public class MainMenu : MonoBehaviour public Button PlayButton; //Imports the play button private string existingProperties; //The variable for the properties - + private string existingCards; + void Start() { - if (!PropertiesHandler.checkExists()) //Checks if the properties file doesn't exist. + if (!PropertiesHandler.CheckPropertyExists()) //Checks if the properties file doesn't exist. { StartCoroutine(GetProperties()); //Downloads the properties json. } + else if (!PropertiesHandler.CheckCardExists()) + { + StartCoroutine(GetCards()); //Downloads the cards json. + } else { enabled = false; //Stops the update function. @@ -29,6 +34,14 @@ public class MainMenu : MonoBehaviour if (existingProperties != null) //Checks if the data has been downloaded { PropertiesHandler.SaveProperties(existingProperties); //Saves the downloaded data + } + if (existingCards != null) + { + PropertiesHandler.SaveCards(existingCards); //Saves the downloaded data + } + + if (PropertiesHandler.CheckPropertyExists() && PropertiesHandler.CheckCardExists()) + { PlayButton.interactable = true; //Enables the play button enabled = false; //Stops the update loop } @@ -57,5 +70,23 @@ public class MainMenu : MonoBehaviour //existingProperties = JsonConvert.DeserializeObject>(json); } } + + IEnumerator GetCards() + { + UnityWebRequest www = UnityWebRequest.Get(Domain.subDomain("includes/get-cards.php")); + yield return www.SendWebRequest(); + + if (www.isNetworkError || www.isHttpError) + { + Debug.Log(www.error); + } + else + { + // Show results as text + string json = www.downloadHandler.text; + existingCards = json; + //existingProperties = JsonConvert.DeserializeObject>(json); + } + } } diff --git a/Assets/Scripts/menu/PropertiesHandler.cs b/Assets/Scripts/menu/PropertiesHandler.cs index df15cc9..fa56714 100644 --- a/Assets/Scripts/menu/PropertiesHandler.cs +++ b/Assets/Scripts/menu/PropertiesHandler.cs @@ -16,6 +16,16 @@ public static class PropertiesHandler formatter.Serialize(stream, data); stream.Close(); } + + public static void SaveCards(string data) + { + BinaryFormatter formatter = new BinaryFormatter(); + string path = Application.persistentDataPath + "/cards.smyal"; + FileStream stream = new FileStream(path, FileMode.Create); + + formatter.Serialize(stream, data); + stream.Close(); + } public static string LoadProperties() { @@ -36,11 +46,37 @@ public static class PropertiesHandler return null; } } + + public static string LoadCards() + { + string path = Application.persistentDataPath + "/cards.smyal"; + if (File.Exists(path)) + { + BinaryFormatter formatter = new BinaryFormatter(); + FileStream stream = new FileStream(path, FileMode.Open); - public static bool checkExists() + string data = formatter.Deserialize(stream) as string; + stream.Close(); + + return data; + } + else + { + Debug.LogError("Save file not found in " + path); + return null; + } + } + + public static bool CheckPropertyExists() { string path = Application.persistentDataPath + "/properties.smyal"; return File.Exists(path); } + public static bool CheckCardExists() + { + string path = Application.persistentDataPath + "/cards.smyal"; + return File.Exists(path); + } + } diff --git a/Assets/Scripts/monopoly/ButtonHandler.cs b/Assets/Scripts/monopoly/ButtonHandler.cs index 87d07fd..f834f6b 100644 --- a/Assets/Scripts/monopoly/ButtonHandler.cs +++ b/Assets/Scripts/monopoly/ButtonHandler.cs @@ -19,6 +19,9 @@ public class ButtonHandler : MonoBehaviour private bool inventoryOpen = false; private Inventory inventoryClass; + public GameObject card; + public Button cardButton; + public void DisableRollDice() { rollDice.interactable = false; @@ -79,6 +82,11 @@ public class ButtonHandler : MonoBehaviour } } + void CloseCard() + { + card.SetActive(false); + } + private Main main; void Awake() @@ -92,6 +100,7 @@ public class ButtonHandler : MonoBehaviour buyButtonButton.onClick.AddListener(BuyPropertyClick); nextTurn.onClick.AddListener(NextTurn); inventory.onClick.AddListener(ToggleInventory); + cardButton.onClick.AddListener(CloseCard); } void BuyPropertyClick() { diff --git a/Assets/Scripts/monopoly/Cards.cs b/Assets/Scripts/monopoly/Cards.cs new file mode 100644 index 0000000..c06ef89 --- /dev/null +++ b/Assets/Scripts/monopoly/Cards.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Cards +{ + + public int card_id; + public int card_group; + public string card_text; + public int card_function; + public int? extra; +} diff --git a/Assets/Scripts/monopoly/Cards.cs.meta b/Assets/Scripts/monopoly/Cards.cs.meta new file mode 100644 index 0000000..fb3603f --- /dev/null +++ b/Assets/Scripts/monopoly/Cards.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2454549cc26e6f48aa34d62f3cff26a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/monopoly/FileHandler.cs b/Assets/Scripts/monopoly/FileHandler.cs index 6df67c8..1483dcd 100644 --- a/Assets/Scripts/monopoly/FileHandler.cs +++ b/Assets/Scripts/monopoly/FileHandler.cs @@ -9,7 +9,7 @@ public static class FileHandler string path = Application.persistentDataPath + "/properties.smyal"; //This finds the predefined path in LocalLow and tries to find the JSON file in binary. if (File.Exists(path)) //If the file exists.. { - BinaryFormatter formatter = new BinaryFormatter(); //Gets the binary formatter to convert it into plain text + BinaryFormatter formatter = new BinaryFormatter(); //Gets the binary formatter to convert it into plain text FileStream stream = new FileStream(path, FileMode.Open); //Opens the properties.smyal file string data = formatter.Deserialize(stream) as string; //It decodes the binary to a string @@ -23,4 +23,25 @@ public static class FileHandler return null; } } + + public static string LoadCards() + { + string path = Application.persistentDataPath + "/cards.smyal"; //This finds the predefined path in LocalLow and tries to find the JSON file in binary. + if (File.Exists(path)) //If the file exists... + { + BinaryFormatter formatter = new BinaryFormatter(); //Gets the binary formatter to convert it into plain text + FileStream stream = new FileStream(path, FileMode.Open); //Opens the cards.smyal file + + string data = formatter.Deserialize(stream) as string; //It decodes the binary to a string + stream.Close(); //The file is now closed. + + return data; //The data is returned. + + } + else + { + Debug.LogError("Save file not found in " + path); //Sends an error message to the console. + return null; + } + } } diff --git a/Assets/Scripts/monopoly/Main.cs b/Assets/Scripts/monopoly/Main.cs index 82f7e3f..94273b2 100644 --- a/Assets/Scripts/monopoly/Main.cs +++ b/Assets/Scripts/monopoly/Main.cs @@ -148,9 +148,10 @@ public class Board //Creating the class for the board mechanics. public int currentPlayer = 0; public List existingProperties; public List avaliableProperties = new List(); //Has a list of all the available properties. - + public List chance = new List(); + public List communityChest = new List(); - public Board(List players, List properties) + public Board(List players, List properties, List existingCards) { this.players = players; //Imports all of the players playing Debug.Log(this.players.Count); //Prints how many players are playing @@ -169,16 +170,30 @@ public class Board //Creating the class for the board mechanics. avaliableProperties.Add(properties[i]); } } + + //This appends all the cards into their own respective pile. + foreach (Cards card in existingCards) + { + switch (card.card_group) //Checks what group the card is in. + { + case 0: //If it is a chance card. + chance.Add(card); + break; + case 1: //If it is a community chest card. + communityChest.Add(card); + break; + } + } } public void MovePlayer(int roll) //This moves the player { players[currentPlayer].Move(roll); //This is telling the player to move in the local player class. - textHandler.updateRoll(roll); //This is updating the text on the screen for the roll + textHandler.UpdateRoll(roll); //This is updating the text on the screen for the roll //Money UI int money = players[currentPlayer].money; //Gets the money the player has - textHandler.updateMoney(money); //Updates the money on the UI + textHandler.UpdateMoney(money); //Updates the money on the UI //Property UI string propertyName = existingProperties[players[currentPlayer].position].property_name; //Gets the property name from where the player is at @@ -186,11 +201,11 @@ public class Board //Creating the class for the board mechanics. if (propertyValue != 0) //This is for if the property can be bought { - textHandler.updateProperty(propertyName, propertyValue); //Updates the UI text for the property info + textHandler.UpdateProperty(propertyName, propertyValue); //Updates the UI text for the property info } else { - textHandler.updateTile(propertyName); //Updates the UI text for the property info without the value of the property + textHandler.UpdateTile(propertyName); //Updates the UI text for the property info without the value of the property } buttonHandler.DisableRollDice(); //Disables the user from being able to roll the dice whilst the player is moving @@ -205,7 +220,7 @@ public class Board //Creating the class for the board mechanics. if (currentProperty.property_rent >= 100) //Only tax tiles have a rent value of 100 or 200 { players[currentPlayer].Pay(Convert.ToInt32(currentProperty.property_rent)); //Makes the player pay the tax and converts int? to int - textHandler.updateMoney(players[currentPlayer].money); //Updates the UI for the current amount of money the player has. + textHandler.UpdateMoney(players[currentPlayer].money); //Updates the UI for the current amount of money the player has. return; } @@ -284,7 +299,7 @@ public class Board //Creating the class for the board mechanics. players[findProperty.Item1].Pay(-payment); //This gives the property owner the money. } - textHandler.updateMoney(players[currentPlayer].money); //Updates the UI for the current amount of money the player has. + textHandler.UpdateMoney(players[currentPlayer].money); //Updates the UI for the current amount of money the player has. } public void NextPlayer() //This moves the queue to the next player. TODO @@ -298,14 +313,26 @@ public class Board //Creating the class for the board mechanics. { currentPlayer++; //Increments the queue to the next player } - textHandler.updateMoney(players[currentPlayer].money); //Changes the amount of money the new player has. + textHandler.UpdateMoney(players[currentPlayer].money); //Changes the amount of money the new player has. buttonHandler.EnableRollDice(); //Re-enables the user to roll the dice. } - public bool CheckBuyable(int position) //This checks if the property can be bought by the user. + public bool CheckProperty(int position) //This checks if the property can be bought by the user. { Property property = existingProperties[position]; //Gets the property the player is currently at. + + if (property.property_group == "chance") + { + UseCard(0); + return false; + } + + if (property.property_group == "chest") + { + UseCard(1); + return false; + } for (int i = 0; i < avaliableProperties.Count; i++) //Checks through all of the properties that are buyable using a linear search { @@ -316,7 +343,7 @@ public class Board //Creating the class for the board mechanics. } } buttonHandler.DisableBuying(); //If the name is not found, the property has not been found. - buttonHandler.EnableRollDice(); //Allows the user to roll the dice if the property cannot be bought + buttonHandler.EnableNextTurn(); //Allows the user to roll the dice if the property cannot be bought return false; //Returns false if the property is not buybale. } @@ -356,7 +383,7 @@ public class Board //Creating the class for the board mechanics. { avaliableProperties.RemoveAt(i); //Removes the property from the list. players[currentPlayer].BuyProperty(property); //This buys the property in the player class - textHandler.updateMoney(players[currentPlayer].money); //This updates the amount of money the player has. + textHandler.UpdateMoney(players[currentPlayer].money); //This updates the amount of money the player has. buttonHandler.DisableBuying(); //Removes the buy button. buttonHandler.EnableNextTurn(); return; //Stops the function @@ -457,6 +484,20 @@ public class Board //Creating the class for the board mechanics. return false; //This returns false to say that the hotel cannot be sold. } + + public void UseCard(int group) //TODO + { + switch (group) + { + case 0: + textHandler.ShowCard(group, chance[0].card_text); + break; + case 1: + textHandler.ShowCard(group, communityChest[0].card_text); + break; + } + buttonHandler.EnableNextTurn(); + } } public class Player @@ -624,6 +665,7 @@ public class Player public class Main : MonoBehaviour { private List existingProperties; + private List existingCards; public Board board; //Player variables @@ -636,7 +678,8 @@ public class Main : MonoBehaviour players.Add(new Player("coomer", 1, GameObject.Find("/Players/Player2"))); Debug.Log(players[0].name); //This is just checking if the player has been assigned. existingProperties = JsonConvert.DeserializeObject>(FileHandler.LoadProperties()); //This loads via JSON all the properties from a file which was originally downloaded from a server. - board = new Board(players, existingProperties); //Creates the board class. + existingCards = JsonConvert.DeserializeObject>(FileHandler.LoadCards()); //This loads via JSON all the cards from a file which was originally downloaded from a server. + board = new Board(players, existingProperties, existingCards); //Creates the board class. } } diff --git a/Assets/Scripts/monopoly/Movement.cs b/Assets/Scripts/monopoly/Movement.cs index df6706b..1a6cd2b 100644 --- a/Assets/Scripts/monopoly/Movement.cs +++ b/Assets/Scripts/monopoly/Movement.cs @@ -53,10 +53,9 @@ public class Movement : MonoBehaviour return; } - if (!main.board.CheckBuyable(roll)) + if (!main.board.CheckProperty(roll)) { main.board.CheckFees(); - main.board.NextPlayer(); } } diff --git a/Assets/Scripts/monopoly/TextHandler.cs b/Assets/Scripts/monopoly/TextHandler.cs index 208dfcf..1ab9441 100644 --- a/Assets/Scripts/monopoly/TextHandler.cs +++ b/Assets/Scripts/monopoly/TextHandler.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using TMPro; using UnityEngine; +using UnityEngine.UI; public class TextHandler : MonoBehaviour { @@ -8,42 +9,60 @@ public class TextHandler : MonoBehaviour public TextMeshProUGUI propertyInfo; private string propertyName; [CanBeNull] private string propertyValue; - + public TextMeshProUGUI Roll; private string roll; public TextMeshProUGUI Money; private string money; + + public GameObject card; + public TextMeshProUGUI cardGroup; + public TextMeshProUGUI cardText; - public void updateTile (string propertyName) + public void UpdateTile (string propertyName) { this.propertyName = propertyName; propertyInfo.text = $"Current tile: {this.propertyName}"; } - public void updateProperty (string propertyName, int? propertyValue) + public void UpdateProperty (string propertyName, int? propertyValue) { this.propertyName = propertyName; this.propertyValue = propertyValue.ToString(); propertyInfo.text = $"Current property: {this.propertyName}\nValue: {this.propertyValue}"; } - public void updateRoll(int roll) + public void UpdateRoll(int roll) { this.roll = roll.ToString(); Roll.text = $"Rolled: {this.roll}"; } - public void updateMoney(int money) + public void UpdateMoney(int money) { this.money = money.ToString(); Money.text = $"Money: {this.money}"; } - - // Update is called once per frame - void Update() + public void ShowCard(int group, string text) { + switch (group) + { + case 0: + cardGroup.text = "Chance"; + break; + case 1: + cardGroup.text = "Community Chest"; + break; + default: + cardGroup.text = ""; + break; + } + cardText.text = text.Replace("\\n", "\n");; //Changes \n to machine readable new line + + card.SetActive(true); } + } diff --git a/Assets/cards.csv b/Assets/cards.csv new file mode 100644 index 0000000..0de76fe --- /dev/null +++ b/Assets/cards.csv @@ -0,0 +1,33 @@ +card_id,card_group,card_text,card_function,extra +1,0,"TAKE A TRIP TO\nKINGS CROSS STATION.\nIF YOU PASS GO,\nCOLLECT 200.",1,5 +2,0,BANK PAYS YOU\nDIVIDEND OF 50.,2,50 +3,0,"MAKE GENERAL REPAIRS\nON ALL YOUR PROPERTY:\nFOR EACH HOUSE PAY 25,\nFOR EACH HOTEL PAY 100.",3, +4,0,"ADVANCE TO THE\nNEAREST STATION.\n\n If UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, pay owner\ntwice the rental to which\nthey are otherwise entitled.",4, +5,0,ADVANCE TO\nMAYFAIR.,1,39 +6,0,YOU HAVE BEEN ELECTED\nCHAIRMAN OF THE BOARD.\nPAY EACH PLAYER 50.,6,50 +7,0,"ADVANCE TO\nTHE NEAREST UTILITY.\n\nIf UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, throw dice\nand pay owner 10 times\nthe amount thrown.",5, +8,0,"ADVANCE TO THE\nNEAREST STATION.\n\n If UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, pay owner\ntwice the rental to which\nthey are otherwise entitled.",4, +9,0,"ADVANCE TO\nPALL MALL.\nIF YOU PASS GO,\nCOLLECT 200.",1,11 +10,0,SPEEDING FINE 15.,7,15 +11,0,GO BACK\nTHREE SPACES.,8, +12,0,YOUR BUILDING\nLOAN MATURES.\nCOLLECT 150.,2,150 +13,0,ADVANCE TO GO.\n(COLLECT 200),1,0 +14,0,"GO TO JAIL. GO DIRECTLY TO JAIL,\nDO NOT PASS GO, DO NOT COLLECT 200.",1,40 +15,0,"ADVANCE TO\nTRAFALGAR SQUARE.\nIF YOU PASS GO,\nCOLLECT 200.",1,24 +16,0,*GET OUT OF JAIL FREE.*,9, +17,1,DOCTOR'S FEES.\nPAY 50.,7,50 +18,1,SCHOOL FEES.\nPAY 50.,7,50 +19,1,INCOME TAX REFUND.\nCOLLECT 20,2,20 +20,1,"GO TO JAIL. GO DIRECTLY TO JAIL,\nDO NOT PASS GO, DO NOT COLLECT 200.",1,40 +21,1,LIFE INSURANCE MATURES.\nCOLLECT 100.,2,100 +22,1,YOU INHERIT\n100.,2,100 +23,1,RECEIVE 25\nCONSULTANCY FEE.,2,25 +24,1,BANK ERROR\nIN YOUR FAVOUR.\nCOLLECT 200.,2,200 +25,1,HOLIDAY FUND MATURES.\nRECEIVE 100.,2,100 +26,1,YOU HAVE WON\nSECOND PRIZE IN\nA BEAUTY CONTEST.\nCOLLECT 10.,2,10 +27,1,YOU ARE ASSESSED\nFOR STREET REPAIRS:\nPAY 40 PER HOUSE AND\n115 PER HOTEL YOU OWN.,10, +28,1,HOSPITAL FEES.\nPAY 100.,7,100 +29,1,IT IS YOUR BIRTHDAY\nCOLLECT 10\nFROM EVERY PLAYER.,11,10 +30,1,FROM SALE OF STOCK\nYOU GET 50.,2,50 +31,1,ADVANCE TO GO.\n(COLLECT 200),1,0 +32,1,*GET OUT OF JAIL FREE.*,9, diff --git a/Assets/cards.csv.meta b/Assets/cards.csv.meta new file mode 100644 index 0000000..892d3f4 --- /dev/null +++ b/Assets/cards.csv.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ad3c9732639538f409ef98de72a4782c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/cards.xlsx b/Assets/cards.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..e20853023160a6c704fd9eb040d50e6b9490bb8c GIT binary patch literal 9945 zcmeHtgoTg#i6+WGIQ_! zW~MXWUvTfv^PHWWbKaHY?Da0)stO2*_yA-8DgXeW0)P)Q%|UPgKrA8vfCoT@*ORcb zbuzVeGJNA^ZwfJZ?rLLA`4JJGF$Vw-yZ?XVzxWB1Ck`n?Ik2TJW$z?5+2j{%L{WJU z{QGd3Uki73C-jyY>t$J3JZ6R6VvFYzSibm#JF@7(b@I);#@43ZKeV?+4I{#@zf%K5 z_JX~qZ=bG%h$P-oSLY}PpG=gK#LzJ6T{_@{LjzQeM{-R}zMRyYfKb?XBXhn_6KAEj z38PfESfGEQYgJiu8HazcWCD9*3~$oXg2@APy1^!g7(wl^NazeIP^HpVX9BA=Io_lw zv_lvhxu@P5!!L6L$F@CP8eTzeX@5bk#6wzB5`I>y+Z$`e(&4G^>E6K@9dV|5)67R; zZpfyWCF)1zKRydkwTh@Etl+X8@#+>K$Wt6T{zAEQOSgsx>|P-=Y0ip?HBly}wqac@ z=*yB+5qQDu?_JbC(8%AZa$pSfv@IM%*+i7Odc?oL*=auQ6vrOuq@wi-IauxAdF8P` zx}_Izc#^#1!}Wj+06ab-095}%%Q_7XnlqTLDZ*HX4x^=^qp3B7{rPXl|IzWkn1g@% z>*euEDo_rL;3L_)kp9c5rC4ln1s5^d7OFSizH*CLby0b=WJ?_kKpbNVxcIMV>Rl>=Q*IpIqcGDuCQCb%uXW=%Pn}O)q{_&)!FqbtJ z=PC@W&`3|5NPfZ|d9Fo@hF1U#CKO8b)9qE#Sq5KK!cB>*A5;WaH@wK%O&Ce{nMp3( z!4wGm^u~!C8(ksoe}stUFI7(>w6)J=v5q`qij; zaId&VWcuiG&V6)ic}|8h-MU|(LCgA&2mB)_ikD#?>hC0Bk#tbrf)NA?qYxJC$+%jx zyVyBef$i+9e)C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=M#SyuV8Ls}KDH4*(!i004jUsK3JhY6AZZ52X4N{NDyqRRIaMx&Xiv*vl8@v?XYN G`}BY6Y;TAF literal 0 HcmV?d00001 diff --git a/Assets/cards.xlsx.meta b/Assets/cards.xlsx.meta new file mode 100644 index 0000000..49406bf --- /dev/null +++ b/Assets/cards.xlsx.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 25012c01f1f996c45ac7abadb2dd45b3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/chance.txt b/chance.txt new file mode 100644 index 0000000..51f83a4 --- /dev/null +++ b/chance.txt @@ -0,0 +1,16 @@ +TAKE A TRIP TO\nKINGS CROSS STATION.\nIF YOU PASS GO,\nCOLLECT 200. +BANK PAYS YOU\nDIVIDEND OF 50. +MAKE GENERAL REPAIRS\nON ALL YOUR PROPERTY:\nFOR EACH HOUSE PAY 25,\nFOR EACH HOTEL PAY 100. +ADVANCE TO THE\nNEAREST STATION.\n\n If UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, pay owner\ntwice the rental to which\nthey are otherwise entitled. +ADVANCE TO\nMAYFAIR. +YOU HAVE BEEN ELECTED\nCHAIRMAN OF THE BOARD.\nPAY EACH PLAYER 50. +ADVANCE TO\nTHE NEAREST UTILITY.\n\nIf UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, throw dice\nand pay owner 10 times\nthe amount thrown. +ADVANCE TO THE\nNEAREST STATION.\n\n If UNOWNED, you may\nbuy it from the Bank.\n\nIf OWNED, pay owner\ntwice the rental to which\nthey are otherwise entitled. +ADVANCE TO\nPALL MALL.\nIF YOU PASS GO,\nCOLLECT 200. +SPEEDING FINE 15. +GO BACK\nTHREE SPACES. +YOUR BUILDING\nLOAN MATURES.\nCOLLECT 150. +ADVANCE TO GO.\n(COLLECT 200) +GO TO JAIL. GO DIRECTLY TO JAIL,\nDO NOT PASS GO, DO NOT COLLECT 200. +ADVANCE TO\nTRAFALGAR SQUARE.\nIF YOU PASS GO,\nCOLLECT 200. +*GET OUT OF JAIL FREE.* \ No newline at end of file diff --git a/community chest.txt b/community chest.txt new file mode 100644 index 0000000..299c7bb --- /dev/null +++ b/community chest.txt @@ -0,0 +1,16 @@ +DOCTOR'S FEES.\nPAY 50. +SCHOOL FEES.\nPAY 50. +INCOME TAX REFUND.\nCOLLECT 20 +GO TO JAIL. GO DIRECTLY TO JAIL,\nDO NOT PASS GO, DO NOT COLLECT 200. +LIFE INSURANCE MATURES.\nCOLLECT 100. +YOU INHERIT\n100. +RECEIVE 25\nCONSULTANCY FEE. +BANK ERROR\nIN YOUR FAVOUR.\nCOLLECT 200. +HOLIDAY FUND MATURES.\nRECEIVE 100. +YOU HAVE WON\nSECOND PRIZE IN\nA BEAUTY CONTEST.\nCOLLECT 10. +YOU ARE ASSESSED\nFOR STREET REPAIRS:\nPAY 40 PER HOUSE AND\n115 PER HOTEL YOU OWN. +HOSPITAL FEES.\nPAY 100. +IT IS YOUR BIRTHDAY\nCOLLECT 10\nFROM EVERY PLAYER. +FROM SALE OF STOCK\nYOU GET 50. +ADVANCE TO GO.\n(COLLECT 200) +*GET OUT OF JAIL FREE.* \ No newline at end of file diff --git a/definitions of functions for cards.txt b/definitions of functions for cards.txt new file mode 100644 index 0000000..8dcb1c1 --- /dev/null +++ b/definitions of functions for cards.txt @@ -0,0 +1,15 @@ +1 - move | extra - move to x (position) +2 - bank gives money | extra - give x money (money) +3 - make repairs 25 per house and 100 per hotel. +4 - advance to the nearest station - requires calculation pay the owner 2x the rent +5 - advance to the nearest utility - make player roll dice, then pay owner 10x entitled pay. +6 - pay each player a sum of money | extra - money x +7 - pay bank | extra - money x +8 - go back 3 steps. +9 - get out of jail free card +10 - street repairs, 40 per house and 115 per hotel. +11 - collect money from every player | extra - money x + +groups: +1 - chance +2 - community chest \ No newline at end of file