Combine score and score string property sources.
This commit is contained in:
@@ -217,7 +217,6 @@ namespace Cryville.Crtr {
|
|||||||
readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
||||||
readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
||||||
readonly Dictionary<int, string> scoreStringCache = new Dictionary<int, string>();
|
readonly Dictionary<int, string> scoreStringCache = new Dictionary<int, string>();
|
||||||
readonly Dictionary<int, PropSrc> scoreStringSrcs = new Dictionary<int, PropSrc>();
|
|
||||||
readonly ArrayPool<byte> scoreStringPool = new ArrayPool<byte>();
|
readonly ArrayPool<byte> scoreStringPool = new ArrayPool<byte>();
|
||||||
readonly Dictionary<int, string> scoreFormatCache = new Dictionary<int, string>();
|
readonly Dictionary<int, string> scoreFormatCache = new Dictionary<int, string>();
|
||||||
readonly TargetString scoreFullStr = new TargetString();
|
readonly TargetString scoreFullStr = new TargetString();
|
||||||
@@ -233,21 +232,18 @@ namespace Cryville.Crtr {
|
|||||||
scoreDefs.Add(key, s.Value);
|
scoreDefs.Add(key, s.Value);
|
||||||
scores.Add(key, s.Value.init);
|
scores.Add(key, s.Value.init);
|
||||||
scoreStringCache.Add(scoreStringKeys[key], null);
|
scoreStringCache.Add(scoreStringKeys[key], null);
|
||||||
scoreStringSrcs.Add(scoreStringKeys[key], new ScoreStringSrc(scoreStringPool, () => scores[key], scoreDefs[key].format));
|
scoreSrcs.Add(scoreStringKeys[key], new ScoreStringSrc(scoreStringPool, () => scores[key], scoreDefs[key].format));
|
||||||
scoreFormatCache[key] = string.Format("{{0:{0}}}", s.Value.format);
|
scoreFormatCache[key] = string.Format("{{0:{0}}}", s.Value.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InvalidateScore(int key) {
|
void InvalidateScore(int key) {
|
||||||
scoreSrcs[key].Invalidate();
|
scoreSrcs[key].Invalidate();
|
||||||
scoreStringCache[scoreStringKeys[key]] = null;
|
scoreStringCache[scoreStringKeys[key]] = null;
|
||||||
scoreStringSrcs[scoreStringKeys[key]].Invalidate();
|
scoreSrcs[scoreStringKeys[key]].Invalidate();
|
||||||
}
|
}
|
||||||
public bool TryGetScoreSrc(int key, out PropSrc value) {
|
public bool TryGetScoreSrc(int key, out PropSrc value) {
|
||||||
return scoreSrcs.TryGetValue(key, out value);
|
return scoreSrcs.TryGetValue(key, out value);
|
||||||
}
|
}
|
||||||
public bool TryGetScoreStringSrc(int key, out PropSrc value) {
|
|
||||||
return scoreStringSrcs.TryGetValue(key, out value);
|
|
||||||
}
|
|
||||||
public TargetString GetFullFormattedScoreString() {
|
public TargetString GetFullFormattedScoreString() {
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
scoreFullBuf.Clear();
|
scoreFullBuf.Clear();
|
||||||
|
@@ -44,10 +44,6 @@ namespace Cryville.Crtr {
|
|||||||
prop.Get(out type, out value);
|
prop.Get(out type, out value);
|
||||||
RevokePotentialConstant();
|
RevokePotentialConstant();
|
||||||
}
|
}
|
||||||
else if (ContextJudge != null && ContextJudge.TryGetScoreStringSrc(name, out prop)) {
|
|
||||||
prop.Get(out type, out value);
|
|
||||||
RevokePotentialConstant();
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
PropSrc result = ContextCascadeLookup(name);
|
PropSrc result = ContextCascadeLookup(name);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
Reference in New Issue
Block a user