WES-51-fingerspelling-result-view

This commit is contained in:
Louis Adriaens 2023-03-12 21:15:49 +00:00 committed by Jelle De Geest
parent 1d1d11ed1a
commit aa7f7bc7f3
3 changed files with 1173 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@ -78,6 +79,30 @@ public class StartPause : MonoBehaviour
/// </summary>
private int correctWords = 0;
/// <summary>
/// The "finished" screen
/// </summary>
public GameObject ResultPanel;
/// <summary>
/// Button to go back to courses list
/// </summary>
public Button CoursesButton;
/// <summary>
/// Webcam class to close the webcam when the course is finished
/// </summary>
public Webcam Webcam;
/// <summary>
/// DateTime containint the start moment
/// </summary>
private DateTime startMoment;
/// <summary>
/// Reference to the timeSpent UI
/// </summary>
public TextMeshProUGUI timeSpent;
/// <summary>
/// This function is called when the script is initialised.
@ -108,6 +133,11 @@ public class StartPause : MonoBehaviour
title.text = course.name;
NextVideo();
NextImage();
// Hide the result panel
ResultPanel.SetActive(false);
// Set the startTime
startMoment = DateTime.Now;
}
// These two functions generate video and image from files
@ -198,8 +228,18 @@ public class StartPause : MonoBehaviour
/// </summary>
public void FinishCourse()
{
// TODO: update progress (maybe this can also be at the `NextSign()`-method)
progress.AddOrUpdate<float>("courseProgress", correctWords / maxWords);
// Show the "finished" screen
ResultPanel.SetActive(true);
// Set the total time spent UI
TimeSpan time = DateTime.Now - startMoment;
timeSpent.text = time.ToString(@"hh\:mm\:ss");
// Link button
//CoursesButton.onClick.AddListener(() => { SceneManager.LoadScene("Assets/Common/Scenes/CoursesScreen.unity"); });
CoursesButton.onClick.AddListener(() => { Webcam.LoadScene("Assets/Common/Scenes/CoursesScreen.unity"); });
progress.AddOrUpdate<float>("courseProgress", 1f);
userList.Save();
}
}

View File

@ -85,7 +85,7 @@ public class Webcam : MonoBehaviour
}
/// <summary>
/// The notmal sceneChanger cannot be used here since the camera also needs to be stopped.
/// The normal sceneChanger cannot be used here since the camera also needs to be stopped.
/// This extra functionality is implemented in this function
/// </summary>
/// <param name="sceneName"> The path for the scene you want to travel to, assuming root-directory is Assets</param>