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