Resolve WES-47 "Final result view"
This commit is contained in:
parent
7c6a5b8fe5
commit
e24765fa05
@ -14,19 +14,4 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
storedUserList:
|
||||
currentUserIndex: 0
|
||||
storedUsers:
|
||||
- username: dvschuyl
|
||||
avatar: {fileID: 21300000, guid: f2344cd67769733ceb363a41e1d88a65, type: 3}
|
||||
playtime: 0
|
||||
courses:
|
||||
- entries:
|
||||
- key: courseIndex
|
||||
bytes: 0001000000ffffffff01000000000000000c0200000046417373656d626c792d4353686172702c2056657273696f6e3d302e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d6e756c6c05010000000b436f75727365496e646578010000000776616c75655f5f000802000000000000000b
|
||||
- key: courseProgress
|
||||
bytes: 0001000000ffffffff010000000000000004010000000d53797374656d2e53696e676c6501000000076d5f76616c7565000b0000403f0b
|
||||
minigames:
|
||||
- entries:
|
||||
- key: minigameIndex
|
||||
bytes: 0001000000ffffffff01000000000000000c0200000046417373656d626c792d4353686172702c2056657273696f6e3d302e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d6e756c6c05010000000d4d696e6967616d65496e646578010000000776616c75655f5f000802000000000000000b
|
||||
- key: highscore
|
||||
bytes: 0001000000ffffffff010000000000000004010000000c53797374656d2e496e74333201000000076d5f76616c75650008000000000b
|
||||
storedUsers: []
|
||||
|
||||
@ -11,7 +11,7 @@ public class UserList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to enable serialization of the UserList class
|
||||
/// (<c>ScriptableObkect</c>s cannot be serialized)
|
||||
/// (<c>ScriptableObject</c>s cannot be serialized)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class StoredUserList
|
||||
|
||||
699
Assets/SpellingBee/Prefabs/ScoreboardEntry.prefab
Normal file
699
Assets/SpellingBee/Prefabs/ScoreboardEntry.prefab
Normal file
@ -0,0 +1,699 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7211582295438040519
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582295438040512}
|
||||
- component: {fileID: 7211582295438040514}
|
||||
- component: {fileID: 7211582295438040513}
|
||||
m_Layer: 5
|
||||
m_Name: PlayerName
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582295438040512
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295438040519}
|
||||
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: 7211582296121986055}
|
||||
m_RootOrder: 1
|
||||
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: -79.6514, y: 0.00016093}
|
||||
m_SizeDelta: {x: 296.6963, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582295438040514
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295438040519}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582295438040513
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295438040519}
|
||||
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: Player name
|
||||
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: 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: 1
|
||||
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 &7211582295887211978
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582295887211979}
|
||||
- component: {fileID: 7211582295887211957}
|
||||
- component: {fileID: 7211582295887211956}
|
||||
m_Layer: 5
|
||||
m_Name: Image
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582295887211979
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295887211978}
|
||||
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: 7211582296121986055}
|
||||
m_RootOrder: 2
|
||||
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: -258, y: -1.71}
|
||||
m_SizeDelta: {x: 60, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582295887211957
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295887211978}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582295887211956
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582295887211978}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: f2344cd67769733ceb363a41e1d88a65, 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
|
||||
--- !u!1 &7211582296197555975
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582296197555968}
|
||||
- component: {fileID: 7211582296197555970}
|
||||
- component: {fileID: 7211582296197555969}
|
||||
m_Layer: 5
|
||||
m_Name: Ago
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582296197555968
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296197555975}
|
||||
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: 7211582296121986055}
|
||||
m_RootOrder: 4
|
||||
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: 338.20084, y: -0.42738974}
|
||||
m_SizeDelta: {x: 93.9784, y: 64.275}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582296197555970
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296197555975}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582296197555969
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296197555975}
|
||||
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: xh
|
||||
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: 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: 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 &7211582296261028605
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582296261028606}
|
||||
- component: {fileID: 7211582296261028600}
|
||||
- component: {fileID: 7211582296261028607}
|
||||
m_Layer: 5
|
||||
m_Name: Score
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582296261028606
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296261028605}
|
||||
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: 7211582296121986055}
|
||||
m_RootOrder: 3
|
||||
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: 165.68, y: -0.85488}
|
||||
m_SizeDelta: {x: 193.9753, y: 63.42}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582296261028600
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296261028605}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582296261028607
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296261028605}
|
||||
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: xxx
|
||||
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: 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: 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 &7211582296562918651
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582296562918628}
|
||||
- component: {fileID: 7211582296562918630}
|
||||
- component: {fileID: 7211582296562918629}
|
||||
m_Layer: 5
|
||||
m_Name: Rank
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582296562918628
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296562918651}
|
||||
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: 7211582296121986055}
|
||||
m_RootOrder: 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: -352.78, y: -0.0000026228}
|
||||
m_SizeDelta: {x: 64.8044, y: 63.42}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582296562918630
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296562918651}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582296562918629
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7211582296562918651}
|
||||
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: 1
|
||||
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: 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: 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 &9154151134820372555
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7211582296121986055}
|
||||
- component: {fileID: 7211582296121986049}
|
||||
- component: {fileID: 7211582296121986048}
|
||||
m_Layer: 5
|
||||
m_Name: ScoreboardEntry
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7211582296121986055
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9154151134820372555}
|
||||
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: 7211582296562918628}
|
||||
- {fileID: 7211582295438040512}
|
||||
- {fileID: 7211582295887211979}
|
||||
- {fileID: 7211582296261028606}
|
||||
- {fileID: 7211582296197555968}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -1.0001831, y: 192.34688}
|
||||
m_SizeDelta: {x: -19.999641, y: -586.5417}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7211582296121986049
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9154151134820372555}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7211582296121986048
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9154151134820372555}
|
||||
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, g: 0, b: 0, a: 0.18431373}
|
||||
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: 10907, guid: 0000000000000000f000000000000000, type: 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
|
||||
7
Assets/SpellingBee/Prefabs/ScoreboardEntry.prefab.meta
Normal file
7
Assets/SpellingBee/Prefabs/ScoreboardEntry.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4a3a228b08d61847acc6da35b44e52c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,105 +1,221 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameController : MonoBehaviour
|
||||
{
|
||||
// All of the words that can be used in this session
|
||||
/// <summary>
|
||||
/// All of the words that can be used in this session
|
||||
/// </summary>
|
||||
private string[] words;
|
||||
|
||||
// Where we currently are in the word
|
||||
/// <summary>
|
||||
/// Where we currently are in the word
|
||||
/// </summary>
|
||||
private int letterIndex;
|
||||
|
||||
// Where we currently are in the word list
|
||||
/// <summary>
|
||||
/// Where we currently are in the word list
|
||||
/// </summary>
|
||||
private int wordIndex;
|
||||
|
||||
// The word that is currently being spelled
|
||||
/// <summary>
|
||||
/// The word that is currently being spelled
|
||||
/// </summary>
|
||||
private string currentWord;
|
||||
|
||||
// All of the available themes
|
||||
/// <summary>
|
||||
/// All of the available themes
|
||||
/// </summary>
|
||||
private ThemeList themeList;
|
||||
|
||||
// The theme we are currently using
|
||||
/// <summary>
|
||||
/// The theme we are currently using
|
||||
/// </summary>
|
||||
private Theme currentTheme;
|
||||
|
||||
// The input field for testing purposes
|
||||
public TMP_InputField input;
|
||||
|
||||
// Current value of timer in seconds
|
||||
/// <summary>
|
||||
/// Current value of timer in seconds
|
||||
/// </summary>
|
||||
private float timerValue;
|
||||
|
||||
// "Game over" or "You win!"
|
||||
/// <summary>
|
||||
/// "Game over" or "You win!"
|
||||
/// </summary>
|
||||
public TMP_Text endText;
|
||||
|
||||
// First score display
|
||||
public TMP_Text correctWordsText;
|
||||
/// <summary>
|
||||
/// LPM
|
||||
/// </summary>
|
||||
public TMP_Text lpmText;
|
||||
|
||||
// Second score display
|
||||
public TMP_Text correctLettersText;
|
||||
/// <summary>
|
||||
/// Letters ( right | wrong )
|
||||
/// </summary>
|
||||
public TMP_Text lettersRightText;
|
||||
public TMP_Text lettersWrongText;
|
||||
|
||||
// The game over panel
|
||||
/// <summary>
|
||||
/// Letters
|
||||
/// </summary>
|
||||
public TMP_Text lettersText;
|
||||
|
||||
/// <summary>
|
||||
/// Accuracy
|
||||
/// </summary>
|
||||
public TMP_Text accuracyText;
|
||||
|
||||
/// <summary>
|
||||
/// Words
|
||||
/// </summary>
|
||||
public TMP_Text wordsText;
|
||||
|
||||
/// <summary>
|
||||
/// Time
|
||||
/// </summary>
|
||||
public TMP_Text timeText;
|
||||
|
||||
/// <summary>
|
||||
/// Score
|
||||
/// </summary>
|
||||
public TMP_Text scoreText;
|
||||
|
||||
/// <summary>
|
||||
/// The game over panel
|
||||
/// </summary>
|
||||
public GameObject gameEndedPanel;
|
||||
|
||||
// Button for restarting the game
|
||||
/// <summary>
|
||||
/// Button for restarting the game
|
||||
/// </summary>
|
||||
public Button replayButton;
|
||||
|
||||
// Indicates if the game is still going
|
||||
/// <summary>
|
||||
/// Indicates if the game is still going
|
||||
/// </summary>
|
||||
private bool gameEnded;
|
||||
|
||||
// Amount of seconds user gets per letter of the current word
|
||||
// Set to 1 for testing; should be increased later
|
||||
/// <summary>
|
||||
/// Amount of seconds user gets per letter of the current word
|
||||
/// Set to 1 for testing; should be increased later
|
||||
/// </summary>
|
||||
private int secondsPerLetter = 1;
|
||||
|
||||
// Counter that keeps track of how many words have been spelled correctly
|
||||
private int spelledLetters;
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many letters have been spelled correctly
|
||||
/// </summary>
|
||||
private int correctLetters;
|
||||
|
||||
// Counter that keeps track of how many letters have been spelled correctly
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many letters have been spelled incorrectly
|
||||
/// </summary>
|
||||
private int incorrectLetters;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many words have been spelled correctly
|
||||
/// </summary>
|
||||
private int spelledWords;
|
||||
|
||||
/// <summary>
|
||||
/// Timer that keeps track of when the game was started
|
||||
/// </summary>
|
||||
private DateTime startTime;
|
||||
|
||||
|
||||
[Header("User")]
|
||||
// Reference to the user list to access the current user
|
||||
/// <summary>
|
||||
/// Reference to the user list to access the current user
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
// Reference to the current user
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the current user
|
||||
/// </summary>
|
||||
private User user;
|
||||
// Reference to the minigame progress of the current user
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the minigame progress of the current user
|
||||
/// </summary>
|
||||
private Progress progress = null;
|
||||
|
||||
[Header("Minigame")]
|
||||
// Reference to the minigame ScriptableObject
|
||||
/// <summary>
|
||||
/// Reference to the minigame ScriptableObject
|
||||
/// </summary>
|
||||
public Minigame minigame;
|
||||
|
||||
[Header("Letter prefab")]
|
||||
// Letter prefab
|
||||
|
||||
/// <summary>
|
||||
/// Letter prefab
|
||||
/// </summary>
|
||||
public GameObject letterPrefab;
|
||||
|
||||
[Header("UI References")]
|
||||
// Reference to letter prefab
|
||||
/// <summary>
|
||||
/// Reference to letter prefab
|
||||
/// </summary>
|
||||
public Transform letterContainer;
|
||||
// The Image component for displaying the appropriate sprite
|
||||
|
||||
/// <summary>
|
||||
/// The Image component for displaying the appropriate sprite
|
||||
/// </summary>
|
||||
public Image wordImage;
|
||||
// Timer display
|
||||
|
||||
/// <summary>
|
||||
/// Timer display
|
||||
/// </summary>
|
||||
public TMP_Text timerText;
|
||||
|
||||
[Header("Private Variables")]
|
||||
// The GameObjects representing the letters
|
||||
/// <summary>
|
||||
/// The GameObjects representing the letters
|
||||
/// </summary>
|
||||
private List<GameObject> letters = new List<GameObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scoreboard
|
||||
/// </summary>
|
||||
public Transform Scoreboard;
|
||||
|
||||
// Start is called before the first frame update
|
||||
/// <summary>
|
||||
/// Reference to the entries grid
|
||||
/// </summary>
|
||||
public Transform EntriesGrid;
|
||||
|
||||
/// <summary>
|
||||
/// The GameObjects representing the letters
|
||||
/// </summary>
|
||||
private List<GameObject> entries = new List<GameObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the ScoreboardEntry prefab
|
||||
/// </summary>
|
||||
public GameObject scoreboardEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Score class TODO: Move to separate file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Score
|
||||
{
|
||||
public int scoreValue;
|
||||
public string time;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
spelledLetters = 0;
|
||||
correctLetters = 0;
|
||||
incorrectLetters = 0;
|
||||
// We use -1 instead of 0 so SetNextWord can simply increment it each time
|
||||
spelledWords = -1;
|
||||
gameEnded = false;
|
||||
wordIndex = 0;
|
||||
input.text = "";
|
||||
timerValue = 0.0f;
|
||||
startTime = DateTime.Now;
|
||||
gameEndedPanel.SetActive(false);
|
||||
replayButton.onClick.AddListener(Start);
|
||||
|
||||
@ -110,12 +226,12 @@ public class GameController : MonoBehaviour
|
||||
{
|
||||
progress = new Progress();
|
||||
progress.AddOrUpdate<MinigameIndex>("minigameIndex", MinigameIndex.SPELLING_BEE);
|
||||
// TODO: add progress we want to keep track off
|
||||
// (for example 'highscore')
|
||||
progress.AddOrUpdate<int>("highscore", 0);
|
||||
progress.AddOrUpdate<List<Score>>("scores", new List<Score>());
|
||||
user.minigames.Add(progress);
|
||||
}
|
||||
userList.Save();
|
||||
|
||||
DeleteWord();
|
||||
|
||||
// TODO: change to ScriptableObject
|
||||
@ -126,14 +242,36 @@ public class GameController : MonoBehaviour
|
||||
SetNextWord();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/// <summary>
|
||||
/// Update is called once per frame
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if (!gameEnded)
|
||||
{
|
||||
if (input.text.Length > 0)
|
||||
// Get keyboard input
|
||||
// Check if the correct char has been given as input
|
||||
foreach (char c in Input.inputString)
|
||||
{
|
||||
CheckChar(input.text[0]);
|
||||
if (Char.ToUpper(c) == Char.ToUpper(currentWord[letterIndex]))
|
||||
{
|
||||
// correct letter
|
||||
letters[letterIndex].GetComponent<Image>().color = Color.green;
|
||||
correctLetters++;
|
||||
letterIndex++;
|
||||
|
||||
if (letterIndex >= currentWord.Length)
|
||||
{
|
||||
DeleteWord();
|
||||
StartCoroutine(Wait());
|
||||
SetNextWord();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// incorrect letter
|
||||
incorrectLetters++;
|
||||
}
|
||||
}
|
||||
|
||||
timerValue -= Time.deltaTime;
|
||||
@ -151,7 +289,9 @@ public class GameController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Randomly shuffle the list of words
|
||||
/// <summary>
|
||||
/// Randomly shuffle the list of words
|
||||
/// </summary>
|
||||
private void ShuffleWords()
|
||||
{
|
||||
for (int i = words.Length - 1; i > 0; i--)
|
||||
@ -164,88 +304,232 @@ public class GameController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Displays the game over panel and score values
|
||||
/// <summary>
|
||||
/// Calculate the score
|
||||
/// </summary>
|
||||
/// <returns>The calculated score</returns>
|
||||
private int CalculateScore()
|
||||
{
|
||||
return spelledWords * 5 + correctLetters;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set score metrics
|
||||
/// </summary>
|
||||
private void SetScoreMetrics()
|
||||
{
|
||||
// LPM
|
||||
TimeSpan duration = DateTime.Now.Subtract(startTime);
|
||||
lpmText.text = (60f * correctLetters / duration.TotalSeconds).ToString("#") + " LPM";
|
||||
|
||||
// Letters ( right | wrong ) total
|
||||
lettersRightText.text = correctLetters.ToString();
|
||||
lettersWrongText.text = incorrectLetters.ToString();
|
||||
lettersText.text = (correctLetters + incorrectLetters).ToString();
|
||||
|
||||
// Accuracy
|
||||
if (correctLetters + incorrectLetters > 0)
|
||||
{
|
||||
accuracyText.text = ((correctLetters) * 100f / (correctLetters + incorrectLetters)).ToString("#.##") + "%";
|
||||
} else
|
||||
{
|
||||
accuracyText.text = "-";
|
||||
}
|
||||
|
||||
|
||||
// Words
|
||||
wordsText.text = spelledWords.ToString();
|
||||
|
||||
// Time
|
||||
timeText.text = duration.ToString(@"mm\:ss");
|
||||
|
||||
// Score
|
||||
scoreText.text = "Score: " + CalculateScore().ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays the game over panel and score values
|
||||
/// </summary>
|
||||
private void ActivateGameOver()
|
||||
{
|
||||
DeleteWord();
|
||||
endText.text = "GAME OVER";
|
||||
correctLettersText.text = "Correctly spelled letters: " + spelledLetters.ToString();
|
||||
correctWordsText.text = "Correctly spelled words: " + spelledWords.ToString();
|
||||
|
||||
SetScoreMetrics();
|
||||
|
||||
gameEndedPanel.SetActive(true);
|
||||
gameEndedPanel.transform.SetAsLastSibling();
|
||||
|
||||
gameEnded = true;
|
||||
|
||||
// Save the scores and show the scoreboard
|
||||
SaveScores();
|
||||
SetScoreBoard();
|
||||
}
|
||||
|
||||
// Display win screen
|
||||
/// <summary>
|
||||
/// Display win screen
|
||||
/// </summary>
|
||||
private void ActivateWin()
|
||||
{
|
||||
int score = words.Length;
|
||||
|
||||
// Update progress
|
||||
// TODO: update all tracked progress
|
||||
int highscore = progress.Get<int>("highscore");
|
||||
if (score < highscore)
|
||||
{
|
||||
progress.AddOrUpdate<int>("highsscore", score);
|
||||
userList.Save();
|
||||
}
|
||||
|
||||
// @lukas stuff
|
||||
DeleteWord();
|
||||
endText.text = "YOU WIN!";
|
||||
correctLettersText.text = "Your time: " + spelledLetters.ToString();
|
||||
int totalWordsDuration = 0;
|
||||
|
||||
foreach (string word in words)
|
||||
{
|
||||
totalWordsDuration += word.Length * secondsPerLetter + 1;
|
||||
}
|
||||
|
||||
// How much time was spent by the player
|
||||
int spentTime = totalWordsDuration - (int)timerValue;
|
||||
|
||||
int seconds = spentTime % 60;
|
||||
int minutes = spentTime / 60;
|
||||
|
||||
if (minutes == 0)
|
||||
{
|
||||
correctLettersText.text = "Your time: " + seconds + " seconds";
|
||||
}
|
||||
else
|
||||
{
|
||||
correctLettersText.text = "Your time: " + minutes + " minutes and " + seconds + " seconds";
|
||||
}
|
||||
|
||||
correctWordsText.text = "";
|
||||
SetScoreMetrics();
|
||||
|
||||
gameEndedPanel.SetActive(true);
|
||||
gameEndedPanel.transform.SetAsLastSibling();
|
||||
|
||||
gameEnded = true;
|
||||
|
||||
// Save the scores and show the scoreboard
|
||||
SaveScores();
|
||||
SetScoreBoard();
|
||||
}
|
||||
|
||||
// Check if the correct char has been given as input
|
||||
private void CheckChar(char letter)
|
||||
/// <summary>
|
||||
/// Update and save the scores
|
||||
/// </summary>
|
||||
private void SaveScores()
|
||||
{
|
||||
if (Char.ToUpper(letter) == Char.ToUpper(currentWord[letterIndex]) && input.text.Length == 1)
|
||||
{
|
||||
letters[letterIndex].GetComponent<Image>().color = Color.green;
|
||||
input.text = "";
|
||||
spelledLetters++;
|
||||
letterIndex++;
|
||||
// Calculate new score
|
||||
int newScore = spelledWords * 5 + correctLetters;
|
||||
// Save the score as a tuple: < int score, string time ago>
|
||||
Score score = new Score();
|
||||
score.scoreValue = newScore;
|
||||
score.time = DateTime.Now.ToString();
|
||||
|
||||
if (letterIndex >= currentWord.Length)
|
||||
// Save the new score
|
||||
user = userList.GetCurrentUser();
|
||||
progress = user.minigames.Find((p) => p != null && p.Get<MinigameIndex>("minigameIndex") == minigame.index);
|
||||
if (progress != null)
|
||||
{
|
||||
// Get the current list of scores
|
||||
List<Score> scores = progress.Get<List<Score>>("scores");
|
||||
|
||||
// Add the new score
|
||||
scores.Add(score);
|
||||
|
||||
// Sort the scores
|
||||
scores.Sort((a, b) => b.scoreValue.CompareTo(a.scoreValue));
|
||||
|
||||
// Only save the top 10 scores, so this list doesn't keep growing endlessly
|
||||
progress.AddOrUpdate<List<Score>>("scores", scores.Take(10).ToList());
|
||||
}
|
||||
|
||||
// Update the highscore
|
||||
int highscore = progress.Get<int>("highscore");
|
||||
if (score.scoreValue < highscore)
|
||||
{
|
||||
progress.AddOrUpdate<int>("highscore", score.scoreValue);
|
||||
}
|
||||
|
||||
userList.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scoreboard
|
||||
/// </summary>
|
||||
private void SetScoreBoard()
|
||||
{
|
||||
// Clean the previous scoreboard entries
|
||||
for (int i = 0; i < entries.Count; i++)
|
||||
{
|
||||
Destroy(entries[i]);
|
||||
}
|
||||
entries.Clear();
|
||||
|
||||
// Instantiate new entries
|
||||
// Get all scores from all users
|
||||
List<Tuple<string, Score>> allScores = new List<Tuple<string, Score>>();
|
||||
foreach (User user in userList.GetUsers())
|
||||
{
|
||||
// Get user's progress for this minigame
|
||||
progress = user.minigames.Find((p) => p != null && p.Get<MinigameIndex>("minigameIndex") == minigame.index);
|
||||
if (progress != null)
|
||||
{
|
||||
DeleteWord();
|
||||
StartCoroutine(Wait());
|
||||
SetNextWord();
|
||||
// Add scores to dictionary
|
||||
List<Score> scores = progress.Get<List<Score>>("scores");
|
||||
foreach (Score score in scores)
|
||||
{
|
||||
allScores.Add(new Tuple<string, Score>(user.username, score));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort allScores based on Score.scoreValue
|
||||
allScores.Sort((a, b) => b.Item2.scoreValue.CompareTo(a.Item2.scoreValue));
|
||||
|
||||
// Instantiate scoreboard entries
|
||||
int rank = 1;
|
||||
foreach (Tuple<string, Score> tup in allScores.Take(10))
|
||||
{
|
||||
string username = tup.Item1;
|
||||
Score score = tup.Item2;
|
||||
|
||||
GameObject entry = Instantiate(scoreboardEntry, EntriesGrid);
|
||||
entries.Add(entry);
|
||||
// Set the player icon
|
||||
entry.transform.Find("Image").GetComponent<Image>().sprite = userList.GetUserByUsername(username).avatar;
|
||||
|
||||
// Set the player name
|
||||
entry.transform.Find("PlayerName").GetComponent<TMP_Text>().text = username;
|
||||
|
||||
// Set the score
|
||||
entry.transform.Find("Score").GetComponent<TMP_Text>().text = score.scoreValue.ToString();
|
||||
|
||||
// Set the rank
|
||||
entry.transform.Find("Rank").GetComponent<TMP_Text>().text = rank.ToString();
|
||||
|
||||
// Set the ago
|
||||
// Convert the score.time to Datetime
|
||||
DateTime time = DateTime.Parse(score.time);
|
||||
DateTime currentTime = DateTime.Now;
|
||||
TimeSpan diff = currentTime.Subtract(time);
|
||||
|
||||
string formatted;
|
||||
if (diff.Days > 0)
|
||||
{
|
||||
formatted = $"{diff.Days}d ";
|
||||
}
|
||||
else if (diff.Hours > 0)
|
||||
{
|
||||
formatted = $"{diff.Hours}h ";
|
||||
}
|
||||
else if (diff.Minutes > 0)
|
||||
{
|
||||
formatted = $"{diff.Minutes}m ";
|
||||
}
|
||||
else
|
||||
{
|
||||
formatted = "now";
|
||||
}
|
||||
|
||||
entry.transform.Find("Ago").GetComponent<TMP_Text>().text = formatted;
|
||||
|
||||
|
||||
// Alternating colors looks nice
|
||||
if (rank % 2 == 0)
|
||||
{
|
||||
Image image = entry.transform.GetComponent<Image>();
|
||||
image.color = new Color(image.color.r, image.color.g, image.color.b, 0f);
|
||||
}
|
||||
|
||||
// Make new score stand out
|
||||
if (diff.TotalSeconds < 1)
|
||||
{
|
||||
Image image = entry.transform.GetComponent<Image>();
|
||||
image.color = new Color(0, 229, 255, 233);
|
||||
}
|
||||
|
||||
rank++;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete all letter objects
|
||||
/// <summary>
|
||||
/// Delete all letter objects
|
||||
/// </summary>
|
||||
private void DeleteWord()
|
||||
{
|
||||
for (int i = 0; i < letters.Count; i++)
|
||||
@ -255,13 +539,20 @@ public class GameController : MonoBehaviour
|
||||
letters.Clear();
|
||||
}
|
||||
|
||||
// Adds seconds to timer
|
||||
/// <summary>
|
||||
/// Adds seconds to timer
|
||||
/// </summary>
|
||||
/// <param name="seconds"></param>
|
||||
private void AddSeconds(int seconds)
|
||||
{
|
||||
timerValue += (float)seconds;
|
||||
}
|
||||
|
||||
// Find the chosen theme by its name
|
||||
/// <summary>
|
||||
/// Find the chosen theme by its name
|
||||
/// </summary>
|
||||
/// <param name="themeName">The name of the theme to find</param>
|
||||
/// <returns>The requested theme</returns>
|
||||
private Theme FindThemeByName(string themeName)
|
||||
{
|
||||
int themeIndex = 0;
|
||||
@ -280,7 +571,9 @@ public class GameController : MonoBehaviour
|
||||
return null;
|
||||
}
|
||||
|
||||
// Display next word in the series
|
||||
/// <summary>
|
||||
/// Display next word in the series
|
||||
/// </summary>
|
||||
private void SetNextWord()
|
||||
{
|
||||
spelledWords++;
|
||||
@ -302,7 +595,10 @@ public class GameController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Displays the word that needs to be spelled
|
||||
/// <summary>
|
||||
/// Displays the word that needs to be spelled
|
||||
/// </summary>
|
||||
/// <param name="word">The word to display</param>
|
||||
private void DisplayWord(string word)
|
||||
{
|
||||
for (int i = 0; i < word.Length; i++)
|
||||
@ -319,7 +615,10 @@ public class GameController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// Change the image that is being displayed
|
||||
/// <summary>
|
||||
/// Change the image that is being displayed
|
||||
/// </summary>
|
||||
/// <param name="spriteName">Name of the new sprite</param>
|
||||
private void ChangeSprite(string spriteName)
|
||||
{
|
||||
// Load the new sprite from the Resources folder
|
||||
@ -329,6 +628,10 @@ public class GameController : MonoBehaviour
|
||||
wordImage.sprite = sprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// wait for 2 seconds
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerator Wait()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(2);
|
||||
|
||||
@ -3,7 +3,21 @@ guid: 44fbed5ae228de39b9f727def7578d06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
defaultReferences:
|
||||
- input: {instanceID: 0}
|
||||
- endText: {instanceID: 0}
|
||||
- correctWordsText: {instanceID: 0}
|
||||
- correctLettersText: {instanceID: 0}
|
||||
- gameEndedPanel: {instanceID: 0}
|
||||
- replayButton: {instanceID: 0}
|
||||
- userList: {instanceID: 0}
|
||||
- minigame: {instanceID: 0}
|
||||
- letterPrefab: {instanceID: 0}
|
||||
- letterContainer: {instanceID: 0}
|
||||
- wordImage: {instanceID: 0}
|
||||
- timerText: {instanceID: 0}
|
||||
- Scoreboard: {instanceID: 0}
|
||||
- scoreboardEntry: {fileID: 9154151134820372555, guid: d4a3a228b08d61847acc6da35b44e52c, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
Assets/users.json
Normal file
1
Assets/users.json
Normal file
@ -0,0 +1 @@
|
||||
{"currentUserIndex":0,"storedUsers":[{"username":"testkonijn","avatar":{"instanceID":22348},"playtime":0.0,"courses":[],"minigames":[{"entries":[{"key":"minigameIndex","bytes":[0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,12,2,0,0,0,70,65,115,115,101,109,98,108,121,45,67,83,104,97,114,112,44,32,86,101,114,115,105,111,110,61,48,46,48,46,48,46,48,44,32,67,117,108,116,117,114,101,61,110,101,117,116,114,97,108,44,32,80,117,98,108,105,99,75,101,121,84,111,107,101,110,61,110,117,108,108,5,1,0,0,0,13,77,105,110,105,103,97,109,101,73,110,100,101,120,1,0,0,0,7,118,97,108,117,101,95,95,0,8,2,0,0,0,0,0,0,0,11]},{"key":"highscore","bytes":[0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,4,1,0,0,0,12,83,121,115,116,101,109,46,73,110,116,51,50,1,0,0,0,7,109,95,118,97,108,117,101,0,8,0,0,0,0,11]},{"key":"scores","bytes":[0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,12,2,0,0,0,70,65,115,115,101,109,98,108,121,45,67,83,104,97,114,112,44,32,86,101,114,115,105,111,110,61,48,46,48,46,48,46,48,44,32,67,117,108,116,117,114,101,61,110,101,117,116,114,97,108,44,32,80,117,98,108,105,99,75,101,121,84,111,107,101,110,61,110,117,108,108,4,1,0,0,0,129,1,83,121,115,116,101,109,46,67,111,108,108,101,99,116,105,111,110,115,46,71,101,110,101,114,105,99,46,76,105,115,116,96,49,91,91,71,97,109,101,67,111,110,116,114,111,108,108,101,114,43,83,99,111,114,101,44,32,65,115,115,101,109,98,108,121,45,67,83,104,97,114,112,44,32,86,101,114,115,105,111,110,61,48,46,48,46,48,46,48,44,32,67,117,108,116,117,114,101,61,110,101,117,116,114,97,108,44,32,80,117,98,108,105,99,75,101,121,84,111,107,101,110,61,110,117,108,108,93,93,3,0,0,0,6,95,105,116,101,109,115,5,95,115,105,122,101,8,95,118,101,114,115,105,111,110,4,0,0,22,71,97,109,101,67,111,110,116,114,111,108,108,101,114,43,83,99,111,114,101,91,93,2,0,0,0,8,8,9,3,0,0,0,10,0,0,0,10,0,0,0,7,3,0,0,0,0,1,0,0,0,10,0,0,0,4,20,71,97,109,101,67,111,110,116,114,111,108,108,101,114,43,83,99,111,114,101,2,0,0,0,9,4,0,0,0,9,5,0,0,0,9,6,0,0,0,9,7,0,0,0,9,8,0,0,0,9,9,0,0,0,9,10,0,0,0,9,11,0,0,0,9,12,0,0,0,9,13,0,0,0,5,4,0,0,0,20,71,97,109,101,67,111,110,116,114,111,108,108,101,114,43,83,99,111,114,101,2,0,0,0,10,115,99,111,114,101,86,97,108,117,101,4,116,105,109,101,0,1,8,2,0,0,0,153,0,0,0,6,14,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,53,58,51,56,58,53,54,1,5,0,0,0,4,0,0,0,17,0,0,0,6,15,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,53,58,51,57,58,53,48,1,6,0,0,0,4,0,0,0,16,0,0,0,6,16,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,55,58,53,51,58,50,50,1,7,0,0,0,4,0,0,0,14,0,0,0,6,17,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,55,58,53,49,58,51,49,1,8,0,0,0,4,0,0,0,12,0,0,0,6,18,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,55,58,50,55,58,48,55,1,9,0,0,0,4,0,0,0,11,0,0,0,6,19,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,53,58,51,51,58,53,48,1,10,0,0,0,4,0,0,0,11,0,0,0,6,20,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,54,58,50,49,58,52,55,1,11,0,0,0,4,0,0,0,11,0,0,0,6,21,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,55,58,51,54,58,50,56,1,12,0,0,0,4,0,0,0,9,0,0,0,6,22,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,55,58,51,48,58,49,56,1,13,0,0,0,4,0,0,0,8,0,0,0,6,23,0,0,0,19,49,48,47,48,51,47,50,48,50,51,32,49,54,58,50,49,58,50,54,11]}]}]}]}
|
||||
7
Assets/users.json.meta
Normal file
7
Assets/users.json.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29594155802425940b4fd7351ad447e8
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user