Fix "at anchor" selector not working in effects.
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Cryville.Crtr.Components {
|
||||
|
||||
public SectionalGameObject() {
|
||||
SubmitProperty("partial", new PropOp.Boolean(v => part = Part.idle));
|
||||
SubmitProperty("part", new PropOp.Enum<Part>(v => part = v, v => (Part)v), 1);
|
||||
SubmitProperty("part", new PropOp.Enum<Part>(v => part = v, v => (Part)v), 2);
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
@@ -63,7 +63,7 @@ namespace Cryville.Crtr.Components {
|
||||
SubmitProperty("head", new PropOp.String(v => head.FrameName = v));
|
||||
SubmitProperty("body", new PropOp.String(v => body.FrameName = v));
|
||||
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v));
|
||||
SubmitProperty("shape", new op_set_shape(this), 1);
|
||||
SubmitProperty("shape", new op_set_shape(this), 2);
|
||||
}
|
||||
|
||||
#pragma warning disable IDE1006
|
||||
|
@@ -14,7 +14,7 @@ namespace Cryville.Crtr.Components {
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the property.</param>
|
||||
/// <param name="property">The property.</param>
|
||||
protected void SubmitProperty(string name, PdtOperator property, int udl = 0) {
|
||||
protected void SubmitProperty(string name, PdtOperator property, int udl = 1) {
|
||||
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, udl));
|
||||
}
|
||||
|
||||
|
@@ -101,6 +101,7 @@ namespace Cryville.Crtr {
|
||||
|
||||
public string TypeName { get { throw new InvalidOperationException("Type name undefined"); } }
|
||||
public SkinContext SkinContext { get; private set; }
|
||||
public int AtAnchorDynamicLevel { get { return 1; } }
|
||||
public int OpenedAnchorName { get { return _currentStateName.Key; } }
|
||||
public void PushAnchorEvent(double time, int name) {
|
||||
throw new InvalidOperationException("Anchor not supported");
|
||||
|
@@ -127,6 +127,7 @@ namespace Cryville.Crtr.Event {
|
||||
ChartPlayer.etor.ContextState = ps;
|
||||
ChartPlayer.etor.ContextEvent = Container;
|
||||
skinContainer.MatchStatic();
|
||||
MatchDynamic(ps, 0);
|
||||
ChartPlayer.etor.ContextEvent = null;
|
||||
ChartPlayer.etor.ContextState = null;
|
||||
_comps = RootTransform.GetComponentsInChildren<SkinComponent>();
|
||||
@@ -161,7 +162,7 @@ namespace Cryville.Crtr.Event {
|
||||
tev.Target.Transform.position = Position;
|
||||
tev.Target.Transform.rotation = Rotation;
|
||||
#endif
|
||||
MatchDynamic(s, 1);
|
||||
MatchDynamic(s, 2);
|
||||
CloseAnchor();
|
||||
}
|
||||
if (tev.Target == a_head) {
|
||||
@@ -172,7 +173,7 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
anchorEvPool.Return(tev);
|
||||
}
|
||||
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 1);
|
||||
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 2);
|
||||
}
|
||||
#region End methods
|
||||
protected virtual void EndGraphicalUpdate(ContainerState s) { }
|
||||
@@ -204,7 +205,7 @@ namespace Cryville.Crtr.Event {
|
||||
foreach (var a in DynamicAnchors) DynamicAnchorSetTime[a.Key] = double.NaN;
|
||||
atime_head = cs.StampedContainer.Time;
|
||||
atime_tail = atime_head + cs.StampedContainer.Duration;
|
||||
MatchDynamic(cs, 0);
|
||||
MatchDynamic(cs, 1);
|
||||
foreach (var i in _comps) i.Tick(skinContainer, cs.Time);
|
||||
if (cs.Active) PushAnchorEvent(cs.Time, a_cur);
|
||||
if (double.IsNaN(DynamicAnchorSetTime[_a_head])) DynamicAnchorSetTime[_a_head] = atime_head;
|
||||
@@ -242,6 +243,7 @@ namespace Cryville.Crtr.Event {
|
||||
#region ISkinnableGroup
|
||||
public abstract string TypeName { get; }
|
||||
public SkinContext SkinContext { get; private set; }
|
||||
public int AtAnchorDynamicLevel { get { return 2; } }
|
||||
Anchor _openedAnchor;
|
||||
public int OpenedAnchorName { get { return _openedAnchor == null ? 0 : _openedAnchor.Name; } }
|
||||
public bool TryGetAnchorsByName(int name, out IReadOnlyCollection<Anchor> result) {
|
||||
|
@@ -8,7 +8,7 @@ namespace Cryville.Crtr {
|
||||
public class SkinContainer {
|
||||
readonly ISkinnableGroup _group;
|
||||
readonly SkinElement _rootElement;
|
||||
readonly DynamicStack[] _stacks = new DynamicStack[2];
|
||||
readonly DynamicStack[] _stacks = new DynamicStack[3];
|
||||
readonly HashSet<SkinPropertyKey> _once = new HashSet<SkinPropertyKey>();
|
||||
public readonly IntKeyedDictionary<SkinVariable> Variables = new IntKeyedDictionary<SkinVariable>();
|
||||
|
||||
@@ -93,21 +93,26 @@ namespace Cryville.Crtr {
|
||||
DynamicElement e = stack.Elements[i];
|
||||
var psrcs = e.Context.ReadContext.PropSrcs;
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||
SkinContext nctx = null;
|
||||
try {
|
||||
nctx = e.Selectors.MatchDynamic(_group, e.Context.ReadContext);
|
||||
}
|
||||
catch (SelectorNotAvailableException) {
|
||||
if (nstack == null) throw;
|
||||
nstack.Elements.Add(e);
|
||||
}
|
||||
if (nctx != null) {
|
||||
MatchDynamic(e.Element, dl, nstack, new RuntimeSkinContext(
|
||||
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
||||
));
|
||||
if (e.Selectors.annotations.Contains("once")) {
|
||||
stack.Elements.RemoveAt(i--);
|
||||
if (e.Selectors.IsUpdatable(_group, dl)) {
|
||||
try {
|
||||
var nctx = e.Selectors.MatchDynamic(_group, e.Context.ReadContext);
|
||||
if (nctx != null) {
|
||||
MatchDynamic(e.Element, dl, nstack, new RuntimeSkinContext(
|
||||
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
||||
));
|
||||
if (e.Selectors.annotations.Contains("once")) {
|
||||
stack.Elements.RemoveAt(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SelectorNotAvailableException) {
|
||||
if (nstack == null) throw;
|
||||
nstack.Elements.Add(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (nstack == null) throw new SelectorNotAvailableException();
|
||||
nstack.Elements.Add(e);
|
||||
}
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
}
|
||||
@@ -203,6 +208,7 @@ namespace Cryville.Crtr {
|
||||
public interface ISkinnableGroup {
|
||||
string TypeName { get; }
|
||||
SkinContext SkinContext { get; }
|
||||
int AtAnchorDynamicLevel { get; }
|
||||
int OpenedAnchorName { get; }
|
||||
bool TryGetAnchorsByName(int name, out IReadOnlyCollection<Anchor> result);
|
||||
void RegisterAnchor(int name);
|
||||
|
@@ -142,7 +142,7 @@ namespace Cryville.Crtr {
|
||||
float _time;
|
||||
readonly PropOp _timeOp;
|
||||
public override void ExecuteDynamic(ISkinnableGroup group, RuntimeSkinContext ctx, PdtExpression exp, IntKeyedDictionary<SkinVariable> vars, int dl) {
|
||||
if (dl > 0) return;
|
||||
if (dl != 1) return;
|
||||
var psrcs = ctx.ReadContext.PropSrcs;
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||
ChartPlayer.etor.Evaluate(_timeOp, exp);
|
||||
|
@@ -104,7 +104,7 @@ namespace Cryville.Crtr {
|
||||
return g.OpenedAnchorName == Name ? c : null;
|
||||
}
|
||||
public override bool IsUpdatable(ISkinnableGroup g, int dl) {
|
||||
return dl >= 1;
|
||||
return dl >= g.AtAnchorDynamicLevel;
|
||||
}
|
||||
}
|
||||
public class Property : SkinSelector {
|
||||
|
Reference in New Issue
Block a user