86 lines
1.8 KiB
C#
86 lines
1.8 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class MissionQuestionAnswerItem : MonoBehaviour {
|
|||
|
|
|||
|
public static MissionQuestionAnswerItem Instance;
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Instance = null;
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
Refresh();
|
|||
|
}
|
|||
|
|
|||
|
public Text _answerText;
|
|||
|
public GameObject _rightBG;
|
|||
|
public GameObject _wrongBG;
|
|||
|
|
|||
|
public GameObject _rightIcon;
|
|||
|
public GameObject _wrongIcon;
|
|||
|
|
|||
|
//public GameObject _markIcon;
|
|||
|
|
|||
|
//当前答案对应的字符(A B C D)
|
|||
|
public string _curAsnwerChar;
|
|||
|
public void InitAnswerItem(string answer)
|
|||
|
{
|
|||
|
Refresh();
|
|||
|
|
|||
|
_answerText.text = answer;
|
|||
|
//if(answerNum == 0)
|
|||
|
//{
|
|||
|
// _curAsnwerChar = "A";
|
|||
|
//}
|
|||
|
//else if(answerNum == 1)
|
|||
|
//{
|
|||
|
// _curAsnwerChar = "B";
|
|||
|
//}
|
|||
|
//else if(answerNum == 3)
|
|||
|
//{
|
|||
|
// _curAsnwerChar = "C";
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// _curAsnwerChar = "D";
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
public void OnItemClick()
|
|||
|
{
|
|||
|
MissionQuestionRoot.Instance.OnAnswerItemClick(_curAsnwerChar);
|
|||
|
}
|
|||
|
|
|||
|
//public void ShowMarkIcon(bool isShow)
|
|||
|
//{
|
|||
|
// _markIcon.SetActive(isShow);
|
|||
|
//}
|
|||
|
|
|||
|
public void ShowResult(bool isRight)
|
|||
|
{
|
|||
|
_rightBG.SetActive(isRight);
|
|||
|
_wrongBG.SetActive(!isRight);
|
|||
|
_rightIcon.SetActive(isRight);
|
|||
|
_wrongIcon.SetActive(!isRight);
|
|||
|
}
|
|||
|
|
|||
|
public void Refresh()
|
|||
|
{
|
|||
|
_rightBG.SetActive(false);
|
|||
|
_wrongBG.SetActive(false);
|
|||
|
//_markIcon.SetActive(false);
|
|||
|
_rightIcon.SetActive(false);
|
|||
|
_wrongIcon.SetActive(false);
|
|||
|
_answerText.text = "";
|
|||
|
}
|
|||
|
}
|