You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
674 B
29 lines
674 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class Question2 : MonoBehaviour
|
|
{
|
|
public int index;//玩家选择的答案记录
|
|
int rand;//随机的结果
|
|
public string[] questionInfo;
|
|
Toggle tg;
|
|
void Start()
|
|
{
|
|
|
|
tg = GetComponent<Toggle>();
|
|
Debug.Log("对题目进行初始化");
|
|
rand = Step2_3.rand;
|
|
transform.GetChild(1).GetComponent<Text>().text = questionInfo[rand];
|
|
tg.onValueChanged.AddListener((bool value) =>
|
|
{
|
|
if (value)
|
|
{
|
|
EventManager.Instance.emit("Question2", index);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}
|