public void LoadContent(PartyCharacter partyCharacter)
        {
            linkedCharacter = partyCharacter;
            switch (mode)
            {
                case PlayerCharacterStatusBoxMode.EndOfBattle:
                    GameClass.SoundManager.LoadSound("Audio/expAddSound");
                    GameClass.SoundManager.LoadSound("Audio/levelUpSound");
                    GameClass.SoundManager.LoadSound("Audio/newTechniqueSound");
                    break;
                case PlayerCharacterStatusBoxMode.MapStatus:
                    spendPointsMenu = new Menu("Spend Points Menu", Vector2.Zero, 5, "Blank", "General/playerTurnMenuCursor", Vector2.Zero, Vector2.Zero, false);
                    MenuOption HPOption = new MenuOption("AddPointsHP", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s HP by 2.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(HPOption, true);
                    MenuOption MPOption = new MenuOption("AddPointsMP", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s MP by 2.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(MPOption, false);
                    MenuOption ATKOption = new MenuOption("AddPointsATK", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s ATK by 1.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(ATKOption, false);
                    MenuOption DEFOption = new MenuOption("AddPointsDEF", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s DEF by 1.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(DEFOption, false);
                    MenuOption MAG_ATKOption = new MenuOption("AddPointsMAG_ATK", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s MAG_ATK by 1.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(MAG_ATKOption, false);
                    MenuOption MAG_DEFOption = new MenuOption("AddPointsMAG_DEF", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s MAG_DEF by 1.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(MAG_DEFOption, false);
                    MenuOption SPDOption = new MenuOption("AddPointsSPD", "Spend a point to increase " + linkedCharacter.CharacterID.ToString() + "'s SPD by 1.", Color.White, Color.White, "General/spendPointsSelected", "General/spendPointsNotSelected");
                    spendPointsMenu.AddMenuOption(SPDOption, false);

                    spendPointsInfoBar = new InfoBar("General/InfoBarBG", Vector2.Zero, GameClass.Size8Font, Color.White, new Vector2(-225, -10), 0.1f);
                    break;
            }
        }
Esempio n. 2
0
        public void switchMenu(TypeMenu menu)
        {
            if (menuactif != null)
            {
                if (menuactif.type == menu)
                {
                    this.IsMouseVisible = false;
                    menuactif.setVisibility(false);
                    menuactif = null;
                    Tools.Quick.player.getInterface().setVisibility(true);
                    //water.Visible = true;
                    //trees.Visible = true;
                    //actualGround.Visible = true;
                    CurrentWorldSpace.Visible = true;
                }

            }
            else
            {

                Tools.Quick.player.getInterface().setVisibility(false);
               // backmenu.SaveAsJpeg((System.IO.Stream)(new System.IO.FileStream("menu.jpg", System.IO.FileMode.OpenOrCreate)), backmenu.Width, backmenu.Height);
                this.IsMouseVisible = true; ;
                menuactif = new Menu(arial, menu);
                menuactif.setVisibility(true);
                CurrentWorldSpace.Visible = false;
            }
        }
Esempio n. 3
0
        public override void LoadContent()
        {
            //Loads the content for a battle.

            //load the static and resued textures.
            battleBG = GlobalGameInfo.CurrentBattleBG;
            battleHUD = GameClass.LoadTextureData("General/BattleHUD");
            turnChartBG = GameClass.LoadTextureData("General/TurnChartBG");
            statusBarTexture = GameClass.LoadTextureData("General/StatusBar");
            hpBarTexture = GameClass.LoadTextureData("General/HPBar");
            mpBarTexture = GameClass.LoadTextureData("General/MPBar");
            buffArrowTexture = GameClass.LoadTextureData("General/buffArrow");
            turnChartSelection = GameClass.LoadTextureData("General/turnChartSelection");

            //Load in the sound effects used by the BattleScreen.
            GameClass.SoundManager.LoadSound("Audio/dash");
            GameClass.SoundManager.LoadSound("Audio/victory");
            GameClass.SoundManager.LoadSound("Audio/loss");

            //reset the games camera to zero as the BattleScreen does not use the camera.
            GameClass.CurrentGameCamera.Position = Vector2.Zero;

            //Initialise the controllers.
            controls = new GamePadController(PlayerIndex.One);
            controls.ControlsActive = false;
            debugControls = new KeyboardController();
            debugControls.ControlsActive = false;
            restartScreenControls = new KeyboardController();

            //Set up the player turn menu.
            playerTurnMenu = new Menu("Player Turn Menu", new Vector2(138, 172), 8, "General/playerTurnMenuBG", "General/playerTurnMenuCursor", Vector2.Zero, Vector2.Zero, true);
            playerTechniqueMenu = new CharacterTechniqueMenu(new Vector2(150, 172), "General/playerTurnMenuCursor", "General/playerTechniqueMenuBG", new Vector2(59, 12));
            battleInventoryMenu = new BattleInventoryMenu(new Vector2(150, 172), "General/playerTurnMenuCursor", "General/battleInventoryMenuBG", new Vector2(59, 12));
            battleTargetSelector = new BattleTargetSelector("General/playerTurnMenuCursor");

            //Set up and add the options for the player turn menu.
            MenuOption attackOption = new MenuOption("Attack", "Perform a normal attack.", Color.Black, Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            playerTurnMenu.AddMenuOption(attackOption, true);
            MenuOption defendOption = new MenuOption("Defend", "Defend yourself.", Color.Black, Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            playerTurnMenu.AddMenuOption(defendOption, false);
            MenuOption skillsOption = new MenuOption("Skills", "Use a special skill.", Color.Black, Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            playerTurnMenu.AddMenuOption(skillsOption, false);
            MenuOption itemsOption = new MenuOption("Items", "Use an Item.", Color.Black,  Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            playerTurnMenu.AddMenuOption(itemsOption, false);

            //Set up the game over menu.
            gameOverMenu = new Menu("Game Over Menu", new Vector2(GameClass.CurrentGameCamera.Position.X + GameClass.CurrentGameCamera.Size.X / 2, GameClass.CurrentGameCamera.Position.Y + GameClass.CurrentGameCamera.Size.Y / 2), 8, "General/gameOverMenuBG", "General/playerTurnMenuCursor", Vector2.Zero, new Vector2(0, 50), true);
            MenuOption retryOption = new MenuOption("Retry", "Retry this battle from the beginning.", Color.Black, Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            gameOverMenu.AddMenuOption(retryOption, true);
            MenuOption quitOption = new MenuOption("Quit", "Quit the game.", Color.Black, Color.White, "General/playerTurnMenuButtonSelected", "General/playerTurnMenuButtonNotSelected");
            gameOverMenu.AddMenuOption(quitOption, false);

            //Set up the info bar.
            infoBar = new InfoBar("General/InfoBarBG", new Vector2(230, 10), GameClass.Size8Font, Color.White, new Vector2(-225, -10), 0.1f);

            //For all the items in the players general inventory, check which are battle items and set them up as new BattleItem objects, loading their effect data from BattleCharacters/BattleItemList.xml into the battle inventory.
            List<BattleItemData> battleItemDataList = GameClass.ContentManager.Load<List<BattleItemData>>("BattleCharacters/BattleItemDataList");
            foreach (KeyValuePair<InventoryItemIdentity, int> inventoryItem in GlobalGameInfo.Inventory)
            {
                foreach (BattleItemData battleItemData in battleItemDataList)
                {
                    if (battleItemData.itemID == inventoryItem.Key)
                    {
                        BattleItem newBattleItem = new BattleItem();
                        newBattleItem.LoadContent(battleItemData, inventoryItem.Value);
                        battleItemInventory.Add(newBattleItem);
                    }
                }
            }

            //Initialise the status box list.
            playerStatusBoxes = new List<PlayerCharacterStatusBox>();

            //For the first three characters in the players party, load the characters sprites and techniques from <characterName>Battle.xml and load their stats from the PartyCharacter into a BattleCharacter
            //The players party takes up Battle Orders 0-2.
            int battleOrder = 0;
            int statusBoxDrawPos = 110;
            for (int count = 0; count < 3; count++)
            {
                if (GlobalGameInfo.CurrentPlayerParty[count] != null)
                {
                    PlayerBattleCharacter newPlayerCharacter = new PlayerBattleCharacter();
                    newPlayerCharacter.LoadContent(battleOrder, GlobalGameInfo.CurrentPlayerParty[count]);
                    activeCharacters.Add(newPlayerCharacter);
                    battleOrder ++;

                    //Create a new status box for each loaded character.
                    PlayerCharacterStatusBox newStatusBox = new PlayerCharacterStatusBox(new Vector2(statusBoxDrawPos, 170), PlayerCharacterStatusBoxMode.EndOfBattle);
                    newStatusBox.LoadContent(GlobalGameInfo.CurrentPlayerParty[count]);
                    playerStatusBoxes.Add(newStatusBox);
                    statusBoxDrawPos += 210;
                }
            }

            //Load the enemies.
            battleOrder = 3;
            if (retryingBattle == false)
            {//If this battle is a fresh battle....

                //load the 'mandatory' enemy (i.e. The map enemy that the player collided with) into the first enemy slot (Battle Order 3)
                EnemyBattleCharacter mandatoryEnemyCharacter = new EnemyBattleCharacter();
                mandatoryEnemyCharacter.LoadContent(battleOrder, GlobalGameInfo.CurrentEnemyInBattle.CharacterID);
                activeCharacters.Add(mandatoryEnemyCharacter);
                enemyGroupLostTo.Add(GlobalGameInfo.CurrentEnemyInBattle.CharacterID);
                battleOrder++;

                //Load in BattleCharacters/EnemyDifficultyList.xml and find the 'mandatory' enemy's difficulty rating.
                List<EnemyDifficultyData> enemyDifficultyList  = GameClass.ContentManager.Load<List<EnemyDifficultyData>>("BattleCharacters/EnemyDifficultyList");
                int currentEnemyDifficulty = -1;
                int spawnEnemy = 0;
                foreach (EnemyDifficultyData difficultyData in enemyDifficultyList)
                {
                    if (difficultyData.enemyID == GlobalGameInfo.CurrentEnemyInBattle.CharacterID)
                    {
                        currentEnemyDifficulty = difficultyData.difficultyLevel;
                    }
                }
                //Iterate through BattleCharacters/EnemyDifficultyList.xml and retrieve all enemies of a similar difficulty rating (i.e. within a range of -1 to 1 from it)
                List<CharacterIdentity> similarDifficultyEnemies = new List<CharacterIdentity>();
                foreach (EnemyDifficultyData difficultyData in enemyDifficultyList)
                {
                    if (Math.Abs(difficultyData.difficultyLevel - currentEnemyDifficulty) < 2)
                    {
                        similarDifficultyEnemies.Add(difficultyData.enemyID);
                    }
                }

                if (similarDifficultyEnemies.Count > 0)
                {//if there are more enemies of a similar difficulty....
                    for (int count = 0; count < 2; count++)
                    {//for the rest of the enemy slots (Battle Orders 4 and 5)....

                        //Decide randomly whether to spawn another enemy.
                        spawnEnemy = GameClass.Random.Next(0, 2);
                        if (spawnEnemy == 1)
                        {//if decided to spawn another enemy...
                            //Decide randomly which enemy to spawn, and load it in.
                            CharacterIdentity enemyToSpawn = similarDifficultyEnemies[GameClass.Random.Next(0, similarDifficultyEnemies.Count)];
                            EnemyBattleCharacter optionalEnemyCharacter = new EnemyBattleCharacter();
                            optionalEnemyCharacter.LoadContent(battleOrder, enemyToSpawn);
                            activeCharacters.Add(optionalEnemyCharacter);
                            enemyGroupLostTo.Add(enemyToSpawn);
                            battleOrder++;
                        }
                    }
                }
            }
            else if(retryingBattle == true)
            {//Otherwise if this battle is a retry, load the previous enemy group back in.
                foreach (CharacterIdentity enemyID in enemyGroupLostTo)
                {
                    EnemyBattleCharacter reloadedEnemyCharacter = new EnemyBattleCharacter();
                    reloadedEnemyCharacter.LoadContent(battleOrder, enemyID);
                    activeCharacters.Add(reloadedEnemyCharacter);
                    battleOrder++;
                }
                retryingBattle = false;
            }

            //Add all the loaded characters to the draw list.
            foreach (BattleCharacter character in activeCharacters)
            {
                drawList.Add(character);
            }

            //Initialise the turn chart and its indicator.
            turnChartSelectorFadeState = AlternatingFadeState.FadingOut;
            turnChartSelectionAlpha = 1.0f;
            currentTurnCount = 1;
            currentTurnIndex = 0;

            //Calculate the first turns order.
            CalculateTurnOrder();
        }