using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class DanXuan :BaseView { public int 选项 = -1; public Toggle[] toggles1; public Button[] buttons; public GameObject next; public Button btn_提交; private void Start() { for (int i = 0; i < toggles1.Length; i++) { int k = i; toggles1[i].onValueChanged.AddListener((bool bo) => ToggleCtrl(bo, k)); } for (int i = 0; i < buttons.Length; i++) { int k = i; buttons[i].onClick.AddListener(() => ButtonCtrl(k)); } btn_提交.onClick.RemoveAllListeners(); AddListener(btn_提交, 确认提交); } public void 确认提交() { GameRoot.SubmitChoiceAnswer(Windows.Instance.关卡, Windows.Instance.题号, 选项); //Windows.Instance.提交中.SetActive(true); Windows.Instance.题号++; //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(); } } public void ToggleCtrl(bool bo, int id) { if (bo) { 选项 = id + 1; } } public void ButtonCtrl(int id) { 选项 = id + 1; } }