using UnityEngine; using UnityEngine.UI; using QFramework; using System.Collections.Generic; using TMPro; using System; using Microsoft.SqlServer.Server; using XMLTool; using static OperationController; namespace QFramework.Example { public class UITextQuestionData : UIPanelData { public string title; public List options = new List(); public List answers = new List(); public List btns = new List(); public float waitCloseTime = -1; public bool showAnswer = false; public float rightScore = 0; public float errorScore = 0; public string scoreName = string.Empty; public string format; public string finishedEvent; /// /// 绝对的 不计算分项得分 对就得分 错就不得分 /// public bool absolutely = true; } public partial class UITextQuestion : UIPanel { protected override void OnInit(IUIData uiData = null) { mData = uiData as UITextQuestionData ?? new UITextQuestionData(); // please add init code here TypeEventSystem.Global.Register(OnStepChanged); } private void OnStepChanged(StepStatusOnChange change) { Hide(); } protected override void OnOpen(IUIData uiData = null) { mData = uiData as UITextQuestionData ?? new UITextQuestionData(); Title.text = mData.title; OptionContent.transform.RemoveAllChildren(); for (int i = 0; i < mData.options.Count; i++) { var item = mData.options[i]; GameObject obj = GameObject.Instantiate(OptionPrefab.gameObject, OptionContent.transform); obj.transform.Find("Label").GetComponent().text = item; obj.name = (i + 1).ToString(); } BtnContent.RemoveAllChildren(); foreach (var item in mData.btns) { GameObject obj = GameObject.Instantiate(BtnPrefab.gameObject, BtnContent); obj.name = item; var label = obj.transform.Find("Label").GetComponent(); label.text = item; obj.GetComponent