using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Audio; using System.Collections.Generic; public class ResourceManager { ContentManager contentManager; Dictionary sprites; Dictionary sounds; public ResourceManager(ContentManager Content) { this.contentManager = Content; this.sprites = new Dictionary(); this.sounds = new Dictionary(); } public Texture2D getSprite(string assetName) { if (assetName == "") return null; if (!this.sprites.ContainsKey(assetName)) this.sprites[assetName] = contentManager.Load(assetName); return this.sprites[assetName]; } public SoundEffect getSound(string assetName) { if (assetName == "") return null; if (!this.sounds.ContainsKey(assetName)) this.sounds[assetName] = contentManager.Load(assetName); return this.sounds[assetName]; } public ContentManager Content { get { return contentManager; } } }