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.

125 lines
3.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DuoXuan : MonoBehaviour
{
// Start is called before the first frame update
public int[] ;//操作题0代表正确1代表错误,多选题数字代表选项
//public List<int> 临时选项;
public GameObject next;
public Button btn_;
public bool a;
public int globalID;
public Toggle[] toggles1, toggles2;
public Button[] buttons1, buttons2;
void Awake()
{
for (int i = 0; i < .Length; i++)
{
[i] = -1;
}
}
void Start()
{
for (int i = 0; i < toggles1.Length; i++)
{
int k = i;
toggles1[i].onValueChanged.AddListener((bool bo) => ToggleCtrl(bo, k, globalID));
}
for (int i = 0; i < buttons1.Length; i++)
{
int k = i;
buttons1[i].onClick.AddListener(() => ButtonCtrl(k, 0));
}
for (int i = 0; i < toggles2.Length; i++)
{
int k = i;
toggles2[i].onValueChanged.AddListener((bool bo) => ToggleCtrl(bo, k, globalID + 1));
}
for (int i = 0; i < buttons2.Length; i++)
{
int k = i;
buttons2[i].onClick.AddListener(() => ButtonCtrl(k, 1));
}
btn_.onClick.AddListener(() => ());
}
public void ()
{
GameRoot.SubmitMoreChoiceAnswer(Windows.Instance., Windows., , a);
// Windows.Instance.提交中.SetActive(true);
Windows.++;
gameObject.SetActive(false);
if (next != null)
{
next.SetActive(true);
}
if (next == null)
{
gameObject.SetActive(true);
GameRoot.SubmitPassState(Windows.Instance., true);
remake.a = 0;
remakeTwo.a = 0;
GameRoot.ReturnMenu();
/*AddListener(btn_已作答提交, GameRoot.ReturnMenu);
提交完毕.gameObject.SetActive(true);*/
}
}
public void ToggleCtrl(bool bo, int id,int num)
{
if (bo)
{ [globalID+num] = id + 1; }
}
public void ButtonCtrl(int id, int num)
{
[globalID+num] = id + 1;
if (num == 0)
{
for (int i = 0; i < buttons1.Length; i++)
{
buttons1[i].transform.Find("圆按钮蓝色").gameObject.SetActive(false);
}
buttons1[id].transform.Find("圆按钮蓝色").gameObject.SetActive(true);
}
if (num == 1)
{
for (int i = 0; i < buttons2.Length; i++)
{
buttons2[i].transform.Find("圆按钮蓝色").gameObject.SetActive(false);
}
buttons2[id].transform.Find("圆按钮蓝色").gameObject.SetActive(true);
}
}
public void ButtonSet(int id)
{
[globalID] = id + 1;
for (int i = 0; i < buttons1.Length; i++)
{
buttons1[i].transform.Find("圆按钮蓝色").gameObject.SetActive(false);
}
buttons1[id].transform.Find("圆按钮蓝色").gameObject.SetActive(true);
}
public void (int offect)
{
globalID++;
globalID += offect;
}
public void ()
{
[globalID] = 0;
}
}