63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using Cryville.Common.Pdt;
|
|
using Cryville.Common.Unity.Input;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Cryville.Crtr {
|
|
public class Judge {
|
|
readonly PdtRuleset rs;
|
|
public Judge() {
|
|
rs = ChartPlayer.pruleset;
|
|
foreach (var s in rs.scores)
|
|
scores.Add(s.Key, s.Value.init);
|
|
}
|
|
public void StartFrame() {
|
|
|
|
}
|
|
public void Feed(InputEvent ev) {
|
|
|
|
}
|
|
public void EndFrame() {
|
|
|
|
}
|
|
public readonly Dictionary<string, float> scores = new Dictionary<string, float>();
|
|
readonly Dictionary<string, string> ScoreCache = new Dictionary<string, string>();
|
|
public Dictionary<string, string> GetFormattedScoreStrings() {
|
|
if (ScoreCache.Count == 0) {
|
|
foreach (var s in scores)
|
|
ScoreCache.Add(s.Key, s.Value.ToString(rs.scores[s.Key].format));
|
|
}
|
|
return ScoreCache;
|
|
}
|
|
public string GetFullFormattedScoreString() {
|
|
bool flag = false;
|
|
string result = "";
|
|
foreach (var s in GetFormattedScoreStrings()) {
|
|
result += string.Format(flag ? "\n{0}: {1}" : "{0}: {1}", s.Key, s.Value);
|
|
flag = true;
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
public class InputDefinition {
|
|
public int dim;
|
|
public bool notnull;
|
|
public Dictionary<string, PdtExpression> pass;
|
|
}
|
|
public class JudgeDefinition {
|
|
public PdtExpression clip;
|
|
public PdtExpression hit;
|
|
public string[] pass;
|
|
public string miss;
|
|
public Dictionary<string, PdtExpression> scores;
|
|
}
|
|
public class ScoreOperation {
|
|
public string name;
|
|
public PdtOperator op;
|
|
}
|
|
public class ScoreDefinition {
|
|
public PdtExpression value;
|
|
public float init = 0;
|
|
public string format = "";
|
|
}
|
|
}
|