2023-12-10 12:28:20 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace ZXL.Excel
|
|
|
|
|
{
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class MultipleChoice_QuestionBank_D_Data
|
|
|
|
|
{
|
|
|
|
|
private readonly QuestionType questionType = QuestionType.多选题;
|
|
|
|
|
private List<MultipleChoice_QuestionBank_D_DataInfo> _list;
|
|
|
|
|
|
|
|
|
|
public List<MultipleChoice_QuestionBank_D_DataInfo> data => _list;
|
|
|
|
|
|
|
|
|
|
public MultipleChoice_QuestionBank_D_Data(List<MultipleChoice_QuestionBank_D_DataInfo> list)
|
|
|
|
|
{
|
|
|
|
|
_list = list;
|
|
|
|
|
foreach (var infos in _list)
|
|
|
|
|
{
|
2023-12-30 14:20:55 +08:00
|
|
|
|
if (infos.id == "201")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-10 12:28:20 +08:00
|
|
|
|
List<string> strings = new List<string>();
|
2023-12-30 14:20:55 +08:00
|
|
|
|
for (int i = 0; i < infos.options.Length; i++)
|
2023-12-10 12:28:20 +08:00
|
|
|
|
{
|
2023-12-30 14:20:55 +08:00
|
|
|
|
var infosOption = infos.options[i].Trim();
|
2023-12-10 12:28:20 +08:00
|
|
|
|
strings.Add(infosOption);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
infos.options = strings.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-30 14:20:55 +08:00
|
|
|
|
public void Remove(string id)
|
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < _list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (_list[i].id == id)
|
|
|
|
|
_list.Remove(_list[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-10 12:28:20 +08:00
|
|
|
|
public MultipleChoice_QuestionBank_D_DataInfo RandomGet()
|
|
|
|
|
{
|
|
|
|
|
MultipleChoice_QuestionBank_D_DataInfo info = null;
|
2023-12-30 14:20:55 +08:00
|
|
|
|
if (_list.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-10 12:28:20 +08:00
|
|
|
|
var range = Random.Range(0, _list.Count);
|
|
|
|
|
info = _list[range];
|
|
|
|
|
_list.RemoveAt(range);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class MultipleChoice_QuestionBank_D_DataInfo
|
|
|
|
|
{
|
|
|
|
|
public string id;
|
|
|
|
|
public string topic;
|
|
|
|
|
public string[] options;
|
|
|
|
|
public string[] answer;
|
|
|
|
|
|
|
|
|
|
public MultipleChoice_QuestionBank_D_DataInfo(string id, string topic, string[] options, string[] answer)
|
|
|
|
|
{
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.topic = topic;
|
|
|
|
|
this.options = options;
|
|
|
|
|
this.answer = answer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|