Code cleanup.

This commit is contained in:
2023-02-18 14:46:08 +08:00
parent 274a823d02
commit a1f7418d32
10 changed files with 78 additions and 66 deletions

View File

@@ -42,11 +42,12 @@ namespace Cryville.Crtr {
_numsrc3 = new PropSrc.Float(() => _numbuf3);
_numsrc4 = new PropSrc.Float(() => _numbuf4);
_rs.judges.TryGetValue(new Identifier(_var_pause), out _judgePause);
foreach (var i in rs.inputs.Keys) {
foreach (var i in rs.inputs) {
var id = i.Key;
var l = new List<JudgeEvent>();
evs.Add(i, l);
activeEvs.Add(i, new List<JudgeEvent>());
if (_judgePause != null && i.Key == _var_pause) {
evs.Add(id, l);
activeEvs.Add(id, new List<JudgeEvent>());
if (_judgePause != null && id.Key == _var_pause) {
l.Add(new JudgeEvent {
StartTime = double.NegativeInfinity, EndTime = double.PositiveInfinity,
StartClip = double.NegativeInfinity, EndClip = double.PositiveInfinity,
@@ -82,8 +83,9 @@ namespace Cryville.Crtr {
#region Judge
internal readonly Dictionary<int, int> judgeMap = new Dictionary<int, int>();
void InitJudges() {
foreach (var i in _rs.judges.Keys) {
judgeMap.Add(i.Key, IdentifierManager.SharedInstance.Request("judge_" + i.Name));
foreach (var i in _rs.judges) {
var id = i.Key;
judgeMap.Add(id.Key, IdentifierManager.SharedInstance.Request("judge_" + id.Name));
}
}
static bool _flag;
@@ -247,9 +249,10 @@ namespace Cryville.Crtr {
public TargetString GetFullFormattedScoreString() {
bool flag = false;
scoreFullBuf.Clear();
foreach (var s in scores.Keys) {
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.SharedInstance.Retrieve(s));
scoreFullBuf.AppendFormat(scoreFormatCache[s], scores[s]);
foreach (var s in scores) {
var id = s.Key;
scoreFullBuf.AppendFormat(flag ? "\n{0}: " : "{0}: ", (string)IdentifierManager.SharedInstance.Retrieve(id));
scoreFullBuf.AppendFormat(scoreFormatCache[id], scores[id]);
flag = true;
}
scoreFullStr.Length = scoreFullBuf.Count;