Introduce IdentifierManager to improve PDT evaluator performance.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Common.Unity.Input;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,24 +8,22 @@ namespace Cryville.Crtr {
|
||||
readonly PdtRuleset _rs;
|
||||
public Judge(PdtRuleset rs) {
|
||||
_rs = rs;
|
||||
foreach (var s in rs.scores)
|
||||
scores.Add(s.Key, s.Value.init);
|
||||
}
|
||||
public void StartFrame() {
|
||||
|
||||
foreach (var s in rs.scores) {
|
||||
var name = IdentifierManager.SharedInstance.Request(s.Key);
|
||||
scoreDefs.Add(name, s.Value);
|
||||
scores.Add(name, s.Value.init);
|
||||
}
|
||||
}
|
||||
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() {
|
||||
public readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
||||
public readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
||||
readonly Dictionary<int, string> ScoreCache = new Dictionary<int, string>();
|
||||
public Dictionary<int, string> GetFormattedScoreStrings() {
|
||||
if (ScoreCache.Count == 0) {
|
||||
foreach (var s in scores)
|
||||
ScoreCache.Add(s.Key, s.Value.ToString(_rs.scores[s.Key].format));
|
||||
ScoreCache.Add(s.Key, s.Value.ToString(scoreDefs[s.Key].format));
|
||||
}
|
||||
return ScoreCache;
|
||||
}
|
||||
@@ -51,7 +50,7 @@ namespace Cryville.Crtr {
|
||||
public Dictionary<string, PdtExpression> scores;
|
||||
}
|
||||
public class ScoreOperation {
|
||||
public string name;
|
||||
public int name;
|
||||
public PdtOperator op;
|
||||
}
|
||||
public class ScoreDefinition {
|
||||
|
Reference in New Issue
Block a user