Code cleanup with the implementation of property store.
This commit is contained in:
@@ -22,29 +22,23 @@ namespace Cryville.Crtr {
|
||||
PdtEvaluator.Instance.ContextCascadeDiscardBlock();
|
||||
_comps = RootTransform.GetComponentsInChildren<SkinComponent>();
|
||||
foreach (var i in _comps) i.Init();
|
||||
_indexSrc = new PropSrc.Float(() => Index);
|
||||
_durationOp = new PropOp.Float(v => _duration = v);
|
||||
}
|
||||
public void Rewind(double time, Transform target) {
|
||||
_startTime = time;
|
||||
foreach (var i in _comps) i.Rewind(time, target);
|
||||
}
|
||||
private float m_index;
|
||||
public float Index {
|
||||
get { return m_index; }
|
||||
set {
|
||||
if (m_index == value) return;
|
||||
m_index = value;
|
||||
_indexSrc.Invalidate();
|
||||
}
|
||||
}
|
||||
Transform _currentTarget;
|
||||
Identifier _currentStateName = Identifier.Empty;
|
||||
EffectState _currentState;
|
||||
ChartEvent _ctxev;
|
||||
ContainerState _ctxstate;
|
||||
internal static readonly int _VAR_EFFECT_INDEX = IdentifierManager.Shared.Request("effect_index");
|
||||
readonly PropSrc _indexSrc;
|
||||
readonly PropStores.Float _indexst = new PropStores.Float();
|
||||
public float Index {
|
||||
get { return _indexst.Value; }
|
||||
set { _indexst.Value = value; }
|
||||
}
|
||||
double _startTime;
|
||||
float _duration;
|
||||
readonly PropOp _durationOp;
|
||||
@@ -74,7 +68,7 @@ namespace Cryville.Crtr {
|
||||
Rewind(time, target);
|
||||
RootTransform.gameObject.SetActive(true);
|
||||
PdtEvaluator.Instance.ContextCascadeInsert();
|
||||
PdtEvaluator.Instance.ContextCascadeUpdate(_VAR_EFFECT_INDEX, _indexSrc);
|
||||
PdtEvaluator.Instance.ContextCascadeUpdate(_VAR_EFFECT_INDEX, _indexst.Source);
|
||||
PdtEvaluator.Instance.Evaluate(_durationOp, _currentState.duration);
|
||||
_skinContainer.MatchDynamic(1, emitting);
|
||||
PdtEvaluator.Instance.ContextCascadeDiscard();
|
||||
|
@@ -453,19 +453,16 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
}
|
||||
}
|
||||
static float _ttime;
|
||||
static Vector4 _trans;
|
||||
static readonly PropSrc _ttimesrc = new PropSrc.Float(() => _ttime);
|
||||
static readonly PropOp _transop = new PropOp.Vector4(v => _trans = v);
|
||||
static readonly PropStores.Float _ttimest = new PropStores.Float();
|
||||
static readonly PropStores.Vector4 _transst = new PropStores.Vector4();
|
||||
Vector4 GetTransition(float time, PdtExpression transition) {
|
||||
if (time >= 1) return Vector4.one;
|
||||
if (transition == null) return new Vector4(time, time, time, time);
|
||||
_ttime = time;
|
||||
_ttimesrc.Invalidate();
|
||||
PdtEvaluator.Instance.ContextSelfValue = _ttimesrc;
|
||||
PdtEvaluator.Instance.Evaluate(_transop, transition);
|
||||
_ttimest.Value = time;
|
||||
PdtEvaluator.Instance.ContextSelfValue = _ttimest.Source;
|
||||
PdtEvaluator.Instance.Evaluate(_transst.Target, transition);
|
||||
PdtEvaluator.Instance.ContextSelfValue = null;
|
||||
return _trans;
|
||||
return _transst.Value;
|
||||
}
|
||||
|
||||
public void BroadcastPreInit() {
|
||||
|
@@ -62,13 +62,6 @@ namespace Cryville.Crtr {
|
||||
_etor.ContextJudge = this;
|
||||
_rs = rs;
|
||||
_areaFuncs = rs.areas;
|
||||
_numsrc1 = new PropSrc.Float(() => _numbuf1);
|
||||
_numsrc2 = new PropSrc.Float(() => _numbuf2);
|
||||
_numsrc3 = new PropSrc.Float(() => _numbuf3);
|
||||
_numsrc4 = new PropSrc.Float(() => _numbuf4);
|
||||
_jnumsrc = new PropSrc.Float(() => _jnumbuf);
|
||||
_jdnumsrc = new PropSrc.Float(() => _jdnumbuf);
|
||||
_jvecsrc = new PropSrc.Vector4(() => _jvecbuf);
|
||||
_identop = new PropOp.Identifier(v => _identbuf = new Identifier(v));
|
||||
_clipop = new PropOp.Clip(v => _clipbuf = v);
|
||||
_rs.judges.TryGetValue(new Identifier(_var_pause), out _judgePause);
|
||||
@@ -173,14 +166,19 @@ namespace Cryville.Crtr {
|
||||
static readonly int _var_tn = IdentifierManager.Shared.Request("judge_time_to");
|
||||
static readonly int _var_ft = IdentifierManager.Shared.Request("input_time_from");
|
||||
static readonly int _var_tt = IdentifierManager.Shared.Request("input_time_to");
|
||||
float _numbuf1, _numbuf2, _numbuf3, _numbuf4;
|
||||
readonly PropSrc _numsrc1, _numsrc2, _numsrc3, _numsrc4;
|
||||
readonly PropStores.Float
|
||||
_numst1 = new PropStores.Float(),
|
||||
_numst2 = new PropStores.Float(),
|
||||
_numst3 = new PropStores.Float(),
|
||||
_numst4 = new PropStores.Float();
|
||||
|
||||
static readonly int _var_jt = IdentifierManager.Shared.Request("hit_time");
|
||||
static readonly int _var_jdt = IdentifierManager.Shared.Request("hit_delta_time");
|
||||
static readonly int _var_jv = IdentifierManager.Shared.Request("hit_vec");
|
||||
float _jnumbuf, _jdnumbuf; Vector4 _jvecbuf;
|
||||
readonly PropSrc _jnumsrc, _jdnumsrc, _jvecsrc;
|
||||
readonly PropStores.Float
|
||||
_jnumst = new PropStores.Float(),
|
||||
_jdnumst = new PropStores.Float();
|
||||
readonly PropStores.Vector4 _jvecst = new PropStores.Vector4();
|
||||
|
||||
// Adopted from System.Collections.Generic.ArraySortHelper<T>.InternalBinarySearch(T[] array, int index, int length, T value, IComparer<T> comparer)
|
||||
int BinarySearch(List<JudgeEvent> list, float time, int stack) {
|
||||
@@ -211,8 +209,8 @@ namespace Cryville.Crtr {
|
||||
return ~num;
|
||||
}
|
||||
void UpdateContextJudgeEvent(JudgeEvent ev) {
|
||||
_numbuf1 = (float)ev.StartTime; _numsrc1.Invalidate(); _etor.ContextCascadeUpdate(_var_fn, _numsrc1);
|
||||
_numbuf2 = (float)ev.EndTime; _numsrc2.Invalidate(); _etor.ContextCascadeUpdate(_var_tn, _numsrc2);
|
||||
_numst1.Value = (float)ev.StartTime; _etor.ContextCascadeUpdate(_var_fn, _numst1.Source);
|
||||
_numst2.Value = (float)ev.EndTime; _etor.ContextCascadeUpdate(_var_tn, _numst2.Source);
|
||||
if (ev.BaseEvent != null) {
|
||||
_etor.ContextEvent = ev.BaseEvent;
|
||||
_etor.ContextState = ev.Handler.cs;
|
||||
@@ -220,9 +218,9 @@ namespace Cryville.Crtr {
|
||||
var call = ev.CallContext;
|
||||
if (call.ReturnEvent != null) {
|
||||
JudgeResult judgeResult = call.ReturnEvent.JudgeResult;
|
||||
_jnumbuf = judgeResult.Time.Value; _jnumsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jt, _jnumsrc);
|
||||
_jdnumbuf = (float)(judgeResult.Time.Value - call.ReturnEvent.StartTime); _jdnumsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jdt, _jdnumsrc);
|
||||
_jvecbuf = judgeResult.Vector; _jvecsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jv, _jvecsrc);
|
||||
_jnumst.Value = judgeResult.Time.Value; _etor.ContextCascadeUpdate(_var_jt, _jnumst.Source);
|
||||
_jdnumst.Value = (float)(judgeResult.Time.Value - call.ReturnEvent.StartTime); _etor.ContextCascadeUpdate(_var_jdt, _jdnumst.Source);
|
||||
_jvecst.Value = judgeResult.Vector; _etor.ContextCascadeUpdate(_var_jv, _jvecst.Source);
|
||||
}
|
||||
else {
|
||||
_etor.ContextCascadeUpdate(_var_jt, PropSrc.Null);
|
||||
@@ -233,8 +231,8 @@ namespace Cryville.Crtr {
|
||||
Forward(target, tt);
|
||||
var actlist = activeEvs[target];
|
||||
if (actlist.Count > 0) {
|
||||
_numbuf3 = ft; _numsrc3.Invalidate(); _etor.ContextCascadeUpdate(_var_ft, _numsrc3);
|
||||
_numbuf4 = tt; _numsrc4.Invalidate(); _etor.ContextCascadeUpdate(_var_tt, _numsrc4);
|
||||
_numst3.Value = ft; _etor.ContextCascadeUpdate(_var_ft, _numst3.Source);
|
||||
_numst4.Value = tt; _etor.ContextCascadeUpdate(_var_tt, _numst4.Source);
|
||||
int index = 0, iter = 0;
|
||||
while (index < actlist.Count) {
|
||||
if (iter++ >= 16) throw new JudgePropagationException();
|
||||
@@ -305,9 +303,9 @@ namespace Cryville.Crtr {
|
||||
void Execute(JudgeEvent ev, float time, PairList<JudgeAction, PdtExpression> actions, bool onMiss, int depth = 0, int index = 0) {
|
||||
JudgeResult judgeResult = ev.JudgeResult;
|
||||
if (!onMiss && judgeResult.Time != null) {
|
||||
_jnumbuf = judgeResult.Time.Value; _jnumsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jt, _jnumsrc);
|
||||
_jdnumbuf = (float)(judgeResult.Time.Value - ev.StartTime); _jdnumsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jdt, _jdnumsrc);
|
||||
_jvecbuf = judgeResult.Vector; _jvecsrc.Invalidate(); _etor.ContextCascadeUpdate(_var_jv, _jvecsrc);
|
||||
_jnumst.Value = judgeResult.Time.Value; _etor.ContextCascadeUpdate(_var_jt, _jnumst.Source);
|
||||
_jdnumst.Value = (float)(judgeResult.Time.Value - ev.StartTime); _etor.ContextCascadeUpdate(_var_jdt, _jdnumst.Source);
|
||||
_jvecst.Value = judgeResult.Vector; _etor.ContextCascadeUpdate(_var_jv, _jvecst.Source);
|
||||
}
|
||||
if (actions != null) {
|
||||
// Ensure that all actions that modifies judge result sources break the execution
|
||||
|
@@ -23,27 +23,21 @@ namespace Cryville.Crtr {
|
||||
static readonly int _var_judge_time_absolute = IdentifierManager.Shared.Request("judge_time_absolute");
|
||||
static readonly int _var_judge_time_relative = IdentifierManager.Shared.Request("judge_time_relative");
|
||||
public Anchor StaticAnchor { get; private set; }
|
||||
public float AbsoluteTime { get; private set; }
|
||||
PropSrc _jtabsPropSrc;
|
||||
public float RelativeTime { get; private set; }
|
||||
PropSrc _jtrelPropSrc;
|
||||
public int Result { get; private set; }
|
||||
PropSrc _resultPropSrc;
|
||||
readonly PropStores.Float _jtabsst = new PropStores.Float();
|
||||
readonly PropStores.Float _jtrelst = new PropStores.Float();
|
||||
readonly PropStores.Identifier _resultst = new PropStores.Identifier();
|
||||
public JudgeState(NoteHandler handler, int name) {
|
||||
StaticAnchor = handler.RegisterAnchor(handler.judge.judgeMap[name], false, 3);
|
||||
}
|
||||
public void MarkJudged(float abs, float rel, int result) {
|
||||
AbsoluteTime = abs;
|
||||
RelativeTime = rel;
|
||||
Result = result;
|
||||
_jtabsPropSrc.Invalidate();
|
||||
_jtrelPropSrc.Invalidate();
|
||||
_resultPropSrc.Invalidate();
|
||||
_jtabsst.Value = abs;
|
||||
_jtrelst.Value = rel;
|
||||
_resultst.Value = result;
|
||||
}
|
||||
public void InitPropSrcs() {
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_result, _resultPropSrc = new PropSrc.Identifier(() => Result));
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_time_absolute, _jtabsPropSrc = new PropSrc.Float(() => AbsoluteTime));
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_time_relative, _jtrelPropSrc = new PropSrc.Float(() => RelativeTime));
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_result, _resultst.Source);
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_time_absolute, _jtabsst.Source);
|
||||
StaticAnchor.PropSrcs.Add(_var_judge_time_relative, _jtrelst.Source);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,6 @@ using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class PdtEvaluator : PdtEvaluatorBase {
|
||||
[ThreadStatic]
|
||||
static PdtEvaluator m_instance;
|
||||
public static PdtEvaluator Instance {
|
||||
get {
|
||||
@@ -41,7 +40,7 @@ namespace Cryville.Crtr {
|
||||
else if (name == _var_false) { LoadNum(0); type = PdtInternalType.Number; value = _numbuf; }
|
||||
else if (name == _var_null) { LoadIdent(0); type = PdtInternalType.Undefined; value = _numbuf; }
|
||||
else {
|
||||
PropSrc prop; SkinVariable variable;
|
||||
PropSrc prop; PropStores.Float variable;
|
||||
if (ContextEvent != null && ContextEvent.PropSrcs.TryGetValue(name, out prop)) {
|
||||
prop.Get(out type, out value);
|
||||
}
|
||||
@@ -55,7 +54,7 @@ namespace Cryville.Crtr {
|
||||
RevokePotentialConstant();
|
||||
}
|
||||
else if (ContextSkinContainer != null && ContextSkinContainer.Variables.TryGetValue(name, out variable)) {
|
||||
variable.Src.Get(out type, out value);
|
||||
variable.Source.Get(out type, out value);
|
||||
}
|
||||
else if (ContextJudge != null && ContextJudge.TryGetScoreSrc(name, out prop)) {
|
||||
prop.Get(out type, out value);
|
||||
|
46
Assets/Cryville/Crtr/PropStore.cs
Normal file
46
Assets/Cryville/Crtr/PropStore.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using RVector4 = UnityEngine.Vector4;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public abstract class PropStore {
|
||||
protected PropSrc m_source;
|
||||
public PropSrc Source { get { return m_source; } }
|
||||
protected PropOp m_target;
|
||||
public PropOp Target { get { return m_target; } }
|
||||
}
|
||||
public abstract class PropStore<T> : PropStore where T : IEquatable<T> {
|
||||
T m_value;
|
||||
public T Value {
|
||||
get {
|
||||
return m_value;
|
||||
}
|
||||
set {
|
||||
if (m_value.Equals(value)) return;
|
||||
m_value = value;
|
||||
m_source.Invalidate();
|
||||
}
|
||||
}
|
||||
public new PropSrc.Fixed<T> Source { get { return (PropSrc.Fixed<T>)m_source; } }
|
||||
public new PropOp.Fixed<T> Target { get { return (PropOp.Fixed<T>)m_target; } }
|
||||
}
|
||||
public static class PropStores {
|
||||
public class Float : PropStore<float> {
|
||||
public Float() {
|
||||
m_source = new PropSrc.Float(() => Value);
|
||||
m_target = new PropOp.Float(v => Value = v);
|
||||
}
|
||||
}
|
||||
public class Identifier : PropStore<int> {
|
||||
public Identifier() {
|
||||
m_source = new PropSrc.Identifier(() => Value);
|
||||
m_target = new PropOp.Identifier(v => Value = v);
|
||||
}
|
||||
}
|
||||
public class Vector4 : PropStore<RVector4> {
|
||||
public Vector4() {
|
||||
m_source = new PropSrc.Vector4(() => Value);
|
||||
m_target = new PropOp.Vector4(v => Value = v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Crtr/PropStore.cs.meta
Normal file
11
Assets/Cryville/Crtr/PropStore.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1654dc7ab34163e4a849fb626a698fbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -10,7 +10,7 @@ namespace Cryville.Crtr {
|
||||
readonly SkinElement _rootElement;
|
||||
readonly DynamicStack[] _stacks = new DynamicStack[3];
|
||||
readonly HashSet<SkinPropertyKey> _once = new HashSet<SkinPropertyKey>();
|
||||
public readonly IntKeyedDictionary<SkinVariable> Variables = new IntKeyedDictionary<SkinVariable>();
|
||||
public readonly IntKeyedDictionary<PropStores.Float> Variables = new IntKeyedDictionary<PropStores.Float>();
|
||||
|
||||
class DynamicStack {
|
||||
public readonly List<DynamicProperty> Properties = new List<DynamicProperty>();
|
||||
@@ -34,7 +34,6 @@ namespace Cryville.Crtr {
|
||||
_group = group;
|
||||
_rootElement = rootElement;
|
||||
for (int i = 0; i < _stacks.Length; i++) _stacks[i] = new DynamicStack();
|
||||
_rtimeSrc = new PropSrc.Float(() => _rtime);
|
||||
}
|
||||
public void MatchStatic() {
|
||||
var stack = _stacks[0];
|
||||
@@ -151,18 +150,16 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
if (rc.PropSrcs != null) PdtEvaluator.Instance.ContextCascadeDiscard();
|
||||
}
|
||||
float _rtime;
|
||||
readonly PropSrc _rtimeSrc;
|
||||
readonly PropStores.Float _rtimest = new PropStores.Float();
|
||||
public void MatchAnimation(AnimationSpan span, float rtime, RuntimeSkinContext ctx) {
|
||||
PdtEvaluator.Instance.ContextSkinContainer = this;
|
||||
PdtEvaluator.Instance.ContextSelfValue = _rtimeSrc;
|
||||
PdtEvaluator.Instance.ContextSelfValue = _rtimest.Source;
|
||||
MatchAnimationInternal(span, rtime, ctx);
|
||||
PdtEvaluator.Instance.ContextSelfValue = null;
|
||||
PdtEvaluator.Instance.ContextSkinContainer = null;
|
||||
}
|
||||
void MatchAnimationInternal(AnimationSpan span, float rtime, RuntimeSkinContext ctx) {
|
||||
_rtime = rtime;
|
||||
_rtimeSrc.Invalidate();
|
||||
_rtimest.Value = rtime;
|
||||
foreach (var p in span.properties) {
|
||||
p.Key.ExecuteDynamic(_group, ctx, p.Value, Variables, 0);
|
||||
}
|
||||
@@ -215,17 +212,4 @@ namespace Cryville.Crtr {
|
||||
void RegisterAnchor(int name);
|
||||
void PushAnchorEvent(double time, int name);
|
||||
}
|
||||
public class SkinVariable {
|
||||
float _value;
|
||||
public PropOp Op { get; private set; }
|
||||
public PropSrc Src { get; private set; }
|
||||
public SkinVariable() {
|
||||
Op = new PropOp.Float(Set);
|
||||
Src = new PropSrc.Float(() => _value);
|
||||
}
|
||||
void Set(float value) {
|
||||
_value = value;
|
||||
Src.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -51,8 +51,8 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
public abstract override string ToString();
|
||||
public abstract bool IsValueRequired { get; }
|
||||
public abstract void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars);
|
||||
public abstract void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl);
|
||||
public abstract void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars);
|
||||
public abstract void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl);
|
||||
public class CreateComponent : SkinPropertyKey {
|
||||
public Type Component { get; private set; }
|
||||
public CreateComponent(IEnumerable<string> a, Type component) : base(a) {
|
||||
@@ -62,10 +62,10 @@ namespace Cryville.Crtr {
|
||||
return string.Format("*{0}", Component.Name);
|
||||
}
|
||||
public override bool IsValueRequired { get { return false; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
ctx.WriteTransform.gameObject.AddComponent(Component);
|
||||
}
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
throw new InvalidOperationException("Component creation in dynamic context is not allowed");
|
||||
}
|
||||
}
|
||||
@@ -80,10 +80,10 @@ namespace Cryville.Crtr {
|
||||
return string.Format("{0}.{1}", Component.Name, IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return true; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
Execute(ctx, GetPropOp(ctx.WriteTransform).Operator, exp);
|
||||
}
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
var prop = GetPropOp(ctx.WriteTransform);
|
||||
if (dl > prop.UpdateDynamicLevel) return;
|
||||
Execute(ctx, prop.Operator, exp);
|
||||
@@ -120,10 +120,10 @@ namespace Cryville.Crtr {
|
||||
return string.Format("@has {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return false; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
group.RegisterAnchor(Name);
|
||||
}
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
throw new InvalidOperationException("Anchor creation in dynamic context is not allowed");
|
||||
}
|
||||
}
|
||||
@@ -137,12 +137,12 @@ namespace Cryville.Crtr {
|
||||
return string.Format("@at {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return true; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
throw new InvalidOperationException("Setting anchor in static context is not allowed");
|
||||
}
|
||||
float _time;
|
||||
readonly PropOp _timeOp;
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
if (dl != 1) return;
|
||||
var psrcs = ctx.ReadContext.PropSrcs;
|
||||
if (psrcs != null) PdtEvaluator.Instance.ContextCascadeInsert(psrcs);
|
||||
@@ -164,12 +164,12 @@ namespace Cryville.Crtr {
|
||||
return string.Format(IsSelf ? "@emit_self {0}" : "@emit {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return true; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
throw new InvalidOperationException("Emitting effect in static context is not allowed");
|
||||
}
|
||||
float _index;
|
||||
readonly PropOp _op;
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
if (!PdtEvaluator.Instance.Evaluate(_op, exp))
|
||||
throw new EvaluationFailureException();
|
||||
if (IsSelf) ChartPlayer.effectManager.EmitSelf(Name, _index, ctx.WriteTransform);
|
||||
@@ -185,18 +185,18 @@ namespace Cryville.Crtr {
|
||||
return string.Format("@var {0}", IdentifierManager.Shared.Retrieve(Name));
|
||||
}
|
||||
public override bool IsValueRequired { get { return true; } }
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars) {
|
||||
SkinVariable v;
|
||||
public override void ExecuteStatic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars) {
|
||||
PropStores.Float v;
|
||||
if (!vars.TryGetValue(Name, out v))
|
||||
vars.Add(Name, v = new SkinVariable());
|
||||
if (!PdtEvaluator.Instance.Evaluate(v.Op, exp))
|
||||
vars.Add(Name, v = new PropStores.Float());
|
||||
if (!PdtEvaluator.Instance.Evaluate(v.Target, exp))
|
||||
throw new EvaluationFailureException();
|
||||
}
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
SkinVariable v;
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<PropStores.Float> vars, int dl) {
|
||||
PropStores.Float v;
|
||||
if (!vars.TryGetValue(Name, out v))
|
||||
throw new InvalidOperationException(string.Format("Variable \"{0}\" not defined", IdentifierManager.Shared.Retrieve(Name)));
|
||||
if (!PdtEvaluator.Instance.Evaluate(v.Op, exp))
|
||||
if (!PdtEvaluator.Instance.Evaluate(v.Target, exp))
|
||||
throw new EvaluationFailureException();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user