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.
97 lines
2.6 KiB
97 lines
2.6 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class DuoXuan : BaseView
|
|
{
|
|
// Start is called before the first frame update
|
|
public int[] 选项;
|
|
public List<int> 临时选项;
|
|
public Toggle[] toggles1;
|
|
public GameObject 未回答, 提交完毕;
|
|
public GameObject next, myscene, nextscene;
|
|
public Button btn_提交, btn_未回答提交, btn_已作答提交;
|
|
void Start()
|
|
{
|
|
toggles1 = GetComponentsInChildren<Toggle>();
|
|
未回答 = GetChild(transform, "NoAnswerTip");
|
|
提交完毕 = GetChild(transform, "OverTip");
|
|
GameObject CtrlWnd = GetChild(transform, "CtrlWnd");
|
|
btn_提交 = GetChild<Button>(CtrlWnd.transform, "SubmitBtn");
|
|
btn_未回答提交 = GetChild<Button>(未回答.transform, "OK");
|
|
// btn_已作答提交 = GetChild<Button>(提交完毕.transform, "OK");
|
|
|
|
btn_提交.onClick.RemoveAllListeners();
|
|
btn_未回答提交.onClick.RemoveAllListeners();
|
|
// btn_已作答提交.onClick.RemoveAllListeners();
|
|
|
|
AddListener(btn_提交, 提交);
|
|
AddListener(btn_未回答提交, 确认提交);
|
|
// AddListener(btn_已作答提交, 确认提交);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void 提交()
|
|
{
|
|
for (int i = 0; i < toggles1.Length; i++)
|
|
{
|
|
int k = i;
|
|
if (toggles1[i].isOn)
|
|
{
|
|
临时选项.Add(k+1);
|
|
}
|
|
}
|
|
选项 = new int[临时选项.Count];
|
|
for (int i = 0; i < 临时选项.Count; i++)
|
|
{
|
|
选项[i] = 临时选项[i];
|
|
}
|
|
if (选项.Length > 0)
|
|
{
|
|
//提交完毕.SetActive(true);
|
|
确认提交();
|
|
}
|
|
else
|
|
{
|
|
未回答.SetActive(true);
|
|
}
|
|
|
|
|
|
}
|
|
public void 确认提交()
|
|
{
|
|
if (选项.Length == 0)
|
|
{
|
|
选项 = new int[] {0 };
|
|
}
|
|
GameRoot.SubmitMoreChoiceAnswer(Windows.Instance.关卡, Windows.Instance.题号, 选项);
|
|
// Windows.Instance.提交中.SetActive(true);
|
|
Windows.Instance.题号++;
|
|
gameObject.SetActive(false);
|
|
if (next != null)
|
|
{
|
|
next.SetActive(true);
|
|
}
|
|
if (nextscene != null)
|
|
{
|
|
nextscene.SetActive(true);
|
|
}
|
|
if (myscene != null)
|
|
{
|
|
myscene.SetActive(false);
|
|
}
|
|
if (next == null)
|
|
{
|
|
GameRoot.SubmitPassState(Windows.Instance.关卡, true);
|
|
GameRoot.ReturnMenu();
|
|
}
|
|
}
|
|
|
|
|
|
}
|