50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PanelWithImage : MonoBehaviour
|
|
{
|
|
public GameObject feedbackProgressObject;
|
|
public GameObject previewMessage;
|
|
public bool isPreview;
|
|
|
|
/// <summary>
|
|
/// Reference to the image for displaying the current words sprite
|
|
/// </summary>
|
|
public Transform signImageContainer;
|
|
|
|
public GameObject signImagePrefab;
|
|
|
|
public RawImage webcamScreen;
|
|
|
|
/// <summary>
|
|
/// Reference to the feedback field
|
|
/// </summary>
|
|
public TMP_Text feedbackText;
|
|
|
|
/// <summary>
|
|
/// Reference to the progress bar
|
|
/// </summary>
|
|
public Slider feedbackProgressBar;
|
|
|
|
/// <summary>
|
|
/// Reference to the progress bar image, so we can add fancy colors
|
|
/// </summary>
|
|
public Image feedbackProgressImage;
|
|
|
|
public List<Learnable> signs;
|
|
public int currentSignIndex;
|
|
|
|
public void Display()
|
|
{
|
|
Learnable currentSign = signs[currentSignIndex];
|
|
|
|
feedbackProgressObject.SetActive(!isPreview);
|
|
previewMessage.SetActive(isPreview);
|
|
|
|
GameObject sprite = GameObject.Instantiate(signImagePrefab, signImageContainer);
|
|
sprite.GetComponent<Image>().sprite = currentSign.image;
|
|
}
|
|
}
|