users can vote
This commit is contained in:
parent
92337afda7
commit
c33825d600
8
Assets/Prefabs.meta
Normal file
8
Assets/Prefabs.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3886f5e8ed5884a99bbd7a95c2f6b27c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
323
Assets/Prefabs/PropositionFrame.prefab
Normal file
323
Assets/Prefabs/PropositionFrame.prefab
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &4654528575356896576
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2993570874611009919}
|
||||||
|
- component: {fileID: 1014643739613990429}
|
||||||
|
- component: {fileID: 782069874130417341}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: PropositionFrame.PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &2993570874611009919
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4654528575356896576}
|
||||||
|
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: 3953387086501582844}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 75}
|
||||||
|
m_SizeDelta: {x: 0, y: 50}
|
||||||
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
|
--- !u!222 &1014643739613990429
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4654528575356896576}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &782069874130417341
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4654528575356896576}
|
||||||
|
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: 01234567890123456
|
||||||
|
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: 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: 64
|
||||||
|
m_fontSizeBase: 64
|
||||||
|
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!1 &5138585656555316049
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1424407976172285298}
|
||||||
|
- component: {fileID: 2716772787860397017}
|
||||||
|
- component: {fileID: 423066451263622249}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: PropositionFrame.Picture
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1424407976172285298
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5138585656555316049}
|
||||||
|
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: 3953387086501582844}
|
||||||
|
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: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 500, y: 500}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &2716772787860397017
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5138585656555316049}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &423066451263622249
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5138585656555316049}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Texture: {fileID: 2800000, guid: 57d7dffbdddc24c959c3c072208cbafe, type: 3}
|
||||||
|
m_UVRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
--- !u!1 &6433924239447685472
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4509981124141486577}
|
||||||
|
- component: {fileID: 4661236625436494338}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: PropositionFrame.VotersGrid
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4509981124141486577
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6433924239447685472}
|
||||||
|
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: 3953387086501582844}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &4661236625436494338
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6433924239447685472}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Padding:
|
||||||
|
m_Left: 5
|
||||||
|
m_Right: 5
|
||||||
|
m_Top: 5
|
||||||
|
m_Bottom: 5
|
||||||
|
m_ChildAlignment: 4
|
||||||
|
m_StartCorner: 0
|
||||||
|
m_StartAxis: 0
|
||||||
|
m_CellSize: {x: 200, y: 100}
|
||||||
|
m_Spacing: {x: 75, y: 25}
|
||||||
|
m_Constraint: 0
|
||||||
|
m_ConstraintCount: 2
|
||||||
|
--- !u!1 &7016400590500538500
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3953387086501582844}
|
||||||
|
- component: {fileID: 9141429158838199157}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: PropositionFrame
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3953387086501582844
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7016400590500538500}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1424407976172285298}
|
||||||
|
- {fileID: 4509981124141486577}
|
||||||
|
- {fileID: 2993570874611009919}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
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: -556, y: 0}
|
||||||
|
m_SizeDelta: {x: 500, y: 500}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &9141429158838199157
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7016400590500538500}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 18061644c95a147eb81059fa46414624, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
picture: {fileID: 423066451263622249}
|
||||||
|
voterStickerPrefab: {fileID: 4312846972391547553, guid: 69942fa558cf34dfc91982c6bccef840, type: 3}
|
||||||
|
playerName: {fileID: 782069874130417341}
|
||||||
|
playerGrid: {fileID: 4509981124141486577}
|
7
Assets/Prefabs/PropositionFrame.prefab.meta
Normal file
7
Assets/Prefabs/PropositionFrame.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6f5bb6680660e49fd9cb0ff864a44bf4
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
262
Assets/Prefabs/VoterSticker.prefab
Normal file
262
Assets/Prefabs/VoterSticker.prefab
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2462192938238515664
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4847416433156003170}
|
||||||
|
- component: {fileID: 5164741681773790499}
|
||||||
|
- component: {fileID: 2430977146559507814}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: VoterSticker.PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4847416433156003170
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2462192938238515664}
|
||||||
|
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: 943229596838791819}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: -10, y: -10}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &5164741681773790499
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2462192938238515664}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &2430977146559507814
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2462192938238515664}
|
||||||
|
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: playernamevraimentlong
|
||||||
|
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: 4294967295
|
||||||
|
m_fontColor: {r: 1, g: 1, b: 1, 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: 36
|
||||||
|
m_fontSizeBase: 36
|
||||||
|
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: 0
|
||||||
|
m_wordWrappingRatios: 0.4
|
||||||
|
m_overflowMode: 1
|
||||||
|
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!1 &2704804050822234674
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7101168500304376256}
|
||||||
|
- component: {fileID: 3089203999989860493}
|
||||||
|
- component: {fileID: 5096287721252539344}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: VoterSticker.Backgound
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &7101168500304376256
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2704804050822234674}
|
||||||
|
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: 943229596838791819}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &3089203999989860493
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2704804050822234674}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &5096287721252539344
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2704804050822234674}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0.854902, g: 0.75294125, b: 0.76470596, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 0}
|
||||||
|
m_Type: 1
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!1 &4312846972391547553
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 943229596838791819}
|
||||||
|
- component: {fileID: -3919290783414862184}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: VoterSticker
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &943229596838791819
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4312846972391547553}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 7101168500304376256}
|
||||||
|
- {fileID: 4847416433156003170}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
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: -427, y: 38}
|
||||||
|
m_SizeDelta: {x: 200, y: 100}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &-3919290783414862184
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4312846972391547553}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 63ba002d2116d4c54a8d55e905869d8f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
playerNameLabel: {fileID: 2430977146559507814}
|
7
Assets/Prefabs/VoterSticker.prefab.meta
Normal file
7
Assets/Prefabs/VoterSticker.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 69942fa558cf34dfc91982c6bccef840
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,15 @@ public Room(string _code)
|
|||||||
currentState = 1; //default by PC
|
currentState = 1; //default by PC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the only player with a specific ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Player GetPlayerById(string id)
|
||||||
|
{
|
||||||
|
return players[id];
|
||||||
|
}
|
||||||
|
|
||||||
public List<Player> GetPlayerList()
|
public List<Player> GetPlayerList()
|
||||||
{
|
{
|
||||||
return new List<Player>(players.Values);
|
return new List<Player>(players.Values);
|
||||||
|
@ -19,4 +19,9 @@ private void CreateEntry()
|
|||||||
};
|
};
|
||||||
prompts.Add(temp);
|
prompts.Add(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Prompt GetPromptById(string _id)
|
||||||
|
{
|
||||||
|
return prompts.Find(x => x.id == _id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
81
Assets/Scripts/PropositionFrame.cs
Normal file
81
Assets/Scripts/PropositionFrame.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Firebase.Extensions;
|
||||||
|
using Firebase.Storage;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class PropositionFrame : MonoBehaviour
|
||||||
|
{
|
||||||
|
public RawImage picture;
|
||||||
|
public GameObject voterStickerPrefab;
|
||||||
|
public TextMeshProUGUI playerName;
|
||||||
|
public Transform playerGrid;
|
||||||
|
|
||||||
|
private List<Player> currentVoters = new List<Player>();
|
||||||
|
private Proposition proposition;
|
||||||
|
|
||||||
|
public void Initialize(Proposition _proposition)
|
||||||
|
{
|
||||||
|
Debug.Log($"Initializing {_proposition.owner}'s proposition", this);
|
||||||
|
proposition = _proposition;
|
||||||
|
DisplayPicture(proposition.photoUrl);
|
||||||
|
playerName.text = proposition.owner.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisplayPicture(string _url)
|
||||||
|
{
|
||||||
|
Debug.Log($"Downloading {_url}");
|
||||||
|
|
||||||
|
StorageReference imageRef = FirebaseStorage.DefaultInstance.GetReferenceFromUrl(_url);
|
||||||
|
imageRef.GetDownloadUrlAsync().ContinueWithOnMainThread(task =>
|
||||||
|
{
|
||||||
|
if (task.IsFaulted || task.IsCanceled)
|
||||||
|
{
|
||||||
|
Debug.LogException(task.Exception);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("Download URL: " + task.Result);
|
||||||
|
StartCoroutine(DownloadImage(task.Result.AbsolutePath, _texture =>
|
||||||
|
{
|
||||||
|
Debug.Log("Set texture in the raw image");
|
||||||
|
picture.texture = _texture;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator DownloadImage(string _url, System.Action<Texture> callback_OnTextureDownloaded)
|
||||||
|
{
|
||||||
|
UnityWebRequest request = UnityWebRequestTexture.GetTexture(_url);
|
||||||
|
yield return request.SendWebRequest();
|
||||||
|
|
||||||
|
if (request.result != UnityWebRequest.Result.Success)
|
||||||
|
{
|
||||||
|
Debug.LogError(request.error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
callback_OnTextureDownloaded?.Invoke(((DownloadHandlerTexture)request.downloadHandler).texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateVoters(List<Player> _newVoters)
|
||||||
|
{
|
||||||
|
Debug.Log($"There are some new voters for {proposition.owner}'s proposition", this);
|
||||||
|
foreach (Player p in _newVoters)
|
||||||
|
{
|
||||||
|
if (!currentVoters.Contains(p))
|
||||||
|
{
|
||||||
|
currentVoters.Add(p);
|
||||||
|
VoterSticker sticker = Instantiate(voterStickerPrefab, playerGrid).GetComponent<VoterSticker>();
|
||||||
|
sticker.playerNameLabel.text = p.name;
|
||||||
|
Debug.Log($"{p.name} has just voted for {proposition.owner.name}'s proposition.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/PropositionFrame.cs.meta
Normal file
11
Assets/Scripts/PropositionFrame.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 18061644c95a147eb81059fa46414624
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -36,22 +36,12 @@ public class RoomManager : MonoBehaviour
|
|||||||
private bool allPlayersHasProposedTwoPictures = false;
|
private bool allPlayersHasProposedTwoPictures = false;
|
||||||
private Dictionary<string, Proposition[]> propositionsPerPlayers = new Dictionary<string, Proposition[]>();
|
private Dictionary<string, Proposition[]> propositionsPerPlayers = new Dictionary<string, Proposition[]>();
|
||||||
|
|
||||||
|
[Header("Waiting For Proposition Page")]
|
||||||
|
public VotingPage votingPage;
|
||||||
|
|
||||||
[Header("Other")]
|
[Header("Other")]
|
||||||
public PromptList promptList;
|
public PromptList promptList;
|
||||||
private Room myRoom = null;
|
private Room myRoom = null;
|
||||||
public float votingTime = 20;
|
|
||||||
|
|
||||||
private float votingCurrentTime = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Contain all the question for this game session
|
|
||||||
/// </summary>
|
|
||||||
private Dictionary<string, Question> questions = new Dictionary<string, Question>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When this is equal to questions.Count, go to score page
|
|
||||||
/// </summary>
|
|
||||||
private int numberOfQuestionVoted = 0;
|
|
||||||
|
|
||||||
DatabaseReference realtimeDB;
|
DatabaseReference realtimeDB;
|
||||||
|
|
||||||
@ -65,8 +55,6 @@ private void Start()
|
|||||||
explanationPage.SetActive(false);
|
explanationPage.SetActive(false);
|
||||||
waitingForPropositionsPage.SetActive(false);
|
waitingForPropositionsPage.SetActive(false);
|
||||||
waitingForPlayersPage.SetActive(true);
|
waitingForPlayersPage.SetActive(true);
|
||||||
|
|
||||||
votingCurrentTime = votingTime;
|
|
||||||
ResetAllPlayerLabels();
|
ResetAllPlayerLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,9 +285,9 @@ public void HostHasStartedGame()
|
|||||||
public void GeneratePrompts()
|
public void GeneratePrompts()
|
||||||
{
|
{
|
||||||
System.Random rnd = new();
|
System.Random rnd = new();
|
||||||
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count()).ToList();
|
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count() * 2).ToList();
|
||||||
List<Player> players = myRoom.players.Values.ToList().OrderBy(x => rnd.Next()).ToList();
|
List<Player> fullPlayers = myRoom.players.Values.ToList().Concat(myRoom.players.Values.ToList()).OrderBy(x => rnd.Next()).ToList();
|
||||||
Dictionary<string, Question> questions = new();
|
Dictionary<string, Question> questions = new Dictionary<string, Question>();
|
||||||
|
|
||||||
for (int i = 0; i < players.Count(); i++)
|
for (int i = 0; i < players.Count(); i++)
|
||||||
{
|
{
|
||||||
@ -388,21 +376,34 @@ private void OnNewGameStateStarted()
|
|||||||
case (int)GameState.WaitingForOtherPlayersToJoin:
|
case (int)GameState.WaitingForOtherPlayersToJoin:
|
||||||
Debug.Log("New State : WaitingForOtherPlayersToJoin");
|
Debug.Log("New State : WaitingForOtherPlayersToJoin");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)GameState.Explanation:
|
case (int)GameState.Explanation:
|
||||||
Debug.Log("New State : Explanation");
|
Debug.Log("New State : Explanation");
|
||||||
waitingForPlayersPage.SetActive(false);
|
waitingForPlayersPage.SetActive(false);
|
||||||
explanationPage.SetActive(true);
|
explanationPage.SetActive(true);
|
||||||
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
|
endOfExplanationDate = DateTime.Now.AddSeconds(explanationTime);
|
||||||
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
|
AudioSource.PlayClipAtPoint(counterSFX, Vector3.zero);
|
||||||
|
|
||||||
//generate all the questions during the explanation
|
//generate all the questions during the explanation
|
||||||
GeneratePrompts();
|
GeneratePrompts();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)GameState.MakeProposition:
|
case (int)GameState.MakeProposition:
|
||||||
Debug.Log("New State : MakeProposition");
|
Debug.Log("New State : MakeProposition");
|
||||||
HostHasStartedGame();
|
HostHasStartedGame();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (int)GameState.MakeVote:
|
||||||
|
votingPage.ShowVotingPage(
|
||||||
|
realtimeDB.Child("rooms").Child(myRoom.code)
|
||||||
|
, myRoom.players
|
||||||
|
, myRoom.questions
|
||||||
|
, () => SendRoomState(GameState.Score));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)GameState.Score:
|
||||||
|
//something
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
9
Assets/Scripts/VoterSticker.cs
Normal file
9
Assets/Scripts/VoterSticker.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class VoterSticker : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TextMeshProUGUI playerNameLabel;
|
||||||
|
}
|
11
Assets/Scripts/VoterSticker.cs.meta
Normal file
11
Assets/Scripts/VoterSticker.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 63ba002d2116d4c54a8d55e905869d8f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
131
Assets/Scripts/VotingPage.cs
Normal file
131
Assets/Scripts/VotingPage.cs
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Firebase.Database;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class VotingPage : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("Scene References")]
|
||||||
|
public PropositionFrame proposition1;
|
||||||
|
public PropositionFrame proposition2;
|
||||||
|
public TextMeshProUGUI currentPromptLabel;
|
||||||
|
public TextMeshProUGUI timerLabel;
|
||||||
|
|
||||||
|
[Header("Asset References")]
|
||||||
|
public PromptList promptList;
|
||||||
|
|
||||||
|
[Header("Settings")]
|
||||||
|
public float votingTime = 20;
|
||||||
|
|
||||||
|
private Queue<Question> remainingQuestions = new Queue<Question>();
|
||||||
|
private Question currentQuestion = null;
|
||||||
|
|
||||||
|
private DatabaseReference roomRef;
|
||||||
|
private Dictionary<string, Player> currentPlayers; //all the current playing players
|
||||||
|
|
||||||
|
private DateTime endOfTimer = DateTime.MinValue;
|
||||||
|
|
||||||
|
private Action OnVoteEnded;
|
||||||
|
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
//there is no question displayed or timer is not started
|
||||||
|
if (currentQuestion == null || endOfTimer == DateTime.MinValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if (endOfTimer <= DateTime.Now)
|
||||||
|
{
|
||||||
|
timerLabel.text = "0";
|
||||||
|
if (remainingQuestions.Count > 0)
|
||||||
|
{
|
||||||
|
currentQuestion = remainingQuestions.Dequeue();
|
||||||
|
ShowQuestion();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OnVoteEnded?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timerLabel.text = (DateTime.Now - endOfTimer).ToString("D2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
public void ShowVotingPage(DatabaseReference _roomRef, Dictionary<string, Player> _currentPlayers, Dictionary<string, Question> _questions, Action _callback_OnVoteEnded)
|
||||||
|
{
|
||||||
|
Debug.Log("Initializing voting page");
|
||||||
|
this.gameObject.SetActive(true);
|
||||||
|
roomRef = _roomRef;
|
||||||
|
currentPlayers = _currentPlayers;
|
||||||
|
OnVoteEnded = _callback_OnVoteEnded;
|
||||||
|
|
||||||
|
foreach (var QuestionByID in _questions)
|
||||||
|
{
|
||||||
|
remainingQuestions.Enqueue(QuestionByID.Value);
|
||||||
|
roomRef.Child("questions").Child(QuestionByID.Key).ValueChanged += OnQuestionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentQuestion = remainingQuestions.Dequeue();
|
||||||
|
roomRef.Child("currentQuestion").SetValueAsync(currentQuestion.id);
|
||||||
|
ShowQuestion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowQuestion()
|
||||||
|
{
|
||||||
|
Debug.Log($"Show Question {currentQuestion.promptId}", this);
|
||||||
|
Prompt currentPrompt = promptList.GetPromptById(currentQuestion.promptId);
|
||||||
|
currentPromptLabel.text = currentPrompt.en;
|
||||||
|
|
||||||
|
Debug.Log($"Prompt is {currentPromptLabel.text}", this);
|
||||||
|
|
||||||
|
proposition1.Initialize(currentQuestion.GetFirstProposition());
|
||||||
|
proposition1.Initialize(currentQuestion.GetSecondProposition());
|
||||||
|
endOfTimer = DateTime.Now.AddSeconds(votingTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is called when a question is updated (someone has voted)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="_questionRef"></param>
|
||||||
|
private void OnQuestionChanged(object sender, ValueChangedEventArgs _questionRef)
|
||||||
|
{
|
||||||
|
Debug.Log("a question value has changed, maybe someone has voted", this);
|
||||||
|
string JSON = _questionRef.Snapshot.GetRawJsonValue();
|
||||||
|
Question question = Newtonsoft.Json.JsonConvert.DeserializeObject<Question>(JSON);
|
||||||
|
|
||||||
|
//if someone succeeded to vote for another question than the one that is displayed => yeet
|
||||||
|
if (question.id != currentQuestion.id)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Debug.Log($"someone has voted for {question.id}", this);
|
||||||
|
currentQuestion.propositions = question.propositions;
|
||||||
|
UpdateVoters();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateVoters()
|
||||||
|
{
|
||||||
|
List<Player> playersThatHasVotedForFirstProposition = new List<Player>();
|
||||||
|
foreach (string playerId in currentQuestion.GetFirstProposition().voters)
|
||||||
|
{
|
||||||
|
playersThatHasVotedForFirstProposition.Add(currentPlayers[playerId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Player> playersThatHasVotedForSecondProposition = new List<Player>();
|
||||||
|
foreach (string playerId in currentQuestion.GetSecondProposition().voters)
|
||||||
|
{
|
||||||
|
playersThatHasVotedForSecondProposition.Add(currentPlayers[playerId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
proposition1.UpdateVoters(playersThatHasVotedForFirstProposition);
|
||||||
|
proposition2.UpdateVoters(playersThatHasVotedForSecondProposition);
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/VotingPage.cs.meta
Normal file
11
Assets/Scripts/VotingPage.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 18219aa91e9f14d64b46209ebcc6d0d9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user