using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; /// /// Class to handle panel with only image and webcam /// public class PanelWithImage : MonoBehaviour { /// /// Reference to the feedback progress bar /// public GameObject feedbackProgressObject; /// /// Reference to the object containing the message for when the course is loaded in preview mode /// public GameObject previewMessage; /// /// True if the course is loaded in preview mode, false otherwise /// public bool isPreview; /// /// Reference to the image for displaying the current words sprite /// public Transform signImageContainer; /// /// Reference to the prefab for displaying the image /// public GameObject signImagePrefab; /// /// Reference to the webcam /// public RawImage webcamScreen; /// /// Reference to the feedback field /// public TMP_Text feedbackText; /// /// Reference to the progress bar /// public Slider feedbackProgressBar; /// /// Reference to the progress bar image, so we can add fancy colors /// public Image feedbackProgressImage; /// /// Reference to the list of learnables /// public List signs; /// /// Index of the current learnable in the list with learnables /// public int currentSignIndex; /// /// Update the display of this panel /// public void Display() { Learnable currentSign = signs[currentSignIndex]; feedbackProgressObject.SetActive(!isPreview); previewMessage.SetActive(isPreview); GameObject sprite = GameObject.Instantiate(signImagePrefab, signImageContainer); sprite.GetComponent().sprite = currentSign.image; } }