61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
public class PanelMultipleChoice : MonoBehaviour
|
|
{
|
|
public GameObject previewMessage;
|
|
|
|
/// <summary>
|
|
/// Reference to instructional video player
|
|
/// </summary>
|
|
public VideoPlayer videoPlayer;
|
|
public Image playButton;
|
|
|
|
/// <summary>
|
|
/// Reference to the image for displaying the current words sprite
|
|
/// </summary>
|
|
public Transform optionContainer;
|
|
|
|
public GameObject optionPrefab;
|
|
|
|
|
|
public List<Learnable> signs;
|
|
public int currentSignIndex;
|
|
|
|
public void Display()
|
|
{
|
|
Learnable currentSign = signs[currentSignIndex];
|
|
videoPlayer.aspectRatio = VideoAspectRatio.FitInside;
|
|
videoPlayer.clip = currentSign.clip;
|
|
videoPlayer.Play();
|
|
|
|
// TODO: @Tibe find 3 other random indexes and make buttons for mc question (and set images and callbacks)
|
|
|
|
/**************************
|
|
* TODO: @Tibe
|
|
*
|
|
* Voor het initialiseren van die multiplechoice opties, er bestaat een prefab van die button, moet maar eens kijken
|
|
* Dus zelf gwn woorden kiezen voor de andere opties ad random.
|
|
* Zie dat je geen dubbels hebt in je opties (logisch)
|
|
*
|
|
* *************************/
|
|
}
|
|
|
|
/// <summary>
|
|
/// This function is called when the pause-button is pressed on the video.
|
|
/// It switches between playing and pausing the video.
|
|
/// It then makes the button invisible when the video is playing, or visible when it's paused.
|
|
/// </summary>
|
|
public void TogglePlayPause()
|
|
{
|
|
if (!videoPlayer.isPlaying)
|
|
// Play video and hide button
|
|
videoPlayer.Play();
|
|
else
|
|
// Pause video and show button
|
|
videoPlayer.Pause();
|
|
}
|
|
}
|