Merge branch 'WES-192-fix-progress-screen' into 'development'
Resolve WES-192 "Fix progress screen" See merge request wesign/unity-application!88
This commit is contained in:
commit
b10358930b
137
Assets/Accounts/Prefabs/Axes Tick Marker.prefab
Normal file
137
Assets/Accounts/Prefabs/Axes Tick Marker.prefab
Normal file
@ -0,0 +1,137 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7141392721760992647
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7141392721760992646}
|
||||
- component: {fileID: 7141392721760992644}
|
||||
- component: {fileID: 2518831828376613321}
|
||||
m_Layer: 5
|
||||
m_Name: Axes Tick Marker
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7141392721760992646
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7141392721760992647}
|
||||
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: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!222 &7141392721760992644
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7141392721760992647}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2518831828376613321
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7141392721760992647}
|
||||
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: 0
|
||||
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: 4279242768
|
||||
m_fontColor: {r: 0.0627451, g: 0.0627451, b: 0.0627451, 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: 36
|
||||
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: 0
|
||||
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}
|
||||
7
Assets/Accounts/Prefabs/Axes Tick Marker.prefab.meta
Normal file
7
Assets/Accounts/Prefabs/Axes Tick Marker.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d96609216a825843b33f6af9cdfa29b
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -33,8 +33,8 @@ RectTransform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
|
||||
515
Assets/Accounts/Prefabs/LearnableProgressCard.prefab
Normal file
515
Assets/Accounts/Prefabs/LearnableProgressCard.prefab
Normal file
@ -0,0 +1,515 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &758255480231791509
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255480231791508}
|
||||
- component: {fileID: 758255480231791506}
|
||||
- component: {fileID: 758255480231791507}
|
||||
- component: {fileID: 8445851122681183268}
|
||||
m_Layer: 0
|
||||
m_Name: LearnableProgressCard
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255480231791508
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255480231791509}
|
||||
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: 758255481422566555}
|
||||
- {fileID: 758255481061489079}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &758255480231791506
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255480231791509}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255480231791507
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255480231791509}
|
||||
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: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &8445851122681183268
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255480231791509}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7835fc450a6bbf24d95f0a19491fb8c1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
progress:
|
||||
entries: []
|
||||
index: 0
|
||||
inUse: 0
|
||||
name:
|
||||
progress: 0
|
||||
course: {fileID: 0}
|
||||
thumbnail: {fileID: 758255481422566554}
|
||||
stars:
|
||||
- {fileID: 758255481653936988}
|
||||
- {fileID: 758255481997431046}
|
||||
- {fileID: 758255482122419822}
|
||||
--- !u!1 &758255481061489032
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255481061489079}
|
||||
- component: {fileID: 758255481061489077}
|
||||
- component: {fileID: 758255481061489078}
|
||||
- component: {fileID: 758255481061489076}
|
||||
m_Layer: 0
|
||||
m_Name: Status
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255481061489079
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481061489032}
|
||||
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: 758255481653936989}
|
||||
- {fileID: 758255481997431047}
|
||||
- {fileID: 758255482122419823}
|
||||
m_Father: {fileID: 758255480231791508}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: -32}
|
||||
m_SizeDelta: {x: -20, y: 45}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!222 &758255481061489077
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481061489032}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255481061489078
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481061489032}
|
||||
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.5803922, g: 0.58431375, b: 0.6, 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: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &758255481061489076
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481061489032}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 4
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &758255481422566556
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255481422566555}
|
||||
- component: {fileID: 758255481422566553}
|
||||
- component: {fileID: 758255481422566554}
|
||||
m_Layer: 0
|
||||
m_Name: Image
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255481422566555
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481422566556}
|
||||
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: 758255480231791508}
|
||||
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: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &758255481422566553
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481422566556}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255481422566554
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481422566556}
|
||||
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: 5e3c345e006acf74791d272061159b89, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &758255481653936990
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255481653936989}
|
||||
- component: {fileID: 758255481653936987}
|
||||
- component: {fileID: 758255481653936988}
|
||||
m_Layer: 0
|
||||
m_Name: Image
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255481653936989
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481653936990}
|
||||
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: 758255481061489079}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &758255481653936987
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481653936990}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255481653936988
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481653936990}
|
||||
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: -2086278073, guid: 4d6d852f751f20046ae733db5bdb1af1, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &758255481997431064
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255481997431047}
|
||||
- component: {fileID: 758255481997431045}
|
||||
- component: {fileID: 758255481997431046}
|
||||
m_Layer: 0
|
||||
m_Name: Image (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255481997431047
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481997431064}
|
||||
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: 758255481061489079}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &758255481997431045
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481997431064}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255481997431046
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255481997431064}
|
||||
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: 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: -2086278073, guid: 4d6d852f751f20046ae733db5bdb1af1, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &758255482122419808
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 758255482122419823}
|
||||
- component: {fileID: 758255482122419821}
|
||||
- component: {fileID: 758255482122419822}
|
||||
m_Layer: 0
|
||||
m_Name: Image (2)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &758255482122419823
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255482122419808}
|
||||
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: 758255481061489079}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &758255482122419821
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255482122419808}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &758255482122419822
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 758255482122419808}
|
||||
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: 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: -2086278073, guid: 4d6d852f751f20046ae733db5bdb1af1, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7a9a8ccb77a37740bfdf5579cb179ca
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -48,9 +48,7 @@ public class ChangeUserScreen : MonoBehaviour
|
||||
private void DisplayUsers()
|
||||
{
|
||||
foreach (Transform child in usersContainer)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
List<User> users = UserList.GetUsers();
|
||||
currentUserIndex = UserList.IndexOf(UserList.GetCurrentUser().GetUsername());
|
||||
|
||||
@ -24,7 +24,7 @@ public class CourseProgressCard : MonoBehaviour
|
||||
public PersistentDataController.SavedCourseProgress courseProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the list of courses so we can query the correct course
|
||||
/// Reference to the list of minigameCards so we can query the correct course
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
|
||||
40
Assets/Accounts/Scripts/LearnableProgressCard.cs
Normal file
40
Assets/Accounts/Scripts/LearnableProgressCard.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to handle learnable progress card display
|
||||
/// </summary>
|
||||
public class LearnableProgressCard : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the progress so we can display a progress bar
|
||||
/// </summary>
|
||||
public PersistentDataController.SavedLearnableProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the list of minigameCards so we can query the correct course
|
||||
/// </summary>
|
||||
public Learnable learnable;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the thumbnail of the course
|
||||
/// </summary>
|
||||
public Image thumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// UI refeerence to the title of the course
|
||||
/// </summary>
|
||||
public List<Image> stars;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
thumbnail.sprite = learnable.image;
|
||||
var starRewards = new float[] { 1.0f, 2.5f, 4.0f, };
|
||||
for (int i = 0; i < 3; i++)
|
||||
stars[i].color = starRewards[i] < progress.progress ? Color.white : Color.black;
|
||||
}
|
||||
}
|
||||
11
Assets/Accounts/Scripts/LearnableProgressCard.cs.meta
Normal file
11
Assets/Accounts/Scripts/LearnableProgressCard.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7835fc450a6bbf24d95f0a19491fb8c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@ -53,9 +54,11 @@ public class MinigameProgressCard : MonoBehaviour
|
||||
|
||||
thumbnail.sprite = minigame.thumbnail;
|
||||
title.text = minigame.title;
|
||||
List<Score> highscores = minigameProgress.highestScores;
|
||||
int score = highscores.Count > 0 ? highscores[0].scoreValue : 0;
|
||||
highscore.text = $"Topscore: {score}";
|
||||
button.onClick.AddListener(selectActivity);
|
||||
List<Score> highscores = minigameProgress.highestScores;
|
||||
if (0 < highscores.Count)
|
||||
highscore.text = $"TOPSCORE: {highscores.Max((s) => s.scoreValue)}";
|
||||
else
|
||||
highscore.text = "(NOG) GEEN TOPSCORE";
|
||||
}
|
||||
}
|
||||
|
||||
130
Assets/Accounts/Scripts/PanelCourseProgress.cs
Normal file
130
Assets/Accounts/Scripts/PanelCourseProgress.cs
Normal file
@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to handle course list progress display
|
||||
/// </summary>
|
||||
public class PanelCourseProgress : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the current user
|
||||
/// </summary>
|
||||
private User user;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the courses list
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of a course card
|
||||
/// </summary>
|
||||
public GameObject courseCardPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the container holding all course cards
|
||||
/// </summary>
|
||||
public Transform coursesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the course info panel
|
||||
/// </summary>
|
||||
public GameObject courseInfo;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the message that displays when no course progress is present
|
||||
/// </summary>
|
||||
public GameObject emptyCourses;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the title on the info panel
|
||||
/// </summary>
|
||||
public TMP_Text courseTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the learnable card prefab
|
||||
/// </summary>
|
||||
public GameObject learnableCardPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the container for holding the learnable cards
|
||||
/// </summary>
|
||||
public Transform learnablesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the course progress bar on the info panel
|
||||
/// </summary>
|
||||
public SlicedSlider progressBar;
|
||||
|
||||
/// <summary>
|
||||
/// Current selected course
|
||||
/// </summary>
|
||||
private int selectedCourse = 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of course backgrounds and indices
|
||||
/// </summary>
|
||||
private List<Tuple<Image, CourseIndex>> courseCards = new List<Tuple<Image, CourseIndex>>();
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
PersistentDataController.GetInstance().Load();
|
||||
user = UserList.GetCurrentUser();
|
||||
|
||||
var courses = user.GetCourses();
|
||||
courseInfo.SetActive(0 < courses.Count);
|
||||
emptyCourses.SetActive(courses.Count <= 0);
|
||||
int i = 0;
|
||||
foreach (var courseProgress in courses)
|
||||
{
|
||||
// Create instance of prefab
|
||||
GameObject instance = GameObject.Instantiate(courseCardPrefab, coursesContainer);
|
||||
int j = i++;
|
||||
|
||||
// Initialize card
|
||||
CourseProgressCard cpc = instance.GetComponent<CourseProgressCard>();
|
||||
cpc.courseProgress = courseProgress;
|
||||
cpc.selectActivity = () => UpdateSelection(j);
|
||||
|
||||
// Store reference to background so we can apply fancy coloring
|
||||
Image background = instance.GetComponent<Image>();
|
||||
background.color = Color.gray;
|
||||
this.courseCards.Add(Tuple.Create(background, courseProgress.courseIndex));
|
||||
}
|
||||
if (0 < courses.Count)
|
||||
UpdateSelection(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the current selected course
|
||||
/// </summary>
|
||||
/// <param name="newCourse">Index to the new course</param>
|
||||
private void UpdateSelection(int newCourse)
|
||||
{
|
||||
courseCards[selectedCourse].Item1.color = Color.gray;
|
||||
selectedCourse = newCourse;
|
||||
courseCards[selectedCourse].Item1.color = Color.blue;
|
||||
|
||||
var progress = user.GetCourseProgress(courseCards[selectedCourse].Item2);
|
||||
var course = courseList.GetCourseByIndex(progress.courseIndex);
|
||||
courseTitle.text = course.title;
|
||||
progressBar.fillAmount = progress.progress;
|
||||
|
||||
foreach (Transform child in learnablesContainer)
|
||||
Destroy(child.gameObject);
|
||||
|
||||
for (int i = 0; i < course.theme.learnables.Count; i++)
|
||||
{
|
||||
GameObject instance = GameObject.Instantiate(learnableCardPrefab, learnablesContainer);
|
||||
var script = instance.GetComponent<LearnableProgressCard>();
|
||||
script.learnable = course.theme.learnables[i];
|
||||
script.progress = progress.learnables[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Accounts/Scripts/PanelCourseProgress.cs.meta
Normal file
11
Assets/Accounts/Scripts/PanelCourseProgress.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba7d548c45e9ade4593922d9530cd56d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Assets/Accounts/Scripts/PanelMinigameProgress.cs
Normal file
127
Assets/Accounts/Scripts/PanelMinigameProgress.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to handle minigame list progress display
|
||||
/// </summary>
|
||||
public class PanelMinigameProgress : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the current user
|
||||
/// </summary>
|
||||
private User user;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the minigames list
|
||||
/// </summary>
|
||||
public MinigameList minigameList;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of a minigame card
|
||||
/// </summary>
|
||||
public GameObject minigameCardPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the container holding all the minigame cards
|
||||
/// </summary>
|
||||
public Transform minigamesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the minigame info panel
|
||||
/// </summary>
|
||||
public GameObject minigameInfo;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the message that displays when no minigame progress is present
|
||||
/// </summary>
|
||||
public GameObject emptyMinigames;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the plot
|
||||
/// </summary>
|
||||
public ProgressGraph progressGraph;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the title of the minigame of the info panel
|
||||
/// </summary>
|
||||
public TMP_Text minigameTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the text that will display when an empty minigame progress object is selected
|
||||
/// </summary>
|
||||
public GameObject emptyHighscore;
|
||||
|
||||
/// <summary>
|
||||
/// Current selected course
|
||||
/// </summary>
|
||||
private int selectedMinigame = 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of course backgrounds and indices
|
||||
/// </summary>
|
||||
private List<Tuple<Image, MinigameIndex>> minigameCards = new List<Tuple<Image, MinigameIndex>>();
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
PersistentDataController.GetInstance().Load();
|
||||
user = UserList.GetCurrentUser();
|
||||
|
||||
var minigames = user.GetMinigames();
|
||||
minigameInfo.SetActive(minigames.Count > 0);
|
||||
emptyMinigames.SetActive(minigames.Count <= 0);
|
||||
int i = 0;
|
||||
foreach (var minigameProgress in minigames)
|
||||
{
|
||||
// Create instance of prefab
|
||||
GameObject instance = GameObject.Instantiate(minigameCardPrefab, minigamesContainer);
|
||||
int j = i++;
|
||||
|
||||
// Initialize card
|
||||
MinigameProgressCard mpc = instance.GetComponent<MinigameProgressCard>();
|
||||
mpc.minigameProgress = minigameProgress;
|
||||
mpc.selectActivity = () => UpdateSelection(j);
|
||||
|
||||
// Store reference to background so we can apply fancy coloring
|
||||
Image background = instance.GetComponent<Image>();
|
||||
background.color = Color.gray;
|
||||
minigameCards.Add(Tuple.Create(background, minigameProgress.minigameIndex));
|
||||
}
|
||||
if (0 < minigames.Count)
|
||||
UpdateSelection(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the current selected course
|
||||
/// </summary>
|
||||
/// <param name="newMinigame">Index to the new course</param>
|
||||
private void UpdateSelection(int newMinigame)
|
||||
{
|
||||
minigameCards[selectedMinigame].Item1.color = Color.gray;
|
||||
selectedMinigame = newMinigame;
|
||||
minigameCards[selectedMinigame].Item1.color = Color.blue;
|
||||
|
||||
var progress = user.GetMinigameProgress(minigameCards[selectedMinigame].Item2);
|
||||
minigameTitle.text = minigameList.GetMinigameByIndex(progress.minigameIndex).title;
|
||||
|
||||
List<Score> latestScores = progress.latestScores;
|
||||
List<Score> highestScores = progress.highestScores;
|
||||
if (0 < highestScores.Count)
|
||||
{
|
||||
emptyHighscore.SetActive(false);
|
||||
progressGraph.gameObject.SetActive(true);
|
||||
progressGraph.Plot(latestScores.ConvertAll<double>((s) => (double)s.scoreValue), highestScores.Max((s) => s.scoreValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
emptyHighscore.SetActive(true);
|
||||
progressGraph.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Accounts/Scripts/PanelMinigameProgress.cs.meta
Normal file
11
Assets/Accounts/Scripts/PanelMinigameProgress.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c17533febddc854f8b01bacf617d45f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
263
Assets/Accounts/Scripts/ProgressGraph.cs
Normal file
263
Assets/Accounts/Scripts/ProgressGraph.cs
Normal file
@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to handle and draw a nice line graph to a Texture2D
|
||||
/// </summary>
|
||||
public class ProgressGraph : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// UI reference to the plot
|
||||
/// </summary>
|
||||
public RawImage progressGraph;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of the highscore marker to display on the graph
|
||||
/// </summary>
|
||||
public GameObject highscoreMarker;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of the axes tick marker to display on the graph
|
||||
/// </summary>
|
||||
public GameObject axesTickMarker;
|
||||
|
||||
/// <summary>
|
||||
/// Color of the graph line
|
||||
/// </summary>
|
||||
public Color lineColor;
|
||||
|
||||
/// <summary>
|
||||
/// Bckground color
|
||||
/// </summary>
|
||||
public Color backgroundColor;
|
||||
|
||||
/// <summary>
|
||||
/// Color of the text and axes grid
|
||||
/// </summary>
|
||||
public Color textColor;
|
||||
|
||||
/// <summary>
|
||||
/// Color of the highscore line
|
||||
/// </summary>
|
||||
public Color highscoreColor;
|
||||
|
||||
/// <summary>
|
||||
/// Left and right padding of the graph
|
||||
/// </summary>
|
||||
private const int GRAPH_PADDING_X_PX = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Top and bottom padding of the graph
|
||||
/// </summary>
|
||||
private const int GRAPH_PADDING_Y_PX = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the point on the graph
|
||||
/// </summary>
|
||||
private const int GRAPH_POINT_RADIUS = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Size of the line on the graph
|
||||
/// </summary>
|
||||
private const int GRAPH_LINE_SIZE = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Plot points and a highscore on the graph
|
||||
/// </summary>
|
||||
/// <param name="scores">List of score values to plot</param>
|
||||
/// <param name="highscore">Highscore value (this will be plotted in a fancy color)</param>
|
||||
public void Plot(List<double> scores, double highscore)
|
||||
{
|
||||
// Remove previous marker(s)
|
||||
foreach (Transform child in progressGraph.gameObject.transform)
|
||||
Destroy(child.gameObject);
|
||||
|
||||
// Get texture reference
|
||||
Texture2D tex = progressGraph.texture as Texture2D;
|
||||
RectTransform rect = progressGraph.gameObject.transform as RectTransform;
|
||||
if (tex == null)
|
||||
{
|
||||
tex = new Texture2D(
|
||||
width: (int)rect.sizeDelta.x,
|
||||
height: (int)rect.sizeDelta.y,
|
||||
textureFormat: TextureFormat.ARGB32,
|
||||
mipCount: 3,
|
||||
linear: true
|
||||
);
|
||||
}
|
||||
tex.filterMode = FilterMode.Point;
|
||||
FillTexture(tex, backgroundColor);
|
||||
|
||||
// calculate positions and offsets
|
||||
int x0 = GRAPH_PADDING_X_PX, x1 = tex.width - GRAPH_PADDING_X_PX;
|
||||
int y0 = GRAPH_PADDING_Y_PX, y1 = tex.height - GRAPH_PADDING_Y_PX;
|
||||
double min = scores.Min();
|
||||
double max = scores.Max();
|
||||
|
||||
List<Tuple<int, int>> points = new List<Tuple<int, int>>();
|
||||
for (int i = 0; i < scores.Count; i++)
|
||||
{
|
||||
int _x = x0 + (scores.Count > 1 ? i * ((x1 - x0) / (scores.Count - 1)) : (x1 - x0) / 2);
|
||||
int _y = y0 + (int)((y1 - y0) * (min != max ? (scores[i] - min) / (max - min) : 0.5));
|
||||
points.Add(Tuple.Create(_x, _y));
|
||||
}
|
||||
|
||||
// Calculate scaling
|
||||
const int NUMBER_OF_AXES = 5;
|
||||
|
||||
double spacing = 0.0;
|
||||
if (min == max)
|
||||
{
|
||||
spacing = CalculateSpacing(highscore, NUMBER_OF_AXES);
|
||||
max = highscore + 2 * spacing;
|
||||
min = highscore - 2 * spacing;
|
||||
}
|
||||
|
||||
spacing = CalculateSpacing(max - min, NUMBER_OF_AXES);
|
||||
double begin = spacing * Math.Round(min / spacing);
|
||||
|
||||
// Draw axes
|
||||
double pixels_per_unit = (y1 - y0) / (max - min);
|
||||
double Y = begin;
|
||||
int y = y0 + (int)(pixels_per_unit * (Y - min));
|
||||
int total = 0;
|
||||
do
|
||||
{
|
||||
if (y0 <= y)
|
||||
{
|
||||
DrawLine(tex, x0, y, x1, y, 2, textColor);
|
||||
|
||||
GameObject tick = GameObject.Instantiate(axesTickMarker, rect);
|
||||
tick.GetComponent<RectTransform>().localPosition = new Vector3(-10 - rect.sizeDelta.y * rect.pivot.x, y - 25 - rect.sizeDelta.y * rect.pivot.y, 0);
|
||||
TMP_Text txt = tick.GetComponent<TMP_Text>();
|
||||
txt.text = $"{Y}";
|
||||
txt.color = textColor;
|
||||
}
|
||||
total += 1;
|
||||
Y += spacing;
|
||||
y = y0 + (int)(pixels_per_unit * (Y - min));
|
||||
|
||||
// Fail save
|
||||
if (2 * NUMBER_OF_AXES < total)
|
||||
break;
|
||||
} while (y <= y1);
|
||||
|
||||
|
||||
// Draw highscore
|
||||
if (min <= highscore && highscore <= max)
|
||||
{
|
||||
y = y0 + (int)(pixels_per_unit * (highscore - min));
|
||||
DrawLine(tex, x0, y, x1, y, GRAPH_LINE_SIZE, highscoreColor);
|
||||
GameObject marker = GameObject.Instantiate(highscoreMarker, rect);
|
||||
marker.GetComponent<RectTransform>().localPosition = new Vector3(tex.width - 50 - rect.sizeDelta.x * rect.pivot.x, y - 25 - rect.sizeDelta.y * rect.pivot.y, 0);
|
||||
}
|
||||
|
||||
// Draw points
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
Tuple<int, int> p = points[i];
|
||||
if (0 < i)
|
||||
{
|
||||
Tuple<int, int> q = points[i - 1];
|
||||
DrawLine(tex, p.Item1, p.Item2, q.Item1, q.Item2, GRAPH_LINE_SIZE, lineColor);
|
||||
}
|
||||
DrawPoint(tex, p.Item1, p.Item2, GRAPH_POINT_RADIUS, lineColor);
|
||||
}
|
||||
|
||||
// Apply to graph GameObject
|
||||
tex.Apply();
|
||||
progressGraph.texture = tex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate nice spacing
|
||||
/// </summary>
|
||||
/// <param name="mu">Either `max - min` if max != min, otherwise `highscore`</param>
|
||||
/// <param name="numberOfAxes">Number of horizontal axes grid lines shown on the graph</param>
|
||||
/// <returns>Spacing between each axes grid line</returns>
|
||||
private double CalculateSpacing(double mu, int numberOfAxes)
|
||||
{
|
||||
if (mu == 0)
|
||||
return 1.0;
|
||||
|
||||
double[] otherSpacings = { 0.5, 1.0, 2.0, 5.0 };
|
||||
|
||||
int mag = (int)Math.Floor(Math.Log10(Math.Abs(mu)));
|
||||
int MAG = (int)Math.Pow(10, mag);
|
||||
double spacing = MAG;
|
||||
foreach (double o in otherSpacings)
|
||||
{
|
||||
if (Math.Abs(mu - numberOfAxes * spacing) <= Math.Abs(mu - numberOfAxes * o * MAG))
|
||||
continue;
|
||||
spacing = o * MAG;
|
||||
}
|
||||
return spacing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set all the pixels of a texture to a given color
|
||||
/// </summary>
|
||||
/// <param name="tex">Texture to fill</param>
|
||||
/// <param name="color">Color to set the texture to</param>
|
||||
private void FillTexture(Texture2D tex, Color color)
|
||||
{
|
||||
for (int y = 0; y < tex.height; y++)
|
||||
for (int x = 0; x < tex.width; x++)
|
||||
tex.SetPixel(x, y, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw a point to a texture
|
||||
/// </summary>
|
||||
/// <param name="tex">Texture2D to plot point on</param>
|
||||
/// <param name="xc">Center x-pos</param>
|
||||
/// <param name="yc">Center y-pos</param>
|
||||
/// <param name="r">Radius (aka width and height)</param>
|
||||
/// <param name="color">Color of the point</param>
|
||||
private void DrawPoint(Texture2D tex, int xc, int yc, int r, Color color)
|
||||
{
|
||||
for (int y = yc - r; y < yc + r; y++)
|
||||
for (int x = xc - r; x < xc + r; x++)
|
||||
tex.SetPixel(x, y, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw a line to a texture
|
||||
/// </summary>
|
||||
/// <param name="tex">Texture2D to plot line on</param>
|
||||
/// <param name="x0">Starting x-pos</param>
|
||||
/// <param name="y0">Strating y-pos</param>
|
||||
/// <param name="x1">Ending x-pos</param>
|
||||
/// <param name="y1">Ending y-pos</param>
|
||||
/// <param name="size">Size of the line (width)</param>
|
||||
/// <param name="color">Color of the line</param>
|
||||
private void DrawLine(Texture2D tex, int x0, int y0, int x1, int y1, int size, Color color)
|
||||
{
|
||||
int w = x1 - x0;
|
||||
int h = y1 - y0;
|
||||
|
||||
int length = Mathf.Abs(x1 - x0);
|
||||
if (Mathf.Abs(y1 - y0) > length)
|
||||
length = Mathf.Abs(h);
|
||||
|
||||
double dx = w / (double)length;
|
||||
double dy = h / (double)length;
|
||||
|
||||
double x = x0;
|
||||
double y = y0;
|
||||
double r = size / 2;
|
||||
for (int i = 0; i <= length; i++)
|
||||
{
|
||||
for (int j = (int)(y - r); j < y + r; j++)
|
||||
for (int k = (int)(x - r); k < x + r; k++)
|
||||
tex.SetPixel(k, j, color);
|
||||
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Accounts/Scripts/ProgressGraph.cs.meta
Normal file
11
Assets/Accounts/Scripts/ProgressGraph.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73c708fbc5395aa4b9765d4b6985bacc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -40,13 +40,13 @@ public class User
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all recently started courses
|
||||
/// Get a list of all recently started minigameCards
|
||||
/// </summary>
|
||||
/// <returns>A <c>List</c> of <c>Tuples</c>, containing the <c>CourseIndex</c>
|
||||
/// and a <c>float</c> holding the progress (value between 0 and 1) of the user in this course</returns>
|
||||
public List<Tuple<CourseIndex, float>> GetRecentCourses()
|
||||
{
|
||||
// TODO: return better results (for now only return all courses)
|
||||
// TODO: return better results (for now only return all minigameCards)
|
||||
List<Tuple<CourseIndex, float>> recentCourses = new List<Tuple<CourseIndex, float>>();
|
||||
foreach (var courseProgress in storedUserData.courses)
|
||||
{
|
||||
@ -58,7 +58,7 @@ public class User
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all recommended courses
|
||||
/// Get a list of all recommended minigameCards
|
||||
/// </summary>
|
||||
/// <returns>A <c>List</c> of <c>Tuples</c>, containing the <c>CourseIndex</c>
|
||||
/// and a <c>float</c> holding the progress (value between 0 and 1) of the user in this course</returns>
|
||||
@ -71,7 +71,7 @@ public class User
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: return better results (for now only return all courses)
|
||||
// TODO: return better results (for now only return all minigameCards)
|
||||
foreach (var courseProgress in storedUserData.courses)
|
||||
{
|
||||
CourseIndex idx = courseProgress.courseIndex;
|
||||
@ -83,7 +83,7 @@ public class User
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the progress of all courses the user did
|
||||
/// Get the progress of all minigameCards the user did
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<SavedCourseProgress> GetCourses()
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@ -25,60 +23,24 @@ public class UserProgressScreen : MonoBehaviour
|
||||
public Image avatar;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the user total playtime
|
||||
/// Reference to the courses panel
|
||||
/// </summary>
|
||||
public TMP_Text playtime;
|
||||
public GameObject coursesPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of the highscore marker to display on the graph
|
||||
/// Reference to the minigame panel
|
||||
/// </summary>
|
||||
public GameObject highscoreMarker;
|
||||
public GameObject minigamesPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of a course card
|
||||
/// Reference to the courses tab button (to set nice color)
|
||||
/// </summary>
|
||||
public GameObject courseCardPrefab;
|
||||
public Image coursesTabButton;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the container holding all course cards
|
||||
/// Reference to the minigames tab button (to set nice color)
|
||||
/// </summary>
|
||||
public GameObject coursesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the message that displays when no course progress is present
|
||||
/// </summary>
|
||||
public GameObject emptyCourses;
|
||||
|
||||
/// <summary>
|
||||
/// Prefab of a minigame card
|
||||
/// </summary>
|
||||
public GameObject minigameCardPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the container holding all the minigame cards
|
||||
/// </summary>
|
||||
public GameObject minigamesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the message that displays when no minigame progress is present
|
||||
/// </summary>
|
||||
public GameObject emptyMinigames;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the plot
|
||||
/// </summary>
|
||||
public RawImage progressGraph;
|
||||
|
||||
/// <summary>
|
||||
/// Current selected activity draw to the graph
|
||||
/// </summary>
|
||||
private int selectedActivity = -1;
|
||||
|
||||
/// <summary>
|
||||
/// List of activity backgrounds and indices
|
||||
/// </summary>
|
||||
private List<Tuple<Image, int>> activities = new List<Tuple<Image, int>>();
|
||||
|
||||
public Image minigamesTabButton;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
@ -92,98 +54,29 @@ public class UserProgressScreen : MonoBehaviour
|
||||
// Set correct displayed items
|
||||
username.text = user.GetUsername();
|
||||
avatar.sprite = user.GetAvatar();
|
||||
playtime.text = $"Totale speeltijd: {user.GetPlaytime().ToString("0.00")}";
|
||||
|
||||
// Set graph inactive
|
||||
progressGraph.gameObject.SetActive(false);
|
||||
|
||||
int i = 0;
|
||||
// Display courses
|
||||
var courses = user.GetCourses();
|
||||
coursesContainer.SetActive(courses.Count > 0);
|
||||
emptyCourses.SetActive(courses.Count <= 0);
|
||||
foreach (var courseProgress in courses)
|
||||
{
|
||||
// Create instance of prefab
|
||||
GameObject instance = GameObject.Instantiate(courseCardPrefab, coursesContainer.transform.Find("Viewport").Find("Content").transform);
|
||||
int j = i++;
|
||||
|
||||
// Initialize card
|
||||
CourseProgressCard cpc = instance.GetComponent<CourseProgressCard>();
|
||||
cpc.courseProgress = courseProgress;
|
||||
cpc.selectActivity = () => UpdateSelection(j);
|
||||
|
||||
// Store reference to background so we can apply fancy coloring
|
||||
Image background = instance.GetComponent<Image>();
|
||||
background.color = Color.gray;
|
||||
activities.Add(Tuple.Create(background, (int)courseProgress.courseIndex));
|
||||
}
|
||||
|
||||
// Display minigames
|
||||
var minigames = user.GetMinigames();
|
||||
minigamesContainer.SetActive(minigames.Count > 0);
|
||||
emptyMinigames.SetActive(minigames.Count <= 0);
|
||||
foreach (var minigameProgress in minigames)
|
||||
{
|
||||
// Create instance of prefab
|
||||
GameObject instance = GameObject.Instantiate(minigameCardPrefab, minigamesContainer.transform.Find("Viewport").Find("Content").transform);
|
||||
int j = i++;
|
||||
|
||||
// Initialize card
|
||||
MinigameProgressCard mpc = instance.GetComponent<MinigameProgressCard>();
|
||||
mpc.minigameProgress = minigameProgress;
|
||||
mpc.selectActivity = () => UpdateSelection(j);
|
||||
|
||||
// Store reference to background so we can apply fancy coloring
|
||||
Image background = instance.GetComponent<Image>();
|
||||
background.color = Color.gray;
|
||||
activities.Add(Tuple.Create(background, (int)minigameProgress.minigameIndex));
|
||||
}
|
||||
DisplayCourses();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the current selected activity
|
||||
/// Switch to displaying the courses
|
||||
/// </summary>
|
||||
/// <param name="newActivity">Index to the new activity</param>
|
||||
private void UpdateSelection(int newActivity)
|
||||
public void DisplayCourses()
|
||||
{
|
||||
if (selectedActivity < 0)
|
||||
{
|
||||
progressGraph.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
activities[selectedActivity].Item1.color = Color.gray;
|
||||
}
|
||||
|
||||
selectedActivity = newActivity;
|
||||
activities[selectedActivity].Item1.color = Color.blue;
|
||||
if (selectedActivity < user.GetCourses().Count)
|
||||
{
|
||||
// TODO: create a better graph
|
||||
//DisplayCourseGraph((CourseIndex)activities[selectedActivity].Item2);
|
||||
// For now: just deactivate graph rendering
|
||||
progressGraph.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayMinigameGraph((MinigameIndex)activities[selectedActivity].Item2);
|
||||
// TODO: remove line, this is only because courses deactivates the graph
|
||||
progressGraph.gameObject.SetActive(true);
|
||||
}
|
||||
coursesPanel.SetActive(true);
|
||||
coursesTabButton.color = Color.blue;
|
||||
minigamesPanel.SetActive(false);
|
||||
minigamesTabButton.color = Color.gray;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plot the graph of a course
|
||||
/// Switch to displaying the minigames
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the course</param>
|
||||
/// <remarks>TODO: create a better plot</remarks>
|
||||
private void DisplayCourseGraph(CourseIndex index) { }
|
||||
|
||||
/// <summary>
|
||||
/// Plot the graph of a minigame
|
||||
/// </summary>
|
||||
/// <param name="minigameIndex">Index of the minigame</param>
|
||||
/// <remarks>TODO: reworking </remarks>
|
||||
private void DisplayMinigameGraph(MinigameIndex minigameIndex) { }
|
||||
public void DisplayMinigames()
|
||||
{
|
||||
coursesPanel.SetActive(false);
|
||||
coursesTabButton.color = Color.gray;
|
||||
minigamesPanel.SetActive(true);
|
||||
minigamesTabButton.color = Color.blue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,13 +33,16 @@ public class CourseProgressCardTests
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayCourses();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_ChangeUserScreen()
|
||||
public void TearDown_MinigameProgressCard()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
|
||||
78
Assets/Accounts/Tests/PlayMode/LearnableProgressCardTests.cs
Normal file
78
Assets/Accounts/Tests/PlayMode/LearnableProgressCardTests.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
/// <summary>
|
||||
/// Test the LearnableProgressCard class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class LearnableProgressCardTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Wait time between scene transitions
|
||||
/// </summary>
|
||||
private const float WAIT_TIME = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Setup the LearnableProgressCard tests
|
||||
/// </summary>
|
||||
[UnitySetUp]
|
||||
public IEnumerator Setup_CourseProgressCard()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string course = "{\"entries\":[],\"courseIndex\":0,\"progress\":0.03846153989434242,\"completedLearnables\":1,\"inUseLearnables\":7,\"totalLearnables\":26,\"learnables\":[{\"entries\":[],\"index\":0,\"inUse\":true,\"name\":\"A\",\"progress\":3.0},{\"entries\":[],\"index\":1,\"inUse\":true,\"name\":\"B\",\"progress\":4.5},{\"entries\":[],\"index\":2,\"inUse\":true,\"name\":\"C\",\"progress\":1.5},{\"entries\":[],\"index\":3,\"inUse\":true,\"name\":\"D\",\"progress\":1.5},{\"entries\":[],\"index\":4,\"inUse\":true,\"name\":\"E\",\"progress\":1.5},{\"entries\":[],\"index\":5,\"inUse\":true,\"name\":\"F\",\"progress\":1.5},{\"entries\":[],\"index\":6,\"inUse\":true,\"name\":\"G\",\"progress\":0.0},{\"entries\":[],\"index\":7,\"inUse\":false,\"name\":\"H\",\"progress\":0.0},{\"entries\":[],\"index\":8,\"inUse\":false,\"name\":\"I\",\"progress\":0.0},{\"entries\":[],\"index\":9,\"inUse\":false,\"name\":\"J\",\"progress\":0.0},{\"entries\":[],\"index\":10,\"inUse\":false,\"name\":\"K\",\"progress\":0.0},{\"entries\":[],\"index\":11,\"inUse\":false,\"name\":\"L\",\"progress\":0.0},{\"entries\":[],\"index\":12,\"inUse\":false,\"name\":\"M\",\"progress\":0.0},{\"entries\":[],\"index\":13,\"inUse\":false,\"name\":\"N\",\"progress\":0.0},{\"entries\":[],\"index\":14,\"inUse\":false,\"name\":\"O\",\"progress\":0.0},{\"entries\":[],\"index\":15,\"inUse\":false,\"name\":\"P\",\"progress\":0.0},{\"entries\":[],\"index\":16,\"inUse\":false,\"name\":\"Q\",\"progress\":0.0},{\"entries\":[],\"index\":17,\"inUse\":false,\"name\":\"R\",\"progress\":0.0},{\"entries\":[],\"index\":18,\"inUse\":false,\"name\":\"S\",\"progress\":0.0},{\"entries\":[],\"index\":19,\"inUse\":false,\"name\":\"T\",\"progress\":0.0},{\"entries\":[],\"index\":20,\"inUse\":false,\"name\":\"U\",\"progress\":0.0},{\"entries\":[],\"index\":21,\"inUse\":false,\"name\":\"V\",\"progress\":0.0},{\"entries\":[],\"index\":22,\"inUse\":false,\"name\":\"W\",\"progress\":0.0},{\"entries\":[],\"index\":23,\"inUse\":false,\"name\":\"X\",\"progress\":0.0},{\"entries\":[],\"index\":24,\"inUse\":false,\"name\":\"Y\",\"progress\":0.0},{\"entries\":[],\"index\":25,\"inUse\":false,\"name\":\"Z\",\"progress\":0.0}]}";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[{course}]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayCourses();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_MinigameProgressCard()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_EditorAssignments()
|
||||
{
|
||||
var card = GameObject.FindObjectOfType<LearnableProgressCard>();
|
||||
Assert.IsNotNull(card);
|
||||
Assert.IsNotNull(card.learnable);
|
||||
Assert.IsNotNull(card.thumbnail);
|
||||
Assert.IsNotNull(card.stars);
|
||||
Assert.AreEqual(3, card.stars.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the card is correctly initialized
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_Start()
|
||||
{
|
||||
var card = GameObject.FindObjectOfType<LearnableProgressCard>();
|
||||
|
||||
Assert.AreEqual(card.learnable.image, card.thumbnail.sprite);
|
||||
var starRewards = new float[] { 1.0f, 2.5f, 4.0f, };
|
||||
for (int i = 0; i < 3; i++)
|
||||
Assert.AreEqual(starRewards[i] < card.progress.progress ? Color.white : Color.black, card.stars[i].color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 238c4a8454aff2744ac782a49d2fbbd6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -19,8 +19,7 @@ public class MinigameProgressCardTests
|
||||
/// <summary>
|
||||
/// Setup the MinigameProgressCard tests
|
||||
/// </summary>
|
||||
[UnitySetUp]
|
||||
public IEnumerator Setup_MinigameProgressCard()
|
||||
private IEnumerator Setup_MinigameProgressCard()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string minigame = "{\"entries\":[],\"minigameIndex\":1,\"latestScores\":[{\"scoreValue\":70,\"time\":\"19/04/2023 22:32:39\"},{\"scoreValue\":55,\"time\":\"20/04/2023 11:50:10\"},{\"scoreValue\":55,\"time\":\"20/04/2023 13:27:15\"}],\"highestScores\":[{\"scoreValue\":70,\"time\":\"19/04/2023 22:32:39\"},{\"scoreValue\":55,\"time\":\"20/04/2023 11:50:10\"},{\"scoreValue\":55,\"time\":\"20/04/2023 13:27:15\"}]}";
|
||||
@ -33,13 +32,37 @@ public class MinigameProgressCardTests
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the MinigameProgressCard tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_MinigameProgressCard_Empty()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string minigame = "{\"entries\":[],\"minigameIndex\":0,\"latestScores\":[],\"highestScores\":[]}";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_ChangeUserScreen()
|
||||
public void TearDown_MinigameProgressCard()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
@ -47,9 +70,11 @@ public class MinigameProgressCardTests
|
||||
/// <summary>
|
||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_EditorAssignments()
|
||||
[UnityTest]
|
||||
public IEnumerator Test_EditorAssignments()
|
||||
{
|
||||
yield return Setup_MinigameProgressCard();
|
||||
|
||||
var card = GameObject.FindObjectOfType<MinigameProgressCard>();
|
||||
Assert.IsNotNull(card);
|
||||
Assert.IsNotNull(card.button);
|
||||
@ -63,15 +88,33 @@ public class MinigameProgressCardTests
|
||||
/// <summary>
|
||||
/// Test whether the card is correctly initialized
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_Start()
|
||||
[UnityTest]
|
||||
public IEnumerator Test_Start()
|
||||
{
|
||||
yield return Setup_MinigameProgressCard();
|
||||
|
||||
var card = GameObject.FindObjectOfType<MinigameProgressCard>();
|
||||
Minigame minigame = card.minigameList.GetMinigameByIndex(card.minigameProgress.minigameIndex);
|
||||
|
||||
Assert.AreEqual(minigame.thumbnail, card.thumbnail.sprite);
|
||||
Assert.AreEqual(minigame.title, card.title.text);
|
||||
Assert.AreEqual(card.highscore.text, $"Topscore: {card.minigameProgress.highestScores[0].scoreValue}");
|
||||
Assert.AreEqual($"TOPSCORE: {card.minigameProgress.highestScores[0].scoreValue}", card.highscore.text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether an empty card is correctly initialized
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_Start_Empty()
|
||||
{
|
||||
yield return Setup_MinigameProgressCard_Empty();
|
||||
|
||||
var card = GameObject.FindObjectOfType<MinigameProgressCard>();
|
||||
Minigame minigame = card.minigameList.GetMinigameByIndex(card.minigameProgress.minigameIndex);
|
||||
|
||||
Assert.AreEqual(minigame.thumbnail, card.thumbnail.sprite);
|
||||
Assert.AreEqual(minigame.title, card.title.text);
|
||||
Assert.AreEqual("(NOG) GEEN TOPSCORE", card.highscore.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
162
Assets/Accounts/Tests/PlayMode/PanelCourseProgressTests.cs
Normal file
162
Assets/Accounts/Tests/PlayMode/PanelCourseProgressTests.cs
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20981edad710f544984afd94847fa502
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
191
Assets/Accounts/Tests/PlayMode/PanelMinigamesProgressTests.cs
Normal file
191
Assets/Accounts/Tests/PlayMode/PanelMinigamesProgressTests.cs
Normal file
@ -0,0 +1,191 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Test the PanelMinigameProgress class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class PanelMinigameProgressTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Wait time between scene transitions
|
||||
/// </summary>
|
||||
private const float WAIT_TIME = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Setup the PanelMinigameProgress tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_PanelMinigameProgress()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string minigame = "{\"entries\":[],\"minigameIndex\":1,\"latestScores\":[{\"scoreValue\":70,\"time\":\"19/04/2023 22:32:39\"},{\"scoreValue\":55,\"time\":\"20/04/2023 11:50:10\"},{\"scoreValue\":55,\"time\":\"20/04/2023 13:27:15\"}],\"highestScores\":[{\"scoreValue\":70,\"time\":\"19/04/2023 22:32:39\"},{\"scoreValue\":55,\"time\":\"20/04/2023 11:50:10\"},{\"scoreValue\":55,\"time\":\"20/04/2023 13:27:15\"}]}";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the PanelMinigameProgress tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_PanelMinigameProgress_Empty()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the PanelMinigameProgress tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_PanelMinigameProgress_NoScorePresent()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string minigame = "{\"entries\":[],\"minigameIndex\":1,\"latestScores\":[],\"highestScores\":[]}";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the PanelMinigameProgress tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_PanelMinigameProgress_Multiple()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string minigame = "[{\"entries\":[],\"minigameIndex\":1,\"latestScores\":[{\"scoreValue\":70,\"time\":\"20/04/2023 16:08:43\"},{\"scoreValue\":20,\"time\":\"20/04/2023 16:11:53\"}],\"highestScores\":[{\"scoreValue\":70,\"time\":\"20/04/2023 16:08:43\"},{\"scoreValue\":20,\"time\":\"20/04/2023 16:11:53\"}]},{\"entries\":[],\"minigameIndex\":2,\"latestScores\":[{\"scoreValue\":194,\"time\":\"20/04/2023 15:27:41\"},{\"scoreValue\":155,\"time\":\"20/04/2023 15:28:56\"},{\"scoreValue\":84,\"time\":\"20/04/2023 15:42:10\"},{\"scoreValue\":465,\"time\":\"20/04/2023 16:14:22\"}],\"highestScores\":[{\"scoreValue\":465,\"time\":\"20/04/2023 16:14:22\"},{\"scoreValue\":194,\"time\":\"20/04/2023 15:27:41\"},{\"scoreValue\":155,\"time\":\"20/04/2023 15:28:56\"},{\"scoreValue\":84,\"time\":\"20/04/2023 15:42:10\"}]},{\"entries\":[],\"minigameIndex\":0,\"latestScores\":[{\"scoreValue\":1090,\"time\":\"20/04/2023 16:02:14\"},{\"scoreValue\":1180,\"time\":\"20/04/2023 16:07:02\"}],\"highestScores\":[{\"scoreValue\":1180,\"time\":\"20/04/2023 16:07:02\"},{\"scoreValue\":1090,\"time\":\"20/04/2023 16:02:14\"}]}]";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":{minigame},\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_PanelMinigameProgress()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_EditorAssignments()
|
||||
{
|
||||
yield return Setup_PanelMinigameProgress();
|
||||
|
||||
var panel = GameObject.FindObjectOfType<PanelMinigameProgress>();
|
||||
Assert.IsNotNull(panel);
|
||||
Assert.IsNotNull(panel.minigameList);
|
||||
Assert.IsNotNull(panel.minigameCardPrefab);
|
||||
Assert.IsNotNull(panel.minigamesContainer);
|
||||
Assert.IsNotNull(panel.minigameInfo);
|
||||
Assert.IsNotNull(panel.emptyMinigames);
|
||||
Assert.IsNotNull(panel.minigameTitle);
|
||||
Assert.IsNotNull(panel.progressGraph);
|
||||
Assert.IsNotNull(panel.emptyHighscore);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_Start()
|
||||
{
|
||||
yield return Setup_PanelMinigameProgress();
|
||||
|
||||
var panel = GameObject.FindObjectOfType<PanelMinigameProgress>();
|
||||
Assert.IsTrue(panel.minigameInfo.gameObject.activeSelf);
|
||||
Assert.IsFalse(panel.emptyMinigames.gameObject.activeSelf);
|
||||
Assert.IsFalse(panel.emptyHighscore.gameObject.activeSelf);
|
||||
Assert.IsTrue(panel.progressGraph.gameObject.activeSelf);
|
||||
|
||||
var minigame = panel.minigameList.GetMinigameByIndex(MinigameIndex.HANGMAN);
|
||||
Assert.AreEqual(minigame.title, panel.minigameTitle.text);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_Start_Empty()
|
||||
{
|
||||
yield return Setup_PanelMinigameProgress_Empty();
|
||||
|
||||
var panel = GameObject.FindObjectOfType<PanelMinigameProgress>();
|
||||
Assert.IsFalse(panel.minigameInfo.gameObject.activeSelf);
|
||||
Assert.IsTrue(panel.emptyMinigames.gameObject.activeSelf);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_Start_NoScorePresent()
|
||||
{
|
||||
yield return Setup_PanelMinigameProgress_NoScorePresent();
|
||||
|
||||
var panel = GameObject.FindObjectOfType<PanelMinigameProgress>();
|
||||
Assert.IsTrue(panel.minigameInfo.gameObject.activeSelf);
|
||||
Assert.IsFalse(panel.emptyMinigames.gameObject.activeSelf);
|
||||
Assert.IsTrue(panel.emptyHighscore.gameObject.activeSelf);
|
||||
Assert.IsFalse(panel.progressGraph.gameObject.activeSelf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether we can select a minigame
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_UpdateSelection()
|
||||
{
|
||||
yield return Setup_PanelMinigameProgress_Multiple();
|
||||
|
||||
var panel = GameObject.FindObjectOfType<PanelMinigameProgress>();
|
||||
var minigames = GameObject.FindObjectsOfType<MinigameProgressCard>();
|
||||
|
||||
var currentMinigame = minigames[0];
|
||||
currentMinigame.selectActivity.Invoke();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
Assert.AreEqual(Color.blue, currentMinigame.GetComponent<Image>().color);
|
||||
for (int i = 1; i < minigames.Length; i++)
|
||||
Assert.AreEqual(Color.gray, minigames[i].GetComponent<Image>().color);
|
||||
|
||||
Assert.AreEqual(currentMinigame.title.text, panel.minigameTitle.text);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f046d113e8709db438b49af46e271111
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
128
Assets/Accounts/Tests/PlayMode/ProgressGraphTests.cs
Normal file
128
Assets/Accounts/Tests/PlayMode/ProgressGraphTests.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
/// <summary>
|
||||
/// Test the ProgressGraph class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ProgressGraphTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Wait time between scene transitions
|
||||
/// </summary>
|
||||
private const float WAIT_TIME = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Setup the ProgressGraph tests
|
||||
/// </summary>
|
||||
private IEnumerator Setup_ProgressGraph(int amount, Func<int, int> f)
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
|
||||
string score = "";
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
score += $"{{\"scoreValue\":{f(i)},\"time\":\"19/04/2023 22:32:39\"}}";
|
||||
if (i < amount - 1)
|
||||
score += ",";
|
||||
}
|
||||
|
||||
string minigame = $"{{\"entries\":[],\"minigameIndex\":1,\"latestScores\":[{score}],\"highestScores\":[{score}]}}";
|
||||
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
|
||||
SystemController.GetInstance().SwapScene("Accounts/Scenes/UserProgressScreen");
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
GameObject.FindObjectOfType<UserProgressScreen>().DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test whether every item that needs to be assign in the editor, is assigned
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_EditorAssignments()
|
||||
{
|
||||
yield return Setup_ProgressGraph(1, (i) => i);
|
||||
|
||||
var graph = GameObject.FindObjectOfType<ProgressGraph>();
|
||||
Assert.IsNotNull(graph);
|
||||
Assert.IsNotNull(graph.progressGraph);
|
||||
Assert.IsNotNull(graph.highscoreMarker);
|
||||
Assert.IsNotNull(graph.axesTickMarker);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_Negative()
|
||||
{
|
||||
yield return Setup_ProgressGraph(4, (i) => -5 * (i + 1));
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_SmallerThen1()
|
||||
{
|
||||
yield return Setup_ProgressGraph(4, (i) => (3 * i + 20) / 100);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_AroundZero()
|
||||
{
|
||||
yield return Setup_ProgressGraph(4, (i) => 5 * i - 10);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_AllZeros()
|
||||
{
|
||||
yield return Setup_ProgressGraph(4, (i) => 0);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_BetweenPos1AndNeg1()
|
||||
{
|
||||
yield return Setup_ProgressGraph(10, (i) => (i % 3) - 1);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_Single()
|
||||
{
|
||||
yield return Setup_ProgressGraph(1, (i) => i + 500);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_Multiple()
|
||||
{
|
||||
yield return Setup_ProgressGraph(5, (i) => 5 * i);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Test_PlotGraph_TooMany()
|
||||
{
|
||||
yield return Setup_ProgressGraph(10, (i) => 5 * i);
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
}
|
||||
11
Assets/Accounts/Tests/PlayMode/ProgressGraphTests.cs.meta
Normal file
11
Assets/Accounts/Tests/PlayMode/ProgressGraphTests.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be53c4208fff73845b85978e1ecae7d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -38,7 +38,7 @@ public class UserCardTests
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_ChangeUserScreen()
|
||||
public void TearDown_UserCard()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public class UserCreationScreenTests
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_ChangeUserScreen()
|
||||
public void TearDown_UserCreationScreen()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Test the UserProgressScreen class
|
||||
@ -42,7 +41,7 @@ public class UserProgressScreenTests
|
||||
/// Cleanup after testing
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void TearDown_ChangeUserScreen()
|
||||
public void TearDown_UserProgressScreen()
|
||||
{
|
||||
PersistentDataController.PATH = null;
|
||||
}
|
||||
@ -58,15 +57,10 @@ public class UserProgressScreenTests
|
||||
var userProgressController = GameObject.FindObjectOfType<UserProgressScreen>();
|
||||
Assert.IsNotNull(userProgressController.username);
|
||||
Assert.IsNotNull(userProgressController.avatar);
|
||||
Assert.IsNotNull(userProgressController.playtime);
|
||||
Assert.IsNotNull(userProgressController.highscoreMarker);
|
||||
Assert.IsNotNull(userProgressController.courseCardPrefab);
|
||||
Assert.IsNotNull(userProgressController.coursesContainer);
|
||||
Assert.IsNotNull(userProgressController.emptyCourses);
|
||||
Assert.IsNotNull(userProgressController.minigameCardPrefab);
|
||||
Assert.IsNotNull(userProgressController.minigamesContainer);
|
||||
Assert.IsNotNull(userProgressController.emptyMinigames);
|
||||
Assert.IsNotNull(userProgressController.progressGraph);
|
||||
Assert.IsNotNull(userProgressController.coursesPanel);
|
||||
Assert.IsNotNull(userProgressController.coursesTabButton);
|
||||
Assert.IsNotNull(userProgressController.minigamesPanel);
|
||||
Assert.IsNotNull(userProgressController.minigamesTabButton);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,17 +76,10 @@ public class UserProgressScreenTests
|
||||
|
||||
Assert.AreEqual(user.GetUsername(), userProgressController.username.text);
|
||||
Assert.AreEqual(user.GetAvatar(), userProgressController.avatar.sprite);
|
||||
Assert.AreEqual($"Totale speeltijd: {user.GetPlaytime().ToString("0.00")}", userProgressController.playtime.text);
|
||||
|
||||
Assert.IsFalse(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
|
||||
Assert.IsTrue(userProgressController.emptyCourses.gameObject.activeSelf);
|
||||
Assert.IsFalse(userProgressController.coursesContainer.gameObject.activeSelf);
|
||||
Assert.IsTrue(userProgressController.coursesPanel.activeSelf);
|
||||
Assert.Zero(GameObject.FindObjectsOfType<CourseProgressCard>().Length);
|
||||
|
||||
Assert.IsTrue(userProgressController.emptyMinigames.gameObject.activeSelf);
|
||||
Assert.IsFalse(userProgressController.minigamesContainer.gameObject.activeSelf);
|
||||
Assert.Zero(GameObject.FindObjectsOfType<MinigameProgressCard>().Length);
|
||||
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -108,87 +95,37 @@ public class UserProgressScreenTests
|
||||
|
||||
Assert.AreEqual(user.GetUsername(), userProgressController.username.text);
|
||||
Assert.AreEqual(user.GetAvatar(), userProgressController.avatar.sprite);
|
||||
Assert.AreEqual($"Totale speeltijd: {user.GetPlaytime().ToString("0.00")}", userProgressController.playtime.text);
|
||||
|
||||
Assert.IsFalse(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
|
||||
Assert.IsFalse(userProgressController.emptyCourses.gameObject.activeSelf);
|
||||
Assert.IsTrue(userProgressController.coursesContainer.gameObject.activeSelf);
|
||||
Assert.IsTrue(userProgressController.coursesPanel.activeSelf);
|
||||
var courses = GameObject.FindObjectsOfType<CourseProgressCard>().ToList();
|
||||
Assert.AreEqual(user.GetCourses().Count, courses.Count);
|
||||
foreach (var course in courses)
|
||||
Assert.AreEqual(Color.gray, course.GetComponent<Image>().color);
|
||||
|
||||
Assert.IsFalse(userProgressController.emptyMinigames.gameObject.activeSelf);
|
||||
Assert.IsTrue(userProgressController.minigamesContainer.gameObject.activeSelf);
|
||||
var minigames = GameObject.FindObjectsOfType<MinigameProgressCard>().ToList();
|
||||
Assert.AreEqual(user.GetMinigames().Count, minigames.Count);
|
||||
foreach (var minigame in minigames)
|
||||
Assert.AreEqual(Color.gray, minigame.GetComponent<Image>().color);
|
||||
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether we can select a course
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_UpdateSelection_Course()
|
||||
public IEnumerator Test_DisplayCourses()
|
||||
{
|
||||
yield return Setup_UserProgressScreen();
|
||||
|
||||
var userProgressController = GameObject.FindObjectOfType<UserProgressScreen>();
|
||||
var course = GameObject.FindObjectOfType<CourseProgressCard>();
|
||||
var minigame = GameObject.FindObjectOfType<MinigameProgressCard>();
|
||||
Assert.IsFalse(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
Assert.AreEqual(Color.gray, course.GetComponent<Image>().color);
|
||||
Assert.AreEqual(Color.gray, minigame.GetComponent<Image>().color);
|
||||
userProgressController.DisplayCourses();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
course.selectActivity.Invoke();
|
||||
Assert.IsFalse(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
Assert.AreEqual(Color.blue, course.GetComponent<Image>().color);
|
||||
Assert.AreEqual(Color.gray, minigame.GetComponent<Image>().color);
|
||||
Assert.IsTrue(userProgressController.coursesPanel.activeSelf);
|
||||
Assert.IsFalse(userProgressController.minigamesPanel.activeSelf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether we can select a minigame
|
||||
/// </summary>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_UpdateSelection_Minigame()
|
||||
public IEnumerator Test_DisplayMinigames()
|
||||
{
|
||||
yield return Setup_UserProgressScreen();
|
||||
|
||||
var userProgressController = GameObject.FindObjectOfType<UserProgressScreen>();
|
||||
var course = GameObject.FindObjectOfType<CourseProgressCard>();
|
||||
var minigame = GameObject.FindObjectOfType<MinigameProgressCard>();
|
||||
Assert.IsFalse(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
Assert.AreEqual(Color.gray, course.GetComponent<Image>().color);
|
||||
Assert.AreEqual(Color.gray, minigame.GetComponent<Image>().color);
|
||||
userProgressController.DisplayMinigames();
|
||||
yield return new WaitForSeconds(WAIT_TIME);
|
||||
|
||||
minigame.selectActivity.Invoke();
|
||||
Assert.IsTrue(userProgressController.progressGraph.gameObject.activeSelf);
|
||||
Assert.AreEqual(Color.gray, course.GetComponent<Image>().color);
|
||||
Assert.AreEqual(Color.blue, minigame.GetComponent<Image>().color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the course graph is correctly displayed
|
||||
/// </summary>
|
||||
/// <remarks>Code is not implemented yet</remarks>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_DisplayCourseGraph()
|
||||
{
|
||||
// TODO: not implemented yet
|
||||
yield return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the minigame graph is correctly displayed
|
||||
/// </summary>
|
||||
/// <remarks>Code is not implemented yet</remarks>
|
||||
[UnityTest]
|
||||
public IEnumerator Test_DisplayMinigameGraph()
|
||||
{
|
||||
// TODO: not implemented yet
|
||||
yield return null;
|
||||
Assert.IsFalse(userProgressController.coursesPanel.activeSelf);
|
||||
Assert.IsTrue(userProgressController.minigamesPanel.activeSelf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
title.text = course.title;
|
||||
description.text = course.description;
|
||||
courseImage.sprite = course.thumbnail;
|
||||
//slider.value = progressValue;
|
||||
//progressBar.value = progressValue;
|
||||
|
||||
// Set progress
|
||||
PersistentDataController.GetInstance().Load();
|
||||
|
||||
@ -38,7 +38,7 @@ public class CourseItem : MonoBehaviour
|
||||
public Button button;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the slider that displays the progress of the user
|
||||
/// Reference to the progressBar that displays the progress of the user
|
||||
/// </summary>
|
||||
public GameObject slider;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user