58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using Script.Excel;
|
|
using Script.UI;
|
|
|
|
namespace Script
|
|
{
|
|
public class GlobalManager : SingleManager<GlobalManager>
|
|
{
|
|
// public SummaryInfo summaryInfo;// 不参与数据存储
|
|
|
|
private SaveData saveData;
|
|
private SaveDataInfo currentInfo;
|
|
|
|
public SaveDataInfo CurrentInfo => currentInfo;
|
|
public int Count => saveData.Count;
|
|
public SaveData SaveData => saveData;
|
|
|
|
// cache
|
|
/// <summary>
|
|
/// 已经回答过的题目ID缓存
|
|
/// </summary>
|
|
public Dictionary<FileManager.QuestionBankType, List<string>> questionIDs = new Dictionary<FileManager.QuestionBankType, List<string>>();
|
|
|
|
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 int AddCurrentResult(int index, string[] result)
|
|
{
|
|
var id = int.Parse(currentInfo.id);
|
|
return 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);
|
|
}
|
|
}
|
|
} |