feat(localization): prompts should be in selected language from PC

This commit is contained in:
Fangh 2024-02-29 21:34:05 +01:00
parent 9d3dfb8c0f
commit f784cbf142
18 changed files with 892 additions and 126 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5ac1099247cfb3e48932f4ab90f393d2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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

Binary file not shown.

View File

@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 2c184ca72cbd8c14aacfa9f75e714f73
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: 256
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: 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:

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

Binary file not shown.

View File

@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 73ca52a46663536498fed319e043fdfe
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: 256
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: 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

@ -121,6 +121,10 @@ MonoBehaviour:
m_Key: PhoneView/Canvas/Background/HomeState/NameField/ErrorRoom m_Key: PhoneView/Canvas/Background/HomeState/NameField/ErrorRoom
m_Metadata: m_Metadata:
m_Items: [] m_Items: []
- m_Id: 710177540153344
m_Key: ComputerView/Canvas/WaitingForPlayersPage/LanguageLabel
m_Metadata:
m_Items: []
m_Metadata: m_Metadata:
m_Items: [] m_Items: []
m_KeyGenerator: m_KeyGenerator:

View File

@ -131,6 +131,10 @@ MonoBehaviour:
m_Localized: 'Error: the room doesn''t exists' m_Localized: 'Error: the room doesn''t exists'
m_Metadata: m_Metadata:
m_Items: [] m_Items: []
- m_Id: 710177540153344
m_Localized: 'Prompts language:'
m_Metadata:
m_Items: []
references: references:
version: 2 version: 2
RefIds: [] RefIds: []

View File

@ -127,6 +127,10 @@ MonoBehaviour:
m_Localized: 'Erreur: cette salle n''existe pas' m_Localized: 'Erreur: cette salle n''existe pas'
m_Metadata: m_Metadata:
m_Items: [] m_Items: []
- m_Id: 710177540153344
m_Localized: 'Langue des phrases :'
m_Metadata:
m_Items: []
references: references:
version: 2 version: 2
RefIds: [] RefIds: []

View File

@ -1626,6 +1626,181 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 233024602} m_GameObject: {fileID: 233024602}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &248639606
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 248639607}
- component: {fileID: 248639610}
- component: {fileID: 248639609}
- component: {fileID: 248639608}
m_Layer: 5
m_Name: PromptsLanguageLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &248639607
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248639606}
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: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -275, y: -25}
m_SizeDelta: {x: 500, y: 120}
m_Pivot: {x: 1, y: 1}
--- !u!114 &248639608
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248639606}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 56eb0353ae6e5124bb35b17aff880f16, type: 3}
m_Name:
m_EditorClassIdentifier:
m_StringReference:
m_TableReference:
m_TableCollectionName: GUID:9a6eec81bdcf2bb48b63d1f03a258bde
m_TableEntryReference:
m_KeyId: 710177540153344
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_FormatArguments: []
m_UpdateString:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 248639609}
m_TargetAssemblyTypeName: TMPro.TMP_Text, Unity.TextMeshPro
m_MethodName: set_text
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 1
references:
version: 2
RefIds: []
--- !u!114 &248639609
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248639606}
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: 'Room Code :'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 72af27804d5aa49408430b4b2500f877, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 9fb4d071241c54841ab116886c83b585, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278255610
m_fontColor: {r: 0.9823009, g: 1, 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: 44
m_fontSizeBase: 72
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 32
m_fontSizeMax: 44
m_fontStyle: 0
m_HorizontalAlignment: 4
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 &248639610
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248639606}
m_CullTransparentMesh: 1
--- !u!1 &270606794 stripped --- !u!1 &270606794 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3} m_CorrespondingSourceObject: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
@ -2707,7 +2882,7 @@ Canvas:
m_OverridePixelPerfect: 0 m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0 m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0 m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25 m_AdditionalShaderChannelsFlag: 31
m_UpdateRectTransformForStandalone: 0 m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 0 m_SortingOrder: 0
@ -5254,6 +5429,8 @@ RectTransform:
- {fileID: 220251970} - {fileID: 220251970}
- {fileID: 593191225} - {fileID: 593191225}
- {fileID: 1503133439} - {fileID: 1503133439}
- {fileID: 248639607}
- {fileID: 2142340730}
m_Father: {fileID: 610087870} m_Father: {fileID: 610087870}
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}
@ -8516,7 +8693,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -369} m_AnchoredPosition: {x: 100, y: -369}
m_SizeDelta: {x: 474, y: 50} m_SizeDelta: {x: 474, y: 86}
m_Pivot: {x: 0, y: 1} m_Pivot: {x: 0, y: 1}
--- !u!114 &1677433387 --- !u!114 &1677433387
MonoBehaviour: MonoBehaviour:
@ -8573,7 +8750,7 @@ MonoBehaviour:
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 1
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
m_wordSpacing: 0 m_wordSpacing: 0
@ -11967,6 +12144,174 @@ MonoBehaviour:
- localeIdentifier: - localeIdentifier:
m_Code: fr m_Code: fr
value: 200 value: 200
--- !u!1 &2142340729
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2142340730}
- component: {fileID: 2142340733}
- component: {fileID: 2142340732}
- component: {fileID: 2142340731}
- component: {fileID: 2142340734}
m_Layer: 0
m_Name: PromptsLanguage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2142340730
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142340729}
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: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -145.00006, y: -25}
m_SizeDelta: {x: 120, y: 120}
m_Pivot: {x: 1, y: 1}
--- !u!114 &2142340731
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142340729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c71e2cd71561f7948aa3b8690f68fd0f, type: 3}
m_Name:
m_EditorClassIdentifier:
flag_en: {fileID: 21300000, guid: 73ca52a46663536498fed319e043fdfe, type: 3}
flag_fr: {fileID: 21300000, guid: 2c184ca72cbd8c14aacfa9f75e714f73, type: 3}
image: {fileID: 2142340732}
--- !u!114 &2142340732
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142340729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fceb93b9d8bf04943b1dd4939eaf6284, 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: 21300000, guid: 6b96d6950a9c30743a2e826ee8684ac4, type: 3}
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
m_DrawShape: 1
m_ImageType: 0
m_StrokeWidth: 0
m_FalloffDistance: 0.5
m_OutlineWidth: 3
m_OutlineColor: {r: 0, g: 0, b: 0, a: 1}
m_ShapeRotation: 0
m_ConstrainRotation: 1
m_FlipHorizontal: 0
m_FlipVertical: 0
m_CornerStyle: 0
m_RectangleCornerRadius: {x: 0, y: 0, z: 0, w: 0}
m_TriangleCornerRadius: {x: 0, y: 0, z: 0}
m_TriangleUniformCornerRadius: 1
m_RectangleUniformCornerRadius: 1
m_CircleRadius: 0
m_CircleFitToRect: 1
m_NStarPolygonSideCount: 3
m_NStarPolygonInset: 2
m_NStarPolygonCornerRadius: 0
--- !u!222 &2142340733
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142340729}
m_CullTransparentMesh: 1
--- !u!114 &2142340734
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2142340729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2142340732}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2142340731}
m_TargetAssemblyTypeName: PromptsLanguage, Assembly-CSharp
m_MethodName: SwapLanguage
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!1001 &2214187228236614840 --- !u!1001 &2214187228236614840
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -17,6 +17,7 @@ public class Room
public int currentQuestionId; public int currentQuestionId;
public double creationDate; public double creationDate;
public int currentState; public int currentState;
public string promptsLanguage;
public Room(string _code) public Room(string _code)
{ {
@ -26,6 +27,7 @@ public Room(string _code)
questions = new Dictionary<int, Question>(); questions = new Dictionary<int, Question>();
currentQuestionId = 0; currentQuestionId = 0;
currentState = 1; //default by PC currentState = 1; //default by PC
promptsLanguage = "en";
} }
public Room Copy() public Room Copy()

View File

@ -18,6 +18,8 @@
/// </summary> /// </summary>
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
public static GameManager Instance;
private List<Player> players = new(); private List<Player> players = new();
public Player currentPlayer = null; public Player currentPlayer = null;
@ -72,6 +74,7 @@ public class GameManager : MonoBehaviour
private void Awake() private void Awake()
{ {
submitNewPlayer.interactable = false; submitNewPlayer.interactable = false;
Instance = this;
FirebaseInitializer.Instance.onFirebaseReady += Initialize; FirebaseInitializer.Instance.onFirebaseReady += Initialize;
} }

View File

@ -0,0 +1,36 @@
using MPUIKIT;
using UnityEngine;
public class PromptsLanguage : MonoBehaviour
{
[SerializeField] private Sprite flag_en;
[SerializeField] private Sprite flag_fr;
[SerializeField] private MPImageBasic image;
private string currentLanguage = "en";
private void Start()
{
RoomManager.Instance.OnRoomCreated += Initialize;
}
private void Initialize()
{
RoomManager.Instance.OnRoomCreated -= Initialize;
currentLanguage = PlayerPrefs.GetString("promptslanguage", currentLanguage);
SetLanguageOnRoom();
}
public void SwapLanguage()
{
currentLanguage = currentLanguage == "en" ? "fr" : "en";
PlayerPrefs.SetString("promptslanguage", currentLanguage);
SetLanguageOnRoom();
}
private void SetLanguageOnRoom()
{
image.sprite = currentLanguage == "fr" ? flag_fr : flag_en;
RoomManager.Instance.SetPromptsLanguage(currentLanguage);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c71e2cd71561f7948aa3b8690f68fd0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -19,9 +19,9 @@ public class PropositionHandler : MonoBehaviour
public void ShowPlayersProposition(Question currentQuestion) public void ShowPlayersProposition(Question currentQuestion)
{ {
List<Proposition> props = currentQuestion.propositions.Values.ToList(); List<Proposition> props = currentQuestion.propositions.Values.ToList();
string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en; string prompt = GameManager.Instance.myRoom.promptsLanguage == "en" ? prompts.GetPromptById(currentQuestion.promptId).en : prompts.GetPromptById(currentQuestion.promptId).fr;
promptLabel.text = enPrompt; promptLabel.text = prompt;
Debug.Log($"Showing Question ({currentQuestion.index}) : {enPrompt}"); Debug.Log($"Showing Question ({currentQuestion.index}) : {prompt}");
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

View File

@ -40,7 +40,7 @@ void OnEnable()
void Redraw(int currentQuestion) void Redraw(int currentQuestion)
{ {
Prompt prompt = promptList.prompts.Find(x => x.id == questionsToAnswer[currentQuestion].promptId); Prompt prompt = promptList.prompts.Find(x => x.id == questionsToAnswer[currentQuestion].promptId);
explainText.SetText(prompt.en); explainText.SetText(gameManager.myRoom.promptsLanguage == "en" ? prompt.en : prompt.fr);
CameraManager cameraManager = gameObject.GetComponent<CameraManager>(); CameraManager cameraManager = gameObject.GetComponent<CameraManager>();
cameraManager.WebcamResume(); cameraManager.WebcamResume();

View File

@ -11,7 +11,11 @@
using UnityEngine.Localization.Settings; using UnityEngine.Localization.Settings;
using UnityEngine.Localization; using UnityEngine.Localization;
using UnityEngine.Localization.Tables; using UnityEngine.Localization.Tables;
using Google.MiniJSON;
/// <summary>
/// This is the game state manager on the PC side
/// </summary>
public class RoomManager : MonoBehaviour public class RoomManager : MonoBehaviour
{ {
public static RoomManager Instance; public static RoomManager Instance;
@ -52,8 +56,12 @@ public class RoomManager : MonoBehaviour
public Room myRoom { get; private set; } = null; public Room myRoom { get; private set; } = null;
public event Action OnRoomCreated;
DatabaseReference realtimeDB; DatabaseReference realtimeDB;
#region Unity Methods
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
@ -66,17 +74,6 @@ private void Start()
InitializeFirstPage(); InitializeFirstPage();
} }
private void InitializeFirstPage()
{
explanationPage.SetActive(false);
waitForPropositionsPage.gameObject.SetActive(false);
votingPage.gameObject.SetActive(false);
scoringPage.gameObject.SetActive(false);
waitingForPlayersPage.SetActive(true);
ResetAllPlayerLabels();
}
private void Update() private void Update()
{ {
if (myRoom == null) if (myRoom == null)
@ -97,6 +94,117 @@ private void Update()
} }
private bool deleteRoomFilesCompleted = false;
private bool deleteRealtimeDBCompleted = false;
private void OnApplicationQuit()
{
StartCoroutine(Coroutine_ClearCurrentRoom(() =>
{
Debug.Log("You can go. Bye bye...");
}));
}
#endregion
#region Public Methods
/// <summary>
/// Automatically called at start of game
/// </summary>
[ContextMenu("Create New Room")]
public void CreateNewRoom()
{
WhichCodesAreAlreadyUsed(codes =>
{
Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4"));
myRoom = newRoom;
try
{
string JSON = JsonConvert.SerializeObject(newRoom);
realtimeDB.Child("rooms").Child(newRoom.code).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{
//then subscribe to it
realtimeDB.Child("rooms").Child(newRoom.code).ValueChanged += OnRoomUpdate;
roomCodeLabel.text = myRoom.code;
OnRoomCreated?.Invoke();
Debug.Log($"room {myRoom.code} has been created on the server");
});
}
catch (Exception e)
{
Debug.LogException(e);
}
});
}
public void GeneratePrompts()
{
System.Random rnd = new();
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count()).ToList();
List<Player> players = myRoom.players.Values.ToList().OrderBy(x => rnd.Next()).ToList();
Dictionary<int, Question> questions = new();
for (int i = 0; i < players.Count(); i++)
{
Dictionary<int, Proposition> propositions = new();
for (int j = 0; j < 2; j++)
{
propositions.Add(j, new Proposition(players[i + j < players.Count() ? i + j : 0]));
}
questions.Add(i, new Question()
{
index = i,
promptId = prompts[i].id,
propositions = propositions,
creationDate = DateTime.Now.ToOADate(),
});
}
string JSON = JsonConvert.SerializeObject(questions);
realtimeDB.Child("rooms").Child(myRoom.code).Child("questions").SetRawJsonValueAsync(JSON);
}
/// <summary>
///
/// </summary>
/// <param name="_language">can be "en" or "fr"</param>
public void SetPromptsLanguage(string _language)
{
if (myRoom == null)
return;
if(_language == "en" ||_language == "fr")
realtimeDB.Child("rooms").Child(myRoom.code).Child("promptsLanguage").SetValueAsync(_language);
}
#endregion
#region Private Methods
private void Initialize()
{
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized");
ClearOldAndCreateNewRoom();
}
private void InitializeFirstPage()
{
explanationPage.SetActive(false);
waitForPropositionsPage.gameObject.SetActive(false);
votingPage.gameObject.SetActive(false);
scoringPage.gameObject.SetActive(false);
waitingForPlayersPage.SetActive(true);
ResetAllPlayerLabels();
}
private void SendRoomState(GameState _newState) private void SendRoomState(GameState _newState)
{ {
//Debug.Log($"sending to RTDB that we are now in the {_newState} state", this); //Debug.Log($"sending to RTDB that we are now in the {_newState} state", this);
@ -112,25 +220,6 @@ private void ResetAllPlayerLabels()
} }
} }
private bool deleteRoomFilesCompleted = false;
private bool deleteRealtimeDBCompleted = false;
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() private void ClearOldAndCreateNewRoom()
{ {
CleanOldRooms(); CleanOldRooms();
@ -177,92 +266,6 @@ private IEnumerator Coroutine_ClearCurrentRoom(Action callback_OnRoomClear = nul
} }
} }
/// <summary>
/// Check all the rooms in the server and give back the number already taken
/// </summary>
private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked)
{
QueryRoomsInDatabase(onlineRooms =>
{
List<int> alreadyUsedCodes = onlineRooms.Select(room => int.Parse(room.code)).ToList();
Debug.Log($"Codes {string.Join(", ", alreadyUsedCodes)} are already used by other parties", this);
callback_OnCodesChecked?.Invoke(alreadyUsedCodes);
});
}
/// <summary>
/// Automatically called at start of game
/// </summary>
[ContextMenu("Create New Room")]
public void CreateNewRoom()
{
WhichCodesAreAlreadyUsed(codes =>
{
Room newRoom = new Room(GenerateRandomAvailableCode(codes).ToString("D4"));
myRoom = newRoom;
try
{
string JSON = JsonConvert.SerializeObject(newRoom);
realtimeDB.Child("rooms").Child(newRoom.code).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{
//then subscribe to it
realtimeDB.Child("rooms").Child(newRoom.code).ValueChanged += OnRoomUpdate;
roomCodeLabel.text = myRoom.code;
Debug.Log($"room {myRoom.code} has been created on the server");
});
}
catch (Exception e)
{
Debug.LogException(e);
}
});
}
/// <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;
}
public void GeneratePrompts()
{
System.Random rnd = new();
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count()).ToList();
List<Player> players = myRoom.players.Values.ToList().OrderBy(x => rnd.Next()).ToList();
Dictionary<int, Question> questions = new();
for (int i = 0; i < players.Count(); i++)
{
Dictionary<int, Proposition> propositions = new();
for (int j = 0; j < 2; j++)
{
propositions.Add(j, new Proposition(players[i + j < players.Count() ? i + j : 0]));
}
questions.Add(i, new Question()
{
index = i,
promptId = prompts[i].id,
propositions = propositions,
creationDate = DateTime.Now.ToOADate(),
});
}
string JSON = JsonConvert.SerializeObject(questions);
realtimeDB.Child("rooms").Child(myRoom.code).Child("questions").SetRawJsonValueAsync(JSON);
}
/// <summary> /// <summary>
/// Automatically called when something change in your room /// Automatically called when something change in your room
@ -314,6 +317,38 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs value)
} }
} }
/// <summary>
/// Check all the rooms in the server and give back the number already taken
/// </summary>
private void WhichCodesAreAlreadyUsed(Action<List<int>> callback_OnCodesChecked)
{
QueryRoomsInDatabase(onlineRooms =>
{
List<int> alreadyUsedCodes = onlineRooms.Select(room => int.Parse(room.code)).ToList();
Debug.Log($"Codes {string.Join(", ", alreadyUsedCodes)} are already used by other parties", this);
callback_OnCodesChecked?.Invoke(alreadyUsedCodes);
});
}
/// <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;
}
/// <summary> /// <summary>
/// Called when we enter in a new game state /// Called when we enter in a new game state
/// </summary> /// </summary>
@ -463,4 +498,6 @@ private void DeleteRoom(string _roomCode)
Debug.Log($"Room {_roomCode} has been deleted"); Debug.Log($"Room {_roomCode} has been deleted");
}); });
} }
#endregion
} }

View File

@ -127,7 +127,7 @@ private void ShowNextQuestion()
// Update the prompt text based on the current question's prompt ID. // Update the prompt text based on the current question's prompt ID.
Debug.Log($"Show Question {currentQuestion.promptId}", this); Debug.Log($"Show Question {currentQuestion.promptId}", this);
Prompt currentPrompt = promptList.GetPromptById(currentQuestion.promptId); Prompt currentPrompt = promptList.GetPromptById(currentQuestion.promptId);
currentPromptLabel.text = currentPrompt.en; currentPromptLabel.text = RoomManager.Instance.myRoom.promptsLanguage == "en" ? currentPrompt.en : currentPrompt.fr;
Debug.Log($"Prompt is {currentPromptLabel.text}", this); Debug.Log($"Prompt is {currentPromptLabel.text}", this);

View File

@ -18,4 +18,4 @@ MonoBehaviour:
m_AssetTable: m_AssetTable:
m_TableReference: m_TableReference:
m_TableCollectionName: m_TableCollectionName:
m_TrackingChanges: 1 m_TrackingChanges: 0