a.spritestudio.editor.xml.NodeReader.AtFloats C# (CSharp) Method

AtFloats() public method

floatの配列で取得
public AtFloats ( char separator ) : float[]
separator char
return float[]
        public float[] AtFloats( char separator )
        {
            string v = node_.InnerText;
            string[] tokens = v.Split( separator );
            float[] results = new float[tokens.Length];

            for ( int i = 0; i < tokens.Length; ++i ) {
                float.TryParse( tokens[i], out results[i] );
            }
            return results;
        }

Same methods

NodeReader::AtFloats ( string tag, char separator ) : float[]

Usage Example

            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 };
            }