57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace ZXL.Excel
|
|
{
|
|
[System.Serializable]
|
|
public class TureOrFalse_QuestionBank_C_Data
|
|
{
|
|
private readonly QuestionType questionType = QuestionType.判断题;
|
|
private List<TureOrFalse_QuestionBank_C_DataInfo> _list;
|
|
|
|
public List<TureOrFalse_QuestionBank_C_DataInfo> data => _list;
|
|
|
|
public TureOrFalse_QuestionBank_C_Data(List<TureOrFalse_QuestionBank_C_DataInfo> list)
|
|
{
|
|
_list = list;
|
|
foreach (var infos in _list)
|
|
{
|
|
List<string> strings = new List<string>();
|
|
strings.Add(infos.options[0]);
|
|
for (int i = 1; i < infos.options.Length - 1; i++)
|
|
{
|
|
var infosOption = infos.options[i].Replace("\n", "");
|
|
strings.Add(infosOption);
|
|
}
|
|
|
|
infos.options = strings.ToArray();
|
|
}
|
|
}
|
|
|
|
public TureOrFalse_QuestionBank_C_DataInfo RandomGet()
|
|
{
|
|
TureOrFalse_QuestionBank_C_DataInfo info = null;
|
|
var range = Random.Range(0, _list.Count);
|
|
info = _list[range];
|
|
_list.RemoveAt(range);
|
|
return info;
|
|
}
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class TureOrFalse_QuestionBank_C_DataInfo
|
|
{
|
|
public string id;
|
|
public string topic;
|
|
public string[] options;
|
|
public string[] answer;
|
|
|
|
public TureOrFalse_QuestionBank_C_DataInfo(string id, string topic, string[] options, string[] answer)
|
|
{
|
|
this.id = id;
|
|
this.topic = topic;
|
|
this.options = options;
|
|
this.answer = answer;
|
|
}
|
|
}
|
|
} |