Code cleanup.
This commit is contained in:
@@ -86,11 +86,9 @@ namespace Cryville.Crtr {
|
|||||||
AudioClient.Start();
|
AudioClient.Start();
|
||||||
|
|
||||||
ChartPlayer.motionRegistry = new Dictionary<string, MotionRegistry> {
|
ChartPlayer.motionRegistry = new Dictionary<string, MotionRegistry> {
|
||||||
|
{ "pt" , new MotionRegistry(typeof(VecPt)) },
|
||||||
{ "dir" , new MotionRegistry(typeof(Vec3)) },
|
{ "dir" , new MotionRegistry(typeof(Vec3)) },
|
||||||
{ "normal" , new MotionRegistry(typeof(Vec3)) },
|
{ "normal" , new MotionRegistry(typeof(Vec3)) },
|
||||||
// { "pdirz", new MotionRegistry(typeof(Vec1)) },
|
|
||||||
{ "pt" , new MotionRegistry(typeof(VecPt)) },
|
|
||||||
// { "visible", new MotionRegistry(typeof(VecI1)) },
|
|
||||||
{ "sv" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, 1f)) },
|
{ "sv" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, 1f)) },
|
||||||
{ "svm" , new MotionRegistry(new Vec1m(1f)) },
|
{ "svm" , new MotionRegistry(new Vec1m(1f)) },
|
||||||
{ "dist" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, float.PositiveInfinity)) },
|
{ "dist" , new MotionRegistry(new VecPtComp(0f, 0f), new VecPtComp(0f, float.PositiveInfinity)) },
|
||||||
@@ -98,8 +96,6 @@ namespace Cryville.Crtr {
|
|||||||
{ "ctrl0" , new MotionRegistry(typeof(VecCtrl)) },
|
{ "ctrl0" , new MotionRegistry(typeof(VecCtrl)) },
|
||||||
{ "ctrl1" , new MotionRegistry(typeof(VecCtrl)) },
|
{ "ctrl1" , new MotionRegistry(typeof(VecCtrl)) },
|
||||||
{ "track" , new MotionRegistry(typeof(Vec1)) },
|
{ "track" , new MotionRegistry(typeof(Vec1)) },
|
||||||
// { "judge" , new MotionRegistry(typeof(Vec1)) },
|
|
||||||
// { "width" , new MotionRegistry(new Vec1(0), new Vec1(1)) },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts");
|
var dir = new DirectoryInfo(Settings.Default.GameDataPath + "/charts");
|
||||||
|
@@ -22,13 +22,16 @@ namespace Cryville.Crtr {
|
|||||||
public readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
public readonly Dictionary<int, ScoreDefinition> scoreDefs = new Dictionary<int, ScoreDefinition>();
|
||||||
public readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
public readonly Dictionary<int, float> scores = new Dictionary<int, float>();
|
||||||
readonly Dictionary<int, string> ScoreCache = new Dictionary<int, string>();
|
readonly Dictionary<int, string> ScoreCache = new Dictionary<int, string>();
|
||||||
|
readonly object _lock = new object();
|
||||||
public Dictionary<int, string> GetFormattedScoreStrings() {
|
public Dictionary<int, string> GetFormattedScoreStrings() {
|
||||||
|
lock (_lock) {
|
||||||
if (ScoreCache.Count == 0) {
|
if (ScoreCache.Count == 0) {
|
||||||
foreach (var s in scores)
|
foreach (var s in scores)
|
||||||
ScoreCache.Add(s.Key, s.Value.ToString(scoreDefs[s.Key].format));
|
ScoreCache.Add(s.Key, s.Value.ToString(scoreDefs[s.Key].format));
|
||||||
}
|
}
|
||||||
return ScoreCache;
|
return ScoreCache;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public string GetFullFormattedScoreString() {
|
public string GetFullFormattedScoreString() {
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
string result = "";
|
string result = "";
|
||||||
|
@@ -70,7 +70,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
else if (sig.Name == _op_sep) {
|
else if (sig.Name == _op_sep) {
|
||||||
result = new op_arr(sig.ParamCount);
|
result = new op_arr(sig.ParamCount);
|
||||||
_shortops.Add(new PdtOperatorSignature(",", sig.ParamCount), result);
|
_shortops.Add(new PdtOperatorSignature(_op_sep, sig.ParamCount), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (_longops.TryGetValue(sig.Name, out result)) {
|
else if (_longops.TryGetValue(sig.Name, out result)) {
|
||||||
@@ -234,13 +234,13 @@ namespace Cryville.Crtr {
|
|||||||
int type = o0.Type;
|
int type = o0.Type;
|
||||||
int len = o0.Length;
|
int len = o0.Length;
|
||||||
bool blit = !IsBlittable(type);
|
bool blit = !IsBlittable(type);
|
||||||
for (var i = 1; i < ParamCount; i++) {
|
for (var i = 1; i < LoadedOperandCount; i++) {
|
||||||
var o = GetOperand(i);
|
var o = GetOperand(i);
|
||||||
if (o.Type != type) throw new InvalidOperationException("Cannot create variant type array");
|
if (o.Type != type) throw new InvalidOperationException("Cannot create variant type array");
|
||||||
else if (!IsBlittable(o.Type)) blit = true;
|
else if (!IsBlittable(o.Type)) blit = true;
|
||||||
len += o.Length;
|
len += o.Length;
|
||||||
}
|
}
|
||||||
if (blit) GetReturnFrame(PdtInternalType.Array, len + 2 * sizeof(int)).SetArraySuffix(type, ParamCount);
|
if (blit) GetReturnFrame(PdtInternalType.Array, len + 2 * sizeof(int)).SetArraySuffix(type, LoadedOperandCount);
|
||||||
else GetReturnFrame(PdtInternalType.Vector, len + sizeof(int)).SetArraySuffix(type);
|
else GetReturnFrame(PdtInternalType.Vector, len + sizeof(int)).SetArraySuffix(type);
|
||||||
}
|
}
|
||||||
bool IsBlittable(int type) {
|
bool IsBlittable(int type) {
|
||||||
|
@@ -32,17 +32,11 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Forward(Action<T> callback = null) {
|
public void Forward(Action<T> callback = null) {
|
||||||
ForwardToTime(float.PositiveInfinity, ev => {
|
ForwardToTime(float.PositiveInfinity, callback);
|
||||||
if (callback != null)
|
|
||||||
callback(ev);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForwardByTime(float time, Action<T> callback = null) {
|
public void ForwardByTime(float time, Action<T> callback = null) {
|
||||||
ForwardToTime(Time + time, ev => {
|
ForwardToTime(Time + time, callback);
|
||||||
if (callback != null)
|
|
||||||
callback(ev);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForwardOnceByTime(float time, Action<T> callback = null) {
|
public void ForwardOnceByTime(float time, Action<T> callback = null) {
|
||||||
|
Reference in New Issue
Block a user