Fixed preview and clothes bug

This commit is contained in:
Jerome Coudron
2023-05-14 12:37:36 +00:00
committed by Dries Van Schuylenbergh
parent 1e09f09dae
commit 7df6ea1ecd
5 changed files with 47 additions and 28 deletions

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f6b23e64e6ffb12459ed4f37d7305852, type: 3}
m_Name: ClothesCourse
m_EditorClassIdentifier:
index: 1
index: 7
title: Kleren en Kleuren
description: // TBA
thumbnail: {fileID: 21300000, guid: 4913be0505c981a49bdbee0bbe6c33fe, type: 3}

View File

@@ -253,12 +253,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;
}
@@ -285,6 +280,14 @@ public class CoursesController : AbstractFeedback
//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;

View File

@@ -135,6 +135,21 @@ public class CoursesControllerTests
var coursesController = GameObject.FindObjectOfType<CoursesController>();
Assert.IsNotNull(coursesController);
Assert.AreEqual(coursesController.GetPanelId(), 0);
// Check that you reach multiple-choice after 6 NextSigns
coursesController.NextSign();
yield return new WaitForSeconds(1f);
coursesController.NextSign();
yield return new WaitForSeconds(1f);
coursesController.NextSign();
yield return new WaitForSeconds(1f);
coursesController.NextSign();
yield return new WaitForSeconds(1f);
coursesController.NextSign();
yield return new WaitForSeconds(1f);
coursesController.NextSign();
yield return new WaitForSeconds(1f);
Assert.AreEqual(coursesController.GetPanelId(), 1);
}