using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; namespace SemiColinGames { public class TextureRef { private static readonly List allTextures = new List(); public static void LoadAll(ContentManager content) { foreach (TextureRef texture in allTextures) { texture.Load(content); } } private readonly string contentPath; public TextureRef(string contentPath) { allTextures.Add(this); this.contentPath = contentPath; } public Texture2D Get { get; private set; } private void Load(ContentManager content) { Get = content.Load(contentPath); } } public static class Textures { public static SpriteFont DebugFont; public static SpriteFont BannerFont; // Character spritesheets. public static TextureRef Executioner = new TextureRef("sprites/ccg/executioner_female"); public static TextureRef Ninja = new TextureRef("sprites/ccg/ninja_female"); // UI sprites. public static TextureRef Heart = new TextureRef("sprites/semicolin/heart"); // Ship sprites. public static TextureRef SilverBlue1 = new TextureRef("sprites/dylestorm/SilverBlue-1"); // Backgrounds are indexed by draw order; the first element should be drawn furthest back. public static TextureRef[] Backgrounds = new TextureRef[] { new TextureRef("backgrounds/szadiart/pf4/background1_day"), new TextureRef("backgrounds/szadiart/pf4/background2a_day"), new TextureRef("backgrounds/szadiart/pf4/background3_day"), new TextureRef("backgrounds/szadiart/pf4/background4_day"), }; // Background tiles. public static TextureRef Cemetery = new TextureRef("tiles/anokolisa/cemetery"); public static TextureRef Crypt = new TextureRef("tiles/anokolisa/crypt"); public static TextureRef Dungeon = new TextureRef("tiles/anokolisa/dungeon"); public static TextureRef Forest = new TextureRef("tiles/anokolisa/forest"); public static TextureRef Garden = new TextureRef("tiles/anokolisa/garden"); public static TextureRef Grassland = new TextureRef("tiles/anokolisa/grassland"); public static TextureRef Ruins = new TextureRef("tiles/anokolisa/ruins"); public static TextureRef Sewer = new TextureRef("tiles/anokolisa/sewer"); public static TextureRef Temple = new TextureRef("tiles/anokolisa/temple"); public static TextureRef Village = new TextureRef("tiles/anokolisa/village"); public static void Load(ContentManager content) { DebugFont = content.Load("fonts/debug"); BannerFont = content.Load("fonts/banner"); TextureRef.LoadAll(content); } } }