using System.Collections; using System.Collections.Generic; using Kill.Managers; using UnityEngine; using UnityEngine.UI; public class SafetylearningOption : MonoBehaviour { /// /// 0未选择 1选中 2正确 3错误 /// public Sprite[] optionBg; /// /// 0正确 1错误 /// public Sprite[] optionLabelIcon; /// /// 0正常 1正确 2错误 /// public Color[] optionTextColor; public Text optionLabelText; public Text optionContentText; public bool isChinese=false; public Image icon; public Image bg; public bool isSelected=false; public void Init(QuestionOption option,bool isChinese) { this.isChinese=isChinese; icon.gameObject.SetActive(false); optionLabelText.gameObject.SetActive(true); optionContentText.gameObject.SetActive(true); optionContentText.color=optionTextColor[0]; bg.sprite=optionBg[0]; optionLabelText.text=option.optionLabel; optionContentText.text=isChinese?option.optionContent:option.optionContentEn; StartCoroutine(FitSize()); } public void SetSelected(bool isSelected) { this.isSelected=isSelected; bg.sprite=isSelected?optionBg[1]:optionBg[0]; } public void SetCorrect(bool isCorrect) { icon.gameObject.SetActive(true); optionLabelText.gameObject.SetActive(false); optionContentText.gameObject.SetActive(true); optionContentText.color=isCorrect?optionTextColor[1]:optionTextColor[2]; icon.sprite=isCorrect?optionLabelIcon[0]:optionLabelIcon[1]; bg.sprite=isCorrect?optionBg[2]:optionBg[3]; GetComponent