Merge branch 'WES-203-Course-freezing' into 'development'

Fixed course freezing and other course-ending bugs

See merge request wesign/unity-application!92
This commit was merged in pull request #92.
This commit is contained in:
Jelle De Geest
2023-05-08 21:38:43 +00:00
8 changed files with 22 additions and 50 deletions

View File

@@ -216,7 +216,7 @@ MonoBehaviour:
thumbnail: {fileID: 4959898009379617328}
title: {fileID: 4959898009362012447}
button: {fileID: 4959898007614330355}
slider: {fileID: 3971139188485731716}
slider: {fileID: 5742510687904928776}
completed: {fileID: 8032316393302770855}
--- !u!95 &5637671876400780781
Animator:

View File

@@ -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<SlicedSlider>().fillAmount = progress;
slider.GetComponentInChildren<SlicedSlider>().fillAmount = progress;
// Add click functionality
button.onClick.AddListener(() =>

View File

@@ -1545,7 +1545,7 @@ MonoBehaviour:
m_Calls:
- m_Target: {fileID: 1122267056}
m_TargetAssemblyTypeName: CoursesController, CourseScripts
m_MethodName: StartCourseController
m_MethodName: ReturnToActivityScreen
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

View File

@@ -196,6 +196,7 @@ public class CoursesController : AbstractFeedback
/// </summary>
public void StartCourseController()
{
// Setting up course
course = courselist.courses[courselist.currentCourseIndex];
maxWords = course.theme.learnables.Count;
@@ -271,8 +272,8 @@ 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;
progress.progress = (float)progress.completedLearnables / (float)maxWords;
progressBar.fillAmount = progress.progress;
@@ -284,7 +285,7 @@ public class CoursesController : AbstractFeedback
StartCoroutine(CRNextSign());
}
// Finish course and record progress
if (progress.completedLearnables == maxWords)
else
{
FinishCourse();
}

View File

@@ -4,6 +4,7 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
using System.Linq;
public class PanelMultipleChoice : MonoBehaviour
@@ -95,15 +96,21 @@ public class PanelMultipleChoice : MonoBehaviour
/// <returns></returns>
public List<Learnable> GetWrongOptions(int notThisIndex)
{
List<Learnable> randomSigns = new List<Learnable>();
// TODO: find more koosjer way to do this
while (randomSigns.Count < 3)
var test = progress.learnables.FindAll((l) => l.index != notThisIndex && l.inUse);
for (int i = test.Count - 1; i > 0; i--)
{
int index = progress.GetRandomLearnable().index;
if (index != notThisIndex && !randomSigns.Contains(signs[index]))
{
randomSigns.Add(signs[index]);
// 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
(test[j], test[i]) = (test[i], test[j]);
}
List<Learnable> randomSigns = new List<Learnable>();
foreach(var sign in test.Take(3))
{
randomSigns.Add(signs[sign.index]);
}
return randomSigns;

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b0fcd1404d38ac94aace1c5b3564cc04
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,20 +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: 63770b348488e4a3983eb57792523f54, type: 3}
m_Name: NatMLHub
m_EditorClassIdentifier:
accessKey:
user:
email:
username:
billing:
plan:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 327974eea6e413e418ae0fddd61a0e00
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant: