/// <summary>
 /// Initializes a new instance of the <see cref="XnaAnimation" /> class.
 /// </summary>
 /// <param name="id">The identifier of the animation.</param>
 /// <param name="loop">Whether or not the animation is looping.</param>
 /// <param name="resetindex">Whether or not to reset the timing index when the frame changes. Turn this on to ensure that each frame gets viewed at least once.</param>
 /// <param name="texturecache">The texture cache used for loading textures.</param>
 public XnaAnimation(string id, bool loop, bool resetindex, TextureCache texturecache)
     : base(id, loop, resetindex)
 {
     if (texturecache != null)
     {
         LoadContent(texturecache);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="XnaBackdrop"/> class.
 /// </summary>
 /// <param name="backdrop">The backdrop.</param>
 /// <param name="texturecache">The texturecache.</param>
 public XnaBackdrop(Backdrop backdrop, TextureCache texturecache)
     : base(backdrop.TextureID, backdrop.Position, backdrop.Parallax, backdrop.Velocity, backdrop.LoopX, backdrop.LoopY, backdrop.Layer, backdrop.WrapCoordsX, backdrop.WrapCoordsY)
 {
     if (texturecache != null)
     {
         LoadContent(texturecache);
     }
 }
        /// <summary>
        /// Loads the textures
        /// </summary>
        /// <param name="texturecache">The texture cache used for loading textures.</param>
        public virtual void LoadContent(TextureCache texturecache)
        {
            foreach (var animation in Animations)
            {
                var anim = (XnaAnimation)animation.Value;

                anim.LoadContent(texturecache);
            }
        }
        /// <summary>
        /// Loads the content.
        /// </summary>
        /// <param name="texturecache">The texture cache used for loading textures.</param>
        public virtual void LoadContent(TextureCache texturecache)
        {
            foreach (var entity in Entities.Values)
            {
                var xnaentity = entity as XnaEntity;

                if (xnaentity != null)
                {
                    xnaentity.LoadContent(texturecache);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XnaAnimation" /> class.
        /// </summary>
        /// <param name="id">The identifier of the animation.</param>
        /// <param name="loop">Whether or not the animation is looping.</param>
        /// <param name="resetindex">Whether or not to reset the timing index when the frame changes. Turn this on to ensure that each frame gets viewed at least once.</param>
        /// <param name="frames">The list of the animation's frames.</param>
        /// <param name="texturecache">The texture cache used for loading textures.</param>
        public XnaAnimation(string id, bool loop, bool resetindex, List<Frame> frames, TextureCache texturecache)
            : base(id, loop, resetindex, null)
        {
            foreach (var frame in frames) //Convert SOL Frame to XNA Frame.
            {
                AddFrame(frame.ToXnaFrame());
            }

            if (texturecache != null)
            {
                LoadContent(texturecache);
            }
        }
示例#6
0
        /// <summary>
        /// Loads the content of all maps.
        /// </summary>
        /// <param name="texturecache">The texturecache.</param>
        public virtual void LoadContent(TextureCache texturecache)
        {
            TextureCache = texturecache;

            foreach (var map in Maps.Values)
            {
                var xnamap = map as XnaMap;

                if (xnamap == null)
                {
                    continue;
                }

                xnamap.LoadContent(texturecache);
            }
        }
示例#7
0
        /// <summary>
        /// Loads the content.
        /// </summary>
        /// <param name="texturecache">The texture cache used for loading textures.</param>
        public virtual void LoadContent(TextureCache texturecache)
        {
            foreach (var tile in TileSet)
            {
                if (tile != null)
                {
                    tile.Animation = new XnaAnimation(tile.Animation, texturecache);
                }
            }

            var newdrops = new Dictionary<string, Backdrop>();

            foreach (var backdrop in Backdrops)
            {
                newdrops.Add(backdrop.Key, new XnaBackdrop(backdrop.Value, texturecache));
            }

            Backdrops = newdrops;
            newdrops = new Dictionary<string, Backdrop>();

            foreach (var foredrop in Foredrops)
            {
                newdrops.Add(foredrop.Key, new XnaBackdrop(foredrop.Value, texturecache));
            }

            Foredrops = newdrops;

            var entities = Entities as XnaEntityManager;

            if (entities != null)
            {
                entities.LoadContent(texturecache);
            }
        }
        /// <summary>
        /// Loads the content.
        /// </summary>
        /// <param name="texturecache">The texture cache used to load the content.</param>
        public void LoadContent(TextureCache texturecache)
        {
            var xnaanims = AnimationCache as XnaAnimationCache;

            if (xnaanims == null)
            {
                var oldcache = AnimationCache;

                AnimationCache = new XnaAnimationCache();

                foreach (var animation in oldcache.Animations.Values)
                {
                    AnimationCache.AddAnimation(animation);
                }

                xnaanims = AnimationCache as XnaAnimationCache;
            }

            xnaanims.LoadContent(texturecache);
        }
示例#9
0
 /// <summary>
 /// Loads the content.
 /// </summary>
 /// <param name="texturecache">The texturecache.</param>
 public void LoadContent(TextureCache texturecache)
 {
 }
        /// <summary>
        /// Loads the textures.
        /// </summary>
        /// <param name="texturecache">The texture cache used for loading textures.</param>
        public virtual void LoadContent(TextureCache texturecache)
        {
            foreach (XnaFrame frame in Frames)
            {
                frame.LoadContent(texturecache);
            }

            TextureCache = texturecache;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XnaAnimation" /> class.
        /// </summary>
        /// <param name="anim">The animation to use the data to load.</param>
        /// <param name="texturecache">The texture cache used to load the textures..</param>
        public XnaAnimation(Animation anim, TextureCache texturecache)
            : base(anim.ID, anim.IsLooping, anim.ResetIndex, new List<Frame>(), anim.CurrentFrame, anim.TimingIndex)
        {
            foreach (var frame in anim.GetFramesList()) //Convert SOL Frame to XNA Frame.
            {
                AddFrame(frame.ToXnaFrame());
            }

            if (texturecache != null)
            {
                LoadContent(texturecache);
            }
        }
 /// <summary>
 /// Loads the texture.
 /// </summary>
 /// <param name="texturecache">The texture cache to use for texture loading.</param>
 public virtual void LoadContent(TextureCache texturecache)
 {
     Texture = texturecache.GetTexture(TextureID);
 }