Compare commits

...

15 Commits

Author SHA1 Message Date
Fangh
2670a870be fix: player can enter room multiple times 2024-02-04 14:32:14 +01:00
Fangh
ee6c2fa97c fix: if there is a broken room, retry 2024-02-04 14:30:11 +01:00
Fangh
50bff13fae fix: remove unused property + disable submitstartgame at start 2024-02-04 14:12:27 +01:00
Fangh
cf0a4d578c fix: display first page and unsubscribe from your old room 2024-02-04 14:09:04 +01:00
Fangh
e9ac369702 fix: clearing room when new game 2024-02-04 13:57:13 +01:00
Fangh
aa410f21e5 fix: remove a white square 2024-02-04 13:44:55 +01:00
Fangh
5f0704c2f1 fix: manage if one player did not send a propositon 2024-02-04 13:36:03 +01:00
Fangh
a99f7dca5c fix: only one background 2024-02-04 13:33:24 +01:00
Fangh
764a39d053 fix: correct pages should toggle at correct time 2024-02-04 13:32:08 +01:00
Fangh
211aa89485 wip: try to know why state doesn't update on phone 2024-02-04 13:21:39 +01:00
Fangh
63bcb59d72 wip 2024-02-04 13:11:24 +01:00
Fangh
6454b54dc6 wip: add some security 2024-02-04 13:02:58 +01:00
Fangh
2de1611c4d wip: reset values 2024-02-04 12:42:57 +01:00
Fangh
825c69fcc1 add debug logs 2024-02-04 12:23:12 +01:00
Fangh
723edde647 WIP restart same players 2024-02-04 12:04:24 +01:00
10 changed files with 238 additions and 547 deletions

View File

@ -191,78 +191,6 @@ MonoBehaviour:
m_Spacing: {x: 50, y: 50} m_Spacing: {x: 50, y: 50}
m_Constraint: 0 m_Constraint: 0
m_ConstraintCount: 2 m_ConstraintCount: 2
--- !u!1 &9253746
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9253747}
- component: {fileID: 9253749}
- component: {fileID: 9253748}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9253747
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9253746}
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: 581333954}
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 &9253748
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9253746}
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 &9253749
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9253746}
m_CullTransparentMesh: 1
--- !u!1 &45150984 --- !u!1 &45150984
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -291,7 +219,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 500028487}
- {fileID: 619055281} - {fileID: 619055281}
- {fileID: 1798182258} - {fileID: 1798182258}
- {fileID: 1350310808} - {fileID: 1350310808}
@ -720,6 +647,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (5) value: PlayerSticker (5)
@ -1489,6 +1420,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (4) value: PlayerSticker (4)
@ -1813,6 +1748,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (1) value: PlayerSticker (1)
@ -2110,78 +2049,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 411140634} m_GameObject: {fileID: 411140634}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &427170778
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 427170779}
- component: {fileID: 427170781}
- component: {fileID: 427170780}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &427170779
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 427170778}
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: 1117928115}
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 &427170780
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 427170778}
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 &427170781
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 427170778}
m_CullTransparentMesh: 1
--- !u!1 &440351810 --- !u!1 &440351810
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2318,78 +2185,6 @@ MonoBehaviour:
m_Spacing: {x: 150, y: 100} m_Spacing: {x: 150, y: 100}
m_Constraint: 0 m_Constraint: 0
m_ConstraintCount: 2 m_ConstraintCount: 2
--- !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 &516717322 --- !u!1 &516717322
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2495,7 +2290,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 9253747}
- {fileID: 190388869} - {fileID: 190388869}
- {fileID: 1813019851} - {fileID: 1813019851}
- {fileID: 98075281} - {fileID: 98075281}
@ -2779,6 +2573,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1836364712}
- {fileID: 1117928115} - {fileID: 1117928115}
- {fileID: 45150985} - {fileID: 45150985}
- {fileID: 1730465903} - {fileID: 1730465903}
@ -3014,6 +2809,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker value: PlayerSticker
@ -3261,6 +3060,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (7) value: PlayerSticker (7)
@ -4187,6 +3990,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (6) value: PlayerSticker (6)
@ -4526,6 +4333,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (3) value: PlayerSticker (3)
@ -5014,7 +4825,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 427170779}
- {fileID: 2078353088} - {fileID: 2078353088}
- {fileID: 1901141295} - {fileID: 1901141295}
- {fileID: 1499472362} - {fileID: 1499472362}
@ -7176,81 +6986,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1503133438} m_GameObject: {fileID: 1503133438}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1542177989
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1542177990}
- component: {fileID: 1542177992}
- component: {fileID: 1542177991}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1542177990
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1542177989}
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: 1660260834}
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: -756, y: 200.00002}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1542177991
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1542177989}
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 &1542177992
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1542177989}
m_CullTransparentMesh: 1
--- !u!1 &1567271221 --- !u!1 &1567271221
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7637,8 +7372,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1542177990}
- {fileID: 1850877722}
- {fileID: 1351333135} - {fileID: 1351333135}
- {fileID: 1236996027} - {fileID: 1236996027}
- {fileID: 1567271222} - {fileID: 1567271222}
@ -7977,7 +7710,6 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1803918110}
- {fileID: 1165659435} - {fileID: 1165659435}
- {fileID: 987875882} - {fileID: 987875882}
- {fileID: 157938956} - {fileID: 157938956}
@ -8385,78 +8117,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1798182257} m_GameObject: {fileID: 1798182257}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1803918109
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1803918110}
- component: {fileID: 1803918112}
- component: {fileID: 1803918111}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1803918110
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1803918109}
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: 1730465903}
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 &1803918111
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1803918109}
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 &1803918112
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1803918109}
m_CullTransparentMesh: 1
--- !u!1 &1805240025 --- !u!1 &1805240025
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -8666,7 +8326,7 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1813019850} m_GameObject: {fileID: 1813019850}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1850877721 --- !u!1 &1836364711
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -8674,9 +8334,9 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1850877722} - component: {fileID: 1836364712}
- component: {fileID: 1850877724} - component: {fileID: 1836364714}
- component: {fileID: 1850877723} - component: {fileID: 1836364713}
m_Layer: 5 m_Layer: 5
m_Name: Background m_Name: Background
m_TagString: Untagged m_TagString: Untagged
@ -8684,35 +8344,35 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!224 &1850877722 --- !u!224 &1836364712
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1850877721} m_GameObject: {fileID: 1836364711}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1660260834} m_Father: {fileID: 610087870}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000030517578, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1920, y: 1080} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1850877723 --- !u!114 &1836364713
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1850877721} m_GameObject: {fileID: 1836364711}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
@ -8723,20 +8383,23 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Texture: {fileID: 2800000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3} m_Sprite: {fileID: 21300000, guid: 51cab6d235722024da1a1ba85f4d2e99, type: 3}
m_UVRect: m_Type: 0
serializedVersion: 2 m_PreserveAspect: 0
x: 0 m_FillCenter: 1
y: 0 m_FillMethod: 4
width: 1 m_FillAmount: 1
height: 1 m_FillClockwise: 1
--- !u!222 &1850877724 m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1836364714
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1850877721} m_GameObject: {fileID: 1836364711}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1854893634 --- !u!1 &1854893634
GameObject: GameObject:
@ -9214,6 +8877,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2430977146559507814, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} - target: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PlayerSticker (2) value: PlayerSticker (2)

View File

@ -49,6 +49,7 @@ public void WebcamResume()
wTexture.Play(); wTexture.Play();
photo = null; photo = null;
photoBox.texture = null;
freezeButton.gameObject.SetActive(true); freezeButton.gameObject.SetActive(true);
resumeButton.gameObject.SetActive(false); resumeButton.gameObject.SetActive(false);
} }

View File

@ -28,6 +28,20 @@ public Room(string _code)
currentState = 1; //default by PC currentState = 1; //default by PC
} }
public Room Copy()
{
Room newRoom = new Room(this.code)
{
questions = new Dictionary<int, Question>(this.questions),
players = new Dictionary<string, Player>(this.players),
currentQuestionId = this.currentQuestionId,
creationDate = this.creationDate,
currentState = this.currentState
};
return newRoom;
}
/// <summary> /// <summary>
/// Return the only player with a specific ID /// Return the only player with a specific ID
/// </summary> /// </summary>

View File

@ -20,7 +20,6 @@ public class GameManager : MonoBehaviour
[Header("Other component")] [Header("Other component")]
public float explanationTime = 4f; public float explanationTime = 4f;
private float currentExplanationTime = 0;
[Header("Home Connection Component")] [Header("Home Connection Component")]
public TMP_InputField roomCodeField; public TMP_InputField roomCodeField;
@ -65,7 +64,11 @@ private void Awake()
private void Start() private void Start()
{ {
currentExplanationTime = explanationTime; InitializeHomePage();
}
private void InitializeHomePage()
{
HomeConnection.SetActive(true); HomeConnection.SetActive(true);
WaitingRoom.SetActive(false); WaitingRoom.SetActive(false);
BeforeStart.SetActive(false); BeforeStart.SetActive(false);
@ -73,10 +76,11 @@ private void Start()
VotePicture.SetActive(false); VotePicture.SetActive(false);
WaitingOtherPlayers.SetActive(false); WaitingOtherPlayers.SetActive(false);
EndGame.SetActive(false); EndGame.SetActive(false);
submitStartGame.SetActive(false);
submitNewPlayer.interactable = true;
if (PlayerPrefs.HasKey("lastplayername")) if (PlayerPrefs.HasKey("lastplayername"))
playerNameField.text = PlayerPrefs.GetString("lastplayername"); playerNameField.text = PlayerPrefs.GetString("lastplayername");
} }
private void OnApplicationQuit() private void OnApplicationQuit()
@ -285,17 +289,15 @@ public void StartGame()
/// </summary> /// </summary>
private void OnRoomUpdate(object sender, ValueChangedEventArgs e) private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{ {
Debug.Log("begin OnRoomUpdate");
GameState lastState = (GameState)myRoom.currentState; GameState lastState = (GameState)myRoom.currentState;
try try
{ {
if (e?.Snapshot?.GetRawJsonValue() != null) if (e?.Snapshot?.GetRawJsonValue() != null)
{ {
string JSON = e.Snapshot.GetRawJsonValue(); string JSON = e.Snapshot.GetRawJsonValue();
Debug.Log($"Room has been updated : {JSON}", this);
myRoom = JsonConvert.DeserializeObject<Room>(e.Snapshot.GetRawJsonValue()); myRoom = JsonConvert.DeserializeObject<Room>(e.Snapshot.GetRawJsonValue());
} }
} }
catch (Exception ex) catch (Exception ex)
@ -304,10 +306,11 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
} }
if (myRoom == null) if (myRoom == null)
{ {
Debug.Log("myroom is null"); Debug.LogError("Got an update for an empty room.", this);
return; return;
} }
Debug.Log($"lasState = {lastState}. Currentstep = {(GameState)myRoom.currentState}", this);
if (myRoom.currentState != (int)lastState) if (myRoom.currentState != (int)lastState)
{ {
OnNewGameState(); OnNewGameState();
@ -341,61 +344,66 @@ private void OnNewGameState()
{ {
case (int)GameState.EnteringName: case (int)GameState.EnteringName:
{ {
if (EndGame.activeInHierarchy) InitializeHomePage();
{
EndGame.SetActive(false);
HomeConnection.SetActive(true);
}
break; break;
} }
case (int)GameState.Explanation: case (int)GameState.Explanation:
{ {
if (EndGame.activeInHierarchy) Debug.Log("Explanation time.", this);
{
EndGame.SetActive(false); WaitingOtherPlayers.SetActive(false);
} TakePicture.SetActive(false);
WaitingRoom.SetActive(false); WaitingRoom.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
BeforeStart.SetActive(true); BeforeStart.SetActive(true);
endOfViewDate = DateTime.Now.AddSeconds(4); endOfViewDate = DateTime.Now.AddSeconds(4);
break; break;
} }
case (int)GameState.MakeProposition: case (int)GameState.MakeProposition:
{
if (BeforeStart.activeInHierarchy)
{ {
Debug.Log("It's photo time !", this); Debug.Log("It's photo time !", this);
WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false); BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(false);
TakePicture.SetActive(true); TakePicture.SetActive(true);
endOfViewDate = DateTime.Now.AddSeconds(60); endOfViewDate = DateTime.Now.AddSeconds(60);
}
break; break;
} }
case (int)GameState.MakeVote: case (int)GameState.MakeVote:
{
if (TakePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy)
{ {
Debug.Log("It's voting time !", this); Debug.Log("It's voting time !", this);
WaitingOtherPlayers.SetActive(false); WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
TakePicture.SetActive(false); TakePicture.SetActive(false);
EndGame.SetActive(false);
VotePicture.SetActive(true); VotePicture.SetActive(true);
Debug.Log("subscribe to question ID");
myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged; myOnlineRoom.Child("currentQuestionId").ValueChanged += OnCurrentQuestionChanged;
}
break; break;
} }
case (int)GameState.Score: case (int)GameState.Score:
{
if (VotePicture.activeInHierarchy || WaitingOtherPlayers.activeInHierarchy)
{ {
Debug.Log("it's scoring time !", this); Debug.Log("it's scoring time !", this);
Debug.Log("unsubscribe to question ID");
myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged; myOnlineRoom.Child("currentQuestionId").ValueChanged -= OnCurrentQuestionChanged;
VotePicture.SetActive(false);
WaitingOtherPlayers.SetActive(false); WaitingOtherPlayers.SetActive(false);
BeforeStart.SetActive(false);
WaitingRoom.SetActive(false);
TakePicture.SetActive(false);
VotePicture.SetActive(false);
EndGame.SetActive(true);
endGameFirstPlayer.SetActive(CheckIfIAmTheFirst(myRoom.GetPlayerList())); endGameFirstPlayer.SetActive(CheckIfIAmTheFirst(myRoom.GetPlayerList()));
endGameOtherPlayers.SetActive(!CheckIfIAmTheFirst(myRoom.GetPlayerList())); endGameOtherPlayers.SetActive(!CheckIfIAmTheFirst(myRoom.GetPlayerList()));
EndGame.SetActive(true);
}
break; break;
} }
@ -468,15 +476,18 @@ public void OnClickSubmitSignIn()
{ {
string playerName = playerNameField.text; string playerName = playerNameField.text;
string roomCode = roomCodeField.text; string roomCode = roomCodeField.text;
submitNewPlayer.interactable = false;
PlayerValidateNameAndServerRoom(playerName, roomCode); PlayerValidateNameAndServerRoom(playerName, roomCode);
} }
public void onClickSamePlayers() public void onClickSamePlayers()
{ {
myRoom.currentState = (int)GameState.Explanation; Debug.Log("Play with same players !", this);
myRoom.questions = null; Room newRoom = myRoom.Copy();
myRoom.currentQuestionId = 0; newRoom.currentState = (int)GameState.Explanation;
string json = JsonConvert.SerializeObject(myRoom); newRoom.questions.Clear();
newRoom.currentQuestionId = 0;
string json = JsonConvert.SerializeObject(newRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task => myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{ {
@ -489,11 +500,13 @@ public void onClickSamePlayers()
} }
public void onClickNewPlayers() public void onClickNewPlayers()
{ {
myRoom.currentState = (int)GameState.EnteringName; Debug.Log("Play with new players !", this);
myRoom.currentQuestionId = 0; Room newRoom = myRoom.Copy();
myRoom.questions = null; newRoom.currentState = (int)GameState.EnteringName;
myRoom.players = null; newRoom.currentQuestionId = 0;
string json = JsonConvert.SerializeObject(myRoom); newRoom.questions = null;
newRoom.players = null;
string json = JsonConvert.SerializeObject(newRoom);
myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task => myOnlineRoom.SetRawJsonValueAsync(json).ContinueWithOnMainThread(task =>
{ {
@ -507,6 +520,9 @@ public void onClickNewPlayers()
private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlineValue) private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlineValue)
{ {
if (onlineValue == null || onlineValue.Snapshot == null || onlineValue.Snapshot.Value == null || myRoom.questions == null || myRoom.questions.Count == 0)
return;
int questionId = onlineValue.Snapshot.Value.ConvertTo<int>(); int questionId = onlineValue.Snapshot.Value.ConvertTo<int>();
Debug.Log($"new question ! Q{(onlineValue.Snapshot.Value.ConvertTo<int>())}"); Debug.Log($"new question ! Q{(onlineValue.Snapshot.Value.ConvertTo<int>())}");

View File

@ -16,7 +16,6 @@ public class PropositionHandler : MonoBehaviour
public void ShowQuestion(Question currentQuestion) public void ShowQuestion(Question currentQuestion)
{ {
List<Proposition> props = currentQuestion.propositions.Values.ToList(); List<Proposition> props = currentQuestion.propositions.Values.ToList();
string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en; string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en;
promptLabel.text = enPrompt; promptLabel.text = enPrompt;
@ -24,6 +23,12 @@ public void ShowQuestion(Question currentQuestion)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int index = i; // Capture la valeur de i pour cette itération int index = i; // Capture la valeur de i pour cette itération
if(props[i].photoUrl == null)
{
Debug.Log("One player did not send a proposition !", this);
}
else
{
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
{ {
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
@ -33,6 +38,7 @@ public void ShowQuestion(Question currentQuestion)
})); }));
}); });
} }
}
} }

View File

@ -12,7 +12,7 @@ public class QuestionHandler : MonoBehaviour
public PromptList promptList; public PromptList promptList;
private GameManager gameManager; private GameManager gameManager;
private List<Question> questionsToAnswer; private List<Question> questionsToAnswer = new List<Question>();
private int activeAnsweredQuestionIndex = 0; private int activeAnsweredQuestionIndex = 0;
private const int FirstQuestionIndex = 0; private const int FirstQuestionIndex = 0;
@ -25,21 +25,14 @@ public class QuestionHandler : MonoBehaviour
/// </summary> /// </summary>
void OnEnable() void OnEnable()
{ {
activeAnsweredQuestionIndex = FirstQuestionIndex;
submitButton.interactable = true;
submitButton.GetComponent<TextMeshProUGUI>().text = "Submit";
gameManager = managers.GetComponent<GameManager>(); gameManager = managers.GetComponent<GameManager>();
questionsToAnswer = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer); questionsToAnswer = gameManager.myRoom.GetQuestionsByPlayer(gameManager.currentPlayer);
Redraw(activeAnsweredQuestionIndex); Redraw(activeAnsweredQuestionIndex);
} }
/// <summary>
/// Called when the script is disabled.
/// Cleans up resources and resets the activeAnsweredQuestionIndex.
/// </summary>
void OnDisable()
{
questionsToAnswer = null;
activeAnsweredQuestionIndex = FirstQuestionIndex;
}
/// <summary> /// <summary>
/// Redraws the UI with the information from the current question. /// Redraws the UI with the information from the current question.
/// </summary> /// </summary>

View File

@ -6,12 +6,9 @@
using UnityEngine; using UnityEngine;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Linq; using System.Linq;
using Google.MiniJSON;
using Firebase.Storage; using Firebase.Storage;
using System.Security.Policy;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections; using System.Collections;
using System.Security.Cryptography;
public class RoomManager : MonoBehaviour public class RoomManager : MonoBehaviour
{ {
@ -56,10 +53,17 @@ private void Awake()
} }
private void Start() private void Start()
{
InitializeFirstPage();
}
private void InitializeFirstPage()
{ {
explanationPage.SetActive(false); explanationPage.SetActive(false);
waitForPropositionsPage.gameObject.SetActive(false); waitForPropositionsPage.gameObject.SetActive(false);
votingPage.gameObject.SetActive(false); votingPage.gameObject.SetActive(false);
scoringPage.gameObject.SetActive(false);
waitingForPlayersPage.SetActive(true); waitingForPlayersPage.SetActive(true);
ResetAllPlayerLabels(); ResetAllPlayerLabels();
} }
@ -101,8 +105,43 @@ private void ResetAllPlayerLabels()
private bool deleteRoomFilesCompleted = false; private bool deleteRoomFilesCompleted = false;
private bool deleteRealtimeDBCompleted = false; private bool deleteRealtimeDBCompleted = false;
private IEnumerator OnApplicationQuit() private void OnApplicationQuit()
{ {
StartCoroutine(Coroutine_ClearCurrentRoom(() =>
{
Debug.Log("You can go. Bye bye...");
}));
}
private void Initialize()
{
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized");
ClearOldAndCreateNewRoom();
}
private void ClearOldAndCreateNewRoom()
{
CleanOldRooms();
StartCoroutine(Coroutine_ClearCurrentRoom(() =>
{
CreateNewRoom();
}));
}
private IEnumerator Coroutine_ClearCurrentRoom(Action callback_OnRoomClear = null)
{
if(myRoom == null || string.IsNullOrEmpty(myRoom.code))
{
yield return null;
Debug.Log("There is no last room to clean", this);
callback_OnRoomClear?.Invoke();
}
else
{
realtimeDB.Child("rooms").Child(myRoom.code).ValueChanged -= OnRoomUpdate;
Debug.Log($"delete files of room {myRoom.code} from storage", this); Debug.Log($"delete files of room {myRoom.code} from storage", this);
StorageManager.Instance.DeleteFileOfRoom(myRoom, () => StorageManager.Instance.DeleteFileOfRoom(myRoom, () =>
{ {
@ -122,23 +161,15 @@ private IEnumerator OnApplicationQuit()
{ {
yield return null; // Yield until both tasks are completed yield return null; // Yield until both tasks are completed
} }
callback_OnRoomClear?.Invoke();
Debug.Log("Everything is clean. You can go. Bye bye..."); Debug.Log("Everything is clean.");
} }
private void Initialize()
{
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized");
CleanOldRooms();
CreateNewRoom();
} }
/// <summary> /// <summary>
/// Check all the rooms in the server and give back the number already taken /// Check all the rooms in the server and give back the number already taken
/// </summary> /// </summary>
private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked) private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked)
{ {
QueryRoomsInDatabase(onlineRooms => QueryRoomsInDatabase(onlineRooms =>
@ -263,8 +294,6 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
UpdateConnectedPlayerList(myRoom.GetPlayerList()); UpdateConnectedPlayerList(myRoom.GetPlayerList());
break; break;
case (int)GameState.Explanation:
break;
case (int)GameState.MakeProposition: case (int)GameState.MakeProposition:
waitForPropositionsPage.OnRoomUpdate(myRoom); waitForPropositionsPage.OnRoomUpdate(myRoom);
break; break;
@ -282,12 +311,18 @@ private void OnNewGameStateStarted()
{ {
switch (myRoom.currentState) switch (myRoom.currentState)
{ {
case (int)GameState.EnteringName: //if game has been reset by a player on mobile
ClearOldAndCreateNewRoom();
InitializeFirstPage();
break;
case (int)GameState.WaitingForOtherPlayersToJoin: case (int)GameState.WaitingForOtherPlayersToJoin:
Debug.Log("New State : WaitingForOtherPlayersToJoin"); Debug.Log("New State : WaitingForOtherPlayersToJoin");
break; break;
case (int)GameState.Explanation: case (int)GameState.Explanation:
Debug.Log("New State : Explanation"); Debug.Log("New State : Explanation");
scoringPage.gameObject.SetActive(false); //if we come back from a new game
waitingForPlayersPage.SetActive(false); waitingForPlayersPage.SetActive(false);
explanationPage.SetActive(true); explanationPage.SetActive(true);
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime); endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
@ -366,7 +401,7 @@ private void QueryRoomsInDatabase(Action<List<Room>> callback)
catch (Exception e) catch (Exception e)
{ {
Debug.LogException(e); Debug.LogException(e);
Debug.LogError($"Room {JSON} was broken, deleting it", this); Debug.Log($"Room {JSON} is broken, deleting it", this);
snapshot.Reference.RemoveValueAsync().ContinueWithOnMainThread(task => snapshot.Reference.RemoveValueAsync().ContinueWithOnMainThread(task =>
{ {
if (task.IsFaulted) if (task.IsFaulted)
@ -374,8 +409,9 @@ private void QueryRoomsInDatabase(Action<List<Room>> callback)
Debug.LogException(task.Exception); Debug.LogException(task.Exception);
return; return;
} }
Debug.Log($"Broken room has been deleted", this); Debug.Log($"Broken room has been deleted. Checking again", this);
}); ; QueryRoomsInDatabase(callback);
});
} }
} }
else else
@ -417,25 +453,4 @@ private void DeleteRoom(string _roomCode)
Debug.Log($"Room {_roomCode} has been deleted"); Debug.Log($"Room {_roomCode} has been deleted");
}); });
} }
private async Task<bool> DoesPathExistAsync(StorageReference storageReference)
{
try
{
await storageReference.GetMetadataAsync();
return true; // Path exists
}
catch (StorageException ex)
{
if (ex.ErrorCode == StorageException.ErrorObjectNotFound)
{
return false; // Path does not exist
}
else
{
Debug.LogException(ex);
return false; // Handle other errors as needed
}
}
}
} }

View File

@ -65,7 +65,6 @@ public void DeleteFileOfRoom(Room _room, Action callBack_OnFinish)
Debug.Log($"There is no files to delete for room {_room.code}", this); Debug.Log($"There is no files to delete for room {_room.code}", this);
callBack_OnFinish.Invoke(); callBack_OnFinish.Invoke();
} }
} }
private void RunDeleteTasks(List<Task> deleteTasks, Action callback_OnFinish) private void RunDeleteTasks(List<Task> deleteTasks, Action callback_OnFinish)
@ -80,37 +79,6 @@ private void RunDeleteTasks(List<Task> deleteTasks, Action callback_OnFinish)
}); });
} }
/*
private IEnumerator RunDeleteTasks(List<Task> deleteTasks, Action callback_OnFinish)
{
int taskCount = deleteTasks.Count;
Debug.Log($"There are {taskCount} files to delete", this);
foreach (Task task in deleteTasks)
{
task.ContinueWith((completedTask) =>
{
// This code will be executed when the task is completed.
taskCount--;
});
// Start the task
task.Start();
}
while (taskCount > 0)
{
yield return null;
}
callback_OnFinish?.Invoke();
}
private Task DeletePhoto(string _gsURL)
{
string temp = _gsURL;
StorageReference imageRef = FirebaseStorage.DefaultInstance.GetReferenceFromUrl(temp);
Debug.Log($"deleting {temp}", this);
return imageRef.DeleteAsync();
}*/
public void UploadPhoto(string roomCode, string playerId, int question, int proposition, Action<bool> callback_OnPhotoUploaded) public void UploadPhoto(string roomCode, string playerId, int question, int proposition, Action<bool> callback_OnPhotoUploaded)
{ {
Texture2D photo = cameraManager.GetPhoto(); Texture2D photo = cameraManager.GetPhoto();

View File

@ -94,10 +94,13 @@ private void EndCurrentQuestion()
public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player> _currentPlayers, Dictionary<int, Question> _questions, Action _callback_OnVoteEnded) public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player> _currentPlayers, Dictionary<int, Question> _questions, Action _callback_OnVoteEnded)
{ {
Debug.Log("Initializing voting page"); Debug.Log("Initializing voting page");
this.gameObject.SetActive(true);
roomRef = _roomRef; roomRef = _roomRef;
currentPlayers = _currentPlayers; currentPlayers = _currentPlayers;
OnVoteEnded = _callback_OnVoteEnded; OnVoteEnded = _callback_OnVoteEnded;
allPlayersHaveVotedForCurrentQuestion = false;
endOfTimer = DateTime.MinValue;
remainingQuestions.Clear();
currentQuestion = null;
Question[] _questionArray = _questions.Values.ToArray(); Question[] _questionArray = _questions.Values.ToArray();
numberOfQuestions = _questionArray.Length; numberOfQuestions = _questionArray.Length;
@ -108,6 +111,7 @@ public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player
roomRef.Child("questions").Child(i.ToString()).ValueChanged += OnQuestionDataUpdate; roomRef.Child("questions").Child(i.ToString()).ValueChanged += OnQuestionDataUpdate;
} }
gameObject.SetActive(true);
currentQuestion = remainingQuestions.Dequeue(); currentQuestion = remainingQuestions.Dequeue();
ShowNextQuestion(); ShowNextQuestion();
} }

View File

@ -24,6 +24,13 @@ public void Initialize(Room _myRoom, Action _onPropositionFinish)
gameObject.SetActive(true); gameObject.SetActive(true);
OnPropositionFinish = _onPropositionFinish; OnPropositionFinish = _onPropositionFinish;
myRoom = _myRoom; myRoom = _myRoom;
allPlayersHasProposedTwoPictures = false;
playersIdWhoHaveProposed.Clear();
foreach(TextMeshProUGUI label in playerLabels)
{
label.color = Color.white;
}
ShowPlayerLabels(); ShowPlayerLabels();
} }