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

@@ -1,5 +1,6 @@
using Cryville.Common;
using Cryville.Common.Pdt;
using Cryville.Crtr.Event;
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -20,11 +21,16 @@ namespace Cryville.Crtr {
else if (name == _var_true) { LoadNum(1); type = PdtInternalType.Number; value = _numbuf; }
else if (name == _var_false) { LoadNum(0); type = PdtInternalType.Number; value = _numbuf; }
else {
var id = new Identifier(name);
PropSrc prop;
string str;
if (ContextEvent != null && ContextEvent.PropSrcs.TryGetValue(name, out prop)) {
prop.Get(out type, out value);
}
else if (ContextState != null && ChartPlayer.motionRegistry.ContainsKey(id)) {
var vec = ContextState.GetRawValue(id);
new VectorSrc(() => vec).Get(out type, out value);
}
else if (ContextJudge != null && ContextJudge.GetFormattedScoreStrings().TryGetValue(name, out str)) {
type = PdtInternalType.String;
value = GetBytes(str);
@@ -41,7 +47,6 @@ namespace Cryville.Crtr {
value = _numbuf;
}
}
return;
}
}
unsafe void LoadNum(int value) {
@@ -93,6 +98,7 @@ namespace Cryville.Crtr {
}
public ChartEvent ContextEvent { private get; set; }
public ContainerState ContextState { private get; set; }
public Transform ContextTransform { private get; set; }
public Judge ContextJudge { private get; set; }
public PropSrc ContextSelfValue { private get; set; }