Files
unity-application/Assets/JustSign/Scripts/JustSignGameEndedPanel.cs
2023-04-23 21:20:12 +00:00

91 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// The JustSign-variant of the ScoreBoard
/// </summary>
public class JustSignGameEndedPanel : AbstractGameEndedPanel
{
/// <summary>
/// Tell the scoreboard that the scoreboard is for JustSign
/// </summary>
protected override MinigameIndex minigameIndex
{
get { return MinigameIndex.JUST_SIGN; }
}
/// <summary>
/// The field that will display the amount of perfect signs
/// </summary>
public TMP_Text perfectSignsText;
/// <summary>
/// The field that will display the amount of good signs
/// </summary>
public TMP_Text goodSignsText;
/// <summary>
/// The field that will display the amount of meh signs
/// </summary>
public TMP_Text mehSignsText;
/// <summary>
/// The field that will display the amount of terrible signs
/// </summary>
public TMP_Text terribleSignsText;
/// <summary>
/// The field that will display the amount of not found signs
/// </summary>
public TMP_Text notFoundSignsText;
/// <summary>
/// The field that will display the signs per minute
/// </summary>
public TMP_Text gpmText;
/// <summary>
/// Score
/// </summary>
public TMP_Text scoreText;
/// <summary>
/// Generate the content of the gameEnded panel
/// </summary>
/// <param name="perfectSigns">The amount of perfect signs</param>
/// <param name="goodSigns">The amount of good signs</param>
/// <param name="mehSigns">The amount of meh signs</param>
/// <param name="terribleSigns">The emount of terrible signs</param>
/// <param name="incorrectSigns">The amount of incorrect signs</param>
/// <param name="duration">The duration of the song that was played</param>
/// <param name="score">The score obtained by the player</param>
public void GenerateContent(int perfectSigns, int goodSigns, int mehSigns, int terribleSigns, int incorrectSigns, int duration, int score)
{
// In de zone
perfectSignsText.text = perfectSigns.ToString();
// Aanvaardbaar
goodSignsText.text = goodSigns.ToString();
// Nipt
mehSignsText.text = mehSigns.ToString();
// Slechte timing
terribleSignsText.text = terribleSigns.ToString();
// Niet Geraden
notFoundSignsText.text = incorrectSigns.ToString();
// LPM
int correctSigns = goodSigns + perfectSigns + mehSigns + terribleSigns;
gpmText.text = (60f * correctSigns / duration).ToString("#") + " GPM";
// Score
scoreText.text = $"Score: {score}";
SetScoreBoard();
}
}