Decouple the usage of PDT evaluator of chart player.

This commit is contained in:
2023-07-28 14:13:49 +08:00
parent 8b64165fb7
commit 3db8f61e3b
15 changed files with 96 additions and 77 deletions

View File

@@ -90,10 +90,10 @@ namespace Cryville.Crtr {
}
void Execute(RuntimeSkinContext ctx, PdtOperator op, PdtExpression exp) {
var psrcs = ctx.ReadContext.PropSrcs;
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
if (!ChartPlayer.etor.Evaluate(op, exp))
if (psrcs != null) PdtEvaluator.Instance.ContextCascadeInsert(psrcs);
if (!PdtEvaluator.Instance.Evaluate(op, exp))
throw new EvaluationFailureException();
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
if (psrcs != null) PdtEvaluator.Instance.ContextCascadeDiscard();
}
SkinProperty GetPropOp(Transform obj) {
var ctype = Component;
@@ -145,10 +145,10 @@ namespace Cryville.Crtr {
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
if (dl != 1) return;
var psrcs = ctx.ReadContext.PropSrcs;
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
if (!ChartPlayer.etor.Evaluate(_timeOp, exp))
if (psrcs != null) PdtEvaluator.Instance.ContextCascadeInsert(psrcs);
if (!PdtEvaluator.Instance.Evaluate(_timeOp, exp))
throw new EvaluationFailureException();
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
if (psrcs != null) PdtEvaluator.Instance.ContextCascadeDiscard();
group.PushAnchorEvent(_time, Name);
}
}
@@ -170,7 +170,7 @@ namespace Cryville.Crtr {
float _index;
readonly PropOp _op;
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
if (!ChartPlayer.etor.Evaluate(_op, exp))
if (!PdtEvaluator.Instance.Evaluate(_op, exp))
throw new EvaluationFailureException();
if (IsSelf) ChartPlayer.effectManager.EmitSelf(Name, _index, ctx.WriteTransform);
else ChartPlayer.effectManager.Emit(Name, _index);
@@ -189,14 +189,14 @@ namespace Cryville.Crtr {
SkinVariable v;
if (!vars.TryGetValue(Name, out v))
vars.Add(Name, v = new SkinVariable());
if (!ChartPlayer.etor.Evaluate(v.Op, exp))
if (!PdtEvaluator.Instance.Evaluate(v.Op, exp))
throw new EvaluationFailureException();
}
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
SkinVariable v;
if (!vars.TryGetValue(Name, out v))
throw new InvalidOperationException(string.Format("Variable \"{0}\" not defined", IdentifierManager.Shared.Retrieve(Name)));
if (!ChartPlayer.etor.Evaluate(v.Op, exp))
if (!PdtEvaluator.Instance.Evaluate(v.Op, exp))
throw new EvaluationFailureException();
}
}