mirror of
https://github.com/ConjureETS/GameOff2024.git
synced 2026-03-24 13:10:58 +00:00
25 lines
748 B
C#
25 lines
748 B
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace GameOff.UI.Quiz
|
|
{
|
|
public class ChoiceUI: MonoBehaviour
|
|
{
|
|
public event EventHandler<string> OnAnswerTrigger;
|
|
|
|
[SerializeField] private Text letterText;
|
|
[SerializeField] private Button selectButton;
|
|
[SerializeField] private GameObject selectedVisual;
|
|
|
|
public void SetUp(string letter, QuestionUI question)
|
|
{
|
|
letterText.text = $"{letter}.";
|
|
selectedVisual.SetActive(false);
|
|
|
|
selectButton.onClick.AddListener(() => OnAnswerTrigger?.Invoke(this, letter));
|
|
|
|
question.OnChoiceUpdate += (sender, e) => selectedVisual.SetActive(e == letter);
|
|
}
|
|
}
|
|
} |