diff --git a/Assets/Cryville/Crtr/SkinInterpreter.cs b/Assets/Cryville/Crtr/SkinInterpreter.cs index 4d9b5a9..532db68 100644 --- a/Assets/Cryville/Crtr/SkinInterpreter.cs +++ b/Assets/Cryville/Crtr/SkinInterpreter.cs @@ -28,7 +28,7 @@ namespace Cryville.Crtr { GetChar(); if (cc == '.') { GetChar(); - s.Add(new SkinSelector.State(GetIdentifier())); + s.Add(new SkinSelector.AtAnchor(GetIdentifier())); key = null; } else { diff --git a/Assets/Cryville/Crtr/SkinSelectors.cs b/Assets/Cryville/Crtr/SkinSelectors.cs index 81f3579..b4e1c07 100644 --- a/Assets/Cryville/Crtr/SkinSelectors.cs +++ b/Assets/Cryville/Crtr/SkinSelectors.cs @@ -104,6 +104,23 @@ namespace Cryville.Crtr { return h.Handler.Anchors[Name].Opened; } } + public class AtAnchor : SkinSelector { + public int Name { get; private set; } + public AtAnchor(string name) { + Name = IdentifierManager.SharedInstance.Request(name); + } + public override bool IsStatic { + get { return false; } + } + + public override Transform Match(ContainerState h, Transform a, bool dyn = false) { + if (!dyn) throw new SelectorNotStaticException(); + return IsUpdatable(h) ? a : null; + } + public override bool IsUpdatable(ContainerState h) { + return h.Handler.Anchors[Name].Opened; + } + } public class Property : SkinSelector { readonly PdtExpression _exp; readonly PdtOperator _op;