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

This commit is contained in:
Michel Roux 2024-01-27 19:59:51 +01:00
commit fbf4dac1c0
21 changed files with 1076 additions and 409 deletions

BIN
Assets/2DAssets/Snaparazzi.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,166 @@
fileFormatVersion: 2
guid: 8ecc59dae983e4540af29b7b3340b4fe
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 1
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 0 mipMapMode: 0
enableMipMap: 1 enableMipMap: 0
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0
fadeOut: 0 fadeOut: 0
@ -37,13 +37,13 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 0
nPOTScale: 1 nPOTScale: 0
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50
spriteMode: 0 spriteMode: 1
spriteExtrude: 1 spriteExtrude: 1
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
@ -52,9 +52,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
alphaIsTransparency: 0 alphaIsTransparency: 1
spriteTessellationDetail: -1 spriteTessellationDetail: -1
textureType: 0 textureType: 8
textureShape: 1 textureShape: 1
singleChannelComponent: 0 singleChannelComponent: 0
flipbookRows: 1 flipbookRows: 1
@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,13 +132,26 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []
spriteID: spriteID: 5e97eb03825dee720800000000000000
internalID: 0 internalID: 0
vertices: [] vertices: []
indices: indices:

View File

@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 0 mipMapMode: 0
enableMipMap: 1 enableMipMap: 0
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0
fadeOut: 0 fadeOut: 0
@ -37,13 +37,13 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 0
nPOTScale: 1 nPOTScale: 0
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50
spriteMode: 0 spriteMode: 1
spriteExtrude: 1 spriteExtrude: 1
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
@ -52,9 +52,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
alphaIsTransparency: 0 alphaIsTransparency: 1
spriteTessellationDetail: -1 spriteTessellationDetail: -1
textureType: 0 textureType: 8
textureShape: 1 textureShape: 1
singleChannelComponent: 0 singleChannelComponent: 0
flipbookRows: 1 flipbookRows: 1
@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,13 +132,26 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []
spriteID: spriteID: 5e97eb03825dee720800000000000000
internalID: 0 internalID: 0
vertices: [] vertices: []
indices: indices:

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View File

@ -74,7 +74,7 @@ TextureImporter:
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 1
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
ignorePlatformSupport: 0 ignorePlatformSupport: 0
@ -132,6 +132,19 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

File diff suppressed because it is too large Load Diff

View File

@ -152,7 +152,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.8068042, y: 1.8068042, z: 1.8068042} m_LocalScale: {x: 1.8068042, y: 1.8068042, z: 1.8068042}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: [] m_Children:
- {fileID: 2103733877}
m_Father: {fileID: 531335862} m_Father: {fileID: 531335862}
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}
@ -180,7 +181,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: 21300000, guid: 8ce21f9a93b91764ea7ce3f5f295c927, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
@ -214,7 +215,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!114 &157909814 --- !u!114 &157909814
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -354,8 +355,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -61} m_AnchoredPosition: {x: 0, y: -66.941}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 112.377}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &204401156 --- !u!114 &204401156
MonoBehaviour: MonoBehaviour:
@ -620,8 +621,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: -230} m_AnchoredPosition: {x: 0, y: -269.436}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 128.871}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &339389581 --- !u!114 &339389581
MonoBehaviour: MonoBehaviour:
@ -908,18 +909,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 436596783} m_GameObject: {fileID: 436596783}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: 0.0040257527, w: -0.99999195}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.4098437, y: 2.4098437, z: 2.4098437} m_LocalScale: {x: 2.4098437, y: 2.4098437, z: 2.4098437}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 1891690321} - {fileID: 1891690321}
m_Father: {fileID: 1590939978} m_Father: {fileID: 1590939978}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -0.461}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 345, y: 575} m_AnchoredPosition: {x: 548.876, y: 125.955}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 419.287, y: 511.83}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &475172432 --- !u!1 &475172432
GameObject: GameObject:
@ -1301,8 +1302,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 689} m_AnchoredPosition: {x: 0, y: 652.9936}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 122.013}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &668577475 --- !u!114 &668577475
MonoBehaviour: MonoBehaviour:
@ -1569,8 +1570,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 689} m_AnchoredPosition: {x: 0, y: 659.2964}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 109.407}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &751581717 --- !u!114 &751581717
MonoBehaviour: MonoBehaviour:
@ -2160,8 +2161,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 335} m_AnchoredPosition: {x: 0, y: 235.55392}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 248.892}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &903645290 --- !u!114 &903645290
MonoBehaviour: MonoBehaviour:
@ -3956,8 +3957,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 477} m_AnchoredPosition: {x: 0, y: 434.13525}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 135.73}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1360529142 --- !u!114 &1360529142
MonoBehaviour: MonoBehaviour:
@ -4090,8 +4091,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 424} m_AnchoredPosition: {x: 0, y: 386.279}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 125.442}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1383251891 --- !u!114 &1383251891
MonoBehaviour: MonoBehaviour:
@ -4645,8 +4646,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 689} m_AnchoredPosition: {x: 0, y: 659.7693}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 108.462}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1575113405 --- !u!114 &1575113405
MonoBehaviour: MonoBehaviour:
@ -4819,7 +4820,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -61} m_AnchoredPosition: {x: 0, y: -61}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 125.442}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1611727550 --- !u!114 &1611727550
MonoBehaviour: MonoBehaviour:
@ -4953,7 +4954,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -61} m_AnchoredPosition: {x: 0, y: -61}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 114.701}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1680408690 --- !u!114 &1680408690
MonoBehaviour: MonoBehaviour:
@ -5868,10 +5869,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 436596784} m_Father: {fileID: 436596784}
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.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: -81, y: 0} m_AnchoredPosition: {x: 209.645, y: -0.0000076293945}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 419.29, y: 511.83}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1891690322 --- !u!114 &1891690322
MonoBehaviour: MonoBehaviour:
@ -5941,7 +5942,7 @@ MonoBehaviour:
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 2 m_HorizontalAlignment: 1
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
@ -5970,7 +5971,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: -369.03137} m_margin: {x: 0, y: 0, z: 0, w: 1.9035797}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@ -6509,7 +6510,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
@ -6741,8 +6742,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 295} m_AnchoredPosition: {x: 0, y: 256.318}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 0, y: 127.364}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2098267450 --- !u!114 &2098267450
MonoBehaviour: MonoBehaviour:
@ -6841,6 +6842,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2098267448} m_GameObject: {fileID: 2098267448}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &2103733876
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2103733877}
- component: {fileID: 2103733879}
- component: {fileID: 2103733878}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2103733877
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103733876}
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: 105416811}
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.731, y: -2.341}
m_SizeDelta: {x: 94.539, y: 46.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2103733878
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103733876}
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: 20
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, 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: 26.7
m_fontSizeBase: 26.7
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 &2103733879
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103733876}
m_CullTransparentMesh: 1
--- !u!1 &2139867525 --- !u!1 &2139867525
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -2,6 +2,7 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
[Serializable] [Serializable]
[Newtonsoft.Json.JsonObject]
public class Player public class Player
{ {
public string name; public string name;
@ -10,7 +11,7 @@ public class Player
public Player(string _name) public Player(string _name)
{ {
id = Guid.NewGuid().ToString(); id = Guid.NewGuid().ToString();
name = _name; SetName( _name);
} }
/// <summary> /// <summary>

View File

@ -3,6 +3,7 @@
using UnityEngine; using UnityEngine;
[Serializable, FirestoreData] [Serializable, FirestoreData]
[Newtonsoft.Json.JsonObject]
public class Prompt public class Prompt
{ {
[field: SerializeField] [field: SerializeField]

View File

@ -1,6 +1,7 @@
using System; using System;
[Serializable] [Serializable]
[Newtonsoft.Json.JsonObject]
public class Proposition public class Proposition
{ {
public string photoUrl; public string photoUrl;

View File

@ -1,6 +1,7 @@
using System; using System;
[Serializable] [Serializable]
[Newtonsoft.Json.JsonObject]
public class Question public class Question
{ {
public string promptId; public string promptId;

View File

@ -1,12 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine;
using Newtonsoft.Json;
using System.Collections;
[Serializable] [Serializable]
[Newtonsoft.Json.JsonObject]
public class Room public class Room
{ {
public string code; public string code;
public List<Question> questions; public Dictionary<string, Question> questions;
public List<Player> players; public Dictionary<string, Player> players;
public int currentQuestion; public int currentQuestion;
public double creationDate; public double creationDate;
@ -15,8 +19,19 @@ public Room(string _code)
{ {
code = _code; code = _code;
creationDate = DateTime.Now.ToOADate(); creationDate = DateTime.Now.ToOADate();
players = new List<Player>(); players = new Dictionary<string, Player>();
questions = new List<Question>(); questions = new Dictionary<string, Question>();
currentQuestion = 0; currentQuestion = 0;
} }
public List<Player> GetPlayerList()
{
return new List<Player>(players.Values);
} }
public List<Question> GetQuestionList()
{
return new List<Question>(questions.Values);
}
}

View File

@ -15,7 +15,7 @@ public class GameManager : MonoBehaviour
{ {
private GameState currentState; private GameState currentState;
private List<Player> players = new List<Player>(); private List<Player> players = new List<Player>();
public Player currentPlayer = null; private Player currentPlayer = null;
@ -23,7 +23,7 @@ public class GameManager : MonoBehaviour
public float explanationTime = 4f; public float explanationTime = 4f;
private float currentExplanationTime = 0; private float currentExplanationTime = 0;
[Header("Home Component")] [Header("Home Connection Component")]
public TMP_InputField roomCodeField; public TMP_InputField roomCodeField;
public TextMeshProUGUI roomError; public TextMeshProUGUI roomError;
public TMP_InputField playerNameField; public TMP_InputField playerNameField;
@ -63,6 +63,7 @@ private void Start()
submitNewPlayer.interactable = false; submitNewPlayer.interactable = false;
} }
public GameState GetCurrentState() public GameState GetCurrentState()
{ {
return currentState; return currentState;
@ -82,9 +83,15 @@ private void Initialize()
/// </summary> /// </summary>
public void PlayerValidateNameAndServerRoom(string _name, string _code) public void PlayerValidateNameAndServerRoom(string _name, string _code)
{ {
nameError.gameObject.SetActive(false);
roomError.gameObject.SetActive(false);
if (string.IsNullOrEmpty(_name)) if (string.IsNullOrEmpty(_name))
{ {
Debug.LogError("Player name is empty", this); Debug.LogError("Player name is empty", this);
nameError.text = "You have to put a valid name";
nameError.gameObject.SetActive(true);
//TODO : MARINE : use the error label to explain to the user that they have forget to put a name //TODO : MARINE : use the error label to explain to the user that they have forget to put a name
return; return;
} }
@ -92,9 +99,13 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
if (string.IsNullOrEmpty(_code)) if (string.IsNullOrEmpty(_code))
{ {
Debug.LogError("Room code is empty", this); Debug.LogError("Room code is empty", this);
roomError.text = "You have to put a room code";
roomError.gameObject.SetActive(true);
//TODO : MARINE : use the error label to explain to the user that they have forget to put a room code //TODO : MARINE : use the error label to explain to the user that they have forget to put a room code
return; return;
} }
currentPlayer = new Player(_name);
//check if the room exists, if not display an error message //check if the room exists, if not display an error message
CheckIfRoomExists(_code, room => CheckIfRoomExists(_code, room =>
@ -107,13 +118,22 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
} }
else else
{ {
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
//if room exists, join it //if room exists, join it
JoinRoom(() => JoinRoom(() =>
{ {
//then subscribe to it //then subscribe to it
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
myOnlineRoom.ChildChanged += OnRoomUpdate; myOnlineRoom.ValueChanged += OnRoomUpdate;
Debug.Log($"room {myRoom.code} exists, I subscribe to it"); currentState = GameState.WaitingForOtherPlayersToJoin;
players.Add(currentPlayer);
WaitingRoom.SetActive(true);
HomeConnection.SetActive(false);
UpdateDisplayedListUser();
}); });
} }
}); });
@ -151,8 +171,10 @@ private void CheckIfRoomExists(string _roomCode, Action<Room> callback_Room)
/// </summary> /// </summary>
private void JoinRoom(Action callback_OnRoomJoined) private void JoinRoom(Action callback_OnRoomJoined)
{ {
string JSON = JsonUtility.ToJson(currentPlayer); string JSON = JsonUtility.ToJson(currentPlayer);
Debug.Log(JSON);
try
{
myOnlineRoom.Child("players").Child(currentPlayer.id).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task => myOnlineRoom.Child("players").Child(currentPlayer.id).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{ {
if (task.IsFaulted) if (task.IsFaulted)
@ -165,6 +187,12 @@ private void JoinRoom(Action callback_OnRoomJoined)
callback_OnRoomJoined?.Invoke(); callback_OnRoomJoined?.Invoke();
} }
}); });
}
catch (Exception ex)
{
Debug.LogException(ex);
}
} }
@ -180,6 +208,7 @@ public void StartGame()
BeforeStart.SetActive(true); BeforeStart.SetActive(true);
} }
/// <summary> /// <summary>
@ -232,57 +261,24 @@ 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(object sender, ChildChangedEventArgs e) private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{
try
{ {
myRoom = JsonUtility.FromJson<Room>(e.Snapshot.GetRawJsonValue()); myRoom = JsonUtility.FromJson<Room>(e.Snapshot.GetRawJsonValue());
}
catch (Exception ex)
{
Debug.LogException(ex);
}
switch (currentState) switch (currentState)
{ {
case GameState.WaitingForOtherPlayersToJoin: case GameState.WaitingForOtherPlayersToJoin:
{ {
WaitingRoom.SetActive(true);
HomeConnection.SetActive(false);
// players = new list en fonction de ce qu'envoie fangh // players = new list en fonction de ce qu'envoie fangh
UpdateDisplayedListUser(); UpdateDisplayedListUser();
break;
}
case GameState.EnteringName:
{
currentState = GameState.WaitingForOtherPlayersToJoin;
//TEMP
players.Add(currentPlayer);
if (players.Count == 1)
{
submitStartGame.SetActive(true);
}
Player player2 = new Player("3J");
player2.SetName("3J");
player2.id = "2";
Player player3 = new Player("3J");
player3.SetName("3J");
player3.id = "3";
Player player4 = new Player("3J");
player4.SetName("3J");
player4.id = "4";
Player player5 = new Player("3J");
player5.SetName("3J");
player5.id = "5";
Player player6 = new Player("3J");
player6.SetName("3J");
player6.id = "6";
players.Add(player2);
players.Add(player3);
players.Add(player4);
players.Add(player5);
players.Add(player6);
UpdateDisplayedListUser();
break; break;
} }
} }
@ -303,7 +299,6 @@ public void OnClickSubmitSignIn()
{ {
string playerName = playerNameField.text; string playerName = playerNameField.text;
string roomCode = roomCodeField.text; string roomCode = roomCodeField.text;
PlayerValidateNameAndServerRoom(playerName, roomCode); PlayerValidateNameAndServerRoom(playerName, roomCode);
} }
} }

View File

@ -4,11 +4,18 @@
using System.Collections.Generic; using System.Collections.Generic;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Linq;
public class RoomManager : MonoBehaviour public class RoomManager : MonoBehaviour
{ {
public List<TextMeshProUGUI> playerLabels = new List<TextMeshProUGUI>();
private RoomState currentState; private RoomState currentState;
private Room currentRoom = null; private Room myRoom = null;
private List<Player> players; private List<Player> players;
public float propositionTime = 60; public float propositionTime = 60;
@ -39,6 +46,7 @@ public class RoomManager : MonoBehaviour
private void Awake() private void Awake()
{ {
FirebaseInitializer.Instance.onFirebaseReady += Initialize; FirebaseInitializer.Instance.onFirebaseReady += Initialize;
currentState = RoomState.None;
} }
@ -46,13 +54,23 @@ private void Start()
{ {
propositionCurrentTime = propositionTime; propositionCurrentTime = propositionTime;
votingCurrentTime = votingTime; votingCurrentTime = votingTime;
DisableAllPlayerLabels();
currentState = RoomState.WaitingForPlayers;
}
private void DisableAllPlayerLabels()
{
for (int i = 0; i < playerLabels.Count; i++)
{
playerLabels[i].text = $"Waiting for P{i + 1}";
}
} }
private void OnApplicationQuit() private void OnApplicationQuit()
{ {
realtimeDB.Child("rooms").Child(currentRoom.code).RemoveValueAsync(); realtimeDB.Child("rooms").Child(myRoom.code).RemoveValueAsync();
Debug.Log($"delete room {currentRoom.code}"); Debug.Log($"delete room {myRoom.code}");
currentRoom = null; myRoom = null;
} }
private void Initialize() private void Initialize()
@ -98,15 +116,25 @@ public void CreateNewRoom()
WhichCodesAreAlreadyUsed(codes => WhichCodesAreAlreadyUsed(codes =>
{ {
Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4")); Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4"));
currentRoom = newRoom; myRoom = newRoom;
try
{
string JSON = JsonUtility.ToJson(newRoom); string JSON = JsonUtility.ToJson(newRoom);
realtimeDB.Child("rooms").Child(newRoom.code).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task => 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; //then subscribe to it
//TODO MARINE : uncomment and reference the correct game object realtimeDB.Child("rooms").Child(newRoom.code).ValueChanged += OnRoomUpdate;
//roomCodeLabel.text = currentRoom.code; roomCodeLabel.text = myRoom.code;
Debug.Log($"room {myRoom.code} has been created on the server");
}); });
}
catch (Exception e)
{
Debug.LogException(e);
}
}); });
} }
@ -205,28 +233,59 @@ public void GenerateCouples()
} }
/// <summary> /// <summary>
/// is automatically called when a player connect to the room /// Automatically called when something change in your room
/// </summary> /// </summary>
/// <param name="_player"></param> private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
public void PlayerConnect(object sender, ChildChangedEventArgs args)
{ {
if (args.DatabaseError != null) Debug.Log("coucou");
if (value.DatabaseError != null)
{ {
Debug.LogError(args.DatabaseError.Message); Debug.LogError(value.DatabaseError.Message);
return; return;
} }
string JSON = value.Snapshot.GetRawJsonValue();
Debug.Log(JSON);
try
{
myRoom = JsonConvert.DeserializeObject<Room>(JSON);
}
catch (Exception ex)
{
Debug.LogException(ex);
}
string JSON = args.Snapshot.GetRawJsonValue(); Debug.Log("caca");
Player joinedPlayer = JsonUtility.FromJson<Player>(JSON);
Debug.Log($"{joinedPlayer.name} has joined the room"); switch (currentState)
//TODO Marine : do somtethjing with the newly joinde player {
case RoomState.WaitingForPlayers:
Debug.Log("prout");
UpdateConnectedPlayerList(myRoom.GetPlayerList());
break;
default:
break;
}
}
/// <summary>
/// Update the player labels on the WaitingForPlayer page
/// </summary>
/// <param name="_players"></param>
private void UpdateConnectedPlayerList(List<Player> _players)
{
Debug.Log($"players count = {_players.Count}");
for (int i = 0; i < _players.Count; i++)
{
Debug.Log($"player {i} = {_players[i].name}");
playerLabels[i].text = _players[i].name;
}
} }
[ContextMenu("Fake Player Connection")] [ContextMenu("Fake Player Connection")]
private void FakePlayerConnection() private void FakePlayerConnection()
{ {
Player temp = new Player("Momo"); Player temp = new Player("Momo");
temp.id = System.Guid.NewGuid().ToString(); temp.id = Guid.NewGuid().ToString();
temp.SetName("Momo"); temp.SetName("Momo");
} }
@ -234,7 +293,8 @@ private void FakePlayerConnection()
public enum RoomState public enum RoomState
{ {
WaitingForPlayer, None,
WaitingForPlayers,
WaitingForPropositions, WaitingForPropositions,
ShowPropositions, ShowPropositions,
ShowVoters, ShowVoters,

View File

@ -3,6 +3,7 @@
"com.unity.collab-proxy": "2.2.0", "com.unity.collab-proxy": "2.2.0",
"com.unity.feature.development": "1.0.1", "com.unity.feature.development": "1.0.1",
"com.unity.memoryprofiler": "1.1.0", "com.unity.memoryprofiler": "1.1.0",
"com.unity.nuget.newtonsoft-json": "3.2.1",
"com.unity.textmeshpro": "3.0.6", "com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.6", "com.unity.timeline": "1.7.6",
"com.unity.toolchain.linux-x86_64": "2.0.6", "com.unity.toolchain.linux-x86_64": "2.0.6",