Sprint 4
This commit is contained in:
@@ -12,12 +12,20 @@ public class BootScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public TMP_Text errorText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the list that holds all user avatars
|
||||
/// </summary>
|
||||
public UserAvatarList sprites;
|
||||
|
||||
/// <summary>
|
||||
/// Request authorization and check whether at least 1 webcam is available
|
||||
/// </summary>
|
||||
/// <returns>IEnumerator object</returns>
|
||||
IEnumerator Start()
|
||||
{
|
||||
UserList.AVATARS = sprites.avatars;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
|
||||
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
||||
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:63c63e721f65ebb7d871cb9ef49f4752",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||
"GUID:e83ddf9a537a96b4a804a16bb7872ec1",
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
@@ -12,20 +13,16 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
public GameObject previewButton;
|
||||
// ^^^ TEMPORARY STUFF ^^^
|
||||
|
||||
public GameObject restartButton;
|
||||
/// <summary>
|
||||
/// Reference to the courses
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the course progress
|
||||
/// </summary>
|
||||
private Progress progress;
|
||||
private PersistentDataController.SavedCourseProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Title Display
|
||||
@@ -42,11 +39,27 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public Image courseImage;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Progress bar Display
|
||||
/// </summary>
|
||||
public Slider progressBar;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progressBar gameObject
|
||||
/// </summary>
|
||||
public GameObject progressObject;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the 'completed' gameObject
|
||||
/// </summary>
|
||||
public GameObject completedObject;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromCourseMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the infopage for a given course
|
||||
/// </summary>
|
||||
@@ -56,8 +69,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,12 +79,48 @@ 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");
|
||||
PersistentDataController.GetInstance().Load();
|
||||
progress = UserList.GetCurrentUser().GetCourseProgress(course.index);
|
||||
if (progress != null && course.theme.modelIndex != ModelIndex.NONE)
|
||||
{
|
||||
progressBar.value = progress.progress;
|
||||
if (progress.progress == 1.0f)
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
progressObject.SetActive(false);
|
||||
completedObject.SetActive(true);
|
||||
}
|
||||
if (progress.inUseLearnables > 0)
|
||||
{
|
||||
restartButton.SetActive(true);
|
||||
playButton.transform.Find("Button Text").GetComponent<TMP_Text>().text = "Verder";
|
||||
}
|
||||
else
|
||||
{
|
||||
restartButton.SetActive(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
progressBar.value = 0.0f;
|
||||
restartButton.SetActive(false);
|
||||
playButton.transform.Find("Button Text").GetComponent<TMP_Text>().text = "Begin";
|
||||
}
|
||||
|
||||
var sys = SystemController.GetInstance();
|
||||
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/CoursesMenuScreen"))
|
||||
directorEnterFromCourseMenu.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to reset and start the course
|
||||
/// </summary>
|
||||
public void ResetCourseProgress()
|
||||
{
|
||||
UserList.GetCurrentUser().ResetCourseProgress(progress.courseIndex);
|
||||
UserList.Save();
|
||||
progressBar.value = 0.0f;
|
||||
StartCourse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,6 +128,6 @@ public class CourseActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public void StartCourse()
|
||||
{
|
||||
SystemController.GetInstance().LoadNextScene("Courses/Scenes/TemplateCourse");
|
||||
SystemController.GetInstance().LoadNextScene("Courses/Scenes/CourseScreen");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class CourseItem : MonoBehaviour
|
||||
progress = Mathf.Clamp01(progress);
|
||||
completed.SetActive(1.0f <= progress);
|
||||
slider.SetActive(0.0f <= progress && progress < 1.0f);
|
||||
slider.GetComponent<Slider>().value = progress;
|
||||
slider.GetComponent<SlicedSlider>().fillAmount = progress;
|
||||
|
||||
// Add click functionality
|
||||
button.onClick.AddListener(() =>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
/// <summary>
|
||||
/// CourseMenuScreen scene manager
|
||||
@@ -27,23 +28,28 @@ public class CourseMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject courseItem;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users so we can get the current user;
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the courses
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromDefault;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromMainMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
|
||||
// Recent courses
|
||||
List<Tuple<CourseIndex, float>> recentCourses = user.GetRecentCourses();
|
||||
@@ -71,6 +77,13 @@ public class CourseMenuScreen : MonoBehaviour
|
||||
item.course = courseList.GetCourseByIndex(course.Item1);
|
||||
item.progress = course.Item2;
|
||||
}
|
||||
|
||||
var sys = SystemController.GetInstance();
|
||||
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/MainMenuScreen"))
|
||||
directorEnterFromMainMenu.Play();
|
||||
else
|
||||
directorEnterFromDefault.Play();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
/// <summary>
|
||||
/// ListCourseScreen scene manager
|
||||
/// </summary>
|
||||
public class ListCoursesScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the userlist
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the course-list container object
|
||||
/// </summary>
|
||||
@@ -25,13 +21,18 @@ public class ListCoursesScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromCourseMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
|
||||
foreach (Course course in courseList.courses)
|
||||
{
|
||||
@@ -42,9 +43,13 @@ public class ListCoursesScreen : MonoBehaviour
|
||||
CourseItem item = instance.GetComponent<CourseItem>();
|
||||
item.course = course;
|
||||
|
||||
Progress progress = user.GetCourseProgress(course.index);
|
||||
item.progress = progress != null ? progress.Get<float>("courseProgress") : 0.0f;
|
||||
var progress = user.GetCourseProgress(course.index);
|
||||
item.progress = progress != null ? progress.progress : 0.0f;
|
||||
}
|
||||
|
||||
var sys = SystemController.GetInstance();
|
||||
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/CoursesMenuScreen"))
|
||||
directorEnterFromCourseMenu.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
/// <summary>
|
||||
/// ListMinigameScreen scene manager
|
||||
@@ -20,6 +21,11 @@ public class ListMinigamesScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public MinigameList minigameList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromMainMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
@@ -34,6 +40,10 @@ public class ListMinigamesScreen : MonoBehaviour
|
||||
MinigameItem item = instance.GetComponent<MinigameItem>();
|
||||
item.minigame = minigame;
|
||||
}
|
||||
|
||||
var sys = SystemController.GetInstance();
|
||||
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/MainMenuScreen"))
|
||||
directorEnterFromMainMenu.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
/// <summary>
|
||||
/// StartScreen scene manager
|
||||
@@ -7,9 +8,24 @@ using UnityEngine;
|
||||
public class MainMenuScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Referece to the userlist to check whether an user account is present
|
||||
/// Reference to the enter animation scene playable director
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
public PlayableDirector directorEnterFromBoot;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the enter animation scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromCourseMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the enter animation scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromListMinigames;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the enter animation scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Check on load whether a user is already present,
|
||||
@@ -17,13 +33,29 @@ public class MainMenuScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
userList.Load();
|
||||
if (!File.Exists(UserList.PATH) || userList.GetUsers().Count <= 0)
|
||||
if (!File.Exists(PersistentDataController.PATH) || UserList.GetUsers().Count <= 0)
|
||||
{
|
||||
UserCreationScreen.canGoBack = false;
|
||||
SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserCreationScreen");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
var sys = SystemController.GetInstance();
|
||||
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/Boot"))
|
||||
directorEnterFromBoot.Play();
|
||||
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/CoursesMenuScreen"))
|
||||
directorEnterFromCourseMenu.Play();
|
||||
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/ListMinigamesScreen"))
|
||||
directorEnterFromListMinigames.Play();
|
||||
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/SettingsScreen"))
|
||||
directorEnterFromSettings.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quit the application
|
||||
/// </summary>
|
||||
|
||||
@@ -40,15 +40,10 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public TMP_Text controls;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the Minigame progress
|
||||
/// </summary>
|
||||
private Progress progress;
|
||||
private PersistentDataController.SavedMinigameProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the users-high-scores container object
|
||||
@@ -60,12 +55,17 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public GameObject prefab;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the ranking title
|
||||
/// </summary>
|
||||
public GameObject rankingTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the infopage for a given minigame
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
PersistentDataController.GetInstance().Load();
|
||||
GenerateContent();
|
||||
GenerateHighScores();
|
||||
}
|
||||
@@ -109,21 +109,23 @@ public class MinigameActivityScreen : MonoBehaviour
|
||||
Minigame minigame = minigameList.minigames[index];
|
||||
|
||||
List<Tuple<string, Sprite, Score>> allScores = new List<Tuple<string, Sprite, Score>>();
|
||||
foreach (User user in userList.GetUsers())
|
||||
foreach (User user in UserList.GetUsers())
|
||||
{
|
||||
// Get user's progress for this minigame
|
||||
progress = user.GetMinigameProgress(minigame.index);
|
||||
if (progress != null)
|
||||
{
|
||||
// Add scores to dictionary
|
||||
List<Score> scores = progress.Get<List<Score>>("highestScores");
|
||||
List<Score> scores = progress.highestScores;
|
||||
foreach (Score score in scores)
|
||||
{
|
||||
allScores.Add(new Tuple<string, Sprite, Score>(user.username, user.avatar, score));
|
||||
allScores.Add(new Tuple<string, Sprite, Score>(user.GetUsername(), user.GetAvatar(), score));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rankingTitle.SetActive(allScores.Count > 0);
|
||||
|
||||
// Sort allScores based on Score.scoreValue
|
||||
allScores.Sort((a, b) => b.Item3.scoreValue.CompareTo(a.Item3.scoreValue));
|
||||
|
||||
|
||||
18
Assets/Common/Scripts/SettingsScreen.cs
Normal file
18
Assets/Common/Scripts/SettingsScreen.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class SettingsScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the scene playable director
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromMainMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
directorEnterFromMainMenu.Play();
|
||||
}
|
||||
}
|
||||
11
Assets/Common/Scripts/SettingsScreen.cs.meta
Normal file
11
Assets/Common/Scripts/SettingsScreen.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c206227bcf352fd4784750b5b2b19a31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -59,7 +59,7 @@ public class ThemeItem : MonoBehaviour
|
||||
{
|
||||
//PlayerPrefs.SetString("gamePath", minigame.minigameEntryPoint);
|
||||
Minigame minigame = minigameList.minigames[minigameList.currentMinigameIndex];
|
||||
minigame.themeList.SetCurrentTheme(theme.index);
|
||||
minigame.themeList.SetCurrentTheme(theme.themeIndex);
|
||||
SystemController.GetInstance().SwapScene(minigame.minigameEntryPoint);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,11 +7,6 @@ using UnityEngine.UI;
|
||||
/// </summary>
|
||||
public class UserButton : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the user list, so we can extract the current user
|
||||
/// </summary>
|
||||
public UserList userList;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the avatar object
|
||||
/// </summary>
|
||||
@@ -32,10 +27,10 @@ public class UserButton : MonoBehaviour
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
userList.Load();
|
||||
User user = userList.GetCurrentUser();
|
||||
avatar.sprite = user.avatar;
|
||||
username.text = user.username;
|
||||
PersistentDataController.GetInstance().Load();
|
||||
User user = UserList.GetCurrentUser();
|
||||
avatar.sprite = user.GetAvatar();
|
||||
username.text = user.GetUsername();
|
||||
dropdownBox.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user