Merge branch 'main' of github.com:LeGall29/GGJ2024

This commit is contained in:
Michel Roux 2024-01-27 16:39:12 +01:00
commit 1de9e63770
5 changed files with 727 additions and 25 deletions

View File

@ -1049,7 +1049,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &638947074 --- !u!224 &638947074
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1113,7 +1113,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 638947076} m_TargetGraphic: {fileID: 638947076}
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls:
- m_Target: {fileID: 1202782732}
m_TargetAssemblyTypeName: GameManager, Assembly-CSharp
m_MethodName: StartGame
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &638947076 --- !u!114 &638947076
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2105,6 +2117,140 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &991600091
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 991600092}
- component: {fileID: 991600094}
- component: {fileID: 991600093}
m_Layer: 5
m_Name: ErrorCodeLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &991600092
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991600091}
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: 2023851069}
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: 2.9758, y: 20.4609}
m_SizeDelta: {x: 154.05, y: 13.5401}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &991600093
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991600091}
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: 'Error: the room code is invalide'
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: 4278190335
m_fontColor: {r: 1, g: 0, 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: 11.43
m_fontSizeBase: 11.43
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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.000000025251643, 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 &991600094
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 991600091}
m_CullTransparentMesh: 1
--- !u!1 &1034781733 --- !u!1 &1034781733
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2596,7 +2742,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1158329300} m_TargetGraphic: {fileID: 1158329300}
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls:
- m_Target: {fileID: 1202782732}
m_TargetAssemblyTypeName: GameManager, Assembly-CSharp
m_MethodName: PlayerValidateNameAndServerRoom
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1158329300 --- !u!114 &1158329300
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2668,6 +2826,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 1288753599} - {fileID: 1288753599}
- {fileID: 1770783105} - {fileID: 1770783105}
- {fileID: 1224049645}
m_Father: {fileID: 2027556832} m_Father: {fileID: 2027556832}
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.5, y: 0.5}
@ -2958,7 +3117,7 @@ GameObject:
- component: {fileID: 1202782729} - component: {fileID: 1202782729}
- component: {fileID: 1202782728} - component: {fileID: 1202782728}
- component: {fileID: 1202782727} - component: {fileID: 1202782727}
- component: {fileID: 1202782731} - component: {fileID: 1202782732}
m_Layer: 5 m_Layer: 5
m_Name: Canvas m_Name: Canvas
m_TagString: Untagged m_TagString: Untagged
@ -3049,7 +3208,7 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &1202782731 --- !u!114 &1202782732
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -3058,9 +3217,160 @@ MonoBehaviour:
m_GameObject: {fileID: 1202782726} m_GameObject: {fileID: 1202782726}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 77ca3ece4774c244e96dcee6ab926fbb, type: 3} m_Script: {fileID: 11500000, guid: 27a435387a7644784a6fc6ae538b68e5, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isRoomExist: 1
isPlayerExist: 1
explanationTime: 4
roomCodeField: {fileID: 2023851070}
roomError: {fileID: 991600093}
playerNameField: {fileID: 1163479463}
nameError: {fileID: 1224049646}
submitNewPlayer: {fileID: 1158329299}
listPlayersUI: {fileID: 1891690322}
submitStartGame: {fileID: 638947073}
HomeConnection: {fileID: 2027556831}
WaitingRoom: {fileID: 1590939977}
BeforeStart: {fileID: 563000513}
TakePicture: {fileID: 1181392805}
VotePicture: {fileID: 531335861}
WaitingOtherPlayers: {fileID: 2095389711}
EndGame: {fileID: 1850164816}
--- !u!1 &1224049644
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1224049645}
- component: {fileID: 1224049647}
- component: {fileID: 1224049646}
m_Layer: 5
m_Name: ErrorNameLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1224049645
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1224049644}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0029413, y: 1.0029413, z: 0.8627451}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1163479462}
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: 2.9845557, y: 18.5}
m_SizeDelta: {x: 154.05, y: 13.5401}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1224049646
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1224049644}
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: 'Error: only numbers and letters'
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: 4278190335
m_fontColor: {r: 1, g: 0, 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: 11.43
m_fontSizeBase: 11.43
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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.000000025251643, 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 &1224049647
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1224049644}
m_CullTransparentMesh: 1
--- !u!1 &1266773203 --- !u!1 &1266773203
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4703,8 +5013,8 @@ RectTransform:
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.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -38.8} m_AnchoredPosition: {x: 2.8591, y: -36.5711}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 194.2818, y: 45.5423}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1770783106 --- !u!114 &1770783106
MonoBehaviour: MonoBehaviour:
@ -5610,6 +5920,7 @@ RectTransform:
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 2008743696} - {fileID: 2008743696}
- {fileID: 991600092}
m_Father: {fileID: 2027556832} m_Father: {fileID: 2027556832}
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.5, y: 0.5}
@ -5768,7 +6079,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &2027556832 --- !u!224 &2027556832
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -22,3 +22,86 @@ MonoBehaviour:
- <id>k__BackingField: 48017744-4552-487a-817a-abd5d03bbbc0 - <id>k__BackingField: 48017744-4552-487a-817a-abd5d03bbbc0
<fr>k__BackingField: elle <fr>k__BackingField: elle
<en>k__BackingField: elle <en>k__BackingField: elle
- <id>k__BackingField: cef08696-352b-4003-85ff-2864996e9949
<fr>k__BackingField: Jacque chirac
<en>k__BackingField: Jacque chirac
- <id>k__BackingField: ecc8ffb1-1965-4169-bd67-b22a9d321951
<fr>k__BackingField: "La 7\xE9me guerre mondiale"
<en>k__BackingField: The 7th world war
- <id>k__BackingField: c3a3c511-a4dc-477e-a04c-76e0b8778fb8
<fr>k__BackingField: Le sujet de ton prochain roman
<en>k__BackingField: The subject of your next novel
- <id>k__BackingField: 4512b17b-454a-481d-b7d4-4765a7f9d23f
<fr>k__BackingField: Le futur
<en>k__BackingField: The futur
- <id>k__BackingField: 3e1ec191-9a90-414d-b52e-ac2eb09eebcc
<fr>k__BackingField: Le plus vieux
<en>k__BackingField: The oldest
- <id>k__BackingField: 177e7d67-81fc-42b9-ad0c-efa2fe46425a
<fr>k__BackingField: "L'\xE9tat de votre gouvernement"
<en>k__BackingField: The state of your government
- <id>k__BackingField: 29c11342-a9fb-4067-b94e-37b292a830d3
<fr>k__BackingField: Dieu
<en>k__BackingField: God
- <id>k__BackingField: 636c16ec-a52b-449f-997c-833c0f8ddf3f
<fr>k__BackingField: Le plus petit
<en>k__BackingField: the smallest
- <id>k__BackingField: 64c6279b-0b91-4c2d-9fd4-7e2873172315
<fr>k__BackingField: Le meilleur d'entre nous
<en>k__BackingField: The best of us
- <id>k__BackingField: 9bd4b867-952b-432b-ba66-de9425e4407c
<fr>k__BackingField: L'objet le plus doux
<en>k__BackingField: The softest object
- <id>k__BackingField: 7954f378-e003-4a37-8d88-4f92dd9e2afd
<fr>k__BackingField: "Un super h\xE9ros"
<en>k__BackingField: A super hero
- <id>k__BackingField: 7f999932-6d98-4c8b-a89b-a335deb0f286
<fr>k__BackingField: Le dernier lien de votre historique internet
<en>k__BackingField: The last link in your internet history
- <id>k__BackingField: e484bb00-291c-4e65-9810-4a11dd0ef57a
<fr>k__BackingField: 'Votre passe temps du moment '
<en>k__BackingField: Your current hobby
- <id>k__BackingField: f91b8236-a6d0-43b7-ae6b-272f36a928c7
<fr>k__BackingField: 'Une jojo pose '
<en>k__BackingField: A jojo pose
- <id>k__BackingField: a7715b73-8fa2-4073-8e80-768ceceb6c6b
<fr>k__BackingField: La nature
<en>k__BackingField: The nature
- <id>k__BackingField: 26ca8ef5-2698-40f2-ac35-9829a3d1c9c0
<fr>k__BackingField: "Cette chose qui vous \xE9nerve un peut"
<en>k__BackingField: That thing that annoys you a little
- <id>k__BackingField: 43e166bb-3ec1-419a-a445-609149a4e62f
<fr>k__BackingField: "Une id\xE9e lumineuse"
<en>k__BackingField: A bright idea
- <id>k__BackingField: a502c6c8-d946-449e-b494-2ffc59dc99d9
<fr>k__BackingField: La plus grande star au monde
<en>k__BackingField: 'The biggest star in the world '
- <id>k__BackingField: b82a8b15-ec9b-4a11-8962-e87994b3c829
<fr>k__BackingField: "Une t\xE9l\xE9commande universel"
<en>k__BackingField: A universal remote control
- <id>k__BackingField: 272fe8c2-4bf2-4ad0-bdb4-fc65d16ae768
<fr>k__BackingField: Un beau bateau
<en>k__BackingField: A nice boat
- <id>k__BackingField: 50f2338f-764d-4ef3-992e-8f632a71ad53
<fr>k__BackingField: Youtube actuellement
<en>k__BackingField: Youtube actually
- <id>k__BackingField: fb09b646-9f27-49fd-9e3f-781b5b915cb2
<fr>k__BackingField: Rond comme un ballon
<en>k__BackingField: 'Round like a balloon '
- <id>k__BackingField: 59622776-9661-4220-9beb-7e3562a79fe1
<fr>k__BackingField: Qui rend heureux
<en>k__BackingField: Who makes you happy
- <id>k__BackingField: a05ec722-a4a5-4cfa-84ba-464309f3aa1f
<fr>k__BackingField: Tortue ninja
<en>k__BackingField: Ninja Turtle
- <id>k__BackingField: f57b973c-d755-42b0-a0f7-48ee2bfa5238
<fr>k__BackingField: Un pokemon
<en>k__BackingField: A pokemon
- <id>k__BackingField: 0eb7bac8-993c-4beb-9fd5-c1136bb337b0
<fr>k__BackingField: "Votre humeur apr\xE8s avoir vue les derni\xE8res nouvelles
sur un de vos r\xE9saux sociaux"
<en>k__BackingField: Your mood after seeing the latest news on one of your social
networks
- <id>k__BackingField: 598d0c4f-da47-4182-946c-c4704f9c8f0b
<fr>k__BackingField: La meilleure boisson
<en>k__BackingField: The best drink

View File

@ -1,8 +1,12 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Firebase.Database;
using Firebase.Extensions;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.UIElements;
/// <summary> /// <summary>
/// This is the game state manager on the phone side /// This is the game state manager on the phone side
@ -12,17 +16,58 @@ public class GameManager : MonoBehaviour
private GameState currentState; private GameState currentState;
private List<Player> players = new List<Player>(); private List<Player> players = new List<Player>();
[Header("Temp variables")]
public bool isRoomExist = true;
public bool isPlayerExist = true;
[Header("Other component")]
public float explanationTime = 4f; public float explanationTime = 4f;
private float currentExplanationTime = 0; private float currentExplanationTime = 0;
public InputField roomCodeField; [Header("Home Component")]
public TMP_InputField roomCodeField;
public TextMeshProUGUI roomError; public TextMeshProUGUI roomError;
public InputField playerNameField; public TMP_InputField playerNameField;
public TextMeshProUGUI nameError; public TextMeshProUGUI nameError;
public UnityEngine.UI.Button submitNewPlayer;
[Header("WaitingRoom Component")]
public TextMeshProUGUI listPlayersUI;
public GameObject submitStartGame;
[Header("Pages")]
[SerializeField]
public GameObject HomeConnection;
[SerializeField]
public GameObject WaitingRoom;
[SerializeField]
public GameObject BeforeStart;
[SerializeField]
public GameObject TakePicture;
[SerializeField]
public GameObject VotePicture;
[SerializeField]
public GameObject WaitingOtherPlayers;
[SerializeField]
public GameObject EndGame;
private DatabaseReference realtimeDB;
private Room myRoom;
private void Awake()
{
FirebaseInitializer.Instance.onFirebaseReady += Initialize;
}
private void Start() private void Start()
{ {
currentExplanationTime = explanationTime; currentExplanationTime = explanationTime;
HomeConnection.SetActive(true);
} }
public GameState GetCurrentState() public GameState GetCurrentState()
@ -30,17 +75,100 @@ public GameState GetCurrentState()
return currentState; return currentState;
} }
private void Initialize()
{
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized");
//TODO MARINE : enable the submit button here. Disabled it at start
}
/// <summary> /// <summary>
/// Send your name and game room to the server /// Send your name and game room to the server
/// </summary> /// </summary>
public void PlayerValidateNameAndServerRoom() public void PlayerValidateNameAndServerRoom(string _name, string _code)
{ {
//check if the room exists, if not display an error message //check if the room exists, if not display an error message
realtimeDB.Child("rooms").Child(_code).GetValueAsync().ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
if (snapshot == null)
{
Debug.LogError("The room doesn't exists");
roomError.text = "Error: the room doesn't exists";
roomError.gameObject.SetActive(true);
}
else
{
myRoom = JsonUtility.FromJson<Room>(snapshot.GetRawJsonValue());
realtimeDB.Child("rooms").Child(_code).ChildChanged += OnRoomUpdate;
}
}
});
string playerName = playerNameField.text;
string roomCode = roomCodeField.text;
// send to the server the room code and the player name
// MORGANE ENVOIE AU SERV
// answer isPlayerExist and isRoomExist
//if succeed, then the player to the server //if succeed, then the player to the server
if (isPlayerExist && isRoomExist)
{
currentState = GameState.WaitingForOtherPlayersToJoin;
WaitingRoom.SetActive(true);
HomeConnection.SetActive(false);
//TEMP
Player player = new Player();
player.SetName(playerName);
player.id = "1";
players.Add(player);
if (players.Count == 1)
{
submitStartGame.SetActive(true);
}
Player player2 = new Player();
player2.SetName("3J");
player2.id = "2";
Player player3 = new Player();
player3.SetName("3J");
player3.id = "3";
Player player4 = new Player();
player4.SetName("3J");
player4.id = "4";
Player player5 = new Player();
player5.SetName("3J");
player5.id = "5";
Player player6 = new Player();
player6.SetName("3J");
player6.id = "6";
players.Add(player2);
players.Add(player3);
players.Add(player4);
players.Add(player5);
players.Add(player6);
UpdateDisplayedListUser();
}
// else we show the errors
roomError.gameObject.SetActive(!isRoomExist);
nameError.gameObject.SetActive(!isPlayerExist);
//if succeed, change the state and change page
currentState = GameState.WaitingForOtherPlayersToJoin;
} }
/// <summary> /// <summary>
@ -48,6 +176,12 @@ public void PlayerValidateNameAndServerRoom()
/// </summary> /// </summary>
public void StartGame() public void StartGame()
{ {
// send Start Game
currentState = GameState.Explanation;
WaitingRoom.SetActive(false);
BeforeStart.SetActive(true);
} }
@ -58,6 +192,8 @@ public void StartGame()
/// <param name="_prompt">The prompt to display</param> /// <param name="_prompt">The prompt to display</param>
public void MakeAProposition(Prompt _prompt) public void MakeAProposition(Prompt _prompt)
{ {
currentState = GameState.MakeProposition;
} }
@ -99,9 +235,28 @@ public void DisplayEndScreen()
/// <summary> /// <summary>
/// Automatically called when something change in your room /// Automatically called when something change in your room
/// </summary> /// </summary>
private void OnRoomUpdate() private void OnRoomUpdate(object sender, ChildChangedEventArgs e)
{ {
myRoom = JsonUtility.FromJson<Room>(e.Snapshot.GetRawJsonValue());
switch (currentState)
{
case GameState.WaitingForOtherPlayersToJoin:
{
// players = new list en fonction de ce qu'envoie fangh
UpdateDisplayedListUser();
break;
}
}
}
private void UpdateDisplayedListUser()
{
listPlayersUI.text = string.Empty;
for (int i = 0; i < players.Count; i++)
{
listPlayersUI.text += "\n" + players[i].name;
}
} }
} }

View File

@ -1,13 +1,31 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
public class PhoneLoop : MonoBehaviour public class PhoneLoop : MonoBehaviour
{ {
[SerializeField]
public GameObject homeConnection;
[SerializeField]
public GameObject WaitingRoom;
[SerializeField]
public GameObject BeforeStart;
[SerializeField]
public GameObject TakePicture;
[SerializeField]
public GameObject VotePicture;
[SerializeField]
public GameObject WaitingOtherPlayers;
[SerializeField]
public GameObject EndGame;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
homeConnection.SetActive(true);
} }
// Update is called once per frame // Update is called once per frame
@ -15,4 +33,69 @@ void Update()
{ {
} }
void ShowWaititngRoom()
{
homeConnection.SetActive(false);
WaitingRoom.SetActive(true);
}
void ShowBeforeStart()
{
WaitingRoom.SetActive(false);
BeforeStart.SetActive(true);
}
void ShowTakePicture()
{
BeforeStart.SetActive(false);
TakePicture.SetActive(true);
}
void showWaitingOtherPlayers()
{
if (TakePicture.activeInHierarchy)
{
TakePicture.SetActive(false);
}
if (VotePicture.activeInHierarchy)
{
VotePicture.SetActive(false);
}
WaitingOtherPlayers.SetActive(true);
}
void ShowVotePicture()
{
if (TakePicture.activeInHierarchy)
{
TakePicture.SetActive(false);
}
if (WaitingOtherPlayers.activeInHierarchy)
{
WaitingOtherPlayers.SetActive(false);
}
VotePicture.SetActive(true);
}
void ShowEndGame()
{
WaitingOtherPlayers.SetActive(false) ;
EndGame.SetActive(true);
}
[ContextMenu("Fake Player Connection")]
private void FakePlayerConnection()
{
}
} }

View File

@ -2,7 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using Firebase; using Firebase;
using Firebase.Database; using Firebase.Database;
using Firebase.Extensions;
using TMPro;
using UnityEngine; using UnityEngine;
using System;
public class RoomManager : MonoBehaviour public class RoomManager : MonoBehaviour
{ {
@ -30,6 +33,11 @@ public class RoomManager : MonoBehaviour
DatabaseReference realtimeDB; DatabaseReference realtimeDB;
/// <summary>
/// TextMeshPro that show the value of the current rooom code
/// </summary>
public TextMeshProUGUI roomCodeLabel;
private void Awake() private void Awake()
{ {
FirebaseInitializer.Instance.onFirebaseReady += Initialize; FirebaseInitializer.Instance.onFirebaseReady += Initialize;
@ -38,11 +46,8 @@ private void Awake()
private void Start() private void Start()
{ {
propositionCurrentTime = propositionTime; propositionCurrentTime = propositionTime;
votingCurrentTime = votingTime; votingCurrentTime = votingTime;
//we need to call CreateNewRoom. but not yet
} }
private void OnApplicationQuit() private void OnApplicationQuit()
@ -57,6 +62,33 @@ private void Initialize()
FirebaseInitializer.Instance.onFirebaseReady -= Initialize; FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference; realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized"); Debug.Log("Realtime DB initialized");
CreateNewRoom();
}
/// <summary>
/// Check all the rooms in the server and give back the number already taken
/// </summary>
private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked)
{
List<int> alreadyUsedCodes = new List<int>();
realtimeDB.Child("rooms").GetValueAsync().ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
List<Room> onlineRooms = JsonUtility.FromJson<List<Room>>(snapshot.GetRawJsonValue());
foreach (Room r in onlineRooms)
{
alreadyUsedCodes.Add(int.Parse(r.code));
}
}
callback_OnCodesChecked?.Invoke(alreadyUsedCodes);
});
} }
/// <summary> /// <summary>
@ -65,11 +97,40 @@ private void Initialize()
[ContextMenu("Create New Room")] [ContextMenu("Create New Room")]
public void CreateNewRoom() public void CreateNewRoom()
{ {
Room newRoom = new Room(Random.Range(0, 1000).ToString("D4")); WhichCodesAreAlreadyUsed(codes =>
currentRoom = newRoom; {
string JSON = JsonUtility.ToJson(newRoom); Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4"));
realtimeDB.Child("rooms").Child(newRoom.code).SetRawJsonValueAsync(JSON); currentRoom = newRoom;
Debug.Log($"room {currentRoom.code} has been created on the server"); string JSON = JsonUtility.ToJson(newRoom);
realtimeDB.Child("rooms").Child(newRoom.code).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{
Debug.Log($"room {currentRoom.code} has been created on the server");
realtimeDB.Child("rooms").Child(newRoom.code).Child("players").ChildAdded += PlayerConnect;
//TODO MARINE : uncomment and reference the correct game object
//roomCodeLabel.text = currentRoom.code;
});
});
}
/// <summary>
/// Generate a code between 0 and 1000 that is not in the list
/// </summary>
/// <param name="_impossibleCodes">the list of code you don"t want to get</param>
/// <returns></returns>
private int GenerateRandomAvailableCode(List<int> _impossibleCodes)
{
int random = UnityEngine.Random.Range(0, 1000);
while (_impossibleCodes.Contains(random))
{
Debug.Log($"{random} is already taken, choosing another room code", this);
random = UnityEngine.Random.Range(0, 1000);
}
return random;
}
private void DisplayRoomCode()
{
} }
public void PlayerSendProposition(Proposition _proposition) public void PlayerSendProposition(Proposition _proposition)
@ -149,9 +210,18 @@ public void GenerateCouples()
/// is automatically called when a player connect to the room /// is automatically called when a player connect to the room
/// </summary> /// </summary>
/// <param name="_player"></param> /// <param name="_player"></param>
public void PlayerConnect(Player _player) public void PlayerConnect(object sender, ChildChangedEventArgs args)
{ {
if (args.DatabaseError != null)
{
Debug.LogError(args.DatabaseError.Message);
return;
}
string JSON = args.Snapshot.GetRawJsonValue();
Player joinedPlayer = JsonUtility.FromJson<Player>(JSON);
Debug.Log($"{joinedPlayer.name} has joined the room");
//TODO Marine : do somtethjing with the newly joinde player
} }
[ContextMenu("Fake Player Connection")] [ContextMenu("Fake Player Connection")]