Sprint 6
This commit is contained in:
@@ -93,6 +93,9 @@ public class CoursesController : AbstractFeedback
|
||||
/// </summary>
|
||||
private Image feedbackProgressImage;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the video player
|
||||
/// </summary>
|
||||
public VideoPlayer videoPlayer;
|
||||
|
||||
/// <summary>
|
||||
@@ -161,6 +164,16 @@ public class CoursesController : AbstractFeedback
|
||||
/// </summary>
|
||||
private GameObject previousPanel = null;
|
||||
|
||||
/// <summary>
|
||||
/// Boolean used to make a test possible
|
||||
/// </summary>
|
||||
private bool corruptPanelId = false;
|
||||
|
||||
/// <summary>
|
||||
/// Corrupted PanelID Value
|
||||
/// </summary>
|
||||
private int CorruptedPanelIDValue = 999;
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the script is initialised.
|
||||
/// It inactivatis the popup, finds a webcam to use and links it via the WebcamTexture to the display RawImage.
|
||||
@@ -171,7 +184,6 @@ public class CoursesController : AbstractFeedback
|
||||
void Start()
|
||||
{
|
||||
StartCourseController();
|
||||
signPredictor.SetSignsList(GetSignsList());
|
||||
signPredictor.SetModel(course.theme.modelIndex);
|
||||
AddSelfAsListener();
|
||||
}
|
||||
@@ -196,6 +208,7 @@ public class CoursesController : AbstractFeedback
|
||||
/// </summary>
|
||||
public void StartCourseController()
|
||||
{
|
||||
|
||||
// Setting up course
|
||||
course = courselist.courses[courselist.currentCourseIndex];
|
||||
maxWords = course.theme.learnables.Count;
|
||||
@@ -242,12 +255,7 @@ public class CoursesController : AbstractFeedback
|
||||
{
|
||||
PersistentDataController.SavedLearnableProgress learnable = progress.GetRandomLearnable();
|
||||
int panelChosen;
|
||||
if (course.theme.modelIndex == ModelIndex.NONE)
|
||||
{
|
||||
// only multiple choice works in preview mode
|
||||
panelChosen = 1;
|
||||
}
|
||||
else if (learnable.progress > 2.0f)
|
||||
if (learnable.progress > 2.0f)
|
||||
{
|
||||
panelChosen = 2;
|
||||
}
|
||||
@@ -271,8 +279,16 @@ public class CoursesController : AbstractFeedback
|
||||
{
|
||||
// This function is also called (async) when pressing the 'Gebaar overslaan' button,
|
||||
// so check for condition so we don't skip multiple signs
|
||||
if (isNextSignInTransit || maxWords <= progress.completedLearnables)
|
||||
return;
|
||||
//if (isNextSignInTransit || maxWords < progress.completedLearnables)
|
||||
if (isNextSignInTransit) return;
|
||||
|
||||
// Code for preview-progress, skipping should give progress unless it is multipleChoice
|
||||
if (course.theme.modelIndex == ModelIndex.NONE)
|
||||
{
|
||||
string currentName = course.theme.learnables[currentWordIndex].name;
|
||||
// This works both to allow panel 0 to allow progress via skipping and also to allow panel 2 to be skipped.
|
||||
if (progress.FindLearnable(currentName).progress <= 1f || progress.FindLearnable(currentName).progress >= 2f) progress.UpdateLearnable(currentName, 1.5f);
|
||||
}
|
||||
|
||||
progress.progress = (float)progress.completedLearnables / (float)maxWords;
|
||||
progressBar.fillAmount = progress.progress;
|
||||
@@ -284,7 +300,7 @@ public class CoursesController : AbstractFeedback
|
||||
StartCoroutine(CRNextSign());
|
||||
}
|
||||
// Finish course and record progress
|
||||
if (progress.completedLearnables == maxWords)
|
||||
else
|
||||
{
|
||||
FinishCourse();
|
||||
}
|
||||
@@ -318,7 +334,14 @@ public class CoursesController : AbstractFeedback
|
||||
/// <returns>Reference to the GameObject of the panel</returns>
|
||||
private GameObject SetupPanel()
|
||||
{
|
||||
(currentWordIndex, panelId) = FetchSign().ToValueTuple();
|
||||
if (corruptPanelId == true)
|
||||
{
|
||||
(currentWordIndex, panelId) = (1, CorruptedPanelIDValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
(currentWordIndex, panelId) = FetchSign().ToValueTuple();
|
||||
}
|
||||
switch (panelId)
|
||||
{
|
||||
case 0:
|
||||
@@ -386,7 +409,7 @@ public class CoursesController : AbstractFeedback
|
||||
ResultPanel.SetActive(true);
|
||||
|
||||
// Set the correct title
|
||||
ResultsTitle.text = course.title + " voltooid!";
|
||||
ResultsTitle.text = course.title + " is voltooid!";
|
||||
|
||||
// Set the correct description
|
||||
ResultsDecription.text = "Goed gedaan! Je kan nu spelletjes spelen met " + course.title + " om verder te oefenen!";
|
||||
@@ -412,9 +435,11 @@ public class CoursesController : AbstractFeedback
|
||||
if (currentWordIndex < course.theme.learnables.Count && panelId != 1 && !hasAnswered)
|
||||
{
|
||||
// Get current sign
|
||||
|
||||
Learnable sign = course.theme.learnables[currentWordIndex];
|
||||
string currentSign = sign.name.ToUpper().Replace(" ", "-");
|
||||
|
||||
|
||||
// Get the predicted sign
|
||||
if (signPredictor != null && signPredictor.learnableProbabilities != null &&
|
||||
currentSign != null && signPredictor.learnableProbabilities.ContainsKey(currentSign))
|
||||
@@ -530,6 +555,10 @@ public class CoursesController : AbstractFeedback
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wait 0.75 seconds and proceed to the next sign
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerator WaitNextSign()
|
||||
{
|
||||
// Wait for 0.75 seconds
|
||||
@@ -566,4 +595,60 @@ public class CoursesController : AbstractFeedback
|
||||
UserList.Save();
|
||||
SystemController.GetInstance().BackToPreviousScene();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns panelId for testing
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetPanelId()
|
||||
{
|
||||
return panelId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns currentSign for testing
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetCurrentSign()
|
||||
{
|
||||
Learnable sign = course.theme.learnables[currentWordIndex];
|
||||
return sign.name.ToUpper().Replace(" ", "-");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used for testing an out of bounds PanelId
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void CorruptPanelID()
|
||||
{
|
||||
corruptPanelId = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Needed to be able to test an out of bounds PanelId
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerator CallSetupPanel()
|
||||
{
|
||||
yield return SetupPanel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Needed to be able to test an out of bounds PanelId
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void SetFeedbackProgress()
|
||||
{
|
||||
feedbackProgress.value = 0.0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open multiple choice panel for testing
|
||||
/// </summary>
|
||||
public IEnumerator SummonMultipleChoice()
|
||||
{
|
||||
CorruptPanelID();
|
||||
CorruptedPanelIDValue = 1;
|
||||
yield return CRNextSign();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user