Implement score update.
This commit is contained in:
@@ -31,9 +31,12 @@ namespace Cryville.Crtr {
|
||||
_etor = ChartPlayer.etor;
|
||||
_rs = rs;
|
||||
foreach (var s in rs.scores) {
|
||||
var name = s.Key.Key;
|
||||
scoreDefs.Add(name, s.Value);
|
||||
scores.Add(name, s.Value.init);
|
||||
var key = s.Key;
|
||||
scoreSrcs.Add(key.Key, new PropSrc.Float(() => scores[key.Key]));
|
||||
scoreOps.Add(key.Key, new PropOp.Float(v => scores[key.Key] = v));
|
||||
scoreFmtKeys.Add(key.Key, IdentifierManager.SharedInstance.Request("_score_" + (string)key.Name));
|
||||
scoreDefs.Add(key.Key, s.Value);
|
||||
scores.Add(key.Key, s.Value.init);
|
||||
}
|
||||
}
|
||||
public void Prepare(float st, float et, Identifier input, JudgeDefinition def, ContainerState container) {
|
||||
@@ -143,12 +146,24 @@ namespace Cryville.Crtr {
|
||||
actlist.Insert(index, ev);
|
||||
}
|
||||
}
|
||||
void UpdateScore(Dictionary<ScoreOperation, PdtExpression> scores) {
|
||||
foreach (var score in scores) {
|
||||
// TODO
|
||||
void UpdateScore(Dictionary<ScoreOperation, PdtExpression> scoreops) {
|
||||
foreach (var scoreop in scoreops) {
|
||||
var key = scoreop.Key;
|
||||
_etor.ContextSelfValue = scoreSrcs[key.name.Key];
|
||||
_etor.Evaluate(scoreOps[key.name.Key], scoreop.Value);
|
||||
foreach (var s in _rs.scores) {
|
||||
if (s.Value.value != null) {
|
||||
_etor.ContextSelfValue = scoreSrcs[s.Key.Key];
|
||||
_etor.Evaluate(scoreOps[s.Key.Key], s.Value.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScoreCache.Clear();
|
||||
}
|
||||
public readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
||||
readonly Dictionary<int, int> scoreFmtKeys = new Dictionary<int, int>();
|
||||
readonly Dictionary<int, PropSrc> scoreSrcs = new Dictionary<int, PropSrc>();
|
||||
readonly Dictionary<int, PropOp> scoreOps = new Dictionary<int, PropOp>();
|
||||
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>();
|
||||
readonly object _lock = new object();
|
||||
@@ -156,7 +171,7 @@ namespace Cryville.Crtr {
|
||||
lock (_lock) {
|
||||
if (ScoreCache.Count == 0) {
|
||||
foreach (var s in scores)
|
||||
ScoreCache.Add(s.Key, s.Value.ToString(scoreDefs[s.Key].format));
|
||||
ScoreCache.Add(scoreFmtKeys[s.Key], s.Value.ToString(scoreDefs[s.Key].format));
|
||||
}
|
||||
return ScoreCache;
|
||||
}
|
||||
|
Reference in New Issue
Block a user