Ejemplo n.º 1
0
        /// <summary>
        /// Parses a file in Semi Animation format and produces a <c>ParsedAnimation</c>.
        /// </summary>
        /// <returns>The parsed animation representation.</returns>
        /// <param name="data">Contents of the Semi Animation file.</param>
        public static ParsedAnimation ParseAnimation(string data, string default_namespace)
        {
            data = ConvertWindowsNewlinesToUnix(data);
            var parser = new Tk0dConfigParser(Mode.Animation, data);

            parser.Parse(default_namespace);
            return(parser.Animation);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads a sprite animation in Semi Animation format.
        /// </summary>
        /// <returns>The newly registered sprite animation.</returns>
        /// <param name="path">Relative resource path to the file in Semi Animation format.</param>
        public SpriteAnimation LoadSpriteAnimation(string path)
        {
            CheckMode();
            path = GetFullResourcePath(path);
            var parsed = Tk0dConfigParser.ParseAnimation(File.ReadAllText(path), Config.ID);
            var dir    = Path.GetDirectoryName(path);

            return(SpriteAnimation.Load(parsed, Config.ID));
        }