private void OnReDo() { TestPaperItem[] Items = transform.GetComponentsInChildren <TestPaperItem>();//数据清除 for (int i = 0; i < Items.Length; i++) { Items[i].ResetAll(); } int curIndex = (int)FlowModel.GetInstance().CurrFlowTask.FlowEnumID; TestPaperModel.GetInstance().paperList[curIndex].ResetData(); Redo(); //Debug.LogError("redo"); //Redo(); }
public void Init() { int curIndex = (int)FlowModel.GetInstance().CurrFlowTask.FlowEnumID; //curIndex = 1;//测试 //Debug.LogError(indexe) Paper paper = TestPaperModel.GetInstance().paperList[curIndex]; paper.ResetData(); transform.Find("bg/Image/title").GetComponent <Text>().text = paper.title; Transform content = transform.Find("subject/Viewport/Content"); for (int i = 0; i < paper.itemList.Count; i++) { TestPaperItem tPaperItem = ResManager.GetPrefab("Prefabs/UI/TestPaperItem").GetComponent <TestPaperItem>(); tPaperItem.name = i.ToString(); tPaperItem.transform.SetParent(content); tPaperItem.Init(paper.itemList[i]); } }
private void OnNextDo() { TestPaperItem[] Items = transform.GetComponentsInChildren <TestPaperItem>();//数据清除 for (int i = 0; i < Items.Length; i++) { if (Items[i].item_right == Items[i].item_wrong) { TipUI tipUI = UIManager.Instance.GetUI <TipUI>("TipUI"); tipUI.SetTipMessage("还有题目为未做 !"); //UIManager.Instance.SetUIDepthTop("TipUI"); transform.SetAsLastSibling(); tipUI.transform.SetAsLastSibling(); return; } } int right = 0, wrong = 0; for (int i = 0; i < Items.Length; i++) { right += Items[i].item_right; wrong += Items[i].item_wrong; } int curIndex = (int)FlowModel.GetInstance().CurrFlowTask.FlowEnumID; Paper paper = TestPaperModel.GetInstance().paperList[curIndex]; paper.rightNum = right; paper.wrongNum = wrong; //Debug.LogError(curIndex); Finished(); if (evtFinished != null) { evtFinished(); } Debug.Log(FlowModel.GetInstance().CurrFlowTask.thisFlowStepName + " 正确个数和错误个数统计 " + TestPaperModel.GetInstance().TotalCount()); }
public void Init() { //分数统计界面UI显示 Text txt = again.transform.Find("Text").GetComponent <Text>(); txt.text = "再来一次"; string[] str = TestPaperModel.GetInstance().TotalCount().Split('_'); int right = int.Parse(str[0]); int wrong = int.Parse(str[1]); double a = ((double)right) / (right + wrong); double ratio = Math.Round(a, 4) * 100; string text = @"答对题目: " + right + "\n" + "答错题目: " + wrong + "\n" + "正确率: " + ratio.ToString() + "%"; transform.Find("Text").GetComponent <Text>().text = text; //发送统计分数时间戳 string guid = BitConverter.ToUInt64(Guid.NewGuid().ToByteArray(), 0).ToString(); //格式:guid+开始时间+结束时间+分数 string msg = "id=" + guid + "&" + HomePageModel.GetInstance().SendTimeStampStr() + "&score=" + ratio.ToString(); StartCoroutine(SendMsg(msg)); Settle(); }
private void Start() { StartCoroutine(ReadXml("/TestPaper/TestPaper.xml", "Subject/Items", TestPaperModel.GetInstance().ParseXml)); StartCoroutine(ReadXml("/TestPaper/sum.xml", "summary/Items", SumaryModel.GetInstance().ParseXml)); }