public Cell( NodeReader node, int textureWidth, int textureHeight ) { name = node.AtText( "name" ); int[] pos = node.AtIntegers( "pos", ' ' ); size = node.AtIntegers( "size", ' ' ); pivot = node.AtFloats( "pivot", ' ' ); rotated = node.AtBoolean( "rotated" ); float s = pos[0] / (float) textureWidth; float t = 1f - (pos[1] / (float) textureHeight); float u = s + (size[0] / (float) textureWidth); float v = t - (size[1] / (float) textureHeight); uv = new float[4] { s, v, u, t }; }
public Part( NodeReader node ) { name = node.AtText( "name" ); index = node.AtInteger( "arrayIndex" ); parent = node.AtInteger( "parentIndex" ); type = NodeTypeOperator.FromString( node.AtText( "type" ) ); boundsType = BoundsTypeOperator.FromString( node.AtText( "boundsType" ) ); inheritType = InheritTypeOperator.FromString( node.AtText( "inheritType" ) ); //inheritRates blendType = AlphaBlendTypeOperator.FromString( node.AtText( "alphaBlendType" ) ); show = node.AtBoolean( "show" ); var n = node.ChildOrNull( "expandAttribute" ); expandAttribute = n != null ? n.AtText() : null; n = node.ChildOrNull( "expandChildren" ); expandChildren = n != null ? n.AtText() : null; }
public PartAnimation( NodeReader node ) { partName = node.AtText( "partName" ); var children = node.Child( "attributes" ).Children( "attribute" ); var results = new List<SpriteAttribute>(); foreach ( var child in children ) { string tag = child.Attribute( "tag" ).AtText(); var targetType = Type.GetType( "a.spritestudio.editor.attribute." + tag ); var attribute = (SpriteAttribute) Activator.CreateInstance( targetType ); attribute.Setup( child ); results.Add( attribute ); } attributes = results.AsReadOnly(); }
public Animation( NodeReader node ) { name = node.AtText( "name" ); if ( node.AtBoolean( "overrideSettings" ) ) { settings = CreateOverrideSettings( node.Child( "settings" ) ); } else { settings = new OverrideSettings(); } var parts = node.Child( "partAnimes" ).Children( "partAnime" ); List<PartAnimation> results = new List<PartAnimation>(); foreach ( var part in parts ) { results.Add( new PartAnimation( part ) ); } this.parts = results.AsReadOnly(); }