Revise update clone type to update depth.
This commit is contained in:
@@ -14,8 +14,9 @@ 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 uct = 1) {
|
||||
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, uct));
|
||||
/// <param name="depth">The maximum depth to update the property.</param>
|
||||
protected void SubmitProperty(string name, PdtOperator property, int depth = 1) {
|
||||
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, depth));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,10 +31,10 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
public struct SkinProperty {
|
||||
public PdtOperator Operator { get; set; }
|
||||
public int UpdateCloneType { get; set; }
|
||||
public SkinProperty(PdtOperator op, int uct = 1) {
|
||||
public int UpdateDepth { get; set; }
|
||||
public SkinProperty(PdtOperator op, int depth = 1) {
|
||||
Operator = op;
|
||||
UpdateCloneType = uct;
|
||||
UpdateDepth = depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ namespace Cryville.Crtr.Event {
|
||||
public virtual void Update(ContainerState s, StampedEvent ev) {
|
||||
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
||||
if (flag) PreAwake(s);
|
||||
if (gogroup && s.CloneType <= 2) skinContainer.MatchDynamic(s);
|
||||
if (gogroup && s.CloneType <= 2) skinContainer.MatchDynamic(s, s.CloneType);
|
||||
if (flag) Awake(s);
|
||||
}
|
||||
public virtual void ExUpdate(ContainerState s, StampedEvent ev) {
|
||||
@@ -158,7 +158,7 @@ namespace Cryville.Crtr.Event {
|
||||
tev.Target.Transform.position = GetCurrentWorldPoint();
|
||||
tev.Target.Transform.rotation = Quaternion.Euler(s.Direction);
|
||||
#endif
|
||||
skinContainer.MatchDynamic(s);
|
||||
skinContainer.MatchDynamic(s, 1);
|
||||
CloseAnchor();
|
||||
}
|
||||
anchorEvPool.Return(tev);
|
||||
@@ -170,7 +170,7 @@ namespace Cryville.Crtr.Event {
|
||||
Awoken = false;
|
||||
if (gogroup && s.CloneType <= 2) {
|
||||
OpenAnchor(a_tail);
|
||||
skinContainer.MatchDynamic(s);
|
||||
skinContainer.MatchDynamic(s, s.CloneType);
|
||||
CloseAnchor();
|
||||
}
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
}
|
||||
public void MatchDynamic(ContainerState state) {
|
||||
public void MatchDynamic(ContainerState state, byte depth) {
|
||||
if (dynprops.Count == 0 && dynelems.Count == 0) return;
|
||||
Profiler.BeginSample("SkinContainer.MatchDynamic");
|
||||
ChartPlayer.etor.ContextState = state;
|
||||
@@ -76,7 +76,7 @@ namespace Cryville.Crtr {
|
||||
var psrcs = p.Context.ReadContext.PropSrcs;
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||
var prop = GetPropOp(p.Context.WriteTransform, p.Key);
|
||||
if (state.CloneType > prop.UpdateCloneType) continue;
|
||||
if (depth > prop.UpdateDepth) continue;
|
||||
ChartPlayer.etor.Evaluate(prop.Operator, p.Value);
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace Cryville.Crtr {
|
||||
var psrcs = e.Context.ReadContext.PropSrcs;
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeInsert(psrcs);
|
||||
var nctx = e.Selectors.MatchDynamic(state, e.Context.ReadContext);
|
||||
if (nctx != null) MatchDynamic(e.Element, state, new RuntimeSkinContext(
|
||||
if (nctx != null) MatchDynamic(e.Element, state, depth, new RuntimeSkinContext(
|
||||
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
||||
));
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
@@ -94,7 +94,7 @@ namespace Cryville.Crtr {
|
||||
ChartPlayer.etor.ContextState = null;
|
||||
Profiler.EndSample();
|
||||
}
|
||||
void MatchDynamic(SkinElement rel, ContainerState state, RuntimeSkinContext ctx) {
|
||||
void MatchDynamic(SkinElement rel, ContainerState state, byte depth, RuntimeSkinContext ctx) {
|
||||
var rc = ctx.ReadContext;
|
||||
ChartPlayer.etor.ContextTransform = rc.Transform;
|
||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeInsert(rc.PropSrcs);
|
||||
@@ -102,14 +102,14 @@ namespace Cryville.Crtr {
|
||||
if (p.Key.Name == 0)
|
||||
throw new InvalidOperationException("Component creation in dynamic context is not allowed");
|
||||
var prop = GetPropOp(ctx.WriteTransform, p.Key);
|
||||
if (state.CloneType > prop.UpdateCloneType) continue;
|
||||
if (depth > prop.UpdateDepth) continue;
|
||||
ChartPlayer.etor.Evaluate(prop.Operator, p.Value);
|
||||
}
|
||||
ChartPlayer.etor.ContextTransform = null;
|
||||
foreach (var r in rel.elements) {
|
||||
if (!r.Key.IsUpdatable(state)) continue;
|
||||
var nctx = r.Key.MatchDynamic(state, rc);
|
||||
if (nctx != null) MatchDynamic(r.Value, state, new RuntimeSkinContext(
|
||||
if (nctx != null) MatchDynamic(r.Value, state, depth, new RuntimeSkinContext(
|
||||
nctx, ctx, r.Key.annotations.Contains("if"), r.Key.annotations.Contains("then")
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user