Annotations + Removal of unneeded lines

This commit is contained in:
Jelle De Geest
2023-05-16 11:09:41 +00:00
committed by Jerome Coudron
parent 8c69ec3cc6
commit 785e56b883
46 changed files with 161 additions and 218 deletions

View File

@@ -504,8 +504,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
rgba: 4284235525
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
@@ -623,7 +623,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.7529412, b: 1, a: 1}
m_Color: {r: 0.9490196, g: 0.49803922, b: 0.047058824, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1

View File

@@ -75,8 +75,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
rgba: 4284235525
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
@@ -433,8 +433,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
rgba: 4284235525
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:

View File

@@ -284,8 +284,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294309365
m_fontColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
rgba: 4284235525
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:

View File

@@ -394,7 +394,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -766,7 +766,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_Color: {r: 0.62352943, g: 0.90588236, b: 0.9607843, a: 0.47058824}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -1821,7 +1821,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &919169249
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -2278,8 +2278,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4279242768
m_fontColor: {r: 0.0627451, g: 0.0627451, b: 0.0627451, a: 1}
rgba: 4284235525
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
@@ -2623,7 +2623,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -3, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1338988555
MonoBehaviour:
@@ -3105,7 +3105,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -3701,7 +3701,7 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
@@ -4225,7 +4225,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_Color: {r: 0.62352943, g: 0.90588236, b: 0.9607843, a: 0.47058824}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1

View File

@@ -72,7 +72,7 @@ public class ChangeUserScreen : MonoBehaviour
Image background = instance.GetComponent<Image>();
userBackgrounds.Add(background);
// Set background color
background.color = i == currentUserIndex ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
background.color = i == currentUserIndex ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
}
}
@@ -82,7 +82,7 @@ public class ChangeUserScreen : MonoBehaviour
/// <param name="index">Index to the user in the <c>this.userBackgrounds</c> list</param>
private void UpdateSelection(int index)
{
userBackgrounds[currentUserIndex].color = Color.gray;
userBackgrounds[currentUserIndex].color = new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
currentUserIndex = index;
userBackgrounds[currentUserIndex].color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);
}

View File

@@ -94,7 +94,7 @@ public class PanelCourseProgress : MonoBehaviour
// Store reference to background so we can apply fancy coloring
Image background = instance.GetComponent<Image>();
background.color = Color.gray;
background.color = new Color(159 / 255f, 231 / 255f, 245 / 255f, 120/255f);
this.courseCards.Add(Tuple.Create(background, courseProgress.courseIndex));
}
if (0 < courses.Count)
@@ -107,7 +107,7 @@ public class PanelCourseProgress : MonoBehaviour
/// <param name="newCourse">Index to the new course</param>
private void UpdateSelection(int newCourse)
{
courseCards[selectedCourse].Item1.color = Color.gray;
courseCards[selectedCourse].Item1.color = new Color(159 / 255f, 231 / 255f, 245 / 255f, 120 / 255f);
selectedCourse = newCourse;
courseCards[selectedCourse].Item1.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);

View File

@@ -90,7 +90,7 @@ public class PanelMinigameProgress : MonoBehaviour
// Store reference to background so we can apply fancy coloring
Image background = instance.GetComponent<Image>();
background.color = Color.gray;
background.color = new Color(159 / 255f, 231 / 255f, 245 / 255f, 120 / 255f);
minigameCards.Add(Tuple.Create(background, minigameProgress.minigameIndex));
}
if (0 < minigames.Count)
@@ -103,7 +103,7 @@ public class PanelMinigameProgress : MonoBehaviour
/// <param name="newMinigame">Index to the new course</param>
private void UpdateSelection(int newMinigame)
{
minigameCards[selectedMinigame].Item1.color = Color.gray;
minigameCards[selectedMinigame].Item1.color = new Color(159 / 255f, 231 / 255f, 245 / 255f, 120 / 255f);
selectedMinigame = newMinigame;
minigameCards[selectedMinigame].Item1.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);

View File

@@ -64,9 +64,9 @@ public class UserProgressScreen : MonoBehaviour
public void DisplayCourses()
{
coursesPanel.SetActive(true);
coursesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);
coursesTabButton.color = new Color(247 / 255f, 173 / 255f, 25 / 255f, 1f);
minigamesPanel.SetActive(false);
minigamesTabButton.color = Color.gray;
minigamesTabButton.color = new Color(247 / 255f, 173 / 255f, 25 / 255f, 120/255f);
}
/// <summary>
@@ -75,8 +75,8 @@ public class UserProgressScreen : MonoBehaviour
public void DisplayMinigames()
{
coursesPanel.SetActive(false);
coursesTabButton.color = Color.gray;
coursesTabButton.color = new Color(247 / 255f, 173 / 255f, 25 / 255f, 120 / 255f);
minigamesPanel.SetActive(true);
minigamesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);
minigamesTabButton.color = new Color(247 / 255f, 173 / 255f, 25 / 255f, 1f);
}
}

View File

@@ -29,7 +29,7 @@ public class ChangeUserScreenTests
private IEnumerator Setup_ChangeUserScreen_SingleUser(string startScreen = "Accounts/Scenes/ChangeUserScreen")
{
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}";
string oneUser = "{\"version\":1537,\"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;
@@ -53,7 +53,7 @@ public class ChangeUserScreenTests
if (i < 4) users += ",";
}
const int currentUser = 2;
string fiveUsers = $"{{\"version\":1027,\"users\":[{users}],\"currentUser\":{currentUser},\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string fiveUsers = $"{{\"version\":1537,\"users\":[{users}],\"currentUser\":{currentUser},\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
File.WriteAllText(path, fiveUsers);
PersistentDataController.PATH = path;
@@ -132,7 +132,7 @@ public class ChangeUserScreenTests
Assert.AreEqual(UserList.GetUsers().Count, cards.Count);
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -150,7 +150,7 @@ public class ChangeUserScreenTests
// Before update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
@@ -161,7 +161,7 @@ public class ChangeUserScreenTests
// After update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == newUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == newUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -179,7 +179,7 @@ public class ChangeUserScreenTests
// Before update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
@@ -189,7 +189,7 @@ public class ChangeUserScreenTests
// After update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -207,7 +207,7 @@ public class ChangeUserScreenTests
// Before update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
@@ -218,7 +218,7 @@ public class ChangeUserScreenTests
// After update
for (int i = 0; i < cards.Count; i++)
{
Color expected = i == newUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == newUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, cards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -269,7 +269,7 @@ public class ChangeUserScreenTests
var oldCards = GameObject.FindObjectsOfType<UserCard>().ToList();
for (int i = 0; i < oldCards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, oldCards[i].gameObject.GetComponent<Image>().color);
}
@@ -284,7 +284,7 @@ public class ChangeUserScreenTests
Assert.AreEqual(oldCards.Count - 1, newCards.Count);
for (int i = 0; i < newCards.Count; i++)
{
Color expected = i == (currentUser - 1) ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == (currentUser - 1) ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, newCards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -301,7 +301,7 @@ public class ChangeUserScreenTests
var oldCards = GameObject.FindObjectsOfType<UserCard>().ToList();
for (int i = 0; i < oldCards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, oldCards[i].gameObject.GetComponent<Image>().color);
}
@@ -316,7 +316,7 @@ public class ChangeUserScreenTests
Assert.AreEqual(oldCards.Count - 1, newCards.Count);
for (int i = 0; i < newCards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, newCards[i].gameObject.GetComponent<Image>().color);
}
}
@@ -333,7 +333,7 @@ public class ChangeUserScreenTests
var oldCards = GameObject.FindObjectsOfType<UserCard>().ToList();
for (int i = 0; i < oldCards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, oldCards[i].gameObject.GetComponent<Image>().color);
}
@@ -348,7 +348,7 @@ public class ChangeUserScreenTests
Assert.AreEqual(oldCards.Count - 1, newCards.Count);
for (int i = 0; i < newCards.Count; i++)
{
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : Color.gray;
Color expected = i == currentUser ? new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f) : new Color(159 / 255f, 231 / 255f, 245 / 255f, 1f);
Assert.AreEqual(expected, newCards[i].gameObject.GetComponent<Image>().color);
}
}

View File

@@ -24,7 +24,7 @@ public class CourseProgressCardTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -24,7 +24,7 @@ public class LearnableProgressCardTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -23,7 +23,7 @@ public class MinigameProgressCardTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -44,7 +44,7 @@ public class MinigameProgressCardTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;

File diff suppressed because one or more lines are too long

View File

@@ -24,7 +24,7 @@ public class PanelMinigameProgressTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -44,7 +44,7 @@ public class PanelMinigameProgressTests
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}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -65,7 +65,7 @@ public class PanelMinigameProgressTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -86,7 +86,7 @@ public class PanelMinigameProgressTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -192,7 +192,7 @@ public class PanelMinigameProgressTests
Assert.AreEqual(new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f), currentMinigame.GetComponent<Image>().color);
for (int i = 1; i < minigames.Length; i++)
Assert.AreEqual(Color.gray, minigames[i].GetComponent<Image>().color);
Assert.AreEqual(new Color(159 / 255f, 231 / 255f, 245 / 255f, 120 / 255f), minigames[i].GetComponent<Image>().color);
Assert.AreEqual(currentMinigame.title.text, panel.minigameTitle.text);
}

View File

@@ -32,7 +32,7 @@ public class ProgressGraphTests
}
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}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -23,7 +23,7 @@ public class UserCardTests
public IEnumerator Setup_UserCard()
{
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}";
string oneUser = "{\"version\":1537,\"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;

View File

@@ -25,7 +25,7 @@ public class UserCreationScreenTests
private IEnumerator Setup_UserCreationScreen(string startScreen = "Accounts/Scenes/UserCreationScreen")
{
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}";
string oneUser = "{\"version\":1537,\"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;

View File

@@ -26,7 +26,7 @@ public class UserProgressScreenTests
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 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\"}]}";
if (!progress) course = minigame = "";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[{course}]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"users\":[{{\"entries\":[],\"username\":\"Tester0\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[{minigame}],\"courses\":[{course}]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
File.WriteAllText(path, oneUser);
PersistentDataController.PATH = path;

View File

@@ -19,7 +19,7 @@ public class PersistentDataController
/// Current implementation version of the PersistentDataController
/// </summary>
/// <remarks>MSB represent sprint version, LSB represent subversion</remarks>
public const int VERSION = 0x04_03;
public const int VERSION = 0x06_01;
/// <summary>
/// Path of the <c>.json</c>-file to store all serialized data

View File

@@ -69,7 +69,7 @@ public class PersistentDataControllerTests
{
PersistentDataController.PATH = null;
Assert.IsNotNull(PersistentDataController.GetInstance());
Assert.AreEqual(0x04_03, PersistentDataController.VERSION);
Assert.AreEqual(0x06_01, PersistentDataController.VERSION);
Assert.AreEqual($"{Application.persistentDataPath}/wesign_saved_data.json", PersistentDataController.PATH);
}
@@ -98,7 +98,7 @@ public class PersistentDataControllerTests
FileAssert.Exists(PATH);
string content = File.ReadAllText(PATH);
string expected = "{\"version\":1027,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string expected = "{\"version\":1537,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
Assert.AreEqual(expected, content);
}
@@ -117,7 +117,7 @@ public class PersistentDataControllerTests
FileAssert.Exists(PATH);
string content = File.ReadAllText(PATH);
string expected = "{\"version\":1027,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string expected = "{\"version\":1537,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
Assert.AreEqual(expected, content);
}
@@ -127,7 +127,7 @@ public class PersistentDataControllerTests
[Test]
public void Test_PersistentDataController_Load_Existing()
{
string content = "{\"version\":1027,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string content = "{\"version\":1537,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
File.WriteAllText(PATH, content);
Assert.IsTrue(pdc.Load(false));
}
@@ -138,7 +138,7 @@ public class PersistentDataControllerTests
[Test]
public void Test_PersistentDataController_Load_OlderVersion()
{
string content = "{\"version\":1026,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string content = "{\"version\":1536,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
File.WriteAllText(PATH, content);
Assert.IsFalse(pdc.Load(false));
}
@@ -149,7 +149,7 @@ public class PersistentDataControllerTests
[Test]
public void Test_PersistentDataController_Load_NewerVersion()
{
string content = "{\"version\":1028,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string content = "{\"version\":1538,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
File.WriteAllText(PATH, content);
Assert.IsFalse(pdc.Load(false));
}
@@ -186,7 +186,7 @@ public class PersistentDataControllerTests
File.WriteAllText(PATH, "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
Assert.IsFalse(pdc.Load(true));
string content = File.ReadAllText(PATH);
string expected = "{\"version\":1027,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string expected = "{\"version\":1537,\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
Assert.AreEqual(expected, content);
}
@@ -196,7 +196,7 @@ public class PersistentDataControllerTests
[Test]
public void Test_PersistentDataController_Version()
{
const int VERSION = 0x04_03;
const int VERSION = 0x06_01;
Assert.AreEqual(VERSION, PersistentDataController.VERSION);
}
@@ -216,7 +216,7 @@ public class PersistentDataControllerTests
pdc.AddUser(d);
string content = File.ReadAllText(PATH);
string expected = "{\"version\":1027,\"users\":[{\"entries\":[],\"username\":\"username\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
string expected = "{\"version\":1537,\"users\":[{\"entries\":[],\"username\":\"username\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0,\"useGPU\":false}";
Assert.AreEqual(expected, content);
}

View File

@@ -30,7 +30,7 @@ public class SystemControllerTests
public IEnumerator Setup_SystemController()
{
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}";
string oneUser = "{\"version\":1537,\"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;

View File

@@ -110,7 +110,7 @@ MonoBehaviour:
- name: S
image: {fileID: 21300000, guid: d934313344ebc264cb9a7ab061c5c4aa, type: 3}
handGuide: {fileID: 21300000, guid: 5c157ea40838eb74f8226c89a7244613, type: 3}
thresholdDistance: 2
thresholdDistance: 3
clip: {fileID: 32900000, guid: a110b3f082d2a8b4596df2964bf56b81, type: 3}
- name: T
image: {fileID: 21300000, guid: 1c0841dbd38336841acbe8b5d2b70ff4, type: 3}

View File

@@ -20,6 +20,5 @@ MonoBehaviour:
- {fileID: 11400000, guid: 12f3260b96f41d1478804406d793a927, type: 2}
- {fileID: 11400000, guid: 70b23bd64ac995b41ae7c26221a9d039, type: 2}
- {fileID: 11400000, guid: adc0467561c43494db61e303d4aeefee, type: 2}
- {fileID: 11400000, guid: 44b4a0fb3c08b144a9fba68adaf2414f, type: 2}
- {fileID: 11400000, guid: 4bdbe6f72de6d654cabc18639fdf7435, type: 2}
- {fileID: 11400000, guid: dfe10d654a2eef045b1570cd4724c28f, type: 2}

View File

@@ -17,7 +17,7 @@ public class BackButtonTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -18,7 +18,7 @@ public class BootScreenTests
public IEnumerator BootWithUsersTest()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class CourseActivityScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -19,7 +19,7 @@ public class CourseItemTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class CourseMenuScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class ListCoursesScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class ListMinigamesScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -18,7 +18,7 @@ public class MainMenuScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class MinigameActivityScreenTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;
@@ -80,7 +80,7 @@ public class MinigameActivityScreenTests
{
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}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -19,7 +19,7 @@ public class MinigameItemTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -19,7 +19,7 @@ public class ThemeItemTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -17,7 +17,7 @@ public class UserButtonTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -2020,7 +2020,7 @@ RectTransform:
- {fileID: 880507767}
- {fileID: 1881341544}
m_Father: {fileID: 1559094126}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@@ -2643,7 +2643,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_RootOrder
value: 2
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_AnchorMax.x
@@ -2842,7 +2842,7 @@ RectTransform:
- {fileID: 1148236155}
- {fileID: 554169248}
m_Father: {fileID: 1559094126}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -2995,10 +2995,10 @@ RectTransform:
m_Children:
- {fileID: 388014848}
- {fileID: 257279697}
- {fileID: 1335886460}
- {fileID: 1677120324}
- {fileID: 994659357}
- {fileID: 1383144367}
- {fileID: 1335886460}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -3290,7 +3290,7 @@ RectTransform:
m_Children:
- {fileID: 1614792576}
m_Father: {fileID: 1559094126}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}

View File

@@ -184,7 +184,6 @@ public class CoursesController : AbstractFeedback
void Start()
{
StartCourseController();
signPredictor.SetSignsList(GetSignsList());
signPredictor.SetModel(course.theme.modelIndex);
AddSelfAsListener();
}

View File

@@ -19,7 +19,7 @@ public class CoursePanelsTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -21,7 +21,7 @@ public class CoursesControllerTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -30,7 +30,7 @@ public class HangmanPlaymodeTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"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;

View File

@@ -258,7 +258,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 906197777}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@@ -1780,7 +1780,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_RootOrder
value: 4
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_AnchorMax.x
@@ -2324,10 +2324,10 @@ RectTransform:
- {fileID: 2093721209}
- {fileID: 1627575592}
- {fileID: 496523653}
- {fileID: 656044897}
- {fileID: 106848221}
- {fileID: 330718655}
- {fileID: 1809925090}
- {fileID: 656044897}
m_Father: {fileID: 1768150806}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -4399,7 +4399,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4318122119930585316, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
propertyPath: m_RootOrder
value: 6
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4318122119930585316, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
propertyPath: m_AnchorMax.x
@@ -4752,7 +4752,7 @@ RectTransform:
- {fileID: 901475051}
- {fileID: 1767314334}
m_Father: {fileID: 906197777}
m_RootOrder: 7
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}

View File

@@ -17,7 +17,7 @@ public class JustSignControllerTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
File.WriteAllText(path, oneUser);
PersistentDataController.GetInstance().Load();

View File

@@ -10,7 +10,9 @@ using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Class for EmbeddingData, Embeddings are used in the Model to make prediction
/// </summary>
[System.Serializable]
public class EmbeddingData
{
@@ -19,26 +21,45 @@ public class EmbeddingData
public int labels;
}
/// <summary>
/// Class for a list of EmbeddingData
/// </summary>
[System.Serializable]
public class EmbeddingDataList
{
public List<EmbeddingData> dataList;
}
/// <summary>
/// Class to save the distance of an embedding
/// </summary>
public class DistanceEmbedding
{
public float distance;
public EmbeddingData embeddingData;
/// <summary>
/// Creation of DistanceEmbedding
/// </summary>
/// <param name="distance"></param>
/// <param name="embeddingData"></param>
public DistanceEmbedding(float distance, EmbeddingData embeddingData)
{
this.distance = distance;
this.embeddingData = embeddingData;
}
}
/// <summary>
/// Class to compare the distance of two embeddings
/// </summary>
public class DistanceComparer : IComparer<DistanceEmbedding>
{
/// <summary>
/// Function to compare the distance of two DistanceEmbeddings
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public int Compare(DistanceEmbedding x, DistanceEmbedding y)
{
return x.distance.CompareTo(y.distance);
@@ -46,7 +67,7 @@ public class DistanceComparer : IComparer<DistanceEmbedding>
}
/// <summary>
///
/// Sign predictor class which gives input to the games/courses by extractin information from the webcam
/// </summary>
public class SignPredictor : MonoBehaviour
{
@@ -95,7 +116,6 @@ public class SignPredictor : MonoBehaviour
return predictions;
}
/// <summary>
/// Disposing the MLEdgeModel
/// </summary>
@@ -153,7 +173,6 @@ public class SignPredictor : MonoBehaviour
return predictions;
}
/// <summary>
/// Disposing the MLEdgeModel
/// </summary>
@@ -163,6 +182,9 @@ public class SignPredictor : MonoBehaviour
}
}
/// <summary>
/// List of listeners that want to get notified on new predictions
/// </summary>
public List<Listener> listeners = new List<Listener>();
/// <summary>
@@ -170,9 +192,6 @@ public class SignPredictor : MonoBehaviour
/// </summary>
private NatMLSignPredictorEmbed predictor_embed;
private NatMLSignPredictor predictor;
/// <summary>
/// The asynchronous predictor which is used to predict the sign using an MLEdgemodel
/// </summary>
@@ -197,6 +216,10 @@ public class SignPredictor : MonoBehaviour
/// Reference to the model info file
/// </summary>
public TextAsset modelInfoFile;
/// <summary>
/// Reference to the model Embedding file
/// </summary>
public TextAsset modelInfoFileEmbedding;
/// <summary>
@@ -296,11 +319,11 @@ public class SignPredictor : MonoBehaviour
/// </summary>
private static bool resourceManagerIsInitialized = false;
private List<string> signs;
/// <summary>
/// List of the EmbeddingData
/// </summary>
private EmbeddingDataList embeddingDataList;
private ModelIndex modelID;
/// <summary>
/// Google Mediapipe setup & run
/// </summary>
@@ -380,10 +403,6 @@ public class SignPredictor : MonoBehaviour
yield return new WaitUntil(() => t.IsCompleted);
model = t.Result;
predictor_embed = new NatMLSignPredictorEmbed(model);
asyncPredictor = predictor_embed.ToAsync();
// Creating a KeypointManager
@@ -397,34 +416,6 @@ public class SignPredictor : MonoBehaviour
StartCoroutine(MediapipeCoroutineEmbed());
}
/*
/// <summary>
/// Coroutine which executes the mediapipe pipeline
/// </summary>
/// <returns></returns>
private IEnumerator MediapipeCoroutine()
{
while (true)
{
inputTexture.SetPixels32(webcamTexture.GetPixels32(pixelData));
var imageFrame = new ImageFrame(ImageFormat.Types.Format.Srgba, width, height, width * 4, inputTexture.GetRawTextureData<byte>());
var currentTimestamp = stopwatch.ElapsedTicks / (System.TimeSpan.TicksPerMillisecond / 1000);
graph.AddPacketToInputStream("input_video", new ImageFramePacket(imageFrame, new Timestamp(currentTimestamp))).AssertOk();
yield return new WaitForEndOfFrame();
NormalizedLandmarkList _poseLandmarks = null;
NormalizedLandmarkList _leftHandLandmarks = null;
NormalizedLandmarkList _rightHandLandmarks = null;
yield return new WaitUntil(() => { posestream.TryGetNext(out _poseLandmarks); return true; });
yield return new WaitUntil(() => { leftstream.TryGetNext(out _leftHandLandmarks); return true; });
yield return new WaitUntil(() => { rightstream.TryGetNext(out _rightHandLandmarks); return true; });
keypointManager.AddLandmarks(_poseLandmarks, _leftHandLandmarks, _rightHandLandmarks);
}
}
*/
/// <summary>
/// Coroutine which executes the mediapipe pipeline
/// </summary>
@@ -451,7 +442,14 @@ public class SignPredictor : MonoBehaviour
}
}
/// <summary>
/// This function calculates the Minkowski distance between two points in a p-dimensional space.
/// The Minkowski distance is a generalization of Euclidean and Manhattan distances, depending on the value of p.
/// </summary>
/// <param name="x">List of float values representing the coordinates of the first point.</param>
/// <param name="y">Array of float values representing the coordinates of the second point.</param>
/// <param name="p">Integer value representing the power parameter of the Minkowski distance. When p=2, it calculates Euclidean distance, and when p=1, it calculates Manhattan distance.</param>
/// <returns>Returns the Minkowski distance between two points x and y in a p-dimensional space.</returns>
private float MinkowskiDistance(List<float> x, float[] y, int p)
{
int dimensions = x.Count;
@@ -465,6 +463,13 @@ public class SignPredictor : MonoBehaviour
return Mathf.Pow(sum, 1.0f / p);
}
/// <summary>
/// This function calculates the Minkowski distances between a given embedding and a list of predefined embeddings.
/// The function returns a sorted list of distance and associated embedding data, sorted in ascending order of distance.
/// </summary>
/// <param name="embedding">A list of float values representing the embedding for which distances to all embeddings in the dataList need to be computed.</param>
/// <param name="p">An optional integer parameter representing the power parameter of the Minkowski distance. Defaults to 2, implying Euclidean distance is calculated if not specified.</param>
/// <returns>Returns a list of DistanceEmbedding objects, each representing the distance between the given embedding and an embedding from the dataList, along with the associated EmbeddingData. The list is sorted in ascending order of distance.</returns>
private List<DistanceEmbedding> GetDistances(List<float> embedding, int p = 2)
{
List<DistanceEmbedding> distances = new List<DistanceEmbedding>();
@@ -492,59 +497,6 @@ public class SignPredictor : MonoBehaviour
return distances;
}
/*
/// <summary>
/// Coroutine which calls the sign predictor model
/// </summary>
/// <returns></returns>
private IEnumerator SignRecognitionCoroutine()
{
while (true)
{
List<List<float>> inputData = keypointManager.GetKeypoints();
if (inputData != null && asyncPredictor.readyForPrediction)
{
// Getting the size of the input data
int framecount = inputData.Count;
int keypointsPerFrame = inputData[0].Count;
// Creating ArrayFeature
int[] shape = { framecount, keypointsPerFrame };
float[] input = new float[framecount * keypointsPerFrame];
int i = 0;
inputData.ForEach((e) => e.ForEach((f) => input[i++] = f));
MLArrayFeature<float> feature = new MLArrayFeature<float>(input, shape);
// Predicting
Task<List<float>> task = Task.Run(async () => await asyncPredictor.Predict(feature));
yield return new WaitUntil(() => task.IsCompleted);
List<float> result = task.Result;
if (0 < result.Count)
{
learnableProbabilities = new Dictionary<string, float>();
for (int j = 0; j < result.Count; j++)
{
learnableProbabilities.Add(signs[j].ToUpper(), result[j]);
}
foreach (Listener listener in listeners)
{
yield return listener.ProcessIncomingCall();
}
}
else
{
// Wait until next frame
yield return null;
}
}
yield return null;
}
}
*/
/// <summary>
/// Coroutine which calls the sign predictor embedding model
/// </summary>
@@ -568,13 +520,10 @@ public class SignPredictor : MonoBehaviour
int i = 0;
inputData.ForEach((e) => e.ForEach((f) => f.ForEach((k) => input[i++] = k)));
MLArrayFeature<float> feature = new MLArrayFeature<float>(input, shape);
// Predicting
Task<List<float>> task = Task.Run(async () => await asyncPredictor.Predict(feature));
yield return new WaitUntil(() => task.IsCompleted);
List<float> result = task.Result;
@@ -604,17 +553,17 @@ public class SignPredictor : MonoBehaviour
}
}
//UnityEngine.Debug.Log(learnableProbabilities.Aggregate("", (t, d) => $"{t}{d}, "));
foreach (Listener listener in listeners)
{
yield return listener.ProcessIncomingCall();
}
}
}
yield return null;
}
}
/// <summary>
@@ -672,7 +621,10 @@ public class SignPredictor : MonoBehaviour
}
}
/// <summary>
/// Let the class know which Model it should load for the chosen Game/Course
/// </summary>
/// <param name="index"></param>
public void SetModel(ModelIndex index)
{
this.modelList.SetCurrentModel(index);
@@ -684,8 +636,6 @@ public class SignPredictor : MonoBehaviour
public void SwapScreen(RawImage screen)
{
this.screen = screen;
//width = webcamTexture.width;
//height = webcamTexture.height;
if (webcamTexture != null)
{
float webcamAspect = (float)webcamTexture.width / (float)webcamTexture.height;
@@ -693,9 +643,4 @@ public class SignPredictor : MonoBehaviour
this.screen.texture = webcamTexture;
}
}
public void SetSignsList(List<string> signs)
{
this.signs = signs;
}
}

View File

@@ -70,7 +70,6 @@ public abstract class AbstractMinigameController : AbstractFeedback
// Prepare the signPredictor
signPredictor.SetModel(signPredictorTheme.modelIndex);
signPredictor.SwapScreen(webcamScreen);
signPredictor.SetSignsList(GetSignsList());
AddSelfAsListener();
}

View File

@@ -1334,7 +1334,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_RootOrder
value: 8
value: 9
objectReference: {fileID: 0}
- target: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
propertyPath: m_AnchorMax.x
@@ -1558,7 +1558,7 @@ RectTransform:
- {fileID: 1913934361}
- {fileID: 2112704851}
m_Father: {fileID: 906197777}
m_RootOrder: 9
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -1976,8 +1976,8 @@ RectTransform:
- {fileID: 1338727893}
- {fileID: 1346005056}
- {fileID: 967164044}
- {fileID: 667202413}
- {fileID: 757133118}
- {fileID: 667202413}
m_Father: {fileID: 1768150806}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -1,6 +1,7 @@
using NUnit.Framework;
using System.Collections;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.TestTools;
@@ -17,7 +18,7 @@ public class SpellingBeeControllerTests
public IEnumerator SetupFunction()
{
string path = $"{Application.persistentDataPath}/wesign_unit_test.json";
string oneUser = $"{{\"version\":1027,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
string oneUser = $"{{\"version\":1537,\"users\":[{{\"entries\":[],\"username\":\"TEST\",\"avatarIndex\":0,\"playtime\":0.0,\"minigames\":[],\"courses\":[]}}],\"currentUser\":0,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
File.WriteAllText(path, oneUser);
PersistentDataController.GetInstance().Load();
@@ -106,7 +107,7 @@ public class SpellingBeeControllerTests
public IEnumerator CheckGoToNextWord()
{
SpellingBeeController spellingBeeController = GameObject.FindObjectOfType<SpellingBeeController>();
string word = spellingBeeController.SkipToEnd();
var letters = spellingBeeController.SkipToEnd().ToList().Where((c) => c != ' ');
spellingBeeController.PredictSign(spellingBeeController.GetSign());
@@ -118,7 +119,7 @@ public class SpellingBeeControllerTests
Assert.IsFalse(spellingBeeController.bonusTimeText.activeSelf);
for (int i = 1; i < word.Length; i++)
foreach (var _ in letters)
{
spellingBeeController.NextLetter(false);
}