Resolve WES-181 "Missing code doc"
This commit is contained in:
committed by
Louis Adriaens
parent
7505ae7262
commit
3d99184717
@@ -2,17 +2,18 @@ using DigitalRuby.Tween;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Contains all game logic for the SpellingBee game
|
||||
/// </summary>
|
||||
public partial class SpellingBeeController : AbstractMinigameController
|
||||
{
|
||||
/// <summary>
|
||||
/// All of the words that can be used in this session
|
||||
/// </summary>
|
||||
//private string[] words;
|
||||
private List<Learnable> words = new List<Learnable>();
|
||||
|
||||
/// <summary>
|
||||
@@ -154,12 +155,12 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
/// <summary>
|
||||
/// Score obtained when spelling a letter
|
||||
/// </summary>
|
||||
private int correctLettersScore = 10;
|
||||
private const int correctLettersScore = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Score obtained when spelling the wrong letter :o
|
||||
/// </summary>
|
||||
private int incorrectLettersScore = -5;
|
||||
private const int incorrectLettersScore = -5;
|
||||
|
||||
/// <summary>
|
||||
/// Set the AbstractMinigameController variable to inform it of the theme for the signPredictor
|
||||
@@ -198,7 +199,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
int seconds = Mathf.FloorToInt(timerValue % 60.0f);
|
||||
|
||||
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
}
|
||||
else
|
||||
{
|
||||
//ActivateWin();
|
||||
ActivateEnd(true);
|
||||
}
|
||||
}
|
||||
@@ -338,9 +337,8 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// wait for 2 seconds
|
||||
/// Wait for 2 seconds
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerator Wait()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(2);
|
||||
@@ -458,7 +456,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
predictedSign = null;
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
|
||||
// Incorrect sign, wait a bit before passing it along
|
||||
else
|
||||
{
|
||||
@@ -475,7 +472,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
previousIncorrectSign = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +523,6 @@ public partial class SpellingBeeController : AbstractMinigameController
|
||||
bonusTimeText.SetActive(false);
|
||||
|
||||
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
||||
//feedback.signPredictor.SetModel(currentTheme.modelIndex);
|
||||
words.AddRange(currentTheme.learnables);
|
||||
ShuffleWords();
|
||||
NextWord();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// The SpellingBee-variant of the ScoreBoard
|
||||
/// </summary>
|
||||
public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
|
||||
{
|
||||
/// <summary>
|
||||
@@ -29,6 +28,10 @@ public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
|
||||
/// Letters ( right | wrong )
|
||||
/// </summary>
|
||||
public TMP_Text lettersRightText;
|
||||
|
||||
/// <summary>
|
||||
/// Letters ( right | wrong )
|
||||
/// </summary>
|
||||
public TMP_Text lettersWrongText;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
/// <summary>
|
||||
/// Test the SpellingBeeGameEndedPanel class
|
||||
/// </summary>
|
||||
public class SpellingBeeGameEndedPanelTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Setup for testing scoreboard of Spelling Bee
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
@@ -34,11 +36,10 @@ public class SpellingBeeGameEndedPanelTests
|
||||
/// <summary>
|
||||
/// Tests the scoreboard for Spelling Bee
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator ScoreTest()
|
||||
{
|
||||
SpellingBeeController spellingBeeController = (SpellingBeeController)GameObject.FindObjectOfType(typeof(SpellingBeeController));
|
||||
var spellingBeeController = GameObject.FindObjectOfType<SpellingBeeController>();
|
||||
spellingBeeController.NextWord();
|
||||
spellingBeeController.NextLetter(false);
|
||||
spellingBeeController.NextLetter(true);
|
||||
@@ -49,16 +50,13 @@ public class SpellingBeeGameEndedPanelTests
|
||||
spellingBeeController.ActivateEnd(true);
|
||||
|
||||
// Fetch the panel with the info for the fields and check if the controller has implemented them
|
||||
var script = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
||||
|
||||
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = (SpellingBeeGameEndedPanel)GameObject.FindObjectOfType(typeof(SpellingBeeGameEndedPanel));
|
||||
var SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
||||
Assert.NotNull(SpellingBeeGameEndedPanel);
|
||||
Assert.AreEqual("Score: 0", SpellingBeeGameEndedPanel.scoreText.text);
|
||||
Assert.AreEqual("1", SpellingBeeGameEndedPanel.lettersRightText.text);
|
||||
Assert.AreEqual("2", SpellingBeeGameEndedPanel.lettersWrongText.text);
|
||||
Assert.AreEqual("3", SpellingBeeGameEndedPanel.lettersTotalText.text);
|
||||
Assert.AreEqual("00:01", SpellingBeeGameEndedPanel.timeText.text);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,12 +5,14 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
/// <summary>
|
||||
/// Test the SpellingBeeController class
|
||||
/// </summary>
|
||||
public class SpellingBeeControllerTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Setup for testing Spelling Bee
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupFunction()
|
||||
{
|
||||
@@ -40,7 +42,6 @@ public class SpellingBeeControllerTests
|
||||
/// <summary>
|
||||
/// Tests the calculations of the score
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator CheckScoreTest()
|
||||
{
|
||||
@@ -56,7 +57,6 @@ public class SpellingBeeControllerTests
|
||||
/// <summary>
|
||||
/// Tests the ending panel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator ActivateGameOverTest()
|
||||
{
|
||||
@@ -67,13 +67,11 @@ public class SpellingBeeControllerTests
|
||||
SpellingBeeGameEndedPanel SpellingBeeGameEndedPanel = GameObject.FindObjectOfType<SpellingBeeGameEndedPanel>();
|
||||
Assert.NotNull(SpellingBeeGameEndedPanel);
|
||||
Assert.AreEqual("VERLOREN", SpellingBeeGameEndedPanel.endText.text);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the scoreboard in case of completion
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator ActivateWinTests()
|
||||
{
|
||||
@@ -89,7 +87,6 @@ public class SpellingBeeControllerTests
|
||||
/// <summary>
|
||||
/// Tests the scoreboard when timer goes off
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator CheckGameOverTest()
|
||||
{
|
||||
@@ -105,7 +102,6 @@ public class SpellingBeeControllerTests
|
||||
/// <summary>
|
||||
/// Tests the completion from a word and from the entire theme + scoreboard
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator CheckGoToNextWord()
|
||||
{
|
||||
@@ -115,7 +111,7 @@ public class SpellingBeeControllerTests
|
||||
spellingBeeController.PredictSign(spellingBeeController.GetSign());
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
|
||||
Assert.IsTrue(spellingBeeController.bonusTimeText.activeSelf);
|
||||
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
@@ -137,7 +133,6 @@ public class SpellingBeeControllerTests
|
||||
/// <summary>
|
||||
/// Tests the feedback in the game
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnityTest]
|
||||
public IEnumerator FeedbackTest()
|
||||
{
|
||||
@@ -165,11 +160,11 @@ public class SpellingBeeControllerTests
|
||||
yield return new WaitForSeconds(2.5f);
|
||||
|
||||
Assert.AreEqual($"Verkeerde gebaar: '{sign}'", spellingBeeController.feedbackText.text);
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
|
||||
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
|
||||
|
||||
spellingBeeController.ProcessCurrentAndPredicted(0.9f * threshold, sign, distance, expected);
|
||||
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);
|
||||
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
@@ -201,7 +196,7 @@ public class SpellingBeeControllerTests
|
||||
|
||||
Assert.AreEqual($"Verkeerde gebaar: '{sign}'", spellingBeeController.feedbackText.text);
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.feedbackText.color);
|
||||
|
||||
|
||||
spellingBeeController.ProcessCurrentAndPredicted(0.9f * threshold, sign, distance, expected);
|
||||
|
||||
Assert.AreEqual(new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f), spellingBeeController.scoreBonus.color);
|
||||
|
||||
Reference in New Issue
Block a user