using System;
using TMPro;
///
/// The SpellingBee-variant of the ScoreBoard
///
public class SpellingBeeGameEndedPanel : AbstractGameEndedPanel
{
///
/// Tell the scoreboard that the scoreboard is for SpellingBee
///
protected override MinigameIndex minigameIndex
{
get { return MinigameIndex.SPELLING_BEE; }
}
///
/// "VERLOREN" or "GEWONNEN"
///
public TMP_Text endText;
///
/// LPM
///
public TMP_Text lpmText;
///
/// Letters ( right | wrong )
///
public TMP_Text lettersRightText;
///
/// Letters ( right | wrong )
///
public TMP_Text lettersWrongText;
///
/// Letters
///
public TMP_Text lettersTotalText;
///
/// Accuracy
///
public TMP_Text accuracyText;
///
/// Words
///
public TMP_Text wordsText;
///
/// Time
///
public TMP_Text timeText;
///
/// Score
///
public TMP_Text scoreText;
///
/// Generate the content of the GameEnded panel
///
/// Time of starting the minigame
/// Total number of words
/// Total number of correctly spelled letters
/// Total number of incorrectly spelled letters
/// "VERLOREN" or "GEWONNEN"
/// Final score
public void GenerateContent(DateTime startTime, int totalWords, int correctLetters, int incorrectLetters, string result, int score)
{
// Final result
endText.text = result;
// LPM
TimeSpan duration = DateTime.Now.Subtract(startTime);
lpmText.text = (60f * correctLetters / duration.TotalSeconds).ToString("#") + " LPM";
// Letters ( right | wrong ) total
lettersRightText.text = correctLetters.ToString();
lettersWrongText.text = incorrectLetters.ToString();
lettersTotalText.text = (correctLetters + incorrectLetters).ToString();
// Accuracy
if (correctLetters + incorrectLetters > 0)
{
accuracyText.text = ((correctLetters) * 100f / (correctLetters + incorrectLetters)).ToString("#.##") + "%";
}
else
{
accuracyText.text = "-";
}
// Words
wordsText.text = $"{totalWords}";
// Time
timeText.text = duration.ToString(@"mm\:ss");
// Score
scoreText.text = $"Score: {score}";
SetScoreBoard();
}
}