2023-09-20 00:15:45 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Mono.Event;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace UnityTest.ZXL
|
|
|
|
|
{
|
|
|
|
|
public class ChoiceQuestionUI : UI
|
|
|
|
|
{
|
|
|
|
|
public Button btnFirst;
|
|
|
|
|
public Button btnSecond;
|
|
|
|
|
|
|
|
|
|
public override void OnInit()
|
|
|
|
|
{
|
|
|
|
|
base.OnInit();
|
|
|
|
|
btnFirst.onClick.AddListener(ClickFirst);
|
|
|
|
|
btnSecond.onClick.AddListener(ClickSecond);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-05 02:31:29 +08:00
|
|
|
|
public void SetIndex(int index)
|
|
|
|
|
{
|
|
|
|
|
if (index == 0)
|
|
|
|
|
{
|
|
|
|
|
btnFirst.interactable = true;
|
|
|
|
|
btnSecond.interactable = false;
|
|
|
|
|
}
|
|
|
|
|
else if (index == 1)
|
|
|
|
|
{
|
|
|
|
|
btnFirst.interactable = false;
|
|
|
|
|
btnSecond.interactable = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 00:15:45 +08:00
|
|
|
|
private void ClickFirst()
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.FireNow(this, new ChoiceQuestionEventArgs(true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ClickSecond()
|
|
|
|
|
{
|
|
|
|
|
EventManager.Instance.FireNow(this, new ChoiceQuestionEventArgs(false));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|