From e13f094914fc6ecd241ce4f56707c1bf9a93f78d Mon Sep 17 00:00:00 2001 From: Morgan - 6 Freedom Date: Sat, 27 Jan 2024 23:07:41 +0100 Subject: [PATCH] explanation page on PC --- Assets/Scenes/ComputerView.unity | 453 ++++++++++++++++++++++++++++--- Assets/Scripts/RoomManager.cs | 39 ++- 2 files changed, 452 insertions(+), 40 deletions(-) diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index 283eb78..ae760c4 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -263,6 +263,44 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 9253746} m_CullTransparentMesh: 1 +--- !u!1 &45150984 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 45150985} + m_Layer: 5 + m_Name: ExplanationPage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &45150985 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 45150984} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 500028487} + - {fileID: 619055281} + - {fileID: 1798182258} + m_Father: {fileID: 610087870} + 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 &58343404 GameObject: m_ObjectHideFlags: 0 @@ -464,10 +502,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 1200, y: -200} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &130058895 MonoBehaviour: @@ -1326,6 +1364,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: waitingForPlayersPage: {fileID: 1117928114} + roomCodeLabel: {fileID: 1805240027} waitingForPlayersLabels: - {fileID: 1794849355} - {fileID: 1452182577} @@ -1335,6 +1374,8 @@ MonoBehaviour: - {fileID: 496953434} - {fileID: 2137991537} - {fileID: 340074661} + explanationPage: {fileID: 0} + counter: {fileID: 0} waitingForPropositionsPage: {fileID: 1730465902} waitingForPropositionsLabels: - {fileID: 972471162} @@ -1346,8 +1387,8 @@ MonoBehaviour: - {fileID: 2065109614} - {fileID: 1197279072} propositionTime: 59.8 + timerGUI: {fileID: 0} votingTime: 20 - roomCodeLabel: {fileID: 1805240027} --- !u!114 &375256413 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1649,6 +1690,78 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 496953432} m_CullTransparentMesh: 0 +--- !u!1 &500028486 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 500028487} + - component: {fileID: 500028489} + - component: {fileID: 500028488} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &500028487 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500028486} + 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: 45150985} + 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 &500028488 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500028486} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, 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_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &500028489 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500028486} + m_CullTransparentMesh: 1 --- !u!1 &581333953 GameObject: m_ObjectHideFlags: 0 @@ -1902,6 +2015,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1117928115} + - {fileID: 45150985} - {fileID: 1730465903} - {fileID: 1660260834} - {fileID: 1451481718} @@ -1913,6 +2027,141 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!1 &619055280 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 619055281} + - component: {fileID: 619055283} + - component: {fileID: 619055282} + m_Layer: 5 + m_Name: Explanation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &619055281 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 619055280} + 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: 45150985} + 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: 210.61394} + m_SizeDelta: {x: 0, y: -421.2278} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &619055282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 619055280} + 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: "You will have some prompts \nand you will have to take pictures of what + is asked.\n\n Are you Ready ?" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278250239 + m_fontColor: {r: 1, g: 0.91909254, b: 0, 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: 96 + m_fontSizeBase: 96 + 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: 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 &619055283 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 619055280} + m_CullTransparentMesh: 1 --- !u!1 &655174605 GameObject: m_ObjectHideFlags: 0 @@ -2213,10 +2462,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -600} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &680005431 MonoBehaviour: @@ -2946,10 +3195,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -200} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &972471162 MonoBehaviour: @@ -3941,10 +4190,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 800, y: -200} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1141337197 MonoBehaviour: @@ -4209,10 +4458,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 1200, y: -600} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1197279072 MonoBehaviour: @@ -4860,10 +5109,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 400, y: -200} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1374681049 MonoBehaviour: @@ -5764,12 +6013,12 @@ GameObject: m_Component: - component: {fileID: 1730465903} m_Layer: 5 - m_Name: WiatingForPropositionPage + m_Name: WaitingForPropositionPage m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1730465903 RectTransform: m_ObjectHideFlags: 0 @@ -6196,6 +6445,140 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1794849353} m_CullTransparentMesh: 0 +--- !u!1 &1798182257 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1798182258} + - component: {fileID: 1798182260} + - component: {fileID: 1798182259} + m_Layer: 5 + m_Name: Counter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1798182258 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1798182257} + 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: 45150985} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 540} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &1798182259 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1798182257} + 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: 3 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2} + m_sharedMaterial: {fileID: 8890805173838430465, guid: 72af27804d5aa49408430b4b2500f877, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278254591 + m_fontColor: {r: 1, g: 0.98475426, b: 0, 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: 200 + m_fontSizeBase: 200 + 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: 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 &1798182260 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1798182257} + m_CullTransparentMesh: 1 --- !u!1 &1803918109 GameObject: m_ObjectHideFlags: 0 @@ -6774,10 +7157,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 400, y: -600} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1854893636 MonoBehaviour: @@ -7664,10 +8047,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 987875882} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 800, y: -600} + m_SizeDelta: {x: 400, y: 400} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2065109614 MonoBehaviour: diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs index 4742796..f046b60 100644 --- a/Assets/Scripts/RoomManager.cs +++ b/Assets/Scripts/RoomManager.cs @@ -18,6 +18,11 @@ public class RoomManager : MonoBehaviour public List waitingForPlayersLabels = new List(); public PromptList promptList; + [Header("Explanation Page")] + public GameObject explanationPage; + public TextMeshProUGUI counter; + private DateTime endOfExplanationDate = DateTime.MinValue; + [Header("Waiting For Proposition Page")] public GameObject waitingForPropositionsPage; public List waitingForPropositionsLabels = new List(); @@ -57,11 +62,26 @@ private void Start() { propositionCurrentTime = propositionTime; votingCurrentTime = votingTime; - DisableAllPlayerLabels(); + ResetAllPlayerLabels(); currentState = GameState.WaitingForOtherPlayersToJoin; } - private void DisableAllPlayerLabels() + private void Update() + { + if (currentState == GameState.Explanation && endOfExplanationDate != DateTime.MinValue) + { + TimeSpan duration = endOfExplanationDate - DateTime.Now; + counter.text = duration.TotalSeconds.ToString("D1"); + + if (duration.TotalMilliseconds <= 0) + { + Debug.Log("It's time to make proposition !", this); + currentState = GameState.MakeProposition; + } + } + } + + private void ResetAllPlayerLabels() { for (int i = 0; i < waitingForPlayersLabels.Count; i++) { @@ -71,9 +91,12 @@ private void DisableAllPlayerLabels() private void OnApplicationQuit() { - realtimeDB.Child("rooms").Child(myRoom.code).RemoveValueAsync(); Debug.Log($"delete room {myRoom.code}"); - myRoom = null; + realtimeDB.Child("rooms").Child(myRoom.code).RemoveValueAsync().ContinueWithOnMainThread(task => + { + Debug.Log($"room {myRoom.code} has been deleted"); + myRoom = null; + }); } private void Initialize() @@ -137,7 +160,6 @@ public void CreateNewRoom() { WhichCodesAreAlreadyUsed(codes => { - Debug.Log("coucou"); Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4")); myRoom = newRoom; try @@ -307,6 +329,11 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value) case GameState.WaitingForOtherPlayersToJoin: UpdateConnectedPlayerList(myRoom.GetPlayerList()); break; + case GameState.Explanation: + waitingForPlayersPage.SetActive(false); + explanationPage.SetActive(true); + endOfExplanationDate = DateTime.Now.AddSeconds(30); + break; case GameState.MakeProposition: HostStartGame(); break; @@ -321,6 +348,8 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value) /// private void UpdateConnectedPlayerList(List _players) { + ResetAllPlayerLabels(); + Debug.Log($"players count = {_players.Count}"); for (int i = 0; i < _players.Count; i++) {