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.
96 lines
2.7 KiB
96 lines
2.7 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class DanXuan :BaseView
|
|
{
|
|
// Start is called before the first frame update
|
|
public int 选项=-1;
|
|
public Toggle[] toggles1;
|
|
public Button[] buttons;
|
|
public GameObject next,myscene,nextscene;
|
|
public GameObject 未回答, 提交完毕;
|
|
public Button btn_提交, btn_未回答提交, btn_已作答提交;
|
|
void Start()
|
|
{
|
|
toggles1 = GetComponentsInChildren<Toggle>();
|
|
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));
|
|
}
|
|
未回答 = 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 提交()
|
|
{
|
|
if (选项 > 0)
|
|
{
|
|
//提交完毕.SetActive(true);
|
|
确认提交();
|
|
}
|
|
else
|
|
{
|
|
未回答.SetActive(true);
|
|
}
|
|
}
|
|
public void 确认提交()
|
|
{
|
|
GameRoot.SubmitChoiceAnswer(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();
|
|
}
|
|
}
|
|
public void ToggleCtrl(bool bo,int id)
|
|
{
|
|
if (bo)
|
|
{ 选项 = id+1; }
|
|
}
|
|
public void ButtonCtrl(int id)
|
|
{
|
|
选项 = id+1;
|
|
}
|
|
|
|
}
|