Пример #1
0
        private void populateAnimationsFromAnimationData()
        {
            Animations = new Dictionary <string, SpriteAnimation>();

            if (AnimationData == null || AnimationData.Length == 0)
            {
                return;
            }

            string[] animationStrings = AnimationData.Split(';');
            foreach (string animationString in animationStrings)
            {
                if (animationString.Length == 0)
                {
                    continue;
                }

                int        colonIndex = animationString.IndexOf(':');
                string     name       = animationString.Substring(0, colonIndex);
                string[]   intStrings = animationString.Substring(colonIndex + 1).Split(',');
                List <int> frames     = new List <int>(intStrings.Length);
                foreach (string str in intStrings)
                {
                    frames.Add(int.Parse(str.Trim()));
                }

                Animations.Add(name, new SpriteAnimation(name, frames.ToArray()));
            }
        }