Resolve WES-192 "Fix progress screen"
This commit is contained in:
40
Assets/Accounts/Scripts/LearnableProgressCard.cs
Normal file
40
Assets/Accounts/Scripts/LearnableProgressCard.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Class to handle learnable progress card display
|
||||
/// </summary>
|
||||
public class LearnableProgressCard : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the progress so we can display a progress bar
|
||||
/// </summary>
|
||||
public PersistentDataController.SavedLearnableProgress progress;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the list of minigameCards so we can query the correct course
|
||||
/// </summary>
|
||||
public Learnable learnable;
|
||||
|
||||
/// <summary>
|
||||
/// UI reference to the thumbnail of the course
|
||||
/// </summary>
|
||||
public Image thumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// UI refeerence to the title of the course
|
||||
/// </summary>
|
||||
public List<Image> stars;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
thumbnail.sprite = learnable.image;
|
||||
var starRewards = new float[] { 1.0f, 2.5f, 4.0f, };
|
||||
for (int i = 0; i < 3; i++)
|
||||
stars[i].color = starRewards[i] < progress.progress ? Color.white : Color.black;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user