示例#1
0
        public static void LoadContent(ContentManager Content)
        {
            Sprites = new Dictionary <string, Texture2D>();

            foreach (var FName in Directory.GetFiles("Content/Sprites"))
            {
                if (FName.Contains(".xnb") || FName.Contains(".ase"))
                {
                    continue;
                }

                var FixedFName = FName.Replace(".png", "").Replace(".jpg", "").Replace(".gif", "");
                FixedFName = FixedFName.Replace("Content/", "");

                Sprites.Add(
                    FixedFName.Replace("Sprites\\", ""),
                    Content.Load <Texture2D>(FixedFName));
            }

            Font = Content.Load <SpriteFont>("Courier New");
        }
示例#2
0
        public static void LoadContent(ContentManager Content)
        {
            Rand = new Random();

            Sprites = new Dictionary <string, Texture2D>();
            foreach (var FName in Directory.GetFiles("Content/Sprites"))
            {
                if (FName.Contains(".xnb") || FName.Contains(".ase"))
                {
                    continue;
                }

                var FixedFName = FName.Replace(".png", "").Replace(".jpg", "").Replace(".gif", "");
                FixedFName = FixedFName.Replace("Content/", "");

                Sprites.Add(
                    FixedFName.Replace("Sprites\\", "").Replace("Sprites/", ""),
                    Content.Load <Texture2D>(FixedFName));
            }

            Sounds = new Dictionary <string, SoundEffect>();
            foreach (var FName in Directory.GetFiles("Content/Sounds"))
            {
                if (!FName.Contains(".xnb"))
                {
                    continue;
                }

                var FixedFName = FName.Replace(".xnb", "");
                FixedFName = FixedFName.Replace("Content/", "");

                Sounds.Add(
                    FixedFName.Replace("Sounds\\", "").Replace("Sounds/", ""),
                    Content.Load <SoundEffect>(FixedFName));
            }
        }