Implement write-only context.
This commit is contained in:
@@ -52,8 +52,9 @@ namespace Cryville.Crtr {
|
||||
try {
|
||||
var nctxs = r.Key.MatchStatic(state, rc);
|
||||
var roflag = r.Key.annotations.Contains("if");
|
||||
var woflag = r.Key.annotations.Contains("then");
|
||||
foreach (var nctx in nctxs) {
|
||||
var nrctx = new RuntimeSkinContext(nctx, ctx.WriteTransform, roflag);
|
||||
var nrctx = new RuntimeSkinContext(nctx, ctx, roflag, woflag);
|
||||
MatchStatic(r.Value, state, nrctx);
|
||||
}
|
||||
}
|
||||
@@ -84,10 +85,9 @@ 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(nctx, e.Context.ReadContext.Transform, e.Selectors.annotations.Contains("if"))
|
||||
);
|
||||
if (nctx != null) MatchDynamic(e.Element, state, new RuntimeSkinContext(
|
||||
nctx, e.Context, e.Selectors.annotations.Contains("if"), e.Selectors.annotations.Contains("then")
|
||||
));
|
||||
if (psrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
}
|
||||
ChartPlayer.etor.ContextEvent = null;
|
||||
@@ -109,10 +109,9 @@ namespace Cryville.Crtr {
|
||||
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(nctx, ctx.WriteTransform, r.Key.annotations.Contains("if"))
|
||||
);
|
||||
if (nctx != null) MatchDynamic(r.Value, state, new RuntimeSkinContext(
|
||||
nctx, ctx, r.Key.annotations.Contains("if"), r.Key.annotations.Contains("then")
|
||||
));
|
||||
}
|
||||
if (rc.PropSrcs != null) ChartPlayer.etor.ContextCascadeDiscard();
|
||||
}
|
||||
@@ -151,9 +150,19 @@ namespace Cryville.Crtr {
|
||||
ReadContext = r;
|
||||
WriteTransform = w;
|
||||
}
|
||||
public RuntimeSkinContext(SkinContext newctx, Transform oldctx, bool roflag) {
|
||||
public RuntimeSkinContext(SkinContext newctx, RuntimeSkinContext oldctx, bool roflag, bool woflag) {
|
||||
if (roflag) {
|
||||
ReadContext = newctx;
|
||||
WriteTransform = oldctx.WriteTransform;
|
||||
}
|
||||
else if (woflag) {
|
||||
ReadContext = oldctx.ReadContext;
|
||||
WriteTransform = newctx.Transform;
|
||||
}
|
||||
else {
|
||||
ReadContext = newctx;
|
||||
WriteTransform = roflag ? oldctx : newctx.Transform;
|
||||
WriteTransform = newctx.Transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user