예제 #1
0
        protected override void LoadContent()
        {
            //Interface
            mBackground = new Background(1);
            Texture2D mainMenuBackground = MGame.Content.Load<Texture2D>("Sprites/Backgrounds/MainMenuBackground");
            mBackground.Load(MGame.GraphicsDevice, mainMenuBackground);
            //font
            font = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFontSmall");
            descriptionBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/InvScreen_DescBackground");
            descriptionBackgroundTextureBig = MGame.Content.Load<Texture2D>("Sprites/UI/InvScreen_DescBackground_Big");
            currentItemDescription = new StringBuilder();

            inventoryGridTexture = MGame.Content.Load<Texture2D>("Sprites/UI/InvScreen_Grid");
            goBackTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton");
            goBackTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton_hover");
            goBackButton = new Button(goBackTextureRegular, goBackTextureHover);
            goBackButton.SetPosition(new Vector2(30, 420));
            slotsTexture = MGame.Content.Load<Texture2D>("Sprites/UI/InvScreen_Slots");

            Texture2D throwButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton");
            Texture2D throwButtonTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton_hover");
            throwButton = new Button(throwButtonTexture, throwButtonTextureHover);
            Texture2D cancelButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton");
            Texture2D cancelButtonTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton_hover");
            cancelButton = new Button(cancelButtonTexture, cancelButtonTextureHover);

            Texture2D mainHandButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_MHand");
            Texture2D mainHandButtonTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_MHand_hover");
            Texture2D offHandButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_OffHand");
            Texture2D offHandButtonTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_OffHand_hover");
            mainHandButton = new Button(mainHandButtonTexture, mainHandButtonTextureHover);
            offHandButton = new Button(offHandButtonTexture, offHandButtonTextureHover);
            itemSpritesCurrentlyUpdateable = true;
            //End interface

            //Equippables
            FillEquippables();
            //items and slots
            bagItemsVisualization = new List<ItemSprite>();
            FillBag();
        }
예제 #2
0
        protected override void LoadContent()
        {
            lme = new LevelManagement();
            this.LoadBackground(this.LevelNumber);
            //font setup
            this.font = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFont");
            this.smallFont = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFontSmall");
            this.gameLogQueue = new Queue<string>();
            if (this.LevelNumber == LevelNumber.One)
            {
                this.currentLog1 = "Please, destroy the monster which threatens our village!";
                this.currentLog2 = string.Format("Welcome, {0}!", this.MGame.Engine.Hero.Name);
                this.currentLog3 = "";
            }
            else
            {
                this.currentLog1 = "Your journey continues...";
                this.currentLog2 = "";
                this.currentLog3 = "";
            }
            heroDeathMessage = true;
            this.logBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/UI_LogBackground");
            this.deathTimer = new Timer(3000);

            this.LoadAnimations();

            //UI
            //player health
            healthTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Game_HealthBar");
            fillHealthTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            fillHealthTexture.SetData<Color>(new Color[] { Color.Red });
            currentHealthTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentHealthTexture.SetData<Color>(new Color[] { Color.GreenYellow });
            //player mana
            fillManaTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            fillManaTexture.SetData<Color>(new Color[] { Color.DimGray });
            currentManaTexture = new Texture2D(MGame.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            currentManaTexture.SetData<Color>(new Color[] { Color.SkyBlue });
            //guide screen
            this.guideBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_message_field");
            this.takeButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_TakeButton");
            this.takeButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_TakeButton_hover");
            this.throwButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton");
            this.throwButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_ThrowButton_hover");
            this.cancelButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton");
            this.cancelButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_CancelButton_hover");
            this.enterButtonTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_EnterButton");
            this.enterButtonHoverTexture = MGame.Content.Load<Texture2D>("Sprites/UI/Guide_EnterButton_hover");
            this.lootButton1 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton2 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton3 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton4 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.lootButton5 = new Button(takeButtonTexture, takeButtonHoverTexture);
            this.throwButton = new Button(throwButtonTexture, throwButtonHoverTexture);
            this.cancelButton = new Button(cancelButtonTexture, cancelButtonHoverTexture);
            this.enterButton = new Button(enterButtonTexture, enterButtonHoverTexture);
            //PLAYER
            #region PLAYER
            switch (this.MGame.HeroType)
            {
                case CharacterType.Samurai:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Male_Samurai");
                        break;
                    }
                case CharacterType.Monk:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Male_Monk");
                        break;
                    }
                case CharacterType.Ninja:
                    {
                        this.playerSprite = this.MGame.Content.Load<Texture2D>("Sprites/PlayerClasses/Female_Ninja");
                        break;
                    }
            }
            #endregion

            mPlayerSprite = new PlayerSprite(playerSprite, animations, this.MGame.Engine.Hero);
            if (this.LevelNumber == LevelNumber.Two)
            {
                mPlayerSprite.Position = new Vector2(1000, 1900);
            }

            //Spells
            fireballTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Fireball");
            var spellAnimation = new Animation(2, 50, 50, 0, 0);
            fireballSprite = new SpecialEffectSprite(fireballTexture, spellAnimation);
            enemySpellTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Lightningball");
            enemySpellSprite = new SpecialEffectSprite(enemySpellTexture, spellAnimation);
            equaizerTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_Equalizer");
            equalizerSprite = new SpecialEffectSprite(equaizerTexture, spellAnimation);
            protectingShadowTexture = MGame.Content.Load<Texture2D>("Sprites/Spells/Spell_ProtectingShadow");
            var protectionAnimation = new Animation(2, 48, 64, 0, 0);
            protectingShadowSprite = new SpecialEffectSprite(protectingShadowTexture, protectionAnimation);

            //sounds
            weaponHitSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Weapon_Hit_SFX");
            fireballSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Fireball_SFX");
            openChestSoundEffect = MGame.Content.Load<SoundEffect>("Sounds/Open_Chest_SFX");
            playBGM = true;
            bgm01 = MGame.Content.Load<SoundEffect>("Sounds/BGM_01");
            bgm02 = MGame.Content.Load<SoundEffect>("Sounds/BGM_02");
            //Loot
            lootTexture = MGame.Content.Load<Texture2D>("Sprites/Inventory/Int_Loot");
            lootList = new List<string>();

            var levCallDelegate = new LevelCallDelegate(LoadBackground);
            levCallDelegate += LoadEnvironment;
            levCallDelegate += LoadEnemySprites;
            levCallDelegate += PlayBgm;
            levCallDelegate(this.LevelNumber);
        }
예제 #3
0
        protected override void LoadContent()
        {
            lme = new LevelManagement();
            mBackground = new Background(1);
            Texture2D mainMenuBackground = MGame.Content.Load<Texture2D>("Sprites/Backgrounds/MainMenuBackground");

            returnToGameTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_ReturnToGame");
            returnToGameTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_ReturnToGame_hover");
            loadTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_LoadButtonRegular");
            loadTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_LoadButtonHover");
            exitTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_ExitButtonRegular");
            exitTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_ExitButtonHover");
            saveTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_SaveGame");
            saveTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_SaveGame_hover");
            inventoryTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_Inventory");
            inventoryTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/PauseScreen_Inventory_hover");

            loadButton = new Button(loadTextureRegular, loadTextureHover);
            exitButton = new Button(exitTextureRegular, exitTextureHover);
            returnToGameButton = new Button(returnToGameTextureRegular, returnToGameTextureHover);
            saveButton = new Button(saveTextureRegular, saveTextureHover);
            inventoryButton = new Button(inventoryTextureRegular, inventoryTextureHover);
            loadButton.EnteringSelection += PlaySound;
            exitButton.EnteringSelection += PlaySound;
            returnToGameButton.EnteringSelection += PlaySound;
            saveButton.EnteringSelection += PlaySound;
            inventoryButton.EnteringSelection += PlaySound;

            returnToGameButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - returnToGameTextureRegular.Width / 2, 150));
            saveButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - saveTextureRegular.Width / 2, 200));
            loadButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - loadTextureRegular.Width / 2, 250));
            inventoryButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - inventoryTextureRegular.Width / 2, 300));
            exitButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - exitTextureRegular.Width / 2, 350));

            mBackground.Load(MGame.GraphicsDevice, mainMenuBackground);
        }
예제 #4
0
        protected override void LoadContent()
        {
            mBackground = new Background(1);
            var mainMenuBackground = MGame.Content.Load<Texture2D>("Sprites/Backgrounds/MainMenuBackground");
            mBackground.Load(MGame.GraphicsDevice, mainMenuBackground);

            offerSelectionTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_hero_selection_texture");
            offerSelectionSprite = new StillSprite(offerSelectionTexture);
            offerSelectionSprite.Position = new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - offerSelectionTexture.Width / 2, 80);

            //font
            font = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFont");

            forwardReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton");
            forwardHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton_hover");
            forwardButton = new Button(forwardReg, forwardHover);
            forwardButton.SetPosition(new Vector2(740, 420));
            confirmationSignTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ConfirmationTexture");
            confirmationSprite = new StillSprite(confirmationSignTexture) { Position = new Vector2(580, 420) };
            samButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_sam_sel_reg");
            samButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_sam_sel_hov");
            monButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_mon_sel_reg");
            monButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_mon_sel_hov");
            ninButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_nin_sel_reg");
            ninButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_nin_sel_hov");

            showSamurai = new Button(samButtonReg, samButtonHover);
            showSamurai.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 4 - samButtonReg.Width / 2, 150));
            showMonk = new Button(monButtonReg, monButtonHover);
            showMonk.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - monButtonReg.Width / 2, 150));
            showNinja = new Button(ninButtonReg, ninButtonHover);
            showNinja.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width -
                    MGame.GraphicsDevice.Viewport.Width / 4 - ninButtonReg.Width / 2, 150));

            showSamurai.EnteringSelection += PlaySound;
            showMonk.EnteringSelection += PlaySound;
            showNinja.EnteringSelection += PlaySound;
            forwardButton.EnteringSelection += PlaySound;

            classTextVector = new Vector2(300, 350);
            samuraiRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Male_Samurai_Representation");
            monkRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Male_Monk_Representation");
            ninjaRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Female_Ninja_Representation");

            representation = new StillSprite(samuraiRep)
            {
                Position = new Vector2(MGame.GraphicsDevice.Viewport.Width / 4 - 60, 200)
            };

            textBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_text_frame");
            textBackgroundSprite = new StillSprite(textBackgroundTexture)
            {
                Position = new
                    Vector2(MGame.GraphicsDevice.Viewport.Width / 4 + samuraiRep.Width / 2 + 40, 200)
            };

            classTextVector = new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 4 + samuraiRep.Width / 2 + 50, 210);

            string desc = string.Concat(
                "INITIAL STATS\n",
                "Health: {0}\n",
                "Mana: {1}\n",
                "Attack: {2}\n",
                "Armor: {3}\n",
                "Starting weapon: {4}");

            this.descriptionSam = new StringBuilder();
            this.descriptionSam.AppendLine(
                string.Format(
                    desc,
                    Samurai.DefaultSamuraiHealth,
                    Samurai.DefaultSamuraiMana,
                    Samurai.DefaultSamuraiArmor,
                    Samurai.DefaultSamuraiDamage,
                    "One-handed sword"));

            this.descriptionMon = new StringBuilder();
            this.descriptionMon.AppendLine(
               string.Format(
                   desc,
                   Monk.DefaultMonkHealth,
                   Monk.DefaultMonkMana,
                   Monk.DefaultMonkArmor,
                   Monk.DefaultMonkDamage,
                   "Staff"));

            this.descriptionNin = new StringBuilder();
            this.descriptionNin.AppendLine(
               string.Format(
                   desc,
                   Ninja.DefaultNinjaHealth,
                   Ninja.DefaultNinjaMana,
                   Ninja.DefaultNinjaArmor,
                   Ninja.DefaultNinjaDamage,
                   "One-handed dagger"));

            currentClass = CharacterType.Samurai;
            showSamurai.IsSelected = true;

            nameLabelTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_NameLabel");
            nameLabel = new StillSprite(nameLabelTexture) { Position = new Vector2(20, 405) };
            nameInputTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_name_input");
            nameInputTextbox = new TextBox(nameInputTexture, font);
            nameInputTextbox.SetPosition(new Vector2(107, 400));
            typedText = "";
            input = new KeyboardInput(nameInputTextbox);
        }
예제 #5
0
        protected override void LoadContent()
        {
            mBackground = new Background(1);
            var mainMenuBackground = MGame.Content.Load<Texture2D>("Sprites/Backgrounds/MainMenuBackground");
            startTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_StartButtonRegular");
            startTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_StartButtonHover");
            loadTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_LoadButtonRegular");
            loadTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_LoadButtonHover");
            exitTextureRegular = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_ExitButtonRegular");
            exitTextureHover = MGame.Content.Load<Texture2D>("Sprites/UI/MainMenu_ExitButtonHover");
            startButton = new Button(startTextureRegular, startTextureHover);
            loadButton = new Button(loadTextureRegular, loadTextureHover);
            exitButton = new Button(exitTextureRegular, exitTextureHover);
            startButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width/2-startTextureRegular.Width/2, 200));
            loadButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - loadTextureRegular.Width / 2, 250));
            exitButton.SetPosition(new Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - exitTextureRegular.Width / 2, 300));
            mBackground.Load(MGame.GraphicsDevice, mainMenuBackground);

            startButton.EnteringSelection += PlaySound;
            loadButton.EnteringSelection += PlaySound;
            exitButton.EnteringSelection += PlaySound;
        }