Пример #1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            DataManager.ReadEntityData(Content);
            DataManager.ReadArmorData(Content);
            DataManager.ReadShieldData(Content);
            DataManager.ReadWeaponData(Content);
            DataManager.ReadChestData(Content);
            DataManager.ReadKeyData(Content);
            DataManager.ReadSkillData(Content);

            FontManager.AddFont("testfont", Content.Load <SpriteFont>("Fonts/scenefont"));
            TextureManager.AddTexture("FullSheet", Content.Load <Texture2D>("GUI/ProjectUtumno_full"));
            string[] fileNames = Directory.GetFiles(
                Path.Combine("Content/Game/Items", "Armor"),
                "*.xnb");

            foreach (string a in fileNames)
            {
                string path = "Game/Items/Armor/" + Path.GetFileNameWithoutExtension(a);

                ArmorData armorData = Content.Load <ArmorData>(path);
                ItemManager.AddArmor(new Armor(armorData));
            }

            fileNames = Directory.GetFiles(
                Path.Combine("Content/Game/Items", "Shield"),
                "*.xnb");

            foreach (string a in fileNames)
            {
                string path = "Game/Items/Shield/" + Path.GetFileNameWithoutExtension(a);

                ShieldData shieldData = Content.Load <ShieldData>(path);
                ItemManager.AddShield(new Shield(shieldData));
            }

            fileNames = Directory.GetFiles(
                Path.Combine("Content/Game/Items", "Weapon"),
                "*.xnb");

            foreach (string a in fileNames)
            {
                string path = "Game/Items/Weapon/" + Path.GetFileNameWithoutExtension(a);

                WeaponData weaponData = Content.Load <WeaponData>(path);
                ItemManager.AddWeapon(new Weapon(weaponData));
            }

            PotionData potionData = new PotionData
            {
                Name             = "Minor Healing Potion",
                Type             = "Potion",
                Target           = "Health",
                Price            = 100,
                Weight           = .25f,
                Minimum          = 6,
                Maximum          = 13,
                AllowableClasses = new[] { "Fighter", "Wizard", "Rogue", "Priest" }
            };

            Potion potion = new Potion(potionData);

            ItemManager.AddPotion(potion);

            potionData = new PotionData
            {
                Name             = "Minor Mana Potion",
                Type             = "Potion",
                Target           = "Mana",
                Price            = 100,
                Weight           = .25f,
                Minimum          = 6,
                Maximum          = 13,
                AllowableClasses = new[] { "Wizard", "Priest" }
            };

            potion = new Potion(potionData);

            ItemManager.AddPotion(potion);

            potionData = new PotionData
            {
                Name             = "Minor Stamina Potion",
                Type             = "Potion",
                Target           = "Stamina",
                Price            = 100,
                Weight           = .25f,
                Minimum          = 6,
                Maximum          = 13,
                AllowableClasses = new[] { "Fighter", "Rogue" }
            };

            potion = new Potion(potionData);

            ItemManager.AddPotion(potion);

            GameItemManager.AddItem("Long Sword", new GameItem(ItemManager.GetWeapon("Long Sword"), "FullSheet", new Rectangle(1696, 1408, 32, 32)));
            GameItemManager.AddItem("Short Sword", new GameItem(ItemManager.GetWeapon("Short Sword"), "FullSheet", new Rectangle(800, 1504, 32, 32)));
            GameItemManager.AddItem("Apprentice Staff", new GameItem(ItemManager.GetWeapon("Apprentice Staff"), "FullSheet", new Rectangle(224, 1408, 32, 32)));
            GameItemManager.AddItem("Acolyte Staff", new GameItem(ItemManager.GetWeapon("Acolyte Staff"), "FullSheet", new Rectangle(256, 1408, 32, 32)));
            GameItemManager.AddItem("Leather Armor", new GameItem(ItemManager.GetArmor("Leather Armor"), "FullSheet", new Rectangle(1248, 1216, 32, 32)));
            GameItemManager.AddItem("Chain Mail", new GameItem(ItemManager.GetArmor("Chain Mail"), "FullSheet", new Rectangle(1472, 1184, 32, 32)));
            GameItemManager.AddItem("Studded Leather Armor", new GameItem(ItemManager.GetArmor("Studded Leather Armor"), "FullSheet", new Rectangle(1984, 1120, 32, 32)));
            GameItemManager.AddItem("Light Robes", new GameItem(ItemManager.GetArmor("Light Robes"), "FullSheet", new Rectangle(992, 1216, 32, 32)));
            GameItemManager.AddItem("Medium Robes", new GameItem(ItemManager.GetArmor("Medium Robes"), "FullSheet", new Rectangle(1024, 1216, 32, 32)));
            GameItemManager.AddItem("Minor Healing Potion", new GameItem(ItemManager.GetPotion("Minor Healing Potion"), "FullSheet", new Rectangle(832, 1344, 32, 32)));
            GameItemManager.AddItem("Minor Mana Potion", new GameItem(ItemManager.GetPotion("Minor Mana Potion"), "FullSheet", new Rectangle(576, 1344, 32, 32)));
            GameItemManager.AddItem("Minor Stamina Potion", new GameItem(ItemManager.GetPotion("Minor Stamina Potion"), "FullSheet", new Rectangle(704, 1344, 32, 32)));
        }