Implement input name evaluation. Implement context state.

This commit is contained in:
2022-11-11 10:01:24 +08:00
parent 84e4e3514d
commit cf00bd8db0
7 changed files with 46 additions and 11 deletions

View File

@@ -214,27 +214,31 @@ namespace Cryville.Crtr.Event {
this.judge = judge;
}
public T GetRawValue<T>(Identifier key) where T : Vector {
public Vector GetRawValue(Identifier key) {
Vector tr;
if (!CachedValues.TryGetValue(key, out tr)) {
tr = (Vector)ReflectionHelper.InvokeEmptyConstructor(typeof(T));
tr = (Vector)ReflectionHelper.InvokeEmptyConstructor(ChartPlayer.motionRegistry[key].Type);
CachedValues.Add(key, tr);
CachedValueStates[key] = false;
}
T r = (T)tr;
Vector r = tr;
#if !DISABLE_CACHE
if (CachedValueStates[key]) return r;
#endif
float reltime = 0;
if (rootPrototype != null) reltime = Time - rootPrototype.Time;
GetMotionValue(key).GetValue(reltime, ref r);
if (Parent != null) r.ApplyFrom(Parent.GetRawValue<T>(key));
if (Parent != null) r.ApplyFrom(Parent.GetRawValue(key));
#if !DISABLE_CACHE
CachedValueStates[key] = true;
#endif
return r;
}
public T GetRawValue<T>(Identifier key) where T : Vector {
return (T)GetRawValue(key);
}
static readonly Identifier n_pt = new Identifier("pt");
public Vector2 ScreenPoint {
get {