36 lines
824 B
C#
36 lines
824 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class JPB_QuestionButtonBehaviour : MonoBehaviour
|
|
{
|
|
public int categoryId = 0;
|
|
public int questionId = 0;
|
|
private Button thisBtn;
|
|
|
|
private void Awake()
|
|
{
|
|
thisBtn = GetComponent<Button>();
|
|
thisBtn.onClick.AddListener(Clicked);
|
|
}
|
|
|
|
public void Clicked()
|
|
{
|
|
JPB_QuestionManager.instance.ReceiveQuestion(questionId, categoryId, this) ;
|
|
JPB_StepsManager.instance.NextStep();
|
|
thisBtn.interactable = false;
|
|
}
|
|
|
|
public void ReturnResult(bool correct)
|
|
{
|
|
if (correct)
|
|
{
|
|
GetComponent<Image>().color = Color.green;
|
|
}
|
|
else
|
|
{
|
|
GetComponent<Image>().color = Color.red;
|
|
}
|
|
}
|
|
} |