完成答题的所有修改
parent
929671f35d
commit
6bf6a6b096
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -4073,7 +4073,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1043.1398, y: -29.695}
|
||||
m_AnchoredPosition: {x: 1236.3799, y: -27.195}
|
||||
m_SizeDelta: {x: 168.2402, y: 59.39}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &349522703
|
||||
|
@ -4680,7 +4680,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6211\u7684\u5224\u65AD\u9898"
|
||||
m_Text: "\u5355\u9009\u5224\u65AD\u9898"
|
||||
--- !u!222 &418911811
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8540,7 +8540,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u60A8\u8FD8\u6709(1)\u9053\u9898\u672A\u7B54,\u8BF7\u95EE\u786E\u8BA4\u4EA4\u5377\u5417?\n"
|
||||
m_Text: "\u60A8\u8FD8\u6709(1)\u9053\u9898\u672A\u7B54,\u8BF7\u95EE\u662F\u5426\u786E\u8BA4\u4EA4\u5377\u5417?\n"
|
||||
--- !u!222 &796212002
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -13689,7 +13689,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u786E\u8BA4"
|
||||
m_Text: "\u662F"
|
||||
--- !u!222 &1309113134
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -15279,7 +15279,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 844.89954, y: -29.695}
|
||||
m_AnchoredPosition: {x: 1038.1396, y: -27.195}
|
||||
m_SizeDelta: {x: 168.2402, y: 59.39}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1419101592
|
||||
|
@ -15435,7 +15435,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u53D6\u6D88"
|
||||
m_Text: "\u5426"
|
||||
--- !u!222 &1424250650
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -15698,7 +15698,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1475178707
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -15717,7 +15717,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1241.38, y: -29.695}
|
||||
m_AnchoredPosition: {x: 1236.38, y: -27.195}
|
||||
m_SizeDelta: {x: 168.2402, y: 59.39}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1475178708
|
||||
|
@ -17505,7 +17505,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "2\u9898"
|
||||
m_Text: "1\u9898"
|
||||
--- !u!222 &1643417209
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -18969,7 +18969,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6211\u7684\u5224\u65AD\u9898"
|
||||
m_Text: "\u5355\u9009\u9009\u62E9\u9898"
|
||||
--- !u!222 &1822718783
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -20027,9 +20027,9 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Right: 5
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_Bottom: 5
|
||||
m_ChildAlignment: 5
|
||||
m_Spacing: 30
|
||||
m_ChildForceExpandWidth: 0
|
||||
|
@ -20863,7 +20863,7 @@ MonoBehaviour:
|
|||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6211\u7684\u5224\u65AD\u9898"
|
||||
m_Text: "\u591A\u9009\u9009\u62E9\u9898"
|
||||
--- !u!222 &2020752203
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
{
|
||||
public static readonly int EventId = typeof(QuestionSureEventArgs).GetHashCode();
|
||||
public override int Id => EventId;
|
||||
public bool isTrue { get; set; }
|
||||
|
||||
public int index;
|
||||
|
||||
public QuestionSureEventArgs(int index)
|
||||
public QuestionSureEventArgs(int index, bool isTrue)
|
||||
{
|
||||
this.index = index;
|
||||
this.isTrue = isTrue;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
namespace ZGameFramework
|
||||
{
|
||||
public class Right_QuestionItemStopInputEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(Right_QuestionItemStopInputEventArgs).GetHashCode();
|
||||
public override int Id => EventId;
|
||||
|
||||
public int index;
|
||||
|
||||
public Right_QuestionItemStopInputEventArgs(int index)
|
||||
{
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 54485189c8734db8bd8027302cb78a07
|
||||
timeCreated: 1703549993
|
|
@ -1,5 +1,10 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OfficeOpenXml;
|
||||
using Script.Excel;
|
||||
using Script.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
@ -30,7 +35,7 @@ public class ExcelManager : SingleManager<ExcelManager>
|
|||
_cData = new TureOrFalse_QuestionBank_C_Data(cData);
|
||||
var dData = ReadExcel.SelectDTable("QuestionBank_D");
|
||||
_dData = new MultipleChoice_QuestionBank_D_Data(dData);
|
||||
|
||||
|
||||
var payerData = ReadExcel.SelectPlayerTable("PlayerData");
|
||||
_playerData = new Player_Data(payerData);
|
||||
|
||||
|
@ -41,6 +46,110 @@ public class ExcelManager : SingleManager<ExcelManager>
|
|||
{
|
||||
return _aData.RandomGet(false);
|
||||
}
|
||||
|
||||
|
||||
#region 存入内容并导出Excel文件
|
||||
|
||||
public void SaveAndExp(SaveExcelData data) // 目前弃用了
|
||||
{
|
||||
string path = Application.streamingAssetsPath + "/程序输出数据" + DateTime.Now.Ticks + ".xlsx";
|
||||
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
|
||||
using (var pck = new ExcelPackage(fs))
|
||||
{
|
||||
var sheet = pck.Workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
for (int i = 0; i < data.hands.Length; i++)
|
||||
{
|
||||
sheet.SetValue(1, i + 2, data.hands[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.infos.Count; i++)
|
||||
{
|
||||
for (var j = 0; j < data.infos[i].strings.Length; j++)
|
||||
{
|
||||
//第0行、列留白
|
||||
// sheet.Cells[i + 2, j + 2].Value = data.infos[i].strings[j];
|
||||
|
||||
sheet.SetValue(i + 2, j + 2, data.infos[i].strings[j]);
|
||||
}
|
||||
}
|
||||
|
||||
pck.Save();
|
||||
}
|
||||
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
public void SaveAndExpIndex(SaveDataInfo info, int index)
|
||||
{
|
||||
string path = Application.streamingAssetsPath + "/程序输出数据" + DateTime.Now.Ticks + ".xlsx";
|
||||
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
|
||||
using (var pck = new ExcelPackage(fs))
|
||||
{
|
||||
var sheet = pck.Workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
string[] hands = new[] { "选手ID", "赛项", "科目", "第一题", "第二题", "第三题", "第四题", "第五题", "分数", "正确数量", "错误数量", "未答数量", "正确率", "用时" };
|
||||
for (int i = 0; i < hands.Length; i++)
|
||||
{
|
||||
sheet.SetValue(1, i + 2, hands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// for (var j = 0; j < info.strings.Length; j++)
|
||||
// {
|
||||
// //第0行、列留白
|
||||
// // sheet.Cells[i + 2, j + 2].Value = data.infos[i].strings[j];
|
||||
//
|
||||
// sheet.SetValue(index + 2, j + 2, info.strings[j]);
|
||||
// }
|
||||
int j = 0;
|
||||
sheet.SetValue(index + 2, j + 2, info.id);
|
||||
sheet.SetValue(index + 2, j + 3, info.title);
|
||||
sheet.SetValue(index + 2, j + 4, info.subject);
|
||||
int num = 0;
|
||||
foreach (var infoAnswerData in info.answerDatas)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("题目:");
|
||||
sb.AppendLine(infoAnswerData.title);
|
||||
sb.AppendLine("选项:");
|
||||
foreach (var option in infoAnswerData.options)
|
||||
{
|
||||
sb.AppendLine(option);
|
||||
}
|
||||
|
||||
sb.AppendLine("正确答案:");
|
||||
foreach (var answer in infoAnswerData.answers)
|
||||
{
|
||||
sb.AppendLine(answer);
|
||||
}
|
||||
|
||||
sb.AppendLine("回答结果:");
|
||||
foreach (var result in infoAnswerData.result)
|
||||
{
|
||||
sb.AppendLine(result);
|
||||
}
|
||||
|
||||
sheet.SetValue(index + 2, num + j + 5, sb.ToString());
|
||||
num++;
|
||||
}
|
||||
|
||||
sheet.SetValue(index + 2, j + 10, info.score);
|
||||
sheet.SetValue(index + 2, j + 11, info.trueCount);
|
||||
sheet.SetValue(index + 2, j + 12, info.falseCount);
|
||||
sheet.SetValue(index + 2, j + 13, info.nullCount);
|
||||
sheet.SetValue(index + 2, j + 14, info.accuracy);
|
||||
sheet.SetValue(index + 2, j + 15, info.time);
|
||||
|
||||
pck.Save();
|
||||
}
|
||||
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
//模拟数据写入
|
|
@ -0,0 +1,83 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Script.Excel
|
||||
{
|
||||
public class SaveDataInfo
|
||||
{
|
||||
public string id;
|
||||
public string title;
|
||||
public string subject;
|
||||
public List<AnswerData> answerDatas = new List<AnswerData>();
|
||||
public string score;
|
||||
public string trueCount;
|
||||
public string falseCount;
|
||||
public string nullCount;
|
||||
public string accuracy;
|
||||
public string time;
|
||||
|
||||
public class AnswerData
|
||||
{
|
||||
public string title;
|
||||
public string[] options;
|
||||
public string[] answers;
|
||||
public string[] result;
|
||||
}
|
||||
}
|
||||
|
||||
public class SaveData
|
||||
{
|
||||
private Dictionary<int, SaveDataInfo> _saveDataInfos = new Dictionary<int, SaveDataInfo>();
|
||||
|
||||
public int Count => _saveDataInfos.Count;
|
||||
|
||||
public SaveDataInfo AddInfo(int id, string title, string subject)
|
||||
{
|
||||
var saveDataInfo = new SaveDataInfo();
|
||||
saveDataInfo.id = id.ToString();
|
||||
saveDataInfo.title = title;
|
||||
saveDataInfo.subject = subject;
|
||||
_saveDataInfos.Add(id, saveDataInfo);
|
||||
return saveDataInfo;
|
||||
}
|
||||
|
||||
public void AddAnswer(int id, string title, string[] options, string[] answers)
|
||||
{
|
||||
if (_saveDataInfos.TryGetValue(id, out var info))
|
||||
{
|
||||
var answerData = new SaveDataInfo.AnswerData();
|
||||
answerData.title = title;
|
||||
answerData.options = options;
|
||||
answerData.answers = answers;
|
||||
info.answerDatas.Add(answerData);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddResult(int id, int index, string[] result)
|
||||
{
|
||||
if (_saveDataInfos.TryGetValue(id, out var info))
|
||||
{
|
||||
info.answerDatas[index].result = result;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetScoreAndOther(int id, string score, string trueCount, string falseCount, string nullCount, string accuracy)
|
||||
{
|
||||
if (_saveDataInfos.TryGetValue(id, out var info))
|
||||
{
|
||||
info.score = score;
|
||||
info.trueCount = trueCount;
|
||||
info.falseCount = falseCount;
|
||||
info.nullCount = nullCount;
|
||||
info.accuracy = accuracy;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTime(int id, string time)
|
||||
{
|
||||
if (_saveDataInfos.TryGetValue(id, out var info))
|
||||
{
|
||||
info.time = time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 09c728e9add04ee6854376faa88e60a5
|
||||
timeCreated: 1703518125
|
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
public class SaveExcelData
|
||||
{
|
||||
public class SaveExcelDataInfo
|
||||
{
|
||||
public string[] strings;
|
||||
|
||||
public SaveExcelDataInfo(string[] str)
|
||||
{
|
||||
strings = str;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SaveExcelDataInfo> infos;
|
||||
public string[] hands;
|
||||
|
||||
public SaveExcelData()
|
||||
{
|
||||
hands = new[] { "选手ID", "选手(如没有内容属于正常情况)", "团型", "文化元素" };
|
||||
this.infos = new List<SaveExcelDataInfo>();
|
||||
}
|
||||
|
||||
public void AddInfoData(string id, string name, string team, string culture)
|
||||
{
|
||||
infos.Add(new SaveExcelDataInfo(new[] { id, name, team, culture }));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a9b4fad1359c4ce59d49c4d44fd36bc2
|
||||
timeCreated: 1703554598
|
|
@ -1,9 +1,50 @@
|
|||
using Script.UI;
|
||||
using Script.Excel;
|
||||
using Script.UI;
|
||||
|
||||
namespace Script
|
||||
{
|
||||
public class GlobalManager : SingleManager<GlobalManager>
|
||||
{
|
||||
public SummaryInfo summaryInfo;
|
||||
// public SummaryInfo summaryInfo;// 不参与数据存储
|
||||
|
||||
private SaveData saveData;
|
||||
private SaveDataInfo currentInfo;
|
||||
|
||||
public SaveDataInfo CurrentInfo => currentInfo;
|
||||
public int Count => saveData.Count;
|
||||
|
||||
public GlobalManager()
|
||||
{
|
||||
saveData = new SaveData();
|
||||
}
|
||||
|
||||
public void AddInfo(int id, string title, string subject)
|
||||
{
|
||||
currentInfo = saveData.AddInfo(id, title, subject);
|
||||
}
|
||||
|
||||
public void AddCurrentAnswer(string title, string[] options, string[] answers)
|
||||
{
|
||||
var id = int.Parse(currentInfo.id);
|
||||
saveData.AddAnswer(id, title, options, answers);
|
||||
}
|
||||
|
||||
public void AddCurrentResult(int index, string[] result)
|
||||
{
|
||||
var id = int.Parse(currentInfo.id);
|
||||
saveData.AddResult(id, index, result);
|
||||
}
|
||||
|
||||
public void SetCurrentScoreAndOther(string score, string trueCount, string falseCount, string nullCount, string accuracy)
|
||||
{
|
||||
var id = int.Parse(currentInfo.id);
|
||||
saveData.SetScoreAndOther(id, score, trueCount, falseCount, nullCount, accuracy);
|
||||
}
|
||||
|
||||
public void SetTime(string time)
|
||||
{
|
||||
var id = int.Parse(currentInfo.id);
|
||||
saveData.SetTime(id, time);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,7 +54,9 @@ namespace Script.UI
|
|||
private void OnEnd()
|
||||
{
|
||||
Debug.Log("倒计时结束");
|
||||
GlobalManager.Instance.summaryInfo.time = TimeSpan.FromSeconds(_time);
|
||||
var fromSeconds = TimeSpan.FromSeconds(_time);
|
||||
var time = fromSeconds.ToCustomString();
|
||||
GlobalManager.Instance.SetTime(time);
|
||||
var panelBase = UIManager.Instance.GetPanel(PanelType.Answering);
|
||||
var answeringPanel = panelBase as AnsweringPanel;
|
||||
answeringPanel.SaveData();
|
||||
|
@ -87,7 +89,9 @@ namespace Script.UI
|
|||
{
|
||||
_timer.Dispose();
|
||||
isCountDown = false;
|
||||
GlobalManager.Instance.summaryInfo.time = TimeSpan.FromSeconds(_time);
|
||||
var fromSeconds = TimeSpan.FromSeconds(_time);
|
||||
var time = fromSeconds.ToCustomString();
|
||||
GlobalManager.Instance.SetTime(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using ZGameFramework;
|
||||
|
@ -17,6 +18,8 @@ namespace Script.UI
|
|||
[SerializeField] private Button btn_Submit;
|
||||
[SerializeField] private ToggleGroup _toggleGroup;
|
||||
|
||||
private List<Toggle> toggles = new List<Toggle>();
|
||||
|
||||
private string title;
|
||||
private string[] options;
|
||||
private string[] answers;
|
||||
|
@ -35,6 +38,17 @@ namespace Script.UI
|
|||
btn_Next.onClick.AddListener(ClickNext);
|
||||
btn_Submit.onClick.AddListener(ClickSubmit);
|
||||
gameObject.SetActive(false);
|
||||
btn_Submit.gameObject.SetActive(false);
|
||||
EventManager.Instance.Subscribe(Right_QuestionItemStopInputEventArgs.EventId, Right_QuestionItemStopInputEvent);
|
||||
}
|
||||
|
||||
private void Right_QuestionItemStopInputEvent(object sender, GameEventArgs e)
|
||||
{
|
||||
var args = e as Right_QuestionItemStopInputEventArgs;
|
||||
if (args.index == currentIndex)
|
||||
{
|
||||
// answerData.StopSetData();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
@ -42,6 +56,7 @@ namespace Script.UI
|
|||
btn_Last.onClick.RemoveListener(ClickLase);
|
||||
btn_Next.onClick.RemoveListener(ClickNext);
|
||||
btn_Submit.onClick.RemoveListener(ClickSubmit);
|
||||
EventManager.Instance.Unsubscribe(Right_QuestionItemStopInputEventArgs.EventId, Right_QuestionItemStopInputEvent);
|
||||
}
|
||||
|
||||
public void SetData(int currentIndex, string right_Title, string title, string[] options, string[] answers, Action<int> last, Action<int> next)
|
||||
|
@ -143,6 +158,7 @@ namespace Script.UI
|
|||
{
|
||||
var go = GameObject.Instantiate(tog_Option_Item.gameObject, tog_Option_Item.transform.parent);
|
||||
toggleItemList.Add(go);
|
||||
toggles.Add(go.GetComponent<Toggle>());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,9 +183,30 @@ namespace Script.UI
|
|||
|
||||
private void RightToggleChanged(bool isTrue, string str)
|
||||
{
|
||||
if (isTrue)
|
||||
answerData.SetInfoData(str, isTrue);
|
||||
// if (isTrue)
|
||||
CheckIsAnswer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查是否回答了
|
||||
/// </summary>
|
||||
private void CheckIsAnswer()
|
||||
{
|
||||
bool isNull = true;
|
||||
foreach (var toggle in toggles)
|
||||
{
|
||||
answerData.SetInfoData(str);
|
||||
if (toggle.isOn)
|
||||
{
|
||||
isNull = false;
|
||||
}
|
||||
}
|
||||
|
||||
EventManager.Instance.FireNow(this, new QuestionSureEventArgs(currentIndex, !isNull));
|
||||
if (!isNull)
|
||||
{
|
||||
_toggleGroup.allowSwitchOff = false;
|
||||
answerData.StopSetData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +224,7 @@ namespace Script.UI
|
|||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void ClickSubmit()
|
||||
private void ClickSubmit() // 弃用
|
||||
{
|
||||
bool isTrue = false;
|
||||
foreach (var go in toggleItemList)
|
||||
|
@ -197,7 +234,7 @@ namespace Script.UI
|
|||
isTrue = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isTrue) return;
|
||||
|
||||
// var resultType = GetResult();
|
||||
|
@ -225,7 +262,7 @@ namespace Script.UI
|
|||
answerData.StopSetData();
|
||||
btn_Submit.interactable = false;
|
||||
|
||||
EventManager.Instance.FireNow(this, new QuestionSureEventArgs(currentIndex));
|
||||
// EventManager.Instance.FireNow(this, new QuestionSureEventArgs(currentIndex));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -234,6 +271,17 @@ namespace Script.UI
|
|||
/// <returns></returns>
|
||||
public ResultType GetResult()
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (var toggle in toggles)
|
||||
{
|
||||
if (toggle.isOn)
|
||||
{
|
||||
list.Add(toggle.name);
|
||||
}
|
||||
}
|
||||
|
||||
GlobalManager.Instance.AddCurrentResult(currentIndex, list.ToArray());
|
||||
|
||||
return answerData.GetDataResult();
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +310,7 @@ namespace Script.UI
|
|||
}
|
||||
}
|
||||
|
||||
public bool SetInfoData(string str)
|
||||
public bool SetInfoData(string str, bool isTrue)
|
||||
{
|
||||
if (IsCanSet)
|
||||
{
|
||||
|
@ -270,7 +318,7 @@ namespace Script.UI
|
|||
{
|
||||
if (adInfo.answer == str)
|
||||
{
|
||||
adInfo.result = true;
|
||||
adInfo.result = isTrue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +344,6 @@ namespace Script.UI
|
|||
public ResultType GetDataResult()
|
||||
{
|
||||
if (isCanSet) return ResultType.未答;
|
||||
|
||||
foreach (var adInfo in datas)
|
||||
{
|
||||
if (!adInfo.result)
|
||||
|
|
|
@ -42,7 +42,10 @@ namespace Script.UI
|
|||
private void QuestionSureEvent(object sender, GameEventArgs e)
|
||||
{
|
||||
var args = e as QuestionSureEventArgs;
|
||||
_toggles[args.index].transform.Find("Background").GetComponent<Image>().color = answeredColor;
|
||||
if (args.isTrue)
|
||||
_toggles[args.index].transform.Find("Background").GetComponent<Image>().color = answeredColor;
|
||||
else
|
||||
_toggles[args.index].transform.Find("Background").GetComponent<Image>().color = unansweredColor;
|
||||
}
|
||||
|
||||
public override void Open()
|
||||
|
@ -71,6 +74,7 @@ namespace Script.UI
|
|||
ShowIndexQuestion,
|
||||
ShowIndexQuestion
|
||||
);
|
||||
GlobalManager.Instance.AddCurrentAnswer(_aDataInfos[0].topic,_aDataInfos[0].options,_aDataInfos[0].answer);
|
||||
|
||||
_rightQuestionItems[1].SetData(
|
||||
1,
|
||||
|
@ -81,6 +85,7 @@ namespace Script.UI
|
|||
ShowIndexQuestion,
|
||||
ShowIndexQuestion
|
||||
);
|
||||
GlobalManager.Instance.AddCurrentAnswer(_bDataInfos[0].topic,_bDataInfos[0].options,_bDataInfos[0].answer);
|
||||
|
||||
_rightQuestionItems[2].SetData(
|
||||
2,
|
||||
|
@ -91,6 +96,7 @@ namespace Script.UI
|
|||
ShowIndexQuestion,
|
||||
ShowIndexQuestion
|
||||
);
|
||||
GlobalManager.Instance.AddCurrentAnswer(_cDataInfos[0].topic,_cDataInfos[0].options,_cDataInfos[0].answer);
|
||||
|
||||
_rightQuestionItems[3].SetData(
|
||||
3,
|
||||
|
@ -101,6 +107,7 @@ namespace Script.UI
|
|||
ShowIndexQuestion,
|
||||
ShowIndexQuestion
|
||||
);
|
||||
GlobalManager.Instance.AddCurrentAnswer(_cDataInfos[1].topic,_cDataInfos[1].options,_cDataInfos[1].answer);
|
||||
|
||||
_rightQuestionItems[4].SetData(
|
||||
4,
|
||||
|
@ -111,9 +118,10 @@ namespace Script.UI
|
|||
ShowIndexQuestion,
|
||||
ShowIndexQuestion
|
||||
);
|
||||
GlobalManager.Instance.AddCurrentAnswer(_dDataInfos[0].topic,_dDataInfos[0].options,_dDataInfos[0].answer);
|
||||
|
||||
//
|
||||
txt_ID.text = GlobalManager.Instance.summaryInfo.id;
|
||||
txt_ID.text = GlobalManager.Instance.CurrentInfo.id;
|
||||
|
||||
SetLeftStart();
|
||||
ShowIndexQuestion(0);
|
||||
|
@ -228,11 +236,12 @@ namespace Script.UI
|
|||
|
||||
Debug.Log($"{score}-{trueCount}-{falseCount}-{nullCount}-{count}%");
|
||||
|
||||
GlobalManager.Instance.summaryInfo.score = score;
|
||||
GlobalManager.Instance.summaryInfo.trueCount = trueCount;
|
||||
GlobalManager.Instance.summaryInfo.falseCount = falseCount;
|
||||
GlobalManager.Instance.summaryInfo.nullCount = nullCount;
|
||||
GlobalManager.Instance.summaryInfo.accuracy = $"{count}%";
|
||||
// GlobalManager.Instance.summaryInfo.score = score;
|
||||
// GlobalManager.Instance.summaryInfo.trueCount = trueCount;
|
||||
// GlobalManager.Instance.summaryInfo.falseCount = falseCount;
|
||||
// GlobalManager.Instance.summaryInfo.nullCount = nullCount;
|
||||
// GlobalManager.Instance.summaryInfo.accuracy = $"{count}%";
|
||||
GlobalManager.Instance.SetCurrentScoreAndOther(score.ToString(),trueCount.ToString(),falseCount.ToString(),nullCount.ToString(),$"{count}%");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,11 +43,12 @@ namespace Script.UI
|
|||
}
|
||||
|
||||
txt_ID.text = dataInfo.id;
|
||||
var info = new SummaryInfo();
|
||||
info.id = dataInfo.id;
|
||||
info.title = FileManager.Instance.GetTitle.title;
|
||||
info.subject = FileManager.Instance.GetTitle.subject;
|
||||
GlobalManager.Instance.summaryInfo = info;
|
||||
// var info = new SummaryInfo();
|
||||
// info.id = dataInfo.id;
|
||||
// info.title = FileManager.Instance.GetTitle.title;
|
||||
// info.subject = FileManager.Instance.GetTitle.subject;
|
||||
// GlobalManager.Instance.summaryInfo = info;
|
||||
GlobalManager.Instance.AddInfo(int.Parse(dataInfo.id), FileManager.Instance.GetTitle.title, FileManager.Instance.GetTitle.subject);
|
||||
}
|
||||
|
||||
private void ClickEnter()
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace Script.UI
|
|||
base.ResetPanelData();
|
||||
UpdateText();
|
||||
|
||||
txt_ID.text = GlobalManager.Instance.summaryInfo.id;
|
||||
txt_Subject.text = GlobalManager.Instance.summaryInfo.subject;
|
||||
txt_ID.text = GlobalManager.Instance.CurrentInfo.id;
|
||||
txt_Subject.text = GlobalManager.Instance.CurrentInfo.subject;
|
||||
}
|
||||
|
||||
private void UpdateText()
|
||||
|
|
|
@ -50,14 +50,14 @@ namespace Script.UI
|
|||
|
||||
private void SaveData()
|
||||
{
|
||||
var info = GlobalManager.Instance.summaryInfo;
|
||||
var info = GlobalManager.Instance.CurrentInfo;
|
||||
|
||||
txt_Score.text = info.score.ToString();
|
||||
txt_True.text = info.trueCount.ToString();
|
||||
txt_False.text = info.falseCount.ToString();
|
||||
txt_Null.text = info.nullCount.ToString();
|
||||
txt_Accuracy.text = info.accuracy;
|
||||
txt_Time.text = info.time.ToCustomString();
|
||||
txt_Time.text = info.time;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"选手ID:{info.id}");
|
||||
|
@ -70,6 +70,7 @@ namespace Script.UI
|
|||
sb.AppendLine($"正确率:{txt_Accuracy.text}");
|
||||
sb.AppendLine($"用时:{txt_Time.text}");
|
||||
FileManager.Instance.SavePlayerData(sb.ToString());
|
||||
ExcelManager.Instance.SaveAndExpIndex(GlobalManager.Instance.CurrentInfo, GlobalManager.Instance.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,15 +32,30 @@ namespace Script.UI
|
|||
var answeringPanel = UIManager.Instance.GetPanel(PanelType.Answering) as AnsweringPanel;
|
||||
if (answeringPanel != null) answeringPanel.Pause();
|
||||
|
||||
var count = GlobalManager.Instance.summaryInfo.nullCount;
|
||||
if (count == 0)
|
||||
txt_Content.text = $"请问确认交卷吗?";
|
||||
var count = GlobalManager.Instance.CurrentInfo.nullCount;
|
||||
var c = int.Parse(count);
|
||||
if (c == 0)
|
||||
txt_Content.text = $"请问是否确认交卷吗?";
|
||||
else
|
||||
txt_Content.text = $"您还有({count})道题未答,请问确认交卷吗?";
|
||||
txt_Content.text = $"您还有({c})道题未答,请问是否确认交卷吗?";
|
||||
}
|
||||
|
||||
private int index = 0;
|
||||
|
||||
public void ResetIndex()
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
private void ClickSure()
|
||||
{
|
||||
++index;
|
||||
if (index < 3)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
var panelBase = UIManager.Instance.GetPanel(PanelType.Answering);
|
||||
var answeringPanel = panelBase as AnsweringPanel;
|
||||
if (answeringPanel != null) answeringPanel.SaveData();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: db1d563e83d344c4bbbd49488aeb3046
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue