Pull current_time to container handler.

This commit is contained in:
2023-02-10 17:34:40 +08:00
parent fc8512ff63
commit fdc55a8e3b
2 changed files with 7 additions and 4 deletions

View File

@@ -66,6 +66,8 @@ namespace Cryville.Crtr.Event {
get { return cs.Container; }
}
static readonly int _var_current_time = IdentifierManager.SharedInstance.Request("current_time");
public readonly Dictionary<int, PropSrc> PropSrcs = new Dictionary<int, PropSrc>();
SkinContainer skinContainer;
protected Judge judge;
public void AttachSystems(PdtSkin skin, Judge judge) {
@@ -120,6 +122,7 @@ namespace Cryville.Crtr.Event {
a_cur = RegisterAnchor(_a_cur);
a_head = RegisterAnchor(_a_head, true);
a_tail = RegisterAnchor(_a_tail, true);
PropSrcs.Add(_var_current_time, new PropSrc.Float(() => (float)cs.rootPrototype.Time));
}
public virtual void Init() {
skinContainer.MatchStatic(ps);
@@ -182,6 +185,7 @@ namespace Cryville.Crtr.Event {
protected static bool CanDoGraphicalUpdate(ContainerState s) { return s.CloneType >= 2 && s.CloneType < 16; }
#region Anchor
public virtual void Anchor() {
foreach (var p in PropSrcs.Values) p.Invalidate();
foreach (var a in DynamicAnchors.Keys) DynamicAnchorSet[a] = false;
skinContainer.MatchDynamic(cs);
if (cs.Active) PushAnchorEvent(cs.Time, a_cur);

View File

@@ -35,10 +35,9 @@ namespace Cryville.Crtr {
var vec = ContextState.GetRawValue(id);
VectorSrc.Construct(() => vec).Get(out type, out value);
}
else if (ContextState != null && name == _var_current_time) {
LoadNum((float)ContextState.rootPrototype.Time);
type = PdtInternalType.Number;
value = _numbuf;
else if (ContextState != null && ContextState.Handler.PropSrcs.TryGetValue(name, out prop)) {
prop.Get(out type, out value);
RevokePotentialConstant();
}
else if (ContextJudge != null && ContextJudge.TryGetScoreSrc(name, out prop)) {
prop.Get(out type, out value);