Compare commits
32 Commits
UI-showcas
...
WES-131-Re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fdf5f425f | ||
|
|
670a8de6cd | ||
|
|
c9c22e6426 | ||
|
|
c9ebec1724 | ||
|
|
a44532b94a | ||
|
|
be8885a508 | ||
|
|
dfdb2ab10b | ||
|
|
be7457236c | ||
|
|
78f4d961f7 | ||
|
|
51ee8b0658 | ||
|
|
2183397a0f | ||
|
|
9f0f48e257 | ||
|
|
564ec209c7 | ||
| a3735af649 | |||
|
|
692b4318bf | ||
|
|
0015c1453c | ||
|
|
c78ef0e773 | ||
|
|
45f545b13f | ||
|
|
d3af75f676 | ||
|
|
5f7216f24c | ||
|
|
b012e40df8 | ||
|
|
f69e2385fc | ||
|
|
37905a904c | ||
|
|
0019a4d07f | ||
|
|
4402e80d0c | ||
|
|
d95a6590d5 | ||
|
|
7b6eb4db69 | ||
|
|
8696aff135 | ||
|
|
001cf6dedb | ||
|
|
669bcb3793 | ||
|
|
668b769094 | ||
|
|
fee989006c |
46
.drone.yml
46
.drone.yml
@@ -27,7 +27,7 @@ steps:
|
||||
pull: if-not-exists
|
||||
image: sonarsource/sonar-scanner-cli
|
||||
commands:
|
||||
- sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.coverageReportPaths="./code_coverage/Report/SonarQube.xml"
|
||||
- sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectVersion=$DRONE_REPO_BRANCH-$DRONE_COMMIT_AUTHOR-$DRONE_COMMIT -Dsonar.coverageReportPaths="./code_coverage/Report/SonarQube.xml"
|
||||
environment:
|
||||
SONAR_HOST:
|
||||
from_secret: sonar_host
|
||||
@@ -37,47 +37,3 @@ steps:
|
||||
from_secret: sonar_project_key
|
||||
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: builds
|
||||
type: docker
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- master
|
||||
- development
|
||||
- Automatic-Builds
|
||||
|
||||
steps:
|
||||
- name: unity-builds
|
||||
image: docker.io/library/unity-runner:0.1
|
||||
commands:
|
||||
- mkdir -p ./wesign-builds/{tmp,WeSign-Windows,WeSign-Linux,WeSign-MacOS}
|
||||
- /opt/unity/editors/2021.3.19f1/Editor/Unity -batchmode -nographics -projectPath . -buildWindowsPlayer ./wesign-builds/tmp/WeSign-Windows.exe -quit --headless || true
|
||||
- chmod 777 -R .
|
||||
- /opt/unity/editors/2021.3.19f1/Editor/Unity -batchmode -nographics -projectPath . -buildWindowsPlayer ./wesign-builds/WeSign-Windows/WeSign.exe -quit --headless
|
||||
- /opt/unity/editors/2021.3.19f1/Editor/Unity -batchmode -nographics -projectPath . -buildLinux64Player ./wesign-builds/WeSign-Linux/WeSign -quit --headless
|
||||
- /opt/unity/editors/2021.3.19f1/Editor/Unity -batchmode -nographics -projectPath . -buildOSXUniversalPlayer ./wesign-builds/WeSign-MacOS/WeSign.app -quit --headless
|
||||
- name: commit-files
|
||||
image: alpine/git
|
||||
environment:
|
||||
GIT_AUTHOR_NAME: DroneCI
|
||||
GIT_AUTHOR_EMAIL: droneci@wesign.com
|
||||
GIT_COMMITTER_NAME: DroneCI
|
||||
GIT_COMMITTER_EMAIL: droneci@wesign.com
|
||||
commands:
|
||||
- git config --global user.name "DroneCI"
|
||||
- git config --global user.email "droneci@wesign.com"
|
||||
|
||||
- zip -r ./wesign-builds/WeSign-Windows.zip ./wesign-builds/WeSign-Windows
|
||||
- zip -r ./wesign-builds/WeSign-MacOS.zip ./wesign-builds/WeSign-MacOS
|
||||
- zip -r ./wesign-builds/WeSign-Linux.zip ./wesign-builds/WeSign-Linux
|
||||
|
||||
- git add ./wesign-builds/WeSign-Windows.zip
|
||||
- git add ./wesign-builds/WeSign-MacOS.zip
|
||||
- git add ./wesign-builds/WeSign-Linux.zip
|
||||
|
||||
- git commit -m "Add build files [skip ci]"
|
||||
- git push -f https://oauth2:ixKiNbp48zzmP5PF-epo@gitlab.ilabt.imec.be/wesign/unity-application/
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -72,4 +72,5 @@ crashlytics-build.properties
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ChangeUserScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
error.SetActive(false);
|
||||
DisplayUsers();
|
||||
}
|
||||
|
||||
@@ -101,4 +101,14 @@ public class Progress
|
||||
// Raise an exception when key is not found
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether a key is present
|
||||
/// </summary>
|
||||
/// <param name="key">The key to check</param>
|
||||
/// <returns>true if a item can be found with the specified key</returns>
|
||||
public bool Has(string key)
|
||||
{
|
||||
return entries.Find(x => x.key == key) != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class UserList : ScriptableObject
|
||||
/// <summary>
|
||||
/// The index of the current/last logged in user in the <c>storedUsers</c> list
|
||||
/// </summary>
|
||||
public int currentUserIndex;
|
||||
public int currentUserIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// A list containing all users (which can be serialized)
|
||||
@@ -43,8 +43,13 @@ public class UserList : ScriptableObject
|
||||
/// </summary>
|
||||
void OnEnable()
|
||||
{
|
||||
PATH = $"{Application.persistentDataPath}/users.json";
|
||||
Load();
|
||||
// The PATH variable can be set by the testing framework,
|
||||
// so we don't overwrite the actual userlist with test data
|
||||
if (PATH == null)
|
||||
{
|
||||
PATH = $"{Application.persistentDataPath}/users.json";
|
||||
Load();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,6 +76,10 @@ public class UserList : ScriptableObject
|
||||
{
|
||||
User user = CreateNewUser(name, avatar);
|
||||
storedUserList.storedUsers.Add(user);
|
||||
if (storedUserList.storedUsers.Count == 1)
|
||||
{
|
||||
storedUserList.currentUserIndex = 0;
|
||||
}
|
||||
Save();
|
||||
return user;
|
||||
}
|
||||
@@ -103,6 +112,10 @@ public class UserList : ScriptableObject
|
||||
/// <returns>The current logged in user</returns>
|
||||
public User GetCurrentUser()
|
||||
{
|
||||
if (storedUserList.storedUsers.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return storedUserList.storedUsers[storedUserList.currentUserIndex];
|
||||
}
|
||||
|
||||
@@ -119,28 +132,46 @@ public class UserList : ScriptableObject
|
||||
/// Change the current user
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the user in the userlist</param>
|
||||
/// <exception cref="IndexOutOfRangeException"></exception>
|
||||
public void ChangeCurrentUser(int index)
|
||||
{
|
||||
storedUserList.currentUserIndex = index;
|
||||
if (0 <= index && index < storedUserList.storedUsers.Count)
|
||||
{
|
||||
storedUserList.currentUserIndex = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the current user
|
||||
/// </summary>
|
||||
/// <param name="user">Reference to the user in the userlist</param>
|
||||
/// <exception cref="KeyNotFoundException"></exception>
|
||||
public void ChangeCurrentUser(User user)
|
||||
{
|
||||
storedUserList.currentUserIndex = storedUserList.storedUsers.IndexOf(user);
|
||||
int idx = storedUserList.storedUsers.IndexOf(user);
|
||||
if (idx < 0)
|
||||
{
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
storedUserList.currentUserIndex = idx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the user
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the user in the userlist</param>
|
||||
/// <returns>true if user was successful removed, false otherwise</returns>
|
||||
/// <returns>true if user was successful removed, false otherwise</returns
|
||||
public bool DeleteUser(int index)
|
||||
{
|
||||
return DeleteUser(storedUserList.storedUsers[index]);
|
||||
if (0 <= index && index < storedUserList.storedUsers.Count)
|
||||
{
|
||||
return DeleteUser(storedUserList.storedUsers[index]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -177,13 +208,14 @@ public class UserList : ScriptableObject
|
||||
/// </summary>
|
||||
public void Load()
|
||||
{
|
||||
try
|
||||
{
|
||||
storedUserList.storedUsers.Clear();
|
||||
storedUserList.storedUsers.Clear();
|
||||
storedUserList.currentUserIndex = -1;
|
||||
|
||||
string text = File.ReadAllText(PATH);
|
||||
storedUserList = JsonUtility.FromJson<StoredUserList>(text);
|
||||
if (!File.Exists(PATH))
|
||||
{
|
||||
Save();
|
||||
}
|
||||
catch (FileNotFoundException) { Debug.Log($"Path '{PATH}' not found"); }
|
||||
string text = File.ReadAllText(PATH);
|
||||
storedUserList = JsonUtility.FromJson<StoredUserList>(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ public class UserProgressScreen : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
// Assign the current user
|
||||
userList.Load();
|
||||
user = userList.GetCurrentUser();
|
||||
|
||||
// Set correct displayed items
|
||||
|
||||
@@ -7,8 +7,14 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// Test the Progress class
|
||||
/// </summary>
|
||||
public class TestProgress
|
||||
[TestFixture]
|
||||
public class ProgressTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the progress object to be tested
|
||||
/// </summary>
|
||||
private Progress progress;
|
||||
|
||||
/// <summary>
|
||||
/// A dummy serializable struct to perform test operations on
|
||||
/// </summary>
|
||||
@@ -29,205 +35,179 @@ public class TestProgress
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method
|
||||
/// Setup the tests
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if <c>Progress.AddOrUpdate(...)</c> throws a <c>SerializationException</c></returns>
|
||||
private bool AddNonSerializableStruct()
|
||||
[SetUp]
|
||||
public void Setup_Progress()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
NonSerializableStruct nss = new NonSerializableStruct();
|
||||
try { progress.AddOrUpdate<NonSerializableStruct>("key", nss); }
|
||||
catch (SerializationException) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if <c>Progress.Get(...)</c> throws a <c>KeyNotFoundException</c></returns>
|
||||
private bool AccessInvalidKey()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
try { progress.Get<int>("non-existing key"); }
|
||||
catch (KeyNotFoundException) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if <c>Progress.Get(...)</c> throws a <c>InvalidCastException</c></returns>
|
||||
private bool AccessInvalidType()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<int>("key", 123456789);
|
||||
try { progress.Get<double>("key"); }
|
||||
catch (InvalidCastException) { return true; }
|
||||
return false;
|
||||
progress = new Progress();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for creation of a new progress
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestNewProgress()
|
||||
public void Test_New_Progress()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(progress != null);
|
||||
Assert.IsNotNull(progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether invalid data will not be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddInvalidData()
|
||||
public void Test_Progress_Add_InvalidData()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(!progress.AddOrUpdate<GameObject>("key", null));
|
||||
Assert.IsFalse(progress.AddOrUpdate<GameObject>("key", null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a duplicated key will be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddDuplicateKey()
|
||||
public void Test_Progress_Add_DuplicateKey()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<int>("key 1", 0);
|
||||
Debug.Assert(progress.AddOrUpdate<int>("key 1", 1));
|
||||
Assert.IsTrue(progress.AddOrUpdate<int>("key 1", 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>int</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddInt()
|
||||
public void Test_Progress_Add_Int()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(progress.AddOrUpdate<int>("key", 1));
|
||||
Assert.IsTrue(progress.AddOrUpdate<int>("key", 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>double</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddDouble()
|
||||
public void Test_Progress_Add_Double()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(progress.AddOrUpdate<double>("key", 1.0));
|
||||
Assert.IsTrue(progress.AddOrUpdate<double>("key", 1.0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>string</c> value can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddString()
|
||||
public void Test_Progress_Add_String()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(progress.AddOrUpdate<string>("key", "Hello World!"));
|
||||
Assert.IsTrue(progress.AddOrUpdate<string>("key", "Hello World!"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a serializable struct can be added
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddSerializableStruct()
|
||||
public void Test_Progress_Add_SerializableStruct()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
Debug.Assert(progress.AddOrUpdate<SerializableStruct>("key", new SerializableStruct()));
|
||||
Assert.IsTrue(progress.AddOrUpdate<SerializableStruct>("key", new SerializableStruct()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a non-serializable struct will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressAddNonSerializableStruct()
|
||||
public void Test_Progress_Add_NonSerializableStruct()
|
||||
{
|
||||
Debug.Assert(AddNonSerializableStruct());
|
||||
NonSerializableStruct nss = new NonSerializableStruct();
|
||||
Assert.Throws<SerializationException>(delegate { progress.AddOrUpdate<NonSerializableStruct>("key", nss); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a key is present
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_Progress_Has_ValidKey()
|
||||
{
|
||||
progress.AddOrUpdate<int>("key", 1);
|
||||
Assert.IsTrue(progress.Has("key"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a key is not present
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_Progress_Has_InvalidKey()
|
||||
{
|
||||
Assert.IsFalse(progress.Has("non-existing key"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether an invalid key will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInvalidKey()
|
||||
public void Test_Progress_Get_InvalidKey()
|
||||
{
|
||||
Debug.Assert(AccessInvalidKey());
|
||||
Assert.Throws<KeyNotFoundException>(delegate { progress.Get<int>("non-existing key"); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether an invalid type will throw an error
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInvalidType()
|
||||
public void Test_Progress_Get_InvalidType()
|
||||
{
|
||||
Debug.Assert(AccessInvalidType());
|
||||
progress.AddOrUpdate<int>("key", 123456789);
|
||||
Assert.Throws<InvalidCastException>(delegate { progress.Get<double>("key"); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a value is correctly updated
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressUpdate()
|
||||
public void Test_Progress_Update()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<int>("key", 1);
|
||||
Debug.Assert(progress.Get<int>("key") == 1);
|
||||
Assert.AreEqual(progress.Get<int>("key"), 1);
|
||||
progress.AddOrUpdate<int>("key", 2);
|
||||
Debug.Assert(progress.Get<int>("key") == 2);
|
||||
Assert.AreEqual(progress.Get<int>("key"), 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>int</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetInt()
|
||||
public void Test_Progress_Get_Int()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<int>("key", 1);
|
||||
Debug.Assert(progress.Get<int>("key") == 1);
|
||||
Assert.AreEqual(progress.Get<int>("key"), 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>double</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetDouble()
|
||||
public void Test_Progress_Get_Double()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<double>("key", 1.0);
|
||||
Debug.Assert(progress.Get<double>("key") == 1.0);
|
||||
Assert.AreEqual(progress.Get<double>("key"), 1.0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a <c>string</c> value can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetString()
|
||||
public void Test_Progress_Get_String()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
progress.AddOrUpdate<string>("key", "Hello World!");
|
||||
Debug.Assert(progress.Get<string>("key") == "Hello World!");
|
||||
Assert.AreEqual(progress.Get<string>("key"), "Hello World!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a serializable struct can be read
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestProgressGetStruct()
|
||||
public void Test_Progress_Get_Struct()
|
||||
{
|
||||
Progress progress = new Progress();
|
||||
|
||||
int R = 1, G = 10, B = 100;
|
||||
float X = 0.1f, Y = 0.01f, Z = 0.001f;
|
||||
SerializableStruct data = new SerializableStruct { r = R, g = G, b = B, x = X, y = Y, z = Z };
|
||||
progress.AddOrUpdate<SerializableStruct>("key", data);
|
||||
SerializableStruct result = progress.Get<SerializableStruct>("key");
|
||||
Debug.Assert(result.r == R);
|
||||
Debug.Assert(result.g == G);
|
||||
Debug.Assert(result.b == B);
|
||||
Debug.Assert(result.x == X);
|
||||
Debug.Assert(result.y == Y);
|
||||
Debug.Assert(result.z == Z);
|
||||
Assert.AreEqual(result, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
using UnityEngine;
|
||||
using NUnit.Framework;
|
||||
|
||||
/// <summary>
|
||||
/// Test the UserCreationScreen class
|
||||
/// </summary>
|
||||
public class TestUserCreationScreen
|
||||
[TestFixture]
|
||||
public class UserCreationScreenTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Tets IsValidUsername will return <c>true</c> for an valid username
|
||||
/// </summary>
|
||||
public void TestIsValidUsernameTrue()
|
||||
[Test]
|
||||
public void Test_UserCreationScreen_IsValidUsername_True()
|
||||
{
|
||||
foreach (char c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
Debug.Assert(UserCreationScreen.IsValidUsername(c.ToString()));
|
||||
Assert.IsTrue(UserCreationScreen.IsValidUsername(c.ToString()));
|
||||
|
||||
Debug.Assert(UserCreationScreen.IsValidUsername("123456789AbC"));
|
||||
Assert.IsTrue(UserCreationScreen.IsValidUsername("123456789AbC"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tets IsValidUsername will return <c>false</c> for an invalid username
|
||||
/// </summary>
|
||||
public void TestIsValidUsernameFalse()
|
||||
[Test]
|
||||
public void Test_UserCreationScreen_IsValidUsername_False()
|
||||
{
|
||||
Debug.Assert(!UserCreationScreen.IsValidUsername(string.Empty));
|
||||
Assert.IsFalse(UserCreationScreen.IsValidUsername(string.Empty));
|
||||
foreach (char c in " \n\t+-*/%_.,;:!?(){}[]\\'\"|&~^$")
|
||||
Debug.Assert(!UserCreationScreen.IsValidUsername(c.ToString()));
|
||||
Assert.IsFalse(UserCreationScreen.IsValidUsername(c.ToString()));
|
||||
|
||||
Debug.Assert(!UserCreationScreen.IsValidUsername("123456789_10_11_12_13"));
|
||||
Assert.IsFalse(UserCreationScreen.IsValidUsername("123456789_10_11_12_13"));
|
||||
}
|
||||
}
|
||||
|
||||
470
Assets/Accounts/Tests/UserListTest.cs
Normal file
470
Assets/Accounts/Tests/UserListTest.cs
Normal file
@@ -0,0 +1,470 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the UserList class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class UserListTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new path so the existing users.json file will not be overwritten
|
||||
/// </summary>
|
||||
private static string PATH = $"{Application.persistentDataPath}/unit_test_users.json";
|
||||
|
||||
/// <summary>
|
||||
/// NUnit test magic (for skipping the setup)
|
||||
/// </summary>
|
||||
public const string SKIP_SETUP = "SKIP_SETUP";
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the userlist to be tested
|
||||
/// </summary>
|
||||
private UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Helper variable for quick user creation
|
||||
/// </summary>
|
||||
private string username = "u5erNam3";
|
||||
|
||||
/// <summary>
|
||||
/// Helper variable for quick user creation
|
||||
/// </summary>
|
||||
private Sprite avatar = Sprite.Create(
|
||||
Texture2D.blackTexture,
|
||||
new Rect(0, 0, Texture2D.blackTexture.width, Texture2D.blackTexture.height),
|
||||
new Vector2(0.5f, 0.5f)
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Setup the tests
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_UserList()
|
||||
{
|
||||
// Check whether the current test needs to skip the setup
|
||||
ArrayList cat = TestContext.CurrentContext.Test.Properties["_CATEGORIES"] as ArrayList;
|
||||
bool skip = cat != null && cat.Contains(SKIP_SETUP);
|
||||
if (!skip)
|
||||
{
|
||||
// The actual setup code
|
||||
UserList.PATH = UserListTest.PATH;
|
||||
userList = ScriptableObject.CreateInstance<UserList>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the UserList.PATH is correctly set
|
||||
/// </summary>
|
||||
[Test]
|
||||
[Category(SKIP_SETUP)]
|
||||
public void Test_UserList_OnEnable()
|
||||
{
|
||||
UserList.PATH = null;
|
||||
userList = ScriptableObject.CreateInstance<UserList>();
|
||||
Assert.AreEqual($"{Application.persistentDataPath}/users.json", UserList.PATH);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for creation of a new UserList
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_New_UserList()
|
||||
{
|
||||
Assert.IsNotNull(userList);
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for creation of new user (without adding the user to the list)
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_CreateNewUser()
|
||||
{
|
||||
User user = userList.CreateNewUser(username, avatar);
|
||||
|
||||
Assert.IsNotNull(user);
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
Assert.AreEqual(username, user.username);
|
||||
Assert.AreEqual(avatar, user.avatar);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for creating a new user and adding the user to the list
|
||||
/// </summary>
|
||||
public void Test_UserList_CreateAndAddNewUser()
|
||||
{
|
||||
Assert.AreEqual(-1, userList.GetCurrentUserIndex());
|
||||
User user = userList.CreateAndAddNewUser(username, avatar);
|
||||
|
||||
Assert.IsNotNull(user);
|
||||
Assert.AreEqual(1, userList.GetUsers().Count);
|
||||
Assert.AreEqual(user, userList.GetUsers()[0]);
|
||||
Assert.Zero(userList.GetCurrentUserIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether an existing user can be found by its username
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetUserByUsername_Valid()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser(username, avatar);
|
||||
User v = userList.GetUserByUsername(username);
|
||||
Assert.AreEqual(u, v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a non-existing user can not be found
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetUserByUsername_Null()
|
||||
{
|
||||
User user = userList.GetUserByUsername("not-a-user");
|
||||
Assert.IsNull(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the correct current user is returned
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetCurrentUser()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(2);
|
||||
|
||||
User W = userList.GetCurrentUser();
|
||||
Assert.AreEqual(w, W);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a null user is returned when the userlist is empty
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetCurrent_Empty()
|
||||
{
|
||||
User user = userList.GetCurrentUser();
|
||||
Assert.IsNull(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the correct index is returned for the current user
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetCurrentUserIndex()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(2);
|
||||
|
||||
int idx = userList.GetCurrentUserIndex();
|
||||
Assert.AreEqual(2, idx);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a bad index is returned when the userlist is empty
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_GetCurrentUserIndex_Empty()
|
||||
{
|
||||
Assert.AreEqual(-1, userList.GetCurrentUserIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user (referenced by index) is correctly changed
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_ValidIndex()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(2);
|
||||
|
||||
User W = userList.GetCurrentUser();
|
||||
Assert.AreEqual(w, W);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user is not changed when a bad index is given
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_InvalidIndex()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
Assert.Throws<IndexOutOfRangeException>(delegate { userList.ChangeCurrentUser(-1); });
|
||||
Assert.Throws<IndexOutOfRangeException>(delegate { userList.ChangeCurrentUser(5); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user is not changed when a bad index is given
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_IndexEmpty()
|
||||
{
|
||||
Assert.Throws<IndexOutOfRangeException>(delegate { userList.ChangeCurrentUser(0); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user is correctly changed
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_ValidUser()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(v);
|
||||
User V = userList.GetCurrentUser();
|
||||
Assert.AreEqual(v, V);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user is not changed when a non-existing user is given
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_InvalidUser()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateNewUser($"{username}_{'v'}", avatar);
|
||||
Assert.Throws<KeyNotFoundException>(delegate { userList.ChangeCurrentUser(v); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether the current user is not changed when a null user is given
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_ChangeCurrentUser_NullUser()
|
||||
{
|
||||
Assert.Throws<KeyNotFoundException>(delegate { userList.ChangeCurrentUser(null); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting a existing user (referenced by index) will correctly be removed
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_ValidIndex()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
Assert.IsTrue(userList.DeleteUser(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting a non-existing user (referenced by wrong index) will fail
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_InValidIndex()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
Assert.IsFalse(userList.DeleteUser(-1));
|
||||
Assert.IsFalse(userList.DeleteUser(5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting any user from an empty userlist will fail
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_IndexEmpty()
|
||||
{
|
||||
Assert.IsFalse(userList.DeleteUser(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting an existing user will correctly remove the user and set the currentUserIndex correctly
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_LastValid()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(2);
|
||||
|
||||
Assert.AreEqual(3, userList.GetUsers().Count);
|
||||
Assert.AreEqual(2, userList.GetCurrentUserIndex());
|
||||
Assert.IsTrue(userList.DeleteUser(w));
|
||||
Assert.AreEqual(2, userList.GetUsers().Count);
|
||||
Assert.AreEqual(1, userList.GetCurrentUserIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting an existing user will remove the user correctly
|
||||
/// </summary>
|
||||
/// <remarks>This will change the currentUserIndex to point to another user</remarks>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_FirstValid()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateAndAddNewUser($"{username}_{'v'}", avatar);
|
||||
User w = userList.CreateAndAddNewUser($"{username}_{'w'}", avatar);
|
||||
userList.ChangeCurrentUser(0);
|
||||
|
||||
Assert.AreEqual(3, userList.GetUsers().Count);
|
||||
Assert.AreEqual(0, userList.GetCurrentUserIndex());
|
||||
Assert.IsTrue(userList.DeleteUser(u));
|
||||
Assert.AreEqual(2, userList.GetUsers().Count);
|
||||
Assert.AreEqual(0, userList.GetCurrentUserIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether deleting a non-existing user will not affect the userlist
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_Invalid()
|
||||
{
|
||||
User u = userList.CreateAndAddNewUser($"{username}_{'u'}", avatar);
|
||||
User v = userList.CreateNewUser($"{username}_{'v'}", avatar);
|
||||
|
||||
Assert.AreEqual(1, userList.GetUsers().Count);
|
||||
Assert.IsFalse(userList.DeleteUser(v));
|
||||
Assert.AreEqual(1, userList.GetUsers().Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether calling the DeleteUser function on an empty list will not affect the userlist
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_DeleteUser_Empty()
|
||||
{
|
||||
User user = userList.CreateNewUser(username, avatar);
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
Assert.IsFalse(userList.DeleteUser(user));
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a savefile is correctly constructed when no savefile is present
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Save_New()
|
||||
{
|
||||
if (File.Exists(PATH))
|
||||
{
|
||||
File.Delete(PATH);
|
||||
}
|
||||
|
||||
List<User> u = new List<User>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
u.Add(userList.CreateAndAddNewUser($"{username}_{i}", avatar));
|
||||
}
|
||||
userList.ChangeCurrentUser(3);
|
||||
userList.Save();
|
||||
FileAssert.Exists(PATH);
|
||||
|
||||
string content = File.ReadAllText(PATH);
|
||||
int id = avatar.GetInstanceID();
|
||||
string expected = $"{{\"currentUserIndex\":3,\"storedUsers\":[{{\"username\":\"u5erNam3_0\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_1\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_2\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_3\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_4\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}}]}}";
|
||||
Assert.AreEqual(expected, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a savefile is correctly constructed when a savefile already exists
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Save_Existing()
|
||||
{
|
||||
if (!File.Exists(PATH))
|
||||
{
|
||||
File.CreateText(PATH).Close();
|
||||
File.WriteAllText(PATH, "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
|
||||
}
|
||||
|
||||
List<User> u = new List<User>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
u.Add(userList.CreateAndAddNewUser($"{username}_{i}", avatar));
|
||||
}
|
||||
userList.ChangeCurrentUser(3);
|
||||
userList.Save();
|
||||
FileAssert.Exists(PATH);
|
||||
|
||||
string content = File.ReadAllText(PATH);
|
||||
int id = avatar.GetInstanceID();
|
||||
string expected = $"{{\"currentUserIndex\":3,\"storedUsers\":[{{\"username\":\"u5erNam3_0\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_1\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_2\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_3\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}},{{\"username\":\"u5erNam3_4\",\"avatar\":{{\"instanceID\":{id}}},\"playtime\":0.0,\"courses\":[],\"minigames\":[]}}]}}";
|
||||
Assert.AreEqual(expected, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a save file is correctly constructed from an empty userlist
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Save_Empty()
|
||||
{
|
||||
userList.Save();
|
||||
FileAssert.Exists(PATH);
|
||||
|
||||
string content = File.ReadAllText(PATH);
|
||||
string expected = "{\"currentUserIndex\":-1,\"storedUsers\":[]}";
|
||||
Assert.AreEqual(expected, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether a userlist (containing some users) is correrctly loaded
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Load()
|
||||
{
|
||||
List<User> u = new List<User>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
u.Add(userList.CreateAndAddNewUser($"{username}_{i}", avatar));
|
||||
}
|
||||
userList.ChangeCurrentUser(3);
|
||||
userList.Save();
|
||||
|
||||
userList.Load();
|
||||
Assert.AreEqual(userList.GetUsers().Count, u.Count);
|
||||
Assert.AreEqual(userList.GetCurrentUserIndex(), 3);
|
||||
List<User> v = userList.GetUsers();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Assert.AreEqual(u[i].username, v[i].username);
|
||||
Assert.AreEqual(u[i].avatar, v[i].avatar);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether an empty userlist is correctly loaded
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Load_Empty()
|
||||
{
|
||||
userList.Save();
|
||||
userList.Load();
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
Assert.AreEqual(-1, userList.GetCurrentUserIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test if the user save file is not found, a new one will be created and an empty userlist will be loaded
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Test_UserList_Load_NotFound()
|
||||
{
|
||||
List<User> u = new List<User>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
u.Add(userList.CreateAndAddNewUser($"{username}_{i}", avatar));
|
||||
}
|
||||
userList.ChangeCurrentUser(3);
|
||||
userList.Save();
|
||||
|
||||
File.Delete(PATH);
|
||||
userList.Load();
|
||||
Assert.Zero(userList.GetUsers().Count);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44e682a32ee15cc489bf50f3a06f717b
|
||||
guid: cc44c73b32b9af7469b76bd6071f0cf5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,150 +1,166 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the User class
|
||||
/// </summary>
|
||||
public class TestUser
|
||||
[TestFixture]
|
||||
public class UserTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the user to be tested
|
||||
/// </summary>
|
||||
private User user;
|
||||
|
||||
/// <summary>
|
||||
/// Setup the tests
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_User()
|
||||
{
|
||||
user = new User();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test for the creation of a new user
|
||||
/// </summary>
|
||||
public void TestNewUser()
|
||||
[Test]
|
||||
public void Test_New_User()
|
||||
{
|
||||
User user = new User();
|
||||
Debug.Assert(user != null);
|
||||
Debug.Assert(user.courses.Count == 0);
|
||||
Debug.Assert(user.minigames.Count == 0);
|
||||
Assert.NotNull(user);
|
||||
Assert.Zero(user.courses.Count);
|
||||
Assert.Zero(user.minigames.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether progress on a new course can be added
|
||||
/// </summary>
|
||||
public void TestUserAddCourse()
|
||||
[Test]
|
||||
public void Test_User_AddCourse()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
user.courses.Add(p);
|
||||
Debug.Assert(user.courses.Count == 1);
|
||||
Debug.Assert(user.minigames.Count == 0);
|
||||
Assert.AreEqual(user.courses.Count, 1);
|
||||
Assert.Zero(user.minigames.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether progress on a new minigame can be added
|
||||
/// </summary>
|
||||
public void TestUserAddMinigame()
|
||||
[Test]
|
||||
public void Test_User_AddMinigame()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
user.minigames.Add(p);
|
||||
Debug.Assert(user.courses.Count == 0);
|
||||
Debug.Assert(user.minigames.Count == 1);
|
||||
Assert.Zero(user.courses.Count);
|
||||
Assert.AreEqual(user.minigames.Count, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetRecentCourses will return empty when no progress is stored
|
||||
/// </summary>
|
||||
public void TestGetRecentCoursesEmpty()
|
||||
[Test]
|
||||
public void Test_User_GetRecentCourses_Empty()
|
||||
{
|
||||
User user = new User();
|
||||
Debug.Assert(user.GetRecentCourses().Count == 0);
|
||||
Assert.Zero(user.GetRecentCourses().Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Temporary test for GetRecentCourses will return all progress that is stored
|
||||
/// TEMPORARY test for GetRecentCourses will return all progress that is stored
|
||||
/// </summary>
|
||||
public void TestGetRecentCoursesAll()
|
||||
[Test]
|
||||
public void Test_User_GetRecentCourses_All()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
p.AddOrUpdate<CourseIndex>("courseIndex", CourseIndex.FINGERSPELLING);
|
||||
p.AddOrUpdate<float>("courseProgress", 0.5f);
|
||||
user.courses.Add(p);
|
||||
List<Tuple<CourseIndex, float>> list = user.GetRecentCourses();
|
||||
Debug.Assert(list.Count == 1);
|
||||
Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING);
|
||||
Debug.Assert(list[0].Item2 == 0.5f);
|
||||
Assert.AreEqual(list.Count, 1);
|
||||
Assert.AreEqual(list[0].Item1, CourseIndex.FINGERSPELLING);
|
||||
Assert.AreEqual(list[0].Item2, 0.5f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetRecommendedCourses will return <c>Tuple<CourseIndex.FINGERSPELLING, 0.0></c> when no progress is stored
|
||||
/// </summary>
|
||||
public void TestGetRecommendedCoursesEmpty()
|
||||
[Test]
|
||||
public void Test_User_GetRecommendedCourses_Empty()
|
||||
{
|
||||
User user = new User();
|
||||
List<Tuple<CourseIndex, float>> list = user.GetRecommendedCourses();
|
||||
Debug.Assert(list.Count == 1);
|
||||
Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING);
|
||||
Debug.Assert(list[0].Item2 == 0.0f);
|
||||
Assert.AreEqual(list.Count, 1);
|
||||
Assert.AreEqual(list[0].Item1, CourseIndex.FINGERSPELLING);
|
||||
Assert.AreEqual(list[0].Item2, 0.0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Temporary test for GetRecommenedCourses will return all progress that is stored
|
||||
/// TEMPORARY test for GetRecommenedCourses will return all progress that is stored
|
||||
/// </summary>
|
||||
public void TestGetRecommendedCoursesAll()
|
||||
[Test]
|
||||
public void Test_User_GetRecommendedCourses_All()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
p.AddOrUpdate<CourseIndex>("courseIndex", CourseIndex.FINGERSPELLING);
|
||||
p.AddOrUpdate<float>("courseProgress", 0.5f);
|
||||
user.courses.Add(p);
|
||||
List<Tuple<CourseIndex, float>> list = user.GetRecommendedCourses();
|
||||
Debug.Assert(list.Count == 1);
|
||||
Debug.Assert(list[0].Item1 == CourseIndex.FINGERSPELLING);
|
||||
Debug.Assert(list[0].Item2 == 0.5f);
|
||||
Assert.AreEqual(list.Count, 1);
|
||||
Assert.AreEqual(list[0].Item1, CourseIndex.FINGERSPELLING);
|
||||
Assert.AreEqual(list[0].Item2, 0.5f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetCourseProgress returns null when course cannot be found
|
||||
/// </summary>
|
||||
public void TestGetCourseProgressNull()
|
||||
[Test]
|
||||
public void Test_User_GetCourseProgress_Null()
|
||||
{
|
||||
User user = new User();
|
||||
Debug.Assert(user.GetCourseProgress(CourseIndex.FINGERSPELLING) == null);
|
||||
Debug.Assert(user.GetCourseProgress((CourseIndex)100) == null);
|
||||
Assert.Null(user.GetCourseProgress(CourseIndex.FINGERSPELLING));
|
||||
Assert.Null(user.GetCourseProgress((CourseIndex)100));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetCourseProgress returns correct progress object
|
||||
/// </summary>
|
||||
public void TestGetCourseProgressValid()
|
||||
[Test]
|
||||
public void Test_User_GetCourseProgress_Valid()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
p.AddOrUpdate<CourseIndex>("courseIndex", CourseIndex.FINGERSPELLING);
|
||||
p.AddOrUpdate<float>("courseProgress", 3.14159265f);
|
||||
user.courses.Add(p);
|
||||
Progress q = user.GetCourseProgress(CourseIndex.FINGERSPELLING);
|
||||
Debug.Assert(q.Get<CourseIndex>("courseIndex") == CourseIndex.FINGERSPELLING);
|
||||
Debug.Assert(q.Get<float>("courseProgress") == 3.14159265f);
|
||||
Assert.AreEqual(q.Get<CourseIndex>("courseIndex"), CourseIndex.FINGERSPELLING);
|
||||
Assert.AreEqual(q.Get<float>("courseProgress"), 3.14159265f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetMinigameProgress returns null when minigame cannot be found
|
||||
/// </summary>
|
||||
public void TestGetMinigameProgressNull()
|
||||
[Test]
|
||||
public void Test_User_GetMinigameProgress_Null()
|
||||
{
|
||||
User user = new User();
|
||||
Debug.Assert(user.GetMinigameProgress(MinigameIndex.SPELLING_BEE) == null);
|
||||
Debug.Assert(user.GetMinigameProgress((MinigameIndex)100) == null);
|
||||
Assert.Null(user.GetMinigameProgress(MinigameIndex.SPELLING_BEE));
|
||||
Assert.Null(user.GetMinigameProgress((MinigameIndex)100));
|
||||
|
||||
Progress p = new Progress();
|
||||
p.AddOrUpdate<MinigameIndex>("minigameIndex", MinigameIndex.SPELLING_BEE);
|
||||
user.minigames.Add(p);
|
||||
Debug.Assert(user.GetMinigameProgress(MinigameIndex.HANGMAN) == null);
|
||||
Assert.Null(user.GetMinigameProgress(MinigameIndex.HANGMAN));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test GetMinigameProgress returns correct progress object
|
||||
/// </summary>
|
||||
public void TestGetMinigameProgressValid()
|
||||
[Test]
|
||||
public void Test_User_GetMinigameProgress_Valid()
|
||||
{
|
||||
User user = new User();
|
||||
Progress p = new Progress();
|
||||
p.AddOrUpdate<MinigameIndex>("minigameIndex", MinigameIndex.SPELLING_BEE);
|
||||
user.minigames.Add(p);
|
||||
Progress q = user.GetMinigameProgress(MinigameIndex.SPELLING_BEE);
|
||||
Debug.Assert(q.Get<CourseIndex>("minigameIndex") == CourseIndex.FINGERSPELLING);
|
||||
Assert.AreEqual(q.Get<CourseIndex>("minigameIndex"), CourseIndex.FINGERSPELLING);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16fc1bc4096fb7140bf8d384ba156204
|
||||
guid: 3602bedf0ebe5b64596873f09eddf57b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
BIN
Assets/Common/Fonts/Korolev Condensed W04 Bold.ttf
Normal file
BIN
Assets/Common/Fonts/Korolev Condensed W04 Bold.ttf
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e223d9d2d83a6e348acec604dc07783d
|
||||
guid: 2bce9312e55b8de45a7cc2d163604db6
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
@@ -9,7 +9,7 @@ TrueTypeFontImporter:
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Continuum Light
|
||||
- KorolevCondensedW04-Bold
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9b37628356c3424d9c240aa7bf35289
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Continuum Bold
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,136 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
|
||||
m_Name: contm SDF - Variant
|
||||
m_EditorClassIdentifier:
|
||||
hashCode: -663352560
|
||||
material: {fileID: 6967724915443675501, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
materialHashCode: 753959088
|
||||
m_Version: 1.1.0
|
||||
m_SourceFontFileGUID: b9b37628356c3424d9c240aa7bf35289
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: b9b37628356c3424d9c240aa7bf35289, type: 3}
|
||||
m_SourceFontFile: {fileID: 0}
|
||||
m_AtlasPopulationMode: 0
|
||||
m_FaceInfo:
|
||||
m_FaceIndex: 0
|
||||
m_FamilyName: Continuum Medium
|
||||
m_StyleName: Regular
|
||||
m_PointSize: 90
|
||||
m_Scale: 1
|
||||
m_UnitsPerEM: 1000
|
||||
m_LineHeight: 112.41
|
||||
m_AscentLine: 90
|
||||
m_CapLine: 64
|
||||
m_MeanLine: 48
|
||||
m_Baseline: 0
|
||||
m_DescentLine: -22.410002
|
||||
m_SuperscriptOffset: 90
|
||||
m_SuperscriptSize: 0.5
|
||||
m_SubscriptOffset: -22.410002
|
||||
m_SubscriptSize: 0.5
|
||||
m_UnderlineOffset: -18.900002
|
||||
m_UnderlineThickness: 1.8000001
|
||||
m_StrikethroughOffset: 19.2
|
||||
m_StrikethroughThickness: 1.8000001
|
||||
m_TabWidth: 25
|
||||
m_GlyphTable: []
|
||||
m_CharacterTable: []
|
||||
m_AtlasTextures:
|
||||
- {fileID: -1484183440720196272, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_AtlasTextureIndex: 0
|
||||
m_IsMultiAtlasTexturesEnabled: 0
|
||||
m_ClearDynamicDataOnBuild: 0
|
||||
m_UsedGlyphRects: []
|
||||
m_FreeGlyphRects:
|
||||
- m_X: 0
|
||||
m_Y: 0
|
||||
m_Width: 1023
|
||||
m_Height: 1023
|
||||
m_fontInfo:
|
||||
Name:
|
||||
PointSize: 0
|
||||
Scale: 0
|
||||
CharacterCount: 0
|
||||
LineHeight: 0
|
||||
Baseline: 0
|
||||
Ascender: 0
|
||||
CapHeight: 0
|
||||
Descender: 0
|
||||
CenterLine: 0
|
||||
SuperscriptOffset: 0
|
||||
SubscriptOffset: 0
|
||||
SubSize: 0
|
||||
Underline: 0
|
||||
UnderlineThickness: 0
|
||||
strikethrough: 0
|
||||
strikethroughThickness: 0
|
||||
TabWidth: 0
|
||||
Padding: 0
|
||||
AtlasWidth: 0
|
||||
AtlasHeight: 0
|
||||
atlas: {fileID: 0}
|
||||
m_AtlasWidth: 1024
|
||||
m_AtlasHeight: 1024
|
||||
m_AtlasPadding: 9
|
||||
m_AtlasRenderMode: 4165
|
||||
m_glyphInfoList: []
|
||||
m_KerningTable:
|
||||
kerningPairs: []
|
||||
m_FontFeatureTable:
|
||||
m_GlyphPairAdjustmentRecords: []
|
||||
fallbackFontAssets: []
|
||||
m_FallbackFontAssetTable: []
|
||||
m_CreationSettings:
|
||||
sourceFontFileName:
|
||||
sourceFontFileGUID: 1a902f269eb0829468e18849bb4818f9
|
||||
pointSizeSamplingMode: 0
|
||||
pointSize: 90
|
||||
padding: 9
|
||||
packingMode: 0
|
||||
atlasWidth: 1024
|
||||
atlasHeight: 1024
|
||||
characterSetSelectionMode: 7
|
||||
characterSequence:
|
||||
referencedFontAssetGUID:
|
||||
referencedTextAssetGUID:
|
||||
fontStyle: 0
|
||||
fontStyleModifier: 0
|
||||
renderMode: 4165
|
||||
includeFontFeatures: 0
|
||||
m_FontWeightTable:
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
fontWeights: []
|
||||
normalStyle: 0
|
||||
normalSpacingOffset: 0
|
||||
boldStyle: 0.75
|
||||
boldSpacing: 7
|
||||
italicStyle: 35
|
||||
tabSize: 10
|
||||
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a902f269eb0829468e18849bb4818f9
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Continuum Medium
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/Common/Interfaces/ModelIndex.cs
Normal file
11
Assets/Common/Interfaces/ModelIndex.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// This enum is used to identify each of the SignLanguage models
|
||||
/// </summary>
|
||||
public enum ModelIndex
|
||||
{
|
||||
FINGERSPELLING,
|
||||
NONE
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 298e34c71d9e68260a1e06d1d4e94be1
|
||||
guid: 6dbd5e1100bc81648b52206df369d0a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
57
Assets/Common/Interfaces/ModelList.cs
Normal file
57
Assets/Common/Interfaces/ModelList.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Unity.Barracuda;
|
||||
/// <summary>
|
||||
/// This scriptable will hold tupples of Courseindices and models
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/ModelList")]
|
||||
public class ModelList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Small class to link a model to a courseIndex irrespective of its position in a list
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ModelTuple
|
||||
{
|
||||
/// <summary>
|
||||
/// ModelIndex to which the model corresponds
|
||||
/// </summary>
|
||||
public ModelIndex index;
|
||||
/// <summary>
|
||||
/// The model itself
|
||||
/// </summary>
|
||||
public NNModel model;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Index of the currently active model
|
||||
/// </summary>
|
||||
public int currentModelIndex = 0;
|
||||
|
||||
/// <summary>
|
||||
/// A list of all the models
|
||||
/// </summary>
|
||||
public List<ModelTuple> models = new List<ModelTuple>();
|
||||
|
||||
/// <summary>
|
||||
/// Get a model by modelindex
|
||||
/// </summary>
|
||||
/// <param name="modelIndex">ModelIndex of the model</param>
|
||||
/// <returns>Model associated with this index, null if no model was found</returns>
|
||||
public NNModel GetCurrentModel()
|
||||
{
|
||||
return models.Find(x => x.model == models[currentModelIndex].model)?.model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function to find a model-index in the list based on its index
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
public void SetCurrentModel(ModelIndex index)
|
||||
{
|
||||
currentModelIndex = models.FindIndex((m) => m.index == index);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85997561a67b3e740be145c96c4a0b37
|
||||
timeCreated: 1455294104
|
||||
licenseType: Store
|
||||
guid: 78a3f61c93a08c04496c49ffd10b9021
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.Barracuda;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
@@ -24,9 +23,9 @@ public class Theme : ScriptableObject
|
||||
public ThemeIndex index;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the model used in the SignPredictor
|
||||
/// The index of the model you want to use
|
||||
/// </summary>
|
||||
public NNModel model;
|
||||
public ModelIndex modelIndex;
|
||||
|
||||
/// <summary>
|
||||
/// List of all learnable words/letters
|
||||
|
||||
@@ -15,7 +15,7 @@ public class BackButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"CommonScripts",
|
||||
"InterfacesScripts",
|
||||
"Unity.TextMeshPro",
|
||||
"AccountsScripts"
|
||||
"AccountsScripts",
|
||||
"SignPredictor"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CourseActivityTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CourseMenuScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ListCoursesScreenTest
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MainMenuScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MiniGameActivityScreenTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StartGamesTests
|
||||
[UnityTest]
|
||||
public IEnumerator BootWithUsersTest()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
@@ -62,7 +62,7 @@ public class StartGamesTests
|
||||
public IEnumerator BootWithoutUsersTest()
|
||||
{
|
||||
// Arrange
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
string path = $"{Application.persistentDataPath}/users.json";
|
||||
var oneUser = "{}";
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(path))
|
||||
|
||||
@@ -15,7 +15,7 @@ public class UserButtonTests
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
string path = Path.Combine("Assets", "users.json");
|
||||
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))
|
||||
|
||||
@@ -183,15 +183,15 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Lessen
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_sharedMaterial: {fileID: 6967724915443675501, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_sharedMaterial: {fileID: -1030930060397404263, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4284235525
|
||||
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
|
||||
rgba: 4288255380
|
||||
m_fontColor: {r: 0.5803922, g: 0.58431375, b: 0.6, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@@ -244,7 +244,7 @@ MonoBehaviour:
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 51.252197, y: 0, z: 0, w: 0}
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
@@ -292,7 +292,7 @@ RectTransform:
|
||||
- {fileID: 766563566}
|
||||
- {fileID: 2105029353}
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
@@ -343,7 +343,7 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
- m_Target: {fileID: 906197780}
|
||||
m_TargetAssemblyTypeName: MainMenuScreen, Assembly-CSharp
|
||||
m_MethodName: GotoMinigames
|
||||
m_Mode: 1
|
||||
@@ -497,7 +497,7 @@ Camera:
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 1, g: 0, b: 0.3479104, a: 0.6666667}
|
||||
m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
@@ -545,143 +545,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &697512469
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 697512470}
|
||||
- component: {fileID: 697512472}
|
||||
- component: {fileID: 697512471}
|
||||
m_Layer: 5
|
||||
m_Name: Sign
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &697512470
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 697512469}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 219.96002, y: 229.45001}
|
||||
m_SizeDelta: {x: 539.9221, y: 314.80273}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &697512471
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 697512469}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 'Sign
|
||||
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 1abd0cd4bed0f2b4082734f91e1d4676, type: 2}
|
||||
m_sharedMaterial: {fileID: -599410478222915337, guid: 1abd0cd4bed0f2b4082734f91e1d4676, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 1
|
||||
m_colorMode: 1
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 0.9490197, g: 0.49803925, b: 0.04705883, a: 1}
|
||||
topRight: {r: 0.96862745, g: 0.6784314, b: 0.09803922, a: 1}
|
||||
bottomLeft: {r: 0.9490197, g: 0.49803925, b: 0.04705883, a: 1}
|
||||
bottomRight: {r: 0.96862745, g: 0.6784314, b: 0.09803922, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 297.6
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 415.96
|
||||
m_fontStyle: 2
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!222 &697512472
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 697512469}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &766563565
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -742,15 +605,15 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Spelletjes
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_sharedMaterial: {fileID: 6967724915443675501, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_sharedMaterial: {fileID: -1030930060397404263, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4284235525
|
||||
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
|
||||
rgba: 4288255380
|
||||
m_fontColor: {r: 0.5803922, g: 0.58431375, b: 0.6, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@@ -882,7 +745,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2823887524698191630, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 3
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2823887524698191630, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
@@ -980,22 +843,6 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5924386446566375588, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_Color.a
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5924386446566375588, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_Color.b
|
||||
value: 0.7411765
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5924386446566375588, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_Color.g
|
||||
value: 0.61960787
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5924386446566375588, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
propertyPath: m_Color.r
|
||||
value: 0.25882354
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
--- !u!224 &790881345 stripped
|
||||
@@ -1003,6 +850,141 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 2823887524698191630, guid: 53b0d00ac817ebf43b61bea2d160dd66, type: 3}
|
||||
m_PrefabInstance: {fileID: 790881344}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &830464405
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 830464406}
|
||||
- component: {fileID: 830464408}
|
||||
- component: {fileID: 830464407}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &830464406
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 830464405}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1377361015}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &830464407
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 830464405}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: x
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 64
|
||||
m_fontSizeBase: 64
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!222 &830464408
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 830464405}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &906197776
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1014,6 +996,7 @@ GameObject:
|
||||
- component: {fileID: 906197777}
|
||||
- component: {fileID: 906197779}
|
||||
- component: {fileID: 906197778}
|
||||
- component: {fileID: 906197780}
|
||||
m_Layer: 5
|
||||
m_Name: Panel
|
||||
m_TagString: Untagged
|
||||
@@ -1033,13 +1016,12 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1733122252}
|
||||
- {fileID: 1637175261}
|
||||
- {fileID: 108186281}
|
||||
- {fileID: 955994878}
|
||||
- {fileID: 790881345}
|
||||
- {fileID: 1377361015}
|
||||
- {fileID: 1339662403}
|
||||
- {fileID: 697512470}
|
||||
m_Father: {fileID: 1768150806}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1061,14 +1043,14 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -1086,6 +1068,19 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 906197776}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &906197780
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 906197776}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7cdd358c46e3f94398d91b7118e6d39, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
userList: {fileID: 11400000, guid: 072bec636a40f7e4e93b0ac624a3bda2, type: 2}
|
||||
--- !u!1 &955994877
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1120,11 +1115,11 @@ RectTransform:
|
||||
- {fileID: 1966196597}
|
||||
- {fileID: 991775368}
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -0.00024414, y: -330}
|
||||
m_AnchoredPosition: {x: 0, y: -330}
|
||||
m_SizeDelta: {x: 6434.104, y: 1862.9999}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &955994879
|
||||
@@ -1171,7 +1166,7 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
- m_Target: {fileID: 906197780}
|
||||
m_TargetAssemblyTypeName: MainMenuScreen, Assembly-CSharp
|
||||
m_MethodName: GotoSettings
|
||||
m_Mode: 1
|
||||
@@ -1297,143 +1292,6 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 991775367}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1339662402
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1339662403}
|
||||
- component: {fileID: 1339662405}
|
||||
- component: {fileID: 1339662404}
|
||||
m_Layer: 5
|
||||
m_Name: We
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1339662403
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339662402}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -272, y: 229.4483}
|
||||
m_SizeDelta: {x: 524.1782, y: 303.3211}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1339662404
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339662402}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 'We
|
||||
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 1abd0cd4bed0f2b4082734f91e1d4676, type: 2}
|
||||
m_sharedMaterial: {fileID: -599410478222915337, guid: 1abd0cd4bed0f2b4082734f91e1d4676, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4288255380
|
||||
m_fontColor: {r: 0.5803922, g: 0.58431375, b: 0.6, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 299.4
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 415.96
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!222 &1339662405
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1339662402}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1369063653
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1540,14 +1398,15 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 830464406}
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 10, y: -10}
|
||||
m_SizeDelta: {x: 100.8383, y: 85.0833}
|
||||
m_SizeDelta: {x: 64, y: 64}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &1377361016
|
||||
MonoBehaviour:
|
||||
@@ -1568,7 +1427,7 @@ MonoBehaviour:
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 0
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
@@ -1593,7 +1452,7 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
- m_Target: {fileID: 906197780}
|
||||
m_TargetAssemblyTypeName: MainMenuScreen, Assembly-CSharp
|
||||
m_MethodName: QuitApplication
|
||||
m_Mode: 1
|
||||
@@ -1618,16 +1477,16 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.96862745, g: 0.6784314, b: 0.09803922, a: 1}
|
||||
m_Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: d5ad855c08e83c3409a8053c8f886d54, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
@@ -1677,7 +1536,7 @@ RectTransform:
|
||||
- {fileID: 37409564}
|
||||
- {fileID: 1369063654}
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
@@ -1728,7 +1587,7 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
- m_Target: {fileID: 906197780}
|
||||
m_TargetAssemblyTypeName: MainMenuScreen, Assembly-CSharp
|
||||
m_MethodName: GotoCourses
|
||||
m_Mode: 1
|
||||
@@ -1778,7 +1637,7 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1637175260}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1673439370
|
||||
--- !u!1 &1733122251
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -1786,43 +1645,74 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1673439372}
|
||||
- component: {fileID: 1673439371}
|
||||
- component: {fileID: 1733122252}
|
||||
- component: {fileID: 1733122254}
|
||||
- component: {fileID: 1733122253}
|
||||
m_Layer: 0
|
||||
m_Name: MainMenuController
|
||||
m_Name: Logo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1673439371
|
||||
--- !u!224 &1733122252
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1733122251}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -3.073702}
|
||||
m_LocalScale: {x: 10, y: 8, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 906197777}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 220}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1733122253
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1673439370}
|
||||
m_GameObject: {fileID: 1733122251}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e7cdd358c46e3f94398d91b7118e6d39, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
userList: {fileID: 11400000, guid: 072bec636a40f7e4e93b0ac624a3bda2, type: 2}
|
||||
--- !u!4 &1673439372
|
||||
Transform:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: f4df4aae6f11d0c4487c9616f770b019, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1733122254
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1673439370}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_GameObject: {fileID: 1733122251}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1768150802
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1959,8 +1849,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 1067, y: 138}
|
||||
m_SizeDelta: {x: -949.823, y: -706.494}
|
||||
m_AnchoredPosition: {x: 700, y: 0}
|
||||
m_SizeDelta: {x: -1800, y: -640}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1966196598
|
||||
MonoBehaviour:
|
||||
@@ -1984,15 +1874,15 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: Instellingen
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_sharedMaterial: {fileID: 6967724915443675501, guid: 9f1c2e49d7e036a40a90afa6b1d4f421, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_sharedMaterial: {fileID: -1030930060397404263, guid: 3602bedf0ebe5b64596873f09eddf57b, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4284235525
|
||||
m_fontColor: {r: 0.019607844, g: 0.24705882, b: 0.36078432, a: 1}
|
||||
rgba: 4288255380
|
||||
m_fontColor: {r: 0.5803922, g: 0.58431375, b: 0.6, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
|
||||
@@ -16,6 +16,7 @@ MonoBehaviour:
|
||||
description: Van vis tot leeuw
|
||||
index: 2
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Walvis
|
||||
image: {fileID: 21300000, guid: 2b01165a5836ab14593d7a5862bd6793, type: 3}
|
||||
|
||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
||||
title: Kleren en Kleuren
|
||||
description: Van rok tot sok
|
||||
index: 1
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Blauw
|
||||
image: {fileID: 21300000, guid: 182fb89eba9c64041bef31ca35c4bcd8, type: 3}
|
||||
|
||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
||||
title: Familie
|
||||
description: Van generatie tot generatie
|
||||
index: 6
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Broer
|
||||
image: {fileID: 21300000, guid: eecf67266f150f1489717049489cf16d, type: 3}
|
||||
|
||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
||||
title: Groenten en Fruit
|
||||
description: Van kers tot pompoen
|
||||
index: 3
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Aardappel
|
||||
image: {fileID: 21300000, guid: 2610cdbc24a125f43ada7fed67d8f51b, type: 3}
|
||||
@@ -79,6 +81,6 @@ MonoBehaviour:
|
||||
- name: Tomaat
|
||||
image: {fileID: 21300000, guid: e16943962d961d948a0a6dc73ebf2b0b, type: 3}
|
||||
clip: {fileID: 32900000, guid: 7ca3dbd42b3033341b3c5c51059643f6, type: 3}
|
||||
- name: Wrotel
|
||||
- name: Wortel
|
||||
image: {fileID: 21300000, guid: 8962e03659a079546810c3ad9c8a211c, type: 3}
|
||||
clip: {fileID: 32900000, guid: ef9554901c0c6784e9102d5c1fd28a9a, type: 3}
|
||||
|
||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
||||
title: Hobbies
|
||||
description: Van schilderen tot reizen
|
||||
index: 4
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Dansen
|
||||
image: {fileID: 21300000, guid: 6d405f607ae817744b49f921f0611088, type: 3}
|
||||
|
||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
||||
title: Huis beschrijven
|
||||
description: Van zetel tot villa
|
||||
index: 5
|
||||
model: {fileID: 0}
|
||||
modelIndex: 1
|
||||
learnables:
|
||||
- name: Keuken
|
||||
image: {fileID: 21300000, guid: b17ce5bf59092b847b084d3400e7a1b4, type: 3}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:63c63e721f65ebb7d871cb9ef49f4752",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25"
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25",
|
||||
"GUID:d0b6b39a21908f94fbbd9f2c196a9725"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -56,8 +56,8 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
Course course = courseList.courses[index];
|
||||
|
||||
// vvv TEMPORARY STUFF vvv
|
||||
playButton.SetActive(course.theme.model != null);
|
||||
previewButton.SetActive(course.theme.model == null);
|
||||
playButton.SetActive(course.theme.modelIndex != ModelIndex.NONE);
|
||||
previewButton.SetActive(course.theme.modelIndex == ModelIndex.NONE);
|
||||
// ^^^ TEMPORARY STUFF ^^^
|
||||
|
||||
title.text = course.title;
|
||||
@@ -66,6 +66,7 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
//slider.value = progressValue;
|
||||
|
||||
// Set progress
|
||||
userList.Load();
|
||||
progress = userList.GetCurrentUser().GetCourseProgress(course.index);
|
||||
if (progress != null)
|
||||
progressBar.value = progress.Get<float>("courseProgress");
|
||||
|
||||
@@ -42,6 +42,7 @@ public class CourseMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
|
||||
// Recent courses
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ListCoursesScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
|
||||
foreach (Course course in courseList.courses)
|
||||
|
||||
@@ -17,6 +17,7 @@ public class MainMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
userList.Load();
|
||||
if (!File.Exists(UserList.PATH) || userList.GetUsers().Count <= 0)
|
||||
{
|
||||
SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserCreationScreen");
|
||||
|
||||
@@ -65,6 +65,7 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
GenerateContent();
|
||||
GenerateHighScores();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class UserButton : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
avatar.sprite = user.avatar;
|
||||
username.text = user.username;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
public class BasicTests
|
||||
{
|
||||
// A Test behaves as an ordinary method
|
||||
[Test]
|
||||
public void BasicTestsSimplePasses()
|
||||
{
|
||||
// Use the Assert class to test conditions
|
||||
}
|
||||
|
||||
// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use
|
||||
// `yield return null;` to skip a frame.
|
||||
[UnityTest]
|
||||
public IEnumerator BasicTestsWithEnumeratorPasses()
|
||||
{
|
||||
// Use the Assert class to test conditions.
|
||||
// Use yield to skip a frame.
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,10 @@
|
||||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"CommonScripts"
|
||||
"CommonScripts",
|
||||
"InterfacesScripts",
|
||||
"Unity.Barracuda",
|
||||
"SignPredictor"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
||||
80
Assets/Common/Tests/CourseListTest.cs
Normal file
80
Assets/Common/Tests/CourseListTest.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the CourseList class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class CourseListTest
|
||||
{
|
||||
private CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Setup a CourseList with all possible courses in the enum
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_Minigame()
|
||||
{
|
||||
courseList = ScriptableObject.CreateInstance<CourseList>();
|
||||
|
||||
// Add a course for each index in the enum
|
||||
|
||||
// Dumb way to access each index in the enum, couldn't find a different way to do it though
|
||||
foreach (var field in typeof(CourseIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
CourseIndex value = (CourseIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Course course = ScriptableObject.CreateInstance<Course>();
|
||||
// This is all we will need to distinguish
|
||||
course.index = value;
|
||||
course.title = name;
|
||||
|
||||
// Insert in front to guarantee that courseIndex will not line up with listIndex
|
||||
courseList.courses.Insert(0, course);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all courses can be correctly fetched via GetCourseByIndex
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestGetMinigameByIndex()
|
||||
{
|
||||
foreach (var field in typeof(CourseIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
CourseIndex value = (CourseIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Course m = courseList.GetCourseByIndex(value);
|
||||
|
||||
Assert.AreEqual(m.title, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all courses can be correctly set as current via SetCurrentCourse
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetCurrentMinigame()
|
||||
{
|
||||
foreach (var field in typeof(CourseIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
CourseIndex value = (CourseIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
courseList.SetCurrentCourse(value);
|
||||
|
||||
// Fetch the current course and check if its name is the same as the one we made into the current one
|
||||
Course m = courseList.courses[courseList.currentCourseIndex];
|
||||
|
||||
Assert.AreEqual(m.title, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Tests/CourseListTest.cs.meta
Normal file
11
Assets/Common/Tests/CourseListTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c340877c5585b545805be35e071e2fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Assets/Common/Tests/MinigameListTest.cs
Normal file
80
Assets/Common/Tests/MinigameListTest.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Test the MinigameList class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class MinigameListTest
|
||||
{
|
||||
private MinigameList minigameList;
|
||||
|
||||
/// <summary>
|
||||
/// Setup a minigameList with all possible minigames in the enum
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_Minigame()
|
||||
{
|
||||
minigameList = ScriptableObject.CreateInstance<MinigameList>();
|
||||
|
||||
// Add a minigame for each index in the enum
|
||||
|
||||
// Dumb way to access each index in the enum, couldn't find a different way to do it though
|
||||
foreach (var field in typeof(MinigameIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
MinigameIndex value = (MinigameIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Minigame m = ScriptableObject.CreateInstance<Minigame>();
|
||||
// This is all we will need to distinguish
|
||||
m.index = value;
|
||||
m.title = name;
|
||||
|
||||
// Insert in front to guarantee that MinigameIndex will not line up with listIndex
|
||||
minigameList.minigames.Insert(0, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all minigames can be correctly fetched via GetMinigameByIndex
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestGetMinigameByIndex()
|
||||
{
|
||||
foreach (var field in typeof(MinigameIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
MinigameIndex value = (MinigameIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Minigame m = minigameList.GetMinigameByIndex(value);
|
||||
|
||||
Assert.AreEqual(m.title, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all minigames can be correctly set as current via SetCurrentMinigame
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetCurrentMinigame()
|
||||
{
|
||||
foreach (var field in typeof(MinigameIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
MinigameIndex value = (MinigameIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
minigameList.SetCurrentMinigame(value);
|
||||
|
||||
// Fetch the current minigame and check if its name is the same as the one we made into the current one
|
||||
Minigame m = minigameList.minigames[minigameList.currentMinigameIndex];
|
||||
|
||||
Assert.AreEqual(m.title, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Tests/MinigameListTest.cs.meta
Normal file
11
Assets/Common/Tests/MinigameListTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee6e0c438a9ea5a44abcb8adb89c6e9b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Assets/Common/Tests/ModelListTest.cs
Normal file
80
Assets/Common/Tests/ModelListTest.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using NUnit.Framework;
|
||||
using Unity.Barracuda;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// Test the ModelList class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ModelListTest
|
||||
{
|
||||
private ModelList modelList;
|
||||
|
||||
/// <summary>
|
||||
/// Setup a ModelList with all possible Models in the enum
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_Model()
|
||||
{
|
||||
modelList = ScriptableObject.CreateInstance<ModelList>();
|
||||
|
||||
// Add a Model for each index in the enum
|
||||
|
||||
// Dumb way to access each index in the enum, couldn't find a different way to do it though
|
||||
foreach (var field in typeof(ModelIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
ModelIndex value = (ModelIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
ModelList.ModelTuple model = new ModelList.ModelTuple();
|
||||
// This is all we will need to distinguish
|
||||
model.index = value;
|
||||
|
||||
// Insert in front to guarantee that ModelIndex will not line up with listIndex
|
||||
modelList.models.Insert(0, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Check if current model can be correctly gotten as current via GetCurrentModel
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestGetCurrentModel()
|
||||
{
|
||||
System.Random random = new System.Random();
|
||||
ModelIndex value = (ModelIndex)random.Next(modelList.models.Count);
|
||||
modelList.SetCurrentModel(value);
|
||||
|
||||
Assert.AreEqual(modelList.models[modelList.currentModelIndex].model, modelList.GetCurrentModel());
|
||||
|
||||
// Check if empty model fails gracefully (returns null)
|
||||
Assert.IsNull(ScriptableObject.CreateInstance<ModelList>().GetCurrentModel());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all models can be correctly set as current via SetCurrentModel
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetCurrentModel()
|
||||
{
|
||||
foreach (var field in typeof(ModelIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
ModelIndex value = (ModelIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
modelList.SetCurrentModel(value);
|
||||
|
||||
// Fetch the current model and check if its name is the same as the one we made into the current one
|
||||
ModelList.ModelTuple m = modelList.models[modelList.currentModelIndex];
|
||||
|
||||
Assert.AreEqual(m.index, value);
|
||||
Assert.IsTrue(m.model is NNModel || m.model is null);
|
||||
}
|
||||
}
|
||||
ModelList emptyList = ScriptableObject.CreateInstance<ModelList>();
|
||||
emptyList.SetCurrentModel(ModelIndex.FINGERSPELLING);
|
||||
|
||||
Assert.IsTrue(emptyList.currentModelIndex == -1);
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Tests/ModelListTest.cs.meta
Normal file
11
Assets/Common/Tests/ModelListTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1313e0cc80244354eb6e2d0c1e891941
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/Common/Tests/ThemeListTest.cs
Normal file
60
Assets/Common/Tests/ThemeListTest.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// Test the ThemeList class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ThemeListTest
|
||||
{
|
||||
private ThemeList themeList;
|
||||
|
||||
/// <summary>
|
||||
/// Setup a ThemeList with all possible themes in the enum
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup_Minigame()
|
||||
{
|
||||
themeList = ScriptableObject.CreateInstance<ThemeList>();
|
||||
|
||||
// Add a theme for each index in the enum
|
||||
|
||||
// Dumb way to access each index in the enum, couldn't find a different way to do it though
|
||||
foreach (var field in typeof(ThemeIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
ThemeIndex value = (ThemeIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Theme theme = ScriptableObject.CreateInstance<Theme>();
|
||||
// This is all we will need to distinguish
|
||||
theme.index = value;
|
||||
theme.title = name;
|
||||
|
||||
// Insert in front to guarantee that themeIndex will not line up with listIndex
|
||||
themeList.themes.Insert(0, theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all themes can be correctly set as current via SetCurrentTheme
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetCurrentMinigame()
|
||||
{
|
||||
foreach (var field in typeof(ThemeIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
ThemeIndex value = (ThemeIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
themeList.SetCurrentTheme(value);
|
||||
|
||||
// Fetch the current theme and check if its name is the same as the one we made into the current one
|
||||
Theme m = themeList.themes[themeList.currentThemeIndex];
|
||||
|
||||
Assert.AreEqual(m.title, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Tests/ThemeListTest.cs.meta
Normal file
11
Assets/Common/Tests/ThemeListTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d1fb3d0097b3794eb1cbbe7a4577e1d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Common/Tests/ThemeTest.cs
Normal file
40
Assets/Common/Tests/ThemeTest.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// Test the Theme class
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ThemeTest
|
||||
{
|
||||
private Theme theme;
|
||||
private List<string> names = new List<string>() { "appel", "peer", "banaan" };
|
||||
/// <summary>
|
||||
/// Setup a theme with some learnables in it
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
theme = ScriptableObject.CreateInstance<Theme>();
|
||||
foreach (string name in names)
|
||||
{
|
||||
Learnable learnable = new Learnable();
|
||||
learnable.name = name;
|
||||
theme.learnables.Add(learnable);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Test if all the learnables are stored in the theme
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestThemeLearnables()
|
||||
{
|
||||
// Check if each of the learnables is kept
|
||||
foreach (Learnable learnable in theme.learnables)
|
||||
{
|
||||
names.Remove(learnable.name);
|
||||
}
|
||||
// Assert that all items have been checked
|
||||
Assert.IsTrue(names.Count == 0);
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Tests/ThemeTest.cs.meta
Normal file
11
Assets/Common/Tests/ThemeTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a5f73ff286a8624eb185a9d7a08cd1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -490,6 +490,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 6b3f784c065813a4a8364b1299284816, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
feedbackText: {fileID: 4318122121437849762}
|
||||
feedbackProgress: {fileID: 4318122121437849761}
|
||||
feedbackProgressImage: {fileID: 4318122121437849760}
|
||||
signPredictor: {fileID: 883853268}
|
||||
previewModel: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||
feedbackProgressBar: {fileID: 4318122121437849759}
|
||||
previewMessage: {fileID: 2070775951}
|
||||
@@ -501,9 +505,10 @@ MonoBehaviour:
|
||||
userList: {fileID: 11400000, guid: 072bec636a40f7e4e93b0ac624a3bda2, type: 2}
|
||||
courselist: {fileID: 11400000, guid: a7ab583094b7897468bbca9243717608, type: 2}
|
||||
ResultPanel: {fileID: 1383144366}
|
||||
ResultsTitle: {fileID: 822960079}
|
||||
ResultsDecription: {fileID: 100123246}
|
||||
CoursesButton: {fileID: 839294691}
|
||||
timeSpent: {fileID: 77614869}
|
||||
feedback: {fileID: 1714882683}
|
||||
--- !u!1 &361280475
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1220,8 +1225,8 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 301088551}
|
||||
m_TargetAssemblyTypeName: TemplateCourse, Assembly-CSharp
|
||||
- m_Target: {fileID: 1335886461}
|
||||
m_TargetAssemblyTypeName: BackButton, CommonScripts
|
||||
m_MethodName: Back
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
@@ -1299,10 +1304,11 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||
modelList: {fileID: 11400000, guid: 39516e4e6e56f0f4f80647d9c4d8034c, type: 2}
|
||||
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
||||
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
||||
screen: {fileID: 378145456}
|
||||
screen2: {fileID: 0}
|
||||
--- !u!4 &883853269
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1836,6 +1842,17 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 8299246693487308515, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
|
||||
m_PrefabInstance: {fileID: 1335886459}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1335886461 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 4518652150503380115, guid: 3bccdf365a4fbea4d8fa1aa461d3dc5c, type: 3}
|
||||
m_PrefabInstance: {fileID: 1335886459}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c3dd279b546423e4a8a1b28819a6c4a1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1383144366
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2249,17 +2266,6 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122119930585316, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1714882683 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122119930585317, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4318122121437849759}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 44e682a32ee15cc489bf50f3a06f717b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1773033262
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2835,6 +2841,10 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4318122119930585317, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4318122119930585317, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
propertyPath: signPredictor
|
||||
value:
|
||||
@@ -2862,3 +2872,36 @@ GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122119930585319, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &4318122121437849760 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122120334233319, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &4318122121437849761 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122119968934242, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &4318122121437849762 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 4318122120222767928, guid: 7c71c65ecb5fe0449a8b0d178987f016, type: 3}
|
||||
m_PrefabInstance: {fileID: 4318122121437849758}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
"AccountsScripts",
|
||||
"InterfacesScripts",
|
||||
"SignPredictor",
|
||||
"Unity.Barracuda"
|
||||
"Unity.Barracuda",
|
||||
"Tween",
|
||||
"SignPredictorInterfaces"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using Unity.Barracuda;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Video;
|
||||
using DigitalRuby.Tween;
|
||||
|
||||
/// <summary>
|
||||
/// TemplateCourse scene manager
|
||||
/// </summary>
|
||||
public class TemplateCourse : MonoBehaviour
|
||||
public class TemplateCourse : AbstractFeedback
|
||||
{
|
||||
// vvv TEMPORARY STUFF vvv
|
||||
public NNModel previewModel;
|
||||
@@ -87,6 +89,16 @@ public class TemplateCourse : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject ResultPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the title on the results panel
|
||||
/// </summary>
|
||||
public TMP_Text ResultsTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the description on the results panel
|
||||
/// </summary>
|
||||
public TMP_Text ResultsDecription;
|
||||
|
||||
/// <summary>
|
||||
/// Button to go back to courses list
|
||||
/// </summary>
|
||||
@@ -102,10 +114,37 @@ public class TemplateCourse : MonoBehaviour
|
||||
/// </summary>
|
||||
public TMP_Text timeSpent;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the feedback script on the Feedback prefab
|
||||
/// Reference to the feedback field
|
||||
/// </summary>
|
||||
public Feedback feedback;
|
||||
public TMP_Text feedbackText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar
|
||||
/// </summary>
|
||||
public Slider feedbackProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar image, so we can add fancy colors
|
||||
/// </summary>
|
||||
public Image feedbackProgressImage;
|
||||
|
||||
/// <summary>
|
||||
/// Timer to keep track of how long a incorrect sign is performed
|
||||
/// </summary>
|
||||
protected DateTime timer;
|
||||
|
||||
/// <summary>
|
||||
/// Current predicted sign
|
||||
/// </summary>
|
||||
protected string predictedSign = null;
|
||||
|
||||
/// <summary>
|
||||
/// Previous incorrect sign, so we can keep track whether the user is wrong or the user is still changing signs
|
||||
/// </summary>
|
||||
protected string previousIncorrectSign = null;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the script is initialised.
|
||||
@@ -114,20 +153,27 @@ public class TemplateCourse : MonoBehaviour
|
||||
/// Then it checks whether or not the User has started the course yet, to possibly create a new progress atribute for the course.
|
||||
/// Then it sets up the course-screen to display relevant information from the course-scriptable.
|
||||
/// </summary>
|
||||
void Awake()
|
||||
void Start()
|
||||
{
|
||||
StartGameController();
|
||||
|
||||
signPredictor.SetModel(course.theme.modelIndex);
|
||||
AddSelfAsListener();
|
||||
}
|
||||
|
||||
public void StartGameController()
|
||||
{
|
||||
// Setting up course
|
||||
course = courselist.courses[courselist.currentCourseIndex];
|
||||
feedback.signPredictor.model = course.theme.model;
|
||||
maxWords = course.theme.learnables.Count;
|
||||
|
||||
// vvv TEMPORARY STUFF vvv
|
||||
feedbackProgressBar.SetActive(course.theme.model != null);
|
||||
previewMessage.SetActive(course.theme.model == null);
|
||||
feedback.signPredictor.model = previewModel;
|
||||
feedbackProgressBar.SetActive(course.theme.modelIndex != ModelIndex.NONE);
|
||||
previewMessage.SetActive(course.theme.modelIndex == ModelIndex.NONE);
|
||||
// ^^^ TEMPORARY STUFF ^^^
|
||||
|
||||
// Create entry in current user for keeping track of progress
|
||||
userList.Load();
|
||||
user = userList.GetCurrentUser();
|
||||
progress = user.GetCourseProgress(course.index);
|
||||
if (progress == null)
|
||||
@@ -152,23 +198,6 @@ public class TemplateCourse : MonoBehaviour
|
||||
ResultPanel.SetActive(false);
|
||||
// Set the startTime
|
||||
startMoment = DateTime.Now;
|
||||
|
||||
// Set callbacks
|
||||
feedback.getSignCallback = () =>
|
||||
{
|
||||
if (currentWordIndex < course.theme.learnables.Count)
|
||||
{
|
||||
return course.theme.learnables[currentWordIndex].name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
feedback.predictSignCallback = (sign) =>
|
||||
{
|
||||
if (sign == course.theme.learnables[currentWordIndex].name)
|
||||
{
|
||||
NextSign();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -259,6 +288,12 @@ public class TemplateCourse : MonoBehaviour
|
||||
// Show the "finished" screen
|
||||
ResultPanel.SetActive(true);
|
||||
|
||||
// Set the correct title
|
||||
ResultsTitle.text = course.title + " voltooid!";
|
||||
|
||||
// Set the correct description
|
||||
ResultsDecription.text = "Goed gedaan! Je kan nu spelletjes spelen met " + course.title + " om verder te oefenen!";
|
||||
|
||||
// Set the total time spent UI
|
||||
TimeSpan time = DateTime.Now - startMoment;
|
||||
timeSpent.text = time.ToString(@"hh\:mm\:ss");
|
||||
@@ -269,4 +304,98 @@ public class TemplateCourse : MonoBehaviour
|
||||
progress.AddOrUpdate<float>("courseProgress", 1f);
|
||||
userList.Save();
|
||||
}
|
||||
|
||||
protected override IEnumerator UpdateFeedback()
|
||||
{
|
||||
// Get current sign
|
||||
string currentSign = course.theme.learnables[currentWordIndex].name;
|
||||
// Get the predicted sign
|
||||
if (signPredictor != null && signPredictor.learnableProbabilities != null &&
|
||||
currentSign != null && signPredictor.learnableProbabilities.ContainsKey(currentSign))
|
||||
{
|
||||
float accuracy = signPredictor.learnableProbabilities[currentSign];
|
||||
if (feedbackText != null && feedbackProgressImage != null)
|
||||
{
|
||||
if (accuracy > 0.90)
|
||||
{
|
||||
feedbackText.text = "Goed";
|
||||
feedbackText.color = Color.green;
|
||||
feedbackProgressImage.color = Color.green;
|
||||
}
|
||||
else if (accuracy > 0.80)
|
||||
{
|
||||
feedbackText.text = "Bijna...";
|
||||
Color col = new Color(0xff / 255.0f, 0x66 / 255.0f, 0x00 / 255.0f);
|
||||
feedbackText.color = col;
|
||||
feedbackProgressImage.color = col;
|
||||
}
|
||||
else
|
||||
{
|
||||
feedbackText.text = "Detecteren...";
|
||||
feedbackText.color = Color.red;
|
||||
feedbackProgressImage.color = Color.red;
|
||||
}
|
||||
|
||||
float oldValue = feedbackProgress.value;
|
||||
// use an exponential scale
|
||||
float newValue = Mathf.Exp(4 * (accuracy - 1.0f));
|
||||
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
|
||||
{
|
||||
if (feedbackProgress != null)
|
||||
{
|
||||
feedbackProgress.value = t.CurrentValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check whether (in)correct sign has high accuracy
|
||||
foreach (var kv in signPredictor.learnableProbabilities)
|
||||
{
|
||||
if (kv.Value > 0.90)
|
||||
{
|
||||
predictedSign = kv.Key;
|
||||
// Correct sign
|
||||
if (predictedSign == currentSign)
|
||||
{
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
CheckEquality(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
// Incorrect sign
|
||||
else
|
||||
{
|
||||
if (previousIncorrectSign != predictedSign)
|
||||
{
|
||||
timer = DateTime.Now;
|
||||
previousIncorrectSign = predictedSign;
|
||||
}
|
||||
else if (DateTime.Now - timer > TimeSpan.FromSeconds(2.0f))
|
||||
{
|
||||
CheckEquality(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (feedbackProgress != null)
|
||||
{
|
||||
|
||||
feedbackProgress.value = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CheckEquality(string predicted)
|
||||
{
|
||||
if(predicted == course.theme.learnables[currentWordIndex].name)
|
||||
{
|
||||
NextSign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -2570,7 +2570,7 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &896343212
|
||||
GameObject:
|
||||
@@ -3507,7 +3507,7 @@ RectTransform:
|
||||
- {fileID: 1892638588}
|
||||
- {fileID: 56162990}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@@ -3526,6 +3526,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 2db44635e0eb1e9429a2e6195785364d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
feedbackText: {fileID: 5233312448025626833}
|
||||
feedbackProgress: {fileID: 5233312447201393291}
|
||||
feedbackProgressImage: {fileID: 5233312447919013134}
|
||||
signPredictor: {fileID: 1991376311}
|
||||
themelist: {fileID: 11400000, guid: a247e2ce790f0f746a3bc521e6ab7d58, type: 2}
|
||||
letterPrefab: {fileID: 4639383499500021565, guid: c3e66e8957864914cb022af914df6a28, type: 3}
|
||||
letterContainer: {fileID: 1870283439}
|
||||
@@ -3545,11 +3549,11 @@ MonoBehaviour:
|
||||
wordsText: {fileID: 1704021883}
|
||||
scoreText: {fileID: 90551462}
|
||||
minigame: {fileID: 11400000, guid: 165c1d9867275924d9720d409e935f95, type: 2}
|
||||
minigamelist: {fileID: 11400000, guid: 51453f9b41bc72f468ba3e67ab622f8f, type: 2}
|
||||
userList: {fileID: 11400000, guid: 072bec636a40f7e4e93b0ac624a3bda2, type: 2}
|
||||
Scoreboard: {fileID: 1007532375}
|
||||
EntriesGrid: {fileID: 1391137944}
|
||||
scoreboardEntry: {fileID: 9154151134820372555, guid: d4a3a228b08d61847acc6da35b44e52c, type: 3}
|
||||
feedback: {fileID: 5233312447513285388}
|
||||
gottogamebutton: {fileID: 1581633295}
|
||||
--- !u!1001 &1290865991
|
||||
PrefabInstance:
|
||||
@@ -6244,7 +6248,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||
modelList: {fileID: 11400000, guid: 39516e4e6e56f0f4f80647d9c4d8034c, type: 2}
|
||||
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
||||
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
||||
screen: {fileID: 1649505745}
|
||||
@@ -6262,7 +6266,7 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2001212056
|
||||
GameObject:
|
||||
@@ -6565,22 +6569,6 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &5233312447513285388
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5233312447513285390}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 44e682a32ee15cc489bf50f3a06f717b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
feedbackText: {fileID: 0}
|
||||
feedbackProgress: {fileID: 0}
|
||||
feedbackProgressImage: {fileID: 0}
|
||||
signPredictor: {fileID: 1991376311}
|
||||
--- !u!224 &5233312447513285389
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -6596,7 +6584,7 @@ RectTransform:
|
||||
- {fileID: 5233312448025626847}
|
||||
- {fileID: 5233312447201393292}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
@@ -6612,7 +6600,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5233312447513285389}
|
||||
- component: {fileID: 5233312447513285388}
|
||||
m_Layer: 5
|
||||
m_Name: Feedback
|
||||
m_TagString: Untagged
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using DigitalRuby.Tween;
|
||||
|
||||
public class HangmanGameController : MonoBehaviour
|
||||
public class HangmanGameController : AbstractFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// The scriptable with all the themes, will be used to select a random word for hangman.
|
||||
@@ -160,6 +161,12 @@ public class HangmanGameController : MonoBehaviour
|
||||
/// </summary>
|
||||
public Minigame minigame;
|
||||
|
||||
/// <summary>
|
||||
/// We keep the minigamelist as well so that the minigame-index doesn't get reset
|
||||
/// DO NOT REMOVE
|
||||
/// </summary>
|
||||
public MinigameList minigamelist;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the user list to access the current user
|
||||
/// </summary>
|
||||
@@ -195,11 +202,6 @@ public class HangmanGameController : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject scoreboardEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Accuracy feeback object
|
||||
/// </summary>
|
||||
public Feedback feedback;
|
||||
|
||||
/// <summary>
|
||||
/// The button to go into the game
|
||||
/// </summary>
|
||||
@@ -210,8 +212,48 @@ public class HangmanGameController : MonoBehaviour
|
||||
/// </summary>
|
||||
private String currentsign = "";
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the feedback field
|
||||
/// </summary>
|
||||
public TMP_Text feedbackText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar
|
||||
/// </summary>
|
||||
public Slider feedbackProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar image, so we can add fancy colors
|
||||
/// </summary>
|
||||
public Image feedbackProgressImage;
|
||||
|
||||
/// <summary>
|
||||
/// Timer to keep track of how long a incorrect sign is performed
|
||||
/// </summary>
|
||||
protected DateTime timer;
|
||||
|
||||
/// <summary>
|
||||
/// Current predicted sign
|
||||
/// </summary>
|
||||
protected string predictedSign = null;
|
||||
|
||||
/// <summary>
|
||||
/// Previous incorrect sign, so we can keep track whether the user is wrong or the user is still changing signs
|
||||
/// </summary>
|
||||
protected string previousIncorrectSign = null;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
StartController();
|
||||
|
||||
signPredictor.SetModel(ModelIndex.FINGERSPELLING);
|
||||
AddSelfAsListener();
|
||||
}
|
||||
/// <summary>
|
||||
/// Called at the start of the scene AND when the scene is replayed
|
||||
/// </summary>
|
||||
public void StartController()
|
||||
{
|
||||
// Make sure the mode starts at zero
|
||||
mode = 0;
|
||||
@@ -223,6 +265,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
playerPanel.SetActive(true);
|
||||
|
||||
// Create entry in current user for keeping track of progress
|
||||
userList.Load();
|
||||
user = userList.GetCurrentUser();
|
||||
Progress progress = user.GetMinigameProgress(minigame.index);
|
||||
if (progress == null)
|
||||
@@ -234,16 +277,6 @@ public class HangmanGameController : MonoBehaviour
|
||||
user.minigames.Add(progress);
|
||||
}
|
||||
userList.Save();
|
||||
|
||||
// Set calllbacks
|
||||
feedback.getSignCallback = () =>
|
||||
{
|
||||
return "A";
|
||||
};
|
||||
feedback.predictSignCallback = (sign) =>
|
||||
{
|
||||
currentsign = sign;
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -272,7 +305,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
DeleteWord();
|
||||
DisplayWord(currentWord);
|
||||
|
||||
replayButton.onClick.AddListener(Start);
|
||||
replayButton.onClick.AddListener(StartController);
|
||||
// Call to display the first image, corresponding to a clean image.
|
||||
ChangeSprite();
|
||||
}
|
||||
@@ -331,7 +364,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
public void TwoPlayer()
|
||||
{
|
||||
if (currentWord.Length >= 2)
|
||||
{
|
||||
{
|
||||
StartGame();
|
||||
}
|
||||
}
|
||||
@@ -341,9 +374,9 @@ public class HangmanGameController : MonoBehaviour
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if(mode == 1)
|
||||
{
|
||||
if (currentsign != "")
|
||||
if (mode == 1)
|
||||
{
|
||||
if (currentsign != "" && currentsign != null)
|
||||
{
|
||||
char letter = currentsign.ToLower()[0];
|
||||
currentsign = "";
|
||||
@@ -359,7 +392,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
if (Input.GetKey(KeyCode.Backspace))
|
||||
{
|
||||
// Remove the last letter from the currentword
|
||||
if(currentWord.Length > 0)
|
||||
if (currentWord.Length > 0)
|
||||
{
|
||||
currentWord = currentWord.Substring(0, currentWord.Length - 1);
|
||||
inputTextField.text = currentWord.ToString();
|
||||
@@ -372,7 +405,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
inputTextField.text = currentWord.ToString();
|
||||
}
|
||||
}
|
||||
gottogamebutton.SetActive(currentWord.Length >2);
|
||||
gottogamebutton.SetActive(currentWord.Length > 2);
|
||||
}
|
||||
|
||||
if (mode == 2)
|
||||
@@ -384,7 +417,7 @@ public class HangmanGameController : MonoBehaviour
|
||||
// For the first input char given by the user, check if the letter is in the word that needs to be spelled.
|
||||
|
||||
// Check to make sure the inputfield is not empty
|
||||
if (currentsign != "")
|
||||
if (currentsign != null && currentsign != "")
|
||||
{
|
||||
char firstLetter = currentsign.ToLower()[0];
|
||||
currentsign = "";
|
||||
@@ -534,21 +567,6 @@ public class HangmanGameController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randomly shuffle the list of words
|
||||
/// </summary>
|
||||
private void ShuffleWords()
|
||||
{
|
||||
for (int i = words.Length - 1; i > 0; i--)
|
||||
{
|
||||
// Generate a random index between 0 and i (inclusive)
|
||||
int j = UnityEngine.Random.Range(0, i + 1);
|
||||
|
||||
// Swap the values at indices i and j
|
||||
(words[j], words[i]) = (words[i], words[j]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update and save the scores
|
||||
/// </summary>
|
||||
@@ -722,4 +740,94 @@ public class HangmanGameController : MonoBehaviour
|
||||
rank++;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerator UpdateFeedback()
|
||||
{
|
||||
// Get current sign
|
||||
string currentSign = "A";
|
||||
// Get the predicted sign
|
||||
if (signPredictor != null && signPredictor.learnableProbabilities != null &&
|
||||
currentSign != null && signPredictor.learnableProbabilities.ContainsKey(currentSign))
|
||||
{
|
||||
float accuracy = signPredictor.learnableProbabilities[currentSign];
|
||||
if (feedbackText != null && feedbackProgressImage != null)
|
||||
{
|
||||
if (accuracy > 0.90)
|
||||
{
|
||||
feedbackText.text = "Goed";
|
||||
feedbackText.color = Color.green;
|
||||
feedbackProgressImage.color = Color.green;
|
||||
}
|
||||
else if (accuracy > 0.80)
|
||||
{
|
||||
feedbackText.text = "Bijna...";
|
||||
Color col = new Color(0xff / 255.0f, 0x66 / 255.0f, 0x00 / 255.0f);
|
||||
feedbackText.color = col;
|
||||
feedbackProgressImage.color = col;
|
||||
}
|
||||
else
|
||||
{
|
||||
feedbackText.text = "Detecteren...";
|
||||
feedbackText.color = Color.red;
|
||||
feedbackProgressImage.color = Color.red;
|
||||
}
|
||||
|
||||
float oldValue = feedbackProgress.value;
|
||||
// use an exponential scale
|
||||
float newValue = Mathf.Exp(4 * (accuracy - 1.0f));
|
||||
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
|
||||
{
|
||||
if (feedbackProgress != null)
|
||||
{
|
||||
feedbackProgress.value = t.CurrentValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check whether (in)correct sign has high accuracy
|
||||
foreach (var kv in signPredictor.learnableProbabilities)
|
||||
{
|
||||
if (kv.Value > 0.90)
|
||||
{
|
||||
predictedSign = kv.Key;
|
||||
// Correct sign
|
||||
if (predictedSign == currentSign)
|
||||
{
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
CheckEquality(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
// Incorrect sign
|
||||
else
|
||||
{
|
||||
if (previousIncorrectSign != predictedSign)
|
||||
{
|
||||
timer = DateTime.Now;
|
||||
previousIncorrectSign = predictedSign;
|
||||
}
|
||||
else if (DateTime.Now - timer > TimeSpan.FromSeconds(2.0f))
|
||||
{
|
||||
CheckEquality(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (feedbackProgress != null)
|
||||
{
|
||||
|
||||
feedbackProgress.value = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
private void CheckEquality(string sign)
|
||||
{
|
||||
currentsign = sign;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
18
Assets/JustSign/ScriptableObjects/Graceland.asset
Normal file
18
Assets/JustSign/ScriptableObjects/Graceland.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cd3d1c3a6cf7ef07abb343f8862a7435, type: 3}
|
||||
m_Name: Graceland
|
||||
m_EditorClassIdentifier:
|
||||
firstSymbolTime: 0.5
|
||||
spawnPeriod: 2
|
||||
duration: 127
|
||||
song: {fileID: 8300000, guid: e01ded5e221494bdbaab8674c0354f64, type: 3}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1abd0cd4bed0f2b4082734f91e1d4676
|
||||
guid: 7a55c88547b9345fe87aecd1398550c9
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
18
Assets/JustSign/ScriptableObjects/SongList.asset
Normal file
18
Assets/JustSign/ScriptableObjects/SongList.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ceeae47a3efc2206299ddf1cc31043c2, type: 3}
|
||||
m_Name: SongList
|
||||
m_EditorClassIdentifier:
|
||||
currentSongIndex: 0
|
||||
songs:
|
||||
- {fileID: 11400000, guid: 0f5b5e156c628bf189df5723ad2aab96, type: 2}
|
||||
- {fileID: 11400000, guid: 7a55c88547b9345fe87aecd1398550c9, type: 2}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f1c2e49d7e036a40a90afa6b1d4f421
|
||||
guid: 4f0ce70309bb901feb28199a82a7d195
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
18
Assets/JustSign/ScriptableObjects/SunnySafari.asset
Normal file
18
Assets/JustSign/ScriptableObjects/SunnySafari.asset
Normal file
@@ -0,0 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cd3d1c3a6cf7ef07abb343f8862a7435, type: 3}
|
||||
m_Name: SunnySafari
|
||||
m_EditorClassIdentifier:
|
||||
firstSymbolTime: 1.3
|
||||
spawnPeriod: 1.99
|
||||
duration: 164
|
||||
song: {fileID: 8300000, guid: d7ca1b558b7b064cdb6f9d6c951b1522, type: 3}
|
||||
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 493623c166a735445b4283396018d38b
|
||||
guid: 0f5b5e156c628bf189df5723ad2aab96
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -40,6 +41,23 @@ public class JustSignController : MonoBehaviour
|
||||
/// </summary>
|
||||
public Minigame minigame;
|
||||
|
||||
/// <summary>
|
||||
/// We keep the minigamelist as well so that the minigame-index doesn't get reset
|
||||
/// DO NOT REMOVE
|
||||
/// </summary>
|
||||
public MinigameList minigamelist;
|
||||
|
||||
/// </summary>
|
||||
/// Reference to the list of available songs
|
||||
/// </summary>
|
||||
public SongList songList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the currently used song
|
||||
/// </summary>
|
||||
private Song currentSong;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The zone that the player should be hitting with his or her inputs
|
||||
/// </summary>
|
||||
@@ -55,11 +73,6 @@ public class JustSignController : MonoBehaviour
|
||||
/// </summary>
|
||||
public Transform symbolContainer;
|
||||
|
||||
/// <summary>
|
||||
/// All of the available themes
|
||||
/// </summary>
|
||||
private ThemeList themeList;
|
||||
|
||||
/// <summary>
|
||||
/// The theme we are currently using
|
||||
/// </summary>
|
||||
@@ -80,6 +93,11 @@ public class JustSignController : MonoBehaviour
|
||||
/// </summary>
|
||||
private int score;
|
||||
|
||||
/// <summary>
|
||||
/// Have the symbols started spawning or not
|
||||
/// </summary>
|
||||
private bool gameIsActive = false;
|
||||
|
||||
/// <summary>
|
||||
/// Width and height of the symbols
|
||||
/// </summary>
|
||||
@@ -146,22 +164,150 @@ public class JustSignController : MonoBehaviour
|
||||
private float lastSpawn;
|
||||
|
||||
/// <summary>
|
||||
/// Determines every how many seconds a symbol should spawn (will become music-dependent later on)
|
||||
/// Time at which the game started, needed to know when to stop
|
||||
/// </summary>
|
||||
private float spawnPeriod = 3.0f;
|
||||
private float beginTime;
|
||||
|
||||
/// <summary>
|
||||
/// Time at which the last symbol should spawn
|
||||
/// </summary>
|
||||
private float lastSymbolTime;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many signs get you score "perfect"
|
||||
/// </summary>
|
||||
private int perfectSigns;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many signs get you score "good"
|
||||
/// </summary>
|
||||
private int goodSigns;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many signs get you score "meh"
|
||||
/// </summary>
|
||||
private int mehSigns;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many signs get you score "perfect"
|
||||
/// </summary>
|
||||
private int terribleSigns;
|
||||
|
||||
/// <summary>
|
||||
/// Counter that keeps track of how many signs done incorrectly
|
||||
/// </summary>
|
||||
private int incorrectSigns;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scoreboard entries container
|
||||
/// </summary>
|
||||
public Transform scoreboardEntriesContainer;
|
||||
|
||||
/// <summary>
|
||||
/// The GameObjects representing the letters
|
||||
/// </summary>
|
||||
private List<GameObject> scoreboardEntries = new List<GameObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the ScoreboardEntry prefab
|
||||
/// </summary>
|
||||
public GameObject scoreboardEntry;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the user list to access the current user
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the current user
|
||||
/// </summary>
|
||||
private User user;
|
||||
|
||||
/// <summary>
|
||||
/// LPM
|
||||
/// </summary>
|
||||
public TMP_Text lpmText;
|
||||
|
||||
/// <summary>
|
||||
/// Perfect Signs Score
|
||||
/// </summary>
|
||||
public TMP_Text perfectSignsText;
|
||||
|
||||
/// <summary>
|
||||
/// Good Signs Score
|
||||
/// </summary>
|
||||
public TMP_Text goodSignsText;
|
||||
|
||||
/// <summary>
|
||||
/// Meh Signs Score
|
||||
/// </summary>
|
||||
public TMP_Text mehSignsText;
|
||||
|
||||
/// <summary>
|
||||
/// Perfect Signs Score
|
||||
/// </summary>
|
||||
public TMP_Text terribleSignsText;
|
||||
|
||||
/// <summary>
|
||||
/// Signs that were not found
|
||||
/// </summary>
|
||||
public TMP_Text notFoundSignsText;
|
||||
|
||||
/// <summary>
|
||||
/// Score
|
||||
/// </summary>
|
||||
public TMP_Text scoreText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the gameEnded panel, so we can update its display
|
||||
/// </summary>
|
||||
public GameObject gameEndedPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
perfectSigns = 0;
|
||||
goodSigns = 0;
|
||||
mehSigns = 0;
|
||||
terribleSigns = 0;
|
||||
incorrectSigns = 0;
|
||||
score = 0;
|
||||
gameEndedPanel.SetActive(false);
|
||||
// Create entry in current user for keeping track of progress
|
||||
userList.Load();
|
||||
user = userList.GetCurrentUser();
|
||||
Progress progress = user.GetMinigameProgress(minigame.index);
|
||||
if (progress == null)
|
||||
{
|
||||
progress = new Progress();
|
||||
progress.AddOrUpdate<MinigameIndex>("minigameIndex", minigame.index);
|
||||
progress.AddOrUpdate<List<Score>>("highestScores", new List<Score>());
|
||||
progress.AddOrUpdate<List<Score>>("latestScores", new List<Score>());
|
||||
user.minigames.Add(progress);
|
||||
}
|
||||
userList.Save();
|
||||
|
||||
scoreDisplay.text = "Score: " + score.ToString();
|
||||
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
||||
words.AddRange(currentTheme.learnables);
|
||||
//currentTheme = FindThemeByName(PlayerPrefs.GetString("themeName"));
|
||||
//words = currentTheme.words;
|
||||
lastSpawn = Time.time;
|
||||
SpawnNewSymbol();
|
||||
currentSong = songList.songs[songList.currentSongIndex];
|
||||
AudioSource.PlayClipAtPoint(currentSong.song, Vector3.zero, 1.0f);
|
||||
beginTime = Time.time;
|
||||
lastSymbolTime = beginTime + currentSong.duration - 1920.0f / moveSpeed;
|
||||
|
||||
StartCoroutine(WaitThenStart(currentSong.firstSymbolTime));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wait for a given amount of time (specified in song) before spawning symbols
|
||||
/// </summary>
|
||||
IEnumerator WaitThenStart(float nrOfSeconds)
|
||||
{
|
||||
//yield on a new YieldInstruction that waits for nrOfSeconds seconds
|
||||
yield return new WaitForSeconds(nrOfSeconds);
|
||||
gameIsActive = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -169,56 +315,86 @@ public class JustSignController : MonoBehaviour
|
||||
/// </summary>
|
||||
void Update()
|
||||
{
|
||||
int matchedSymbolIndex = -1;
|
||||
for (int i = 0; i < activeWords.Count; i++) {
|
||||
if (activeWords[i].ToLower() == answerField.text.ToLower()) {
|
||||
matchedSymbolIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy the oldest symbol if the current input matches it
|
||||
if (matchedSymbolIndex >= 0) {
|
||||
int difference = Math.Abs((int) (activeSymbols[matchedSymbolIndex].transform.position.x - hitZone.transform.position.x));
|
||||
if (difference < perfectBoundary) {
|
||||
feedBack.text = "Perfect!";
|
||||
score += perfectScore;
|
||||
} else if (difference < goodBoundary) {
|
||||
feedBack.text = "Good!";
|
||||
score += goodScore;
|
||||
} else if (difference < mehBoundary) {
|
||||
feedBack.text = "Meh...";
|
||||
score += mehScore;
|
||||
} else {
|
||||
feedBack.text = "Terrible!";
|
||||
score += terribleScore;
|
||||
if (gameIsActive) {
|
||||
int matchedSymbolIndex = -1;
|
||||
for (int i = 0; i < activeWords.Count; i++) {
|
||||
if (activeWords[i].ToLower() == answerField.text.ToLower()) {
|
||||
matchedSymbolIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
DestroySymbolAt(matchedSymbolIndex);
|
||||
answerField.text = "";
|
||||
}
|
||||
// Destroy the oldest symbol if the current input matches it
|
||||
if (matchedSymbolIndex >= 0) {
|
||||
int difference = Math.Abs((int) (activeSymbols[matchedSymbolIndex].transform.position.x - hitZone.transform.position.x));
|
||||
if (difference < perfectBoundary) {
|
||||
feedBack.text = "Perfect!";
|
||||
perfectSigns++;
|
||||
score += perfectScore;
|
||||
} else if (difference < goodBoundary) {
|
||||
feedBack.text = "Good!";
|
||||
goodSigns++;
|
||||
score += goodScore;
|
||||
} else if (difference < mehBoundary) {
|
||||
feedBack.text = "Meh...";
|
||||
mehSigns++;
|
||||
score += mehScore;
|
||||
} else {
|
||||
feedBack.text = "Terrible!";
|
||||
terribleSigns++;
|
||||
score += terribleScore;
|
||||
}
|
||||
|
||||
// Destroy the oldest symbol if it leaves the screen
|
||||
if (activeSymbols.Count > 0) {
|
||||
if (activeSymbols[0].GetComponent<RectTransform>().localPosition.x > -trackX) {
|
||||
DestroySymbolAt(0);
|
||||
score += offscreenScore;
|
||||
DestroySymbolAt(matchedSymbolIndex);
|
||||
answerField.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn new symbol every spawn period
|
||||
float currentTime = Time.time;
|
||||
if (currentTime - lastSpawn > spawnPeriod) {
|
||||
lastSpawn = currentTime;
|
||||
SpawnNewSymbol();
|
||||
}
|
||||
// Destroy the oldest symbol if it leaves the screen
|
||||
if (activeSymbols.Count > 0) {
|
||||
if (activeSymbols[0].GetComponent<RectTransform>().localPosition.x > -trackX) {
|
||||
DestroySymbolAt(0);
|
||||
incorrectSigns++;
|
||||
feedBack.text = "Te laat!";
|
||||
score += offscreenScore;
|
||||
}
|
||||
}
|
||||
|
||||
// Move all active symbols to the right
|
||||
foreach (GameObject symbol in activeSymbols) {
|
||||
RectTransform rectTransform = symbol.GetComponent<RectTransform>();
|
||||
rectTransform.localPosition = new Vector3(rectTransform.localPosition.x + Time.deltaTime * moveSpeed, trackY, 0);
|
||||
}
|
||||
// Spawn new symbol every spawn period
|
||||
float currentTime = Time.time;
|
||||
if (currentTime - lastSpawn > currentSong.spawnPeriod && lastSymbolTime > currentTime) {
|
||||
lastSpawn = currentTime;
|
||||
SpawnNewSymbol();
|
||||
}
|
||||
|
||||
scoreDisplay.text = "Score: " + score.ToString();
|
||||
// Check if the song has ended and activate scorescreen if it has
|
||||
if (currentTime - beginTime > currentSong.duration) {
|
||||
ActivateEnd();
|
||||
}
|
||||
|
||||
// Move all active symbols to the right
|
||||
foreach (GameObject symbol in activeSymbols) {
|
||||
RectTransform rectTransform = symbol.GetComponent<RectTransform>();
|
||||
rectTransform.localPosition = new Vector3(rectTransform.localPosition.x + Time.deltaTime * moveSpeed, trackY, 0);
|
||||
}
|
||||
|
||||
scoreDisplay.text = "Score: " + score.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display Scoreboard + Metrics
|
||||
/// </summary>
|
||||
public void ActivateEnd()
|
||||
{
|
||||
gameIsActive = false;
|
||||
while (activeSymbols.Count > 0)
|
||||
{
|
||||
DestroySymbolAt(0);
|
||||
}
|
||||
// TODO: Scoreboard
|
||||
SaveScores();
|
||||
SetScoreMetrics();
|
||||
SetScoreBoard();
|
||||
gameEndedPanel.SetActive(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -264,4 +440,169 @@ public class JustSignController : MonoBehaviour
|
||||
activeWords.Add(nextSymbol);
|
||||
activeSymbols.Add(newSymbolObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update and save the scores
|
||||
/// </summary>
|
||||
public void SaveScores()
|
||||
{
|
||||
// Calculate new score
|
||||
int newScore = this.score;
|
||||
|
||||
// Save the score as a tuple: < int score, string time ago>
|
||||
Score score = new Score();
|
||||
score.scoreValue = newScore;
|
||||
score.time = DateTime.Now.ToString();
|
||||
|
||||
// Save the new score
|
||||
user = userList.GetCurrentUser();
|
||||
Progress progress = user.GetMinigameProgress(minigame.index);
|
||||
|
||||
// Get the current list of scores
|
||||
List<Score> latestScores = progress.Get<List<Score>>("latestScores");
|
||||
List<Score> highestScores = progress.Get<List<Score>>("highestScores");
|
||||
|
||||
// Add the new score
|
||||
latestScores.Add(score);
|
||||
highestScores.Add(score);
|
||||
|
||||
// Sort the scores
|
||||
highestScores.Sort((a, b) => b.scoreValue.CompareTo(a.scoreValue));
|
||||
|
||||
// Only save the top 10 scores, so this list doesn't keep growing endlessly
|
||||
progress.AddOrUpdate<List<Score>>("latestScores", latestScores.Take(10).ToList());
|
||||
progress.AddOrUpdate<List<Score>>("highestScores", highestScores.Take(10).ToList());
|
||||
|
||||
userList.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set score metrics
|
||||
/// </summary>
|
||||
private void SetScoreMetrics()
|
||||
{
|
||||
// In de zone
|
||||
perfectSignsText.text = perfectSigns.ToString();
|
||||
|
||||
// Aanvaardbaar
|
||||
goodSignsText.text = goodSigns.ToString();
|
||||
|
||||
// Nipt
|
||||
mehSignsText.text = mehSigns.ToString();
|
||||
|
||||
// Slechte timing
|
||||
terribleSignsText.text = terribleSigns.ToString();
|
||||
|
||||
// Niet Geraden
|
||||
notFoundSignsText.text = incorrectSigns.ToString();
|
||||
|
||||
// LPM
|
||||
int duration = songList.songs[songList.currentSongIndex].duration;
|
||||
int correctSigns = goodSigns + perfectSigns + mehSigns + terribleSigns;
|
||||
lpmText.text = (60f * correctSigns / duration).ToString("#") + " GPM";
|
||||
|
||||
// Score
|
||||
scoreText.text = "Score: " + score.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scoreboard
|
||||
/// </summary>
|
||||
private void SetScoreBoard()
|
||||
{
|
||||
// Clean the previous scoreboard entries
|
||||
for (int i = 0; i < scoreboardEntries.Count; i++)
|
||||
{
|
||||
Destroy(scoreboardEntries[i]);
|
||||
}
|
||||
scoreboardEntries.Clear();
|
||||
|
||||
// Instantiate new entries
|
||||
// Get all scores from all users
|
||||
List<Tuple<string, Score>> allScores = new List<Tuple<string, Score>>();
|
||||
foreach (User user in userList.GetUsers())
|
||||
{
|
||||
// Get user's progress for this minigame
|
||||
Progress progress = user.GetMinigameProgress(minigame.index);
|
||||
if (progress != null)
|
||||
{
|
||||
// Add scores to dictionary
|
||||
List<Score> scores = progress.Get<List<Score>>("highestScores");
|
||||
foreach (Score score in scores)
|
||||
{
|
||||
allScores.Add(new Tuple<string, Score>(user.username, score));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort allScores based on Score.scoreValue
|
||||
allScores.Sort((a, b) => b.Item2.scoreValue.CompareTo(a.Item2.scoreValue));
|
||||
|
||||
// Instantiate scoreboard entries
|
||||
int rank = 1;
|
||||
foreach (Tuple<string, Score> tup in allScores.Take(10))
|
||||
{
|
||||
string username = tup.Item1;
|
||||
Score score = tup.Item2;
|
||||
|
||||
GameObject entry = Instantiate(scoreboardEntry, scoreboardEntriesContainer);
|
||||
scoreboardEntries.Add(entry);
|
||||
|
||||
// Set the player icon
|
||||
entry.transform.Find("Image").GetComponent<Image>().sprite = userList.GetUserByUsername(username).avatar;
|
||||
|
||||
// Set the player name
|
||||
entry.transform.Find("PlayerName").GetComponent<TMP_Text>().text = username;
|
||||
|
||||
// Set the score
|
||||
entry.transform.Find("Score").GetComponent<TMP_Text>().text = score.scoreValue.ToString();
|
||||
|
||||
// Set the rank
|
||||
entry.transform.Find("Rank").GetComponent<TMP_Text>().text = rank.ToString();
|
||||
|
||||
// Set the ago
|
||||
// Convert the score.time to Datetime
|
||||
DateTime time = DateTime.Parse(score.time);
|
||||
DateTime currentTime = DateTime.Now;
|
||||
TimeSpan diff = currentTime.Subtract(time);
|
||||
|
||||
string formatted;
|
||||
if (diff.Days > 0)
|
||||
{
|
||||
formatted = $"{diff.Days}d ";
|
||||
}
|
||||
else if (diff.Hours > 0)
|
||||
{
|
||||
formatted = $"{diff.Hours}h ";
|
||||
}
|
||||
else if (diff.Minutes > 0)
|
||||
{
|
||||
formatted = $"{diff.Minutes}m ";
|
||||
}
|
||||
else
|
||||
{
|
||||
formatted = "now";
|
||||
}
|
||||
|
||||
entry.transform.Find("Ago").GetComponent<TMP_Text>().text = formatted;
|
||||
|
||||
|
||||
// Alternating colors looks nice
|
||||
if (rank % 2 == 0)
|
||||
{
|
||||
Image image = entry.transform.GetComponent<Image>();
|
||||
image.color = new Color(image.color.r, image.color.g, image.color.b, 0f);
|
||||
}
|
||||
|
||||
// Make new score stand out
|
||||
if (diff.TotalSeconds < 1)
|
||||
{
|
||||
Image image = entry.transform.GetComponent<Image>();
|
||||
image.color = new Color(0, 229, 255, 233);
|
||||
}
|
||||
|
||||
rank++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
<<<<<<<< HEAD:Assets/JustSign/Scripts/JustSignController.cs.meta
|
||||
guid: 9ede962218eda88668cd8032b921aada
|
||||
========
|
||||
guid: 40ff941e1b34847bdb160c6950f35aec
|
||||
>>>>>>>> development:Assets/MediaPipeUnity/Common/Scripts/KeypointManager.cs.meta
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
defaultReferences:
|
||||
- canvas: {instanceID: 0}
|
||||
- answerField: {instanceID: 0}
|
||||
- feedBack: {instanceID: 0}
|
||||
- scoreDisplay: {instanceID: 0}
|
||||
- minigame: {instanceID: 0}
|
||||
- songList: {fileID: 11400000, guid: 4f0ce70309bb901feb28199a82a7d195, type: 2}
|
||||
- hitZone: {instanceID: 0}
|
||||
- symbolPrefab: {instanceID: 0}
|
||||
- symbolContainer: {instanceID: 0}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
|
||||
29
Assets/JustSign/Scripts/Song.cs
Normal file
29
Assets/JustSign/Scripts/Song.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
/// <summary>
|
||||
/// Class for holding all (static) data about a certain song
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/Song")]
|
||||
public class Song : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Time at which the first symbol should enter the hit zone
|
||||
/// </summary>
|
||||
public float firstSymbolTime;
|
||||
|
||||
/// <summary>
|
||||
/// Determines every how many seconds a symbol should enter the hit zone
|
||||
/// </summary>
|
||||
public float spawnPeriod;
|
||||
|
||||
/// <summary>
|
||||
/// Duration of the song in seconds
|
||||
/// </summary>
|
||||
public int duration;
|
||||
|
||||
/// <summary>
|
||||
/// The actual audio source
|
||||
/// </summary>
|
||||
public AudioClip song;
|
||||
}
|
||||
11
Assets/JustSign/Scripts/Song.cs.meta
Normal file
11
Assets/JustSign/Scripts/Song.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd3d1c3a6cf7ef07abb343f8862a7435
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/JustSign/Scripts/SongList.cs
Normal file
19
Assets/JustSign/Scripts/SongList.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Keep track of all songs
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/SongList")]
|
||||
public class SongList : ScriptableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Index of the active/to be loaded/current song
|
||||
/// </summary>
|
||||
public int currentSongIndex = 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of all installed songs
|
||||
/// </summary>
|
||||
public List<Song> songs = new List<Song>();
|
||||
}
|
||||
11
Assets/JustSign/Scripts/SongList.cs.meta
Normal file
11
Assets/JustSign/Scripts/SongList.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ceeae47a3efc2206299ddf1cc31043c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 847642ab4c6075d4d934ce75df517885
|
||||
guid: a92b9838d20352bb8b984c2e361c7fba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
BIN
Assets/JustSign/Songs/graceland.mp3
Normal file
BIN
Assets/JustSign/Songs/graceland.mp3
Normal file
Binary file not shown.
22
Assets/JustSign/Songs/graceland.mp3.meta
Normal file
22
Assets/JustSign/Songs/graceland.mp3.meta
Normal file
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e01ded5e221494bdbaab8674c0354f64
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/JustSign/Songs/sunny_safari_120bpm.mp3
Normal file
BIN
Assets/JustSign/Songs/sunny_safari_120bpm.mp3
Normal file
Binary file not shown.
22
Assets/JustSign/Songs/sunny_safari_120bpm.mp3.meta
Normal file
22
Assets/JustSign/Songs/sunny_safari_120bpm.mp3.meta
Normal file
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7ca1b558b7b064cdb6f9d6c951b1522
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fed3e516d8073fd49a3db979e66ff443
|
||||
guid: 73c615986873dc246893879daf74c05d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
8
Assets/MediaPipeUnity/Interfaces/Listener.cs
Normal file
8
Assets/MediaPipeUnity/Interfaces/Listener.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public interface Listener
|
||||
{
|
||||
public IEnumerator ProcessIncomingCall();
|
||||
}
|
||||
11
Assets/MediaPipeUnity/Interfaces/Listener.cs.meta
Normal file
11
Assets/MediaPipeUnity/Interfaces/Listener.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4c1da9896d9ba2449549a016b5fd15e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"name": "HeathenEngineering.UX",
|
||||
"references": [
|
||||
"GUID:58d42c70423577947911995925414405",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
],
|
||||
"name": "SignPredictorInterfaces",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5702ca0318eb1942af8daf18131f44d
|
||||
guid: f55a02e98b01bc849b30d9650ccd8f15
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -9,7 +9,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4318122119930585316}
|
||||
- component: {fileID: 4318122119930585317}
|
||||
m_Layer: 5
|
||||
m_Name: Feedback
|
||||
m_TagString: Untagged
|
||||
@@ -39,22 +38,6 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 200}
|
||||
m_SizeDelta: {x: 500, y: 150}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!114 &4318122119930585317
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4318122119930585319}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 44e682a32ee15cc489bf50f3a06f717b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
feedbackText: {fileID: 4318122120222767928}
|
||||
feedbackProgress: {fileID: 4318122119968934242}
|
||||
feedbackProgressImage: {fileID: 4318122120334233319}
|
||||
signPredictor: {fileID: 0}
|
||||
--- !u!1 &4318122119968934244
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67bb46dfd509932429fc985052104b72
|
||||
guid: 438a3ced42dd6fc4ab38e3a16c1e43a7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
20
Assets/MediaPipeUnity/ScriptableObjects/ModelList.asset
Normal file
20
Assets/MediaPipeUnity/ScriptableObjects/ModelList.asset
Normal file
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 78a3f61c93a08c04496c49ffd10b9021, type: 3}
|
||||
m_Name: ModelList
|
||||
m_EditorClassIdentifier:
|
||||
currentModelIndex: 0
|
||||
models:
|
||||
- index: 0
|
||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||
- index: 1
|
||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39516e4e6e56f0f4f80647d9c4d8034c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/MediaPipeUnity/Scripts/AbstractFeedback.cs
Normal file
32
Assets/MediaPipeUnity/Scripts/AbstractFeedback.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using DigitalRuby.Tween;
|
||||
using Mediapipe.Unity.Tutorial;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to display feedback during a course
|
||||
/// </summary>
|
||||
public abstract class AbstractFeedback : MonoBehaviour, Listener
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the sign predictor
|
||||
/// </summary>
|
||||
public SignPredictor signPredictor;
|
||||
|
||||
public IEnumerator ProcessIncomingCall()
|
||||
{
|
||||
yield return StartCoroutine(UpdateFeedback());
|
||||
}
|
||||
|
||||
public void AddSelfAsListener()
|
||||
{
|
||||
signPredictor.listeners.Add(this);
|
||||
}
|
||||
|
||||
protected abstract IEnumerator UpdateFeedback();
|
||||
}
|
||||
11
Assets/MediaPipeUnity/Scripts/AbstractFeedback.cs.meta
Normal file
11
Assets/MediaPipeUnity/Scripts/AbstractFeedback.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b5ac794337a54143a6e3077483d96c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,182 +0,0 @@
|
||||
using DigitalRuby.Tween;
|
||||
using Mediapipe.Unity.Tutorial;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to display feedback during a course
|
||||
/// </summary>
|
||||
public class Feedback : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the feedback field
|
||||
/// </summary>
|
||||
public TMP_Text feedbackText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar
|
||||
/// </summary>
|
||||
public Slider feedbackProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar image, so we can add fancy colors
|
||||
/// </summary>
|
||||
public Image feedbackProgressImage;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the sign predictor
|
||||
/// </summary>
|
||||
public SignPredictor signPredictor;
|
||||
|
||||
/// <summary>
|
||||
/// Callback for getting the correct sign
|
||||
/// </summary>
|
||||
public Func<string> getSignCallback;
|
||||
|
||||
/// <summary>
|
||||
/// Callback to initiate the next sign
|
||||
/// </summary>
|
||||
public UnityAction<string> predictSignCallback;
|
||||
|
||||
/// <summary>
|
||||
/// Timer to keep track of how long a incorrect sign is performed
|
||||
/// </summary>
|
||||
private DateTime timer;
|
||||
|
||||
/// <summary>
|
||||
/// Current predicted sign
|
||||
/// </summary>
|
||||
private string predictedSign = null;
|
||||
|
||||
/// <summary>
|
||||
/// Previous incorrect sign, so we can keep track whether the user is wrong or the user is still changing signs
|
||||
/// </summary>
|
||||
private string previousIncorrectSign = null;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
// Start the coroutine to update the scale every 200 milliseconds
|
||||
StartCoroutine(UpdateFeedback());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UpdateScale updates the progress bar every 200ms, updated the feedback text, and progress bar color
|
||||
/// If a high enough accuracy is detected, it will go to the next sign
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IEnumerator UpdateFeedback()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (getSignCallback != null && predictSignCallback != null)
|
||||
{
|
||||
|
||||
// Get current sign
|
||||
string currentSign = getSignCallback();
|
||||
// Get the predicted sign
|
||||
if (signPredictor != null && signPredictor.learnableProbabilities != null &&
|
||||
currentSign != null && signPredictor.learnableProbabilities.ContainsKey(currentSign))
|
||||
{
|
||||
float accuracy = signPredictor.learnableProbabilities[currentSign];
|
||||
if (feedbackText != null && feedbackProgressImage != null){
|
||||
if (accuracy > 0.98)
|
||||
{
|
||||
// TODO: fix emojis
|
||||
feedbackText.text = "✨ Perfect ✨";
|
||||
Color col = new Color(0xff / 255.0f, 0xcc / 255.0f, 0x00 / 255.0f);
|
||||
feedbackText.color = col;
|
||||
feedbackProgressImage.color = col;
|
||||
}
|
||||
else if (accuracy > 0.95)
|
||||
{
|
||||
feedbackText.text = "Super!";
|
||||
Color col = new Color(0x00 / 255.0f, 0xff / 255.0f, 0xcc / 255.0f);
|
||||
feedbackText.color = col;
|
||||
feedbackProgressImage.color = col;
|
||||
}
|
||||
else if (accuracy > 0.90)
|
||||
{
|
||||
feedbackText.text = "Goed";
|
||||
feedbackText.color = Color.green;
|
||||
feedbackProgressImage.color = Color.green;
|
||||
}
|
||||
else if (accuracy > 0.80)
|
||||
{
|
||||
feedbackText.text = "Bijna...";
|
||||
Color col = new Color(0xff / 255.0f, 0x66 / 255.0f, 0x00 / 255.0f);
|
||||
feedbackText.color = col;
|
||||
feedbackProgressImage.color = col;
|
||||
}
|
||||
else
|
||||
{
|
||||
feedbackText.text = "Detecteren...";
|
||||
feedbackText.color = Color.red;
|
||||
feedbackProgressImage.color = Color.red;
|
||||
}
|
||||
|
||||
float oldValue = feedbackProgress.value;
|
||||
// use an exponential scale
|
||||
float newValue = Mathf.Exp(4 * (accuracy - 1.0f));
|
||||
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
|
||||
{
|
||||
if (feedbackProgress != null)
|
||||
{
|
||||
feedbackProgress.value = t.CurrentValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check whether (in)correct sign has high accuracy
|
||||
foreach (var kv in signPredictor.learnableProbabilities)
|
||||
{
|
||||
if (kv.Value > 0.90)
|
||||
{
|
||||
predictedSign = kv.Key;
|
||||
// Correct sign
|
||||
if (predictedSign == currentSign)
|
||||
{
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
predictSignCallback(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
// Incorrect sign
|
||||
else
|
||||
{
|
||||
if (previousIncorrectSign != predictedSign)
|
||||
{
|
||||
timer = DateTime.Now;
|
||||
previousIncorrectSign = predictedSign;
|
||||
}
|
||||
else if (DateTime.Now - timer > TimeSpan.FromSeconds(2.0f))
|
||||
{
|
||||
predictSignCallback(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(feedbackProgress != null)
|
||||
{
|
||||
|
||||
feedbackProgress.value = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for 200 milliseconds before updating the scale again
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@
|
||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||
"GUID:04c4d86a70aa56c55a78c61f1ab1a56d",
|
||||
"GUID:edc93f477bb73a743a97d6882ed330b3",
|
||||
"GUID:58e104b97fb3752438ada2902a36dcbf"
|
||||
"GUID:58e104b97fb3752438ada2902a36dcbf",
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25",
|
||||
"GUID:f55a02e98b01bc849b30d9650ccd8f15"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace Mediapipe.Unity.Tutorial
|
||||
public class SignPredictor : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the model used in the SignPredictor
|
||||
/// ModelList, used to change model using ModelIndex
|
||||
/// </summary>
|
||||
public NNModel model;
|
||||
public ModelList modelList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the model info file
|
||||
@@ -141,6 +141,8 @@ namespace Mediapipe.Unity.Tutorial
|
||||
/// </summary>
|
||||
private Tensor inputTensor;
|
||||
|
||||
public List<Listener> listeners = new List<Listener>();
|
||||
|
||||
/// <summary>
|
||||
/// Google Mediapipe setup & run
|
||||
/// </summary>
|
||||
@@ -207,14 +209,21 @@ namespace Mediapipe.Unity.Tutorial
|
||||
|
||||
|
||||
keypointManager = new KeypointManager(modelInfoFile);
|
||||
|
||||
// check if model exists at path
|
||||
//var model = ModelLoader.Load(Resources.Load<NNModel>("Models/Fingerspelling/model_A-L"));
|
||||
worker = model.CreateWorker();
|
||||
worker = modelList.GetCurrentModel().CreateWorker();
|
||||
|
||||
StartCoroutine(SignRecognitionCoroutine());
|
||||
StartCoroutine(MediapipeCoroutine());
|
||||
}
|
||||
/// <summary>
|
||||
/// Called at the start of course/Minigame, will set the model before the start of SIgnPredictor is called.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the model to be used</param>
|
||||
public void SetModel(ModelIndex index)
|
||||
{
|
||||
this.modelList.SetCurrentModel(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine which executes the mediapipe pipeline
|
||||
@@ -314,8 +323,11 @@ namespace Mediapipe.Unity.Tutorial
|
||||
{
|
||||
learnableProbabilities.Add(((char)(i + 65)).ToString(), softmaxedOutput2[i]);
|
||||
}
|
||||
// publishes: new probs
|
||||
//Debug.Log($"prob = [{learnableProbabilities.Aggregate(" ", (t, kv) => $"{t}{kv.Key}:{kv.Value} ")}]");
|
||||
foreach(Listener listener in listeners)
|
||||
{
|
||||
yield return listener.ProcessIncomingCall();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00431337d21e1ff4f80d7e6f0761c4ee
|
||||
guid: 2fd5cdf8e7f70bf4882b352aaaa8a2bf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user