Resolve WES-117 "Persistent data handling"
This commit is contained in:
@@ -113,6 +113,18 @@ TextureImporter:
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3e4df0d6e02ad2f0905d1614f2e6545
|
||||
guid: 06c24ca85a8bc6b4d947cdb9b2492e99
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
/// <summary>
|
||||
/// Enum for easy indexing and checking if a course is of a certain kind
|
||||
/// </summary>
|
||||
public enum CourseIndex
|
||||
{
|
||||
FINGERSPELLING,
|
||||
CLOTHING,
|
||||
ANIMALS,
|
||||
FOOD,
|
||||
HOBBIES,
|
||||
HOUSE,
|
||||
FAMILY
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5bf21dee022ed0489face1c734359de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// Keep track of all courses
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/CourseList")]
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/Course List")]
|
||||
public class CourseList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name": "InterfacesScripts",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||
"GUID:d23f64cfd3b314bb4a18a8284c99bf5e"
|
||||
"GUID:d23f64cfd3b314bb4a18a8284c99bf5e",
|
||||
"GUID:e83ddf9a537a96b4a804a16bb7872ec1"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
/// <summary>
|
||||
/// Enum for easy indexing and checking if a minigame is of a certain kind
|
||||
/// </summary>
|
||||
public enum MinigameIndex
|
||||
{
|
||||
SPELLING_BEE,
|
||||
HANGMAN,
|
||||
JUST_SIGN
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97282ff3b465e3c4682d218b3819b2e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// Keep track off installed minigames
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/MinigameList")]
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/Minigame List")]
|
||||
public class MinigameList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ public class MinigameList : ScriptableObject
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
public void SetCurrentMinigame(MinigameIndex index)
|
||||
{
|
||||
{
|
||||
currentMinigameIndex = minigames.FindIndex((mi) => mi.index == index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Score class
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Score
|
||||
{
|
||||
public int scoreValue;
|
||||
public string time;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16056ca3e1523f78cbd727cea2bfe047
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
/// <summary>
|
||||
/// Enum for easy indexing and checking if a course is of a certain kind
|
||||
/// </summary>
|
||||
public enum ThemeIndex
|
||||
{
|
||||
SIGN_ALPHABET,
|
||||
SIGN_CLOTHING,
|
||||
SIGN_ANIMALS,
|
||||
SIGN_FOOD,
|
||||
SIGN_HOBBIES,
|
||||
SIGN_HOUSE,
|
||||
SIGN_FAMILY,
|
||||
SPELLING_GEOGRAPY,
|
||||
SPELLING_BUILDINGS,
|
||||
SPELLING_SPORTS,
|
||||
SPELLING_BASICS,
|
||||
SPELLING_HOBBIES,
|
||||
SPELLING_PEOPLE,
|
||||
SPELLING_FRUIT,
|
||||
SPELLING_VEGGIES,
|
||||
SPELLING_WILD,
|
||||
SPELLING_FARM
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58e9afcf842bdfa48939e754bb39182a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// Keep track off defined themes
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/ThemeList")]
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/Theme List")]
|
||||
public class ThemeList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class BackButtonTests
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class BackButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
|
||||
File.WriteAllText(path, oneUser);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/MainMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
||||
@@ -33,11 +28,11 @@ public class BackButtonTests
|
||||
public IEnumerator BackTest()
|
||||
{
|
||||
|
||||
var backButton = (BackButton) GameObject.FindObjectOfType(typeof(BackButton));
|
||||
var backButton = (BackButton)GameObject.FindObjectOfType(typeof(BackButton));
|
||||
backButton.Back();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
Assert.IsNotNull(mainMenuScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"InterfacesScripts",
|
||||
"Unity.TextMeshPro",
|
||||
"AccountsScripts",
|
||||
"SignPredictor"
|
||||
"SignPredictor",
|
||||
"SystemArchitecture"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class CourseActivityTests
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class CourseActivityTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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().LoadNextScene("Common/Scenes/CourseActivityScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -30,11 +25,11 @@ public class CourseActivityTests
|
||||
[UnityTest]
|
||||
public IEnumerator StartCoursesTests()
|
||||
{
|
||||
var courseActivityScreen = (CourseActivityScreen) GameObject.FindObjectOfType(typeof(CourseActivityScreen));
|
||||
var courseActivityScreen = (CourseActivityScreen)GameObject.FindObjectOfType(typeof(CourseActivityScreen));
|
||||
courseActivityScreen.StartCourse();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var templateCourse = (CoursesController) GameObject.FindObjectOfType(typeof(CoursesController));
|
||||
var templateCourse = (CoursesController)GameObject.FindObjectOfType(typeof(CoursesController));
|
||||
Assert.IsNotNull(templateCourse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class CourseMenuScreenTest
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class CourseMenuScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -30,7 +25,7 @@ public class CourseMenuScreenTest
|
||||
[UnityTest]
|
||||
public IEnumerator GotoListOfCoursesTest()
|
||||
{
|
||||
var courseMenuScreen = (CourseMenuScreen) GameObject.FindObjectOfType(typeof(CourseMenuScreen));
|
||||
var courseMenuScreen = (CourseMenuScreen)GameObject.FindObjectOfType(typeof(CourseMenuScreen));
|
||||
courseMenuScreen.GotoListOfCourses();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class ListCoursesScreenTest
|
||||
{
|
||||
@@ -15,14 +11,13 @@ public class ListCoursesScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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().LoadNextScene("Common/Scenes/ListCoursesScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
|
||||
public class MainMenuScreenTests
|
||||
@@ -15,14 +13,13 @@ public class MainMenuScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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();
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
@@ -42,28 +39,28 @@ public class MainMenuScreenTests
|
||||
[UnityTest]
|
||||
public IEnumerator GotoMiniGamesTest()
|
||||
{
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoMinigames();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var listMinigamesScreen = (ListMinigamesScreen) GameObject.FindObjectOfType(typeof(ListMinigamesScreen));
|
||||
var listMinigamesScreen = (ListMinigamesScreen)GameObject.FindObjectOfType(typeof(ListMinigamesScreen));
|
||||
Assert.IsNotNull(listMinigamesScreen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [UnityTest]
|
||||
public IEnumerator GotoSettingsTest()
|
||||
{
|
||||
Arrange
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
/* [UnityTest]
|
||||
public IEnumerator GotoSettingsTest()
|
||||
{
|
||||
Arrange
|
||||
SceneManager.LoadScene("Common/Scenes/MainMenuScreen");
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoSettings();
|
||||
yield return new WaitForSeconds(1f);
|
||||
yield return new WaitForSeconds(1f);
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
mainMenuScreen.GotoSettings();
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
var minigameActivityScreen = (MinigameActivityScreen)GameObject.FindObjectOfType(typeof(MinigameActivityScreen));
|
||||
Assert.IsNotNull(minigameActivityScreen);
|
||||
}*/
|
||||
var minigameActivityScreen = (MinigameActivityScreen)GameObject.FindObjectOfType(typeof(MinigameActivityScreen));
|
||||
Assert.IsNotNull(minigameActivityScreen);
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class MiniGameActivityScreenTests
|
||||
@@ -15,14 +12,13 @@ public class MiniGameActivityScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
|
||||
public class StartGamesTests
|
||||
{
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator BootWithUsersTest()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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();
|
||||
SceneManager.LoadScene("Common/Scenes/Boot");
|
||||
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
var userCreationScreen = (UserCreationScreen) GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen) GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var userCreationScreen = (UserCreationScreen)GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen)GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
|
||||
// yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
// if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
@@ -42,41 +37,37 @@ public class StartGamesTests
|
||||
// Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!");
|
||||
// }
|
||||
// else
|
||||
if(0 >= WebCamTexture.devices.Length){
|
||||
Debug.Log("no webcam");
|
||||
Assert.IsNull(userCreationScreen);
|
||||
if (0 >= WebCamTexture.devices.Length)
|
||||
{
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(bootScreen);
|
||||
Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat je webcam correct is aangesloten!");
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Debug.Log("everything is there");
|
||||
Assert.IsNull(bootScreen);
|
||||
Assert.IsNull(userCreationScreen);
|
||||
Assert.IsNotNull(mainMenuScreen);
|
||||
}
|
||||
Assert.IsNull(userCreationScreen);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator BootWithoutUsersTest()
|
||||
{
|
||||
// Arrange
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string noUsers = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
|
||||
|
||||
File.WriteAllText(path, noUsers);
|
||||
PersistentDataController.PATH = path;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
AssetDatabase.LoadAssetAtPath<UserAvatarList>("Assets/Accounts/ScriptableObjects/UserAvatarList.asset").Awake();
|
||||
SceneManager.LoadScene("Common/Scenes/Boot");
|
||||
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
var userCreationScreen = (UserCreationScreen) GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen) GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen) GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
var userCreationScreen = (UserCreationScreen)GameObject.FindObjectOfType(typeof(UserCreationScreen));
|
||||
var bootScreen = (BootScreen)GameObject.FindObjectOfType(typeof(BootScreen));
|
||||
var mainMenuScreen = (MainMenuScreen)GameObject.FindObjectOfType(typeof(MainMenuScreen));
|
||||
|
||||
// yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
// if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
@@ -88,19 +79,18 @@ public class StartGamesTests
|
||||
// Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!");
|
||||
// }
|
||||
// else
|
||||
if(0 >= WebCamTexture.devices.Length){
|
||||
Debug.Log("no webcam");
|
||||
if (0 >= WebCamTexture.devices.Length)
|
||||
{
|
||||
Assert.IsNull(userCreationScreen);
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(bootScreen);
|
||||
Assert.AreEqual(bootScreen.errorText.text, "Zorg ervoor dat je webcam correct is aangesloten!");
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("no users");
|
||||
Assert.IsNull(bootScreen);
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
Assert.IsNotNull(userCreationScreen);
|
||||
}
|
||||
Assert.IsNull(mainMenuScreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class UserButtonTests
|
||||
@@ -15,28 +12,27 @@ public class UserButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{\"currentUserIndex\": 0,\"storedUsers\": [{\"username\": \"TEST\",\"avatar\": {\"instanceID\": 40848},\"playtime\": 0.0,\"courses\": [],\"minigames\": []}]}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
{
|
||||
writer.Write(oneUser);
|
||||
}
|
||||
string path = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
string oneUser = $"{{\"version\":{PersistentDataController.VERSION},\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"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().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
|
||||
/* [UnityTest]
|
||||
public IEnumerator OpenProgressCallbackTest()
|
||||
{
|
||||
var userButton = (UserButton)GameObject.FindObjectOfType(typeof(UserButton));
|
||||
userButton.OpenProgressCallback();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
/* [UnityTest]
|
||||
public IEnumerator OpenProgressCallbackTest()
|
||||
{
|
||||
var userButton = (UserButton)GameObject.FindObjectOfType(typeof(UserButton));
|
||||
userButton.OpenProgressCallback();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
var listCoursesScreen = (ListCoursesScreen)GameObject.FindObjectOfType(typeof(ListCoursesScreen));
|
||||
Assert.IsNotNull(listCoursesScreen);
|
||||
}*/
|
||||
var listCoursesScreen = (ListCoursesScreen)GameObject.FindObjectOfType(typeof(ListCoursesScreen));
|
||||
Assert.IsNotNull(listCoursesScreen);
|
||||
}*/
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator ChangeUserCallbackTest()
|
||||
|
||||
@@ -314,6 +314,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
errorText: {fileID: 1663223260}
|
||||
sprites: {fileID: 11400000, guid: 017ec1af3b6cc4d4ab2b506911a4edad, type: 2}
|
||||
--- !u!4 &1427583095
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -12,12 +12,20 @@ public class BootScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public TMP_Text errorText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the list that holds all user avatars
|
||||
/// </summary>
|
||||
public UserAvatarList sprites;
|
||||
|
||||
/// <summary>
|
||||
/// Request authorization and check whether at least 1 webcam is available
|
||||
/// </summary>
|
||||
/// <returns>IEnumerator object</returns>
|
||||
IEnumerator Start()
|
||||
{
|
||||
UserList.AVATARS = sprites.avatars;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
|
||||
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:63c63e721f65ebb7d871cb9ef49f4752",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:e83ddf9a537a96b4a804a16bb7872ec1",
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
|
||||
@@ -17,15 +17,10 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the course progress
|
||||
/// </summary>
|
||||
private Progress progress;
|
||||
private PersistentDataController.SavedCourseProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Title Display
|
||||
@@ -66,10 +61,10 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
//slider.value = progressValue;
|
||||
|
||||
// Set progress
|
||||
userList.Load();
|
||||
progress = userList.GetCurrentUser().GetCourseProgress(course.index);
|
||||
PersistentDataController.GetInstance().Load();
|
||||
progress = UserList.GetCurrentUser().GetCourseProgress(course.index);
|
||||
if (progress != null)
|
||||
progressBar.value = progress.Get<float>("courseProgress");
|
||||
progressBar.value = progress.progress;
|
||||
else
|
||||
progressBar.value = 0.0f;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,6 @@ public class CourseMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject courseItem;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users so we can get the current user;
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the courses
|
||||
/// </summary>
|
||||
@@ -42,8 +37,8 @@ public class CourseMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
|
||||
// Recent courses
|
||||
List<Tuple<CourseIndex, float>> recentCourses = user.GetRecentCourses();
|
||||
|
||||
@@ -5,11 +5,6 @@ using UnityEngine;
|
||||
/// </summary>
|
||||
public class ListCoursesScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the userlist
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the course-list container object
|
||||
/// </summary>
|
||||
@@ -30,8 +25,8 @@ public class ListCoursesScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
|
||||
foreach (Course course in courseList.courses)
|
||||
{
|
||||
@@ -42,8 +37,8 @@ public class ListCoursesScreen : MonoBehaviour
|
||||
CourseItem item = instance.GetComponent<CourseItem>();
|
||||
item.course = course;
|
||||
|
||||
Progress progress = user.GetCourseProgress(course.index);
|
||||
item.progress = progress != null ? progress.Get<float>("courseProgress") : 0.0f;
|
||||
var progress = user.GetCourseProgress(course.index);
|
||||
item.progress = progress != null ? progress.progress : 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,13 @@ using UnityEngine;
|
||||
/// </summary>
|
||||
public class MainMenuScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Referece to the userlist to check whether an user account is present
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Check on load whether a user is already present,
|
||||
/// if not load the UserCreationScreen scene so the user can create a new account
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
userList.Load();
|
||||
if (!File.Exists(UserList.PATH) || userList.GetUsers().Count <= 0)
|
||||
if (!File.Exists(PersistentDataController.PATH) || UserList.GetUsers().Count <= 0)
|
||||
{
|
||||
SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserCreationScreen");
|
||||
}
|
||||
|
||||
@@ -40,15 +40,10 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public TMP_Text controls;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the Minigame progress
|
||||
/// </summary>
|
||||
private Progress progress;
|
||||
private PersistentDataController.SavedMinigameProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users-high-scores container object
|
||||
@@ -65,7 +60,7 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
GenerateContent();
|
||||
GenerateHighScores();
|
||||
}
|
||||
@@ -109,17 +104,17 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
Minigame minigame = minigameList.minigames[index];
|
||||
|
||||
List<Tuple<string, Sprite, Score>> allScores = new List<Tuple<string, Sprite, Score>>();
|
||||
foreach (User user in userList.GetUsers())
|
||||
foreach (User user in UserList.GetUsers())
|
||||
{
|
||||
// Get user's progress for this minigame
|
||||
progress = user.GetMinigameProgress(minigame.index);
|
||||
if (progress != null)
|
||||
{
|
||||
// Add scores to dictionary
|
||||
List<Score> scores = progress.Get<List<Score>>("highestScores");
|
||||
List<Score> scores = progress.highestScores;
|
||||
foreach (Score score in scores)
|
||||
{
|
||||
allScores.Add(new Tuple<string, Sprite, Score>(user.username, user.avatar, score));
|
||||
allScores.Add(new Tuple<string, Sprite, Score>(user.GetUsername(), user.GetAvatar(), score));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,6 @@ using UnityEngine.UI;
|
||||
/// </summary>
|
||||
public class UserButton : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the user list, so we can extract the current user
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the avatar object
|
||||
/// </summary>
|
||||
@@ -32,10 +27,10 @@ public class UserButton : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
avatar.sprite = user.avatar;
|
||||
username.text = user.username;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
avatar.sprite = user.GetAvatar();
|
||||
username.text = user.GetUsername();
|
||||
dropdownBox.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"CommonScripts",
|
||||
"InterfacesScripts",
|
||||
"SignPredictor",
|
||||
"SystemArchitecture",
|
||||
"NatML.ML"
|
||||
],
|
||||
"includePlatforms": [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the ThemeList class
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the Theme class
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user