Resolve WES-80 "Data"

This commit is contained in:
Helena Van Breugel
2023-03-18 22:32:36 +00:00
parent 8ff5c6c4c8
commit a19d89db03
1092 changed files with 18349 additions and 30118 deletions

View File

@@ -4415,6 +4415,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 44fbed5ae228de39b9f727def7578d06, type: 3}
m_Name:
m_EditorClassIdentifier:
themeList: {fileID: 11400000, guid: a96bdbd3b1486d947a196fa1eb41d90b, type: 2}
endText: {fileID: 1502459770}
lpmText: {fileID: 1172084829}
lettersRightText: {fileID: 994850063}

View File

@@ -16,8 +16,8 @@ MonoBehaviour:
title: Spelling Bee
description: In deze minigame krijg je verschillende woorden voorgeschoteld die
je zo snel mogelijk moet spellen met behulp van het vingeralfabet
needsTheme: 1
thumbnail: {fileID: 21300000, guid: d99bb2dc44e35344fa358208a01c06c4, type: 3}
themeList: {fileID: 11400000, guid: a247e2ce790f0f746a3bc521e6ab7d58, type: 2}
thumbnail: {fileID: 21300000, guid: f2a020e24bfa24842bccecf6b36d5b79, type: 3}
minigameEntryPoint: SpellingBee/Scenes/Game
controls: Je begint dit spel met 5 seconden tijd, voor elk juist antwoord krijg
je extra tijd. Hoe sneller je het spel uitspeelt, hoe meer punten je scoort.

View File

@@ -11,7 +11,8 @@ public partial class GameController : MonoBehaviour
/// <summary>
/// All of the words that can be used in this session
/// </summary>
private string[] words;
//private string[] words;
private List<Learnable> words = new List<Learnable>();
/// <summary>
/// Where we currently are in the word
@@ -31,7 +32,7 @@ public partial class GameController : MonoBehaviour
/// <summary>
/// All of the available themes
/// </summary>
private ThemeList themeList;
public ThemeList themeList;
/// <summary>
/// The theme we are currently using
@@ -197,6 +198,7 @@ public partial class GameController : MonoBehaviour
/// </summary>
public void Start()
{
words.Clear();
correctLetters = 0;
incorrectLetters = 0;
// We use -1 instead of 0 so SetNextWord can simply increment it each time
@@ -223,10 +225,8 @@ public partial class GameController : MonoBehaviour
DeleteWord();
// TODO: change to ScriptableObject
themeList = ThemeLoader.LoadJson();
currentTheme = FindThemeByName(PlayerPrefs.GetString("themeName"));
words = currentTheme.words;
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
words.AddRange(currentTheme.learnables);
ShuffleWords();
SetNextWord();
}
@@ -283,7 +283,7 @@ public partial class GameController : MonoBehaviour
/// </summary>
private void ShuffleWords()
{
for (int i = words.Length - 1; i > 0; i--)
for (int i = words.Count - 1; i > 0; i--)
{
// Generate a random index between 0 and i (inclusive)
int j = UnityEngine.Random.Range(0, i + 1);
@@ -534,29 +534,6 @@ public partial class GameController : MonoBehaviour
timerValue += (float)seconds;
}
/// <summary>
/// Find the chosen theme by its name
/// </summary>
/// <param name="themeName">The name of the theme to find</param>
/// <returns>The requested theme</returns>
private Theme FindThemeByName(string themeName)
{
int themeIndex = 0;
while (themeIndex < themeList.themes.Length)
{
Theme theme = themeList.themes[themeIndex];
if (theme.name == themeName)
{
return theme;
}
themeIndex++;
}
Debug.Log("Requested theme not found");
return null;
}
/// <summary>
/// Display next word in the series
/// </summary>
@@ -564,11 +541,12 @@ public partial class GameController : MonoBehaviour
{
spelledWords++;
if (wordIndex < words.Length)
if (wordIndex < words.Count)
{
currentWord = words[wordIndex];
currentWord = words[wordIndex].name;
ChangeSprite(currentWord);
//ChangeSprite(currentWord);
DisplayWord(currentWord);
AddSeconds(currentWord.Length * secondsPerLetter + 1);
@@ -599,19 +577,7 @@ public partial class GameController : MonoBehaviour
TMP_Text txt = instance.GetComponentInChildren<TMP_Text>();
txt.text = Char.ToString(Char.ToUpper(word[i]));
}
}
/// <summary>
/// Change the image that is being displayed
/// </summary>
/// <param name="spriteName">Name of the new sprite</param>
private void ChangeSprite(string spriteName)
{
// Load the new sprite from the Resources folder
Sprite sprite = Resources.Load<Sprite>("SpellingBee/images/" + spriteName);
// Set the new sprite as the Image component's source image
wordImage.sprite = sprite;
wordImage.sprite = words[wordIndex].image;
}
/// <summary>