Exemplo n.º 1
0
        public void AddLongButton(Button button)
        {
            if (mButtonList.Count == 0)
            {
                button.ButtonRectangle = new Rectangle(mButtonGroupRectangle.X, mButtonGroupRectangle.Y,
                                                       (int)(mButtonGroupRectangle.Width / 1.5f),
                                                       (int)(mButtonGroupRectangle.Height / mMaxButtonsPerColumn));
                if (button.Sprite.SpriteSheet != null)
                {
                    button.SetSpritePosition();
                }
                mButtonList.Add(button);
                mCurrentButtonsInRow++;
                mTotalButtons++;
            }

            else if (mCurrentButtonsInRow < mMaxButtonsPerRow)
            {
                button.ButtonRectangle = new Rectangle(
                                        (int)(mButtonList[mTotalButtons - 1].Position.X + mButtonList[mCurrentButtonsInRow - 1].Width),
                                        (int)(mButtonList[mTotalButtons - 1].Position.Y),
                                        (int)mButtonList[mTotalButtons - 1].Width,
                                        (int)mButtonList[mTotalButtons - 1].Height);
                if (button.Sprite.SpriteSheet != null)
                {
                    button.SetSpritePosition();
                }
                mButtonList.Add(button);
                mCurrentButtonsInRow++;
                mTotalButtons++;
            }

               // We are moving to the next column.
            else if (mCurrentButtonsInColumn < mMaxButtonsPerColumn)
            {

                button.ButtonRectangle = new Rectangle(
                                        (int)(mButtonList[mCurrentButtonsInColumn].Position.X),
                                        (int)(mButtonList[mCurrentButtonsInColumn].Position.Y + mButtonList[mCurrentButtonsInColumn].Height),
                                        (int)mButtonList[0].Width,
                                        (int)mButtonList[0].Height);
                if (button.Sprite.SpriteSheet != null)
                {
                    button.SetSpritePosition();
                }
                mCurrentButtonsInRow = 1;
                mCurrentButtonsInColumn++;
                mTotalButtons++;
                mButtonList.Add(button);

            }
        }
        private static void InitializeButtons()
        {
            //Initialize Settings Button
            SettingsButton = new Button(Content,ButtonSettingsFunction,UnclickedSettingsPath,UnclickedSettingsPath);

            // Initialize Structure Buttons
            BlueStructureButton = new Button(Content, BlueStructureButtonFunction, BlueStructureButtonPath);
            BlueStructureButton.AddAnimation(new Animation("Sprites/UserInterface/Buttons/RuneButtons/RuneAnimationBlue", 18, 2, 18, 175));
            YellowStructureButton = new Button(Content, YellowStructureButtonFunction, YellowStructureButtonPath);
            YellowStructureButton.AddAnimation(new Animation("Sprites/UserInterface/Buttons/RuneButtons/RuneAnimationYeller", 18, 2, 18, 190));
            RedStructureButton = new Button(Content, RedStructureButtonFunction, RedStructureButtonPath);
            RedStructureButton.AddAnimation(new Animation("Sprites/UserInterface/Buttons/RuneButtons/RuneAnimationRed", 18, 2, 18, 200));
            PurpleStructureButton = new Button(Content, PurpleStructureButtonFunction, PurpleStructureButtonPath);
            PurpleStructureButton.AddAnimation(new Animation("Sprites/UserInterface/Buttons/RuneButtons/RuneAnimationPurple", 18, 2, 18, 160));
            GreenStructureButton = new Button(Content, GreenStructureButtonFunction, GreenStructureButtonPath);
            GreenStructureButton.AddAnimation(new Animation("Sprites/UserInterface/Buttons/RuneButtons/RuneAnimationGreen", 18, 2, 18, 155));

            // Initialize Blank Button.
            BlankButton0 = new Button(Content, BlankButtonFunction, UnclickedBlankButton1Path, ClickedBlankButton1Path);
            BlankButton1 = new Button(Content, BlankButtonFunction, UnclickedBlankButton2Path, ClickedBlankButton2Path);
            BlankButton2 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton3Path);
            BlankButton3 = new Button(Content, BlankButtonFunction, UnclickedBlankButton4Path, ClickedBlankButton4Path);
            BlankButton4 = new Button(Content, BlankButtonFunction, UnclickedBlankButton2Path, ClickedBlankButton2Path);
            BlankButton5 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton3Path);
            BlankButton6 = new Button(Content, BlankButtonFunction, UnclickedBlankButton1Path, ClickedBlankButton1Path);
            BlankButton7 = new Button(Content, BlankButtonFunction, UnclickedBlankButton1Path, ClickedBlankButton1Path);
            BlankButton8 = new Button(Content, BlankButtonFunction, UnclickedBlankButton2Path, ClickedBlankButton2Path);
            BlankButton9 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton3Path);
            BlankButton10 = new Button(Content, BlankButtonFunction, UnclickedBlankButton4Path, ClickedBlankButton4Path);
            BlankButton11 = new Button(Content, BlankButtonFunction, UnclickedBlankButton2Path, ClickedBlankButton2Path);
            BlankButton12 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton3Path);
            BlankButton13 = new Button(Content, BlankButtonFunction, UnclickedBlankButton1Path, ClickedBlankButton1Path);
            BlankButton14 = new Button(Content, BlankButtonFunction, UnclickedBlankButton1Path, ClickedBlankButton1Path);
            BlankButton15 = new Button(Content, BlankButtonFunction, UnclickedBlankButton4Path, ClickedBlankButton1Path);
            BlankButton16 = new Button(Content, BlankButtonFunction, UnclickedBlankButton2Path, ClickedBlankButton4Path);
            BlankButton17 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton2Path);
            BlankButton18 = new Button(Content, BlankButtonFunction, UnclickedBlankButton4Path, ClickedBlankButton1Path);
            BlankButton19 = new Button(Content, BlankButtonFunction, UnclickedBlankButton3Path, ClickedBlankButton1Path);

            // Initialize Main Menu Buttons.
            NewGameButton = new Button(Content, NewGame, UnclickedNewGameButtonPath, ClickedNewGameButtonPath);
            LoadGameButton = new Button(Content, LoadGame, UnClickedLoadGameButtonPath, ClickedLoadGameButtonPath);
            CreditButton = new Button(Content, RunCredits, UnclickedCreditButtonPath, ClickedCreditButtonPath);
            QuitGameButton = new Button(Content, QuitGame, UnclickedQuitButtonPath, ClickedQuitButtonPath);
            TutorialButton = new Button(Content, RunTutorial, UnclickedTutorialButtonPath, ClickedTutorialButtonPath);

            // Initialize Hero Action Buttons.

            BuildButton = new Button(Content, BuildButtonFunction, UnclickedBuildButtonPath, ClickedBuildButtonPath, null, Keys.B);
            SpellsButton = new Button(Content, SpellButtonFunction, UnclickedSpellsButtonPath, ClickedSpellsButtonPath, null, Keys.S);
            RallyButton = new Button(Content, RallyButtonFunction, UnclickedRallyButtonPath, ClickedRallyButtonPath, null, Keys.R);
            PurchaseStructureButton = new Button(Content, PurchaseStructureButtonFunction, UnclickedBuyStructureButtonPath, ClickedBuyStructureButtonPath, null, Keys.U);

            // Initialize Build Buttons.
            BuildDragonButton = new Button(Content, BuildDragonButtonFunction, UnclickedBuildDragonCaveButtonPath, ClickedBuildDragonCaveButtonPath, DisabledBuildDragonCaveButtonPath, Keys.D);
            BuildWolfButton = new Button(Content, BuildWolfButtonFunction, UnclickedBuildWolfPenButtonPath, ClickedBuildWolfPenButtonPath, DisabledBuildWolfPenButtonPath, Keys.W);
            BuildBerzerkerButton = new Button(Content, BuildBerzerkerButtonFunction, UnclickedBuildBarracksButtonPath, ClickedBuildBarracksButtonPath, DisabledBuildBarracksButtonPath, Keys.B);
            BuildAxeThrowerButton = new Button(Content, BuildAxeThrowerButtonFunction, UnclickedBuildArmoryButtonPath, ClickedBuildArmoryButtonPath, DisabledBuildArmoryButtonPath, Keys.A);
            BuildArcaneMageButton = new Button(Content, BuildArcaneMageButtonFunction, UnclickedBuildLibraryButtonPath, ClickedBuildLibraryButtonPath, DisabledBuildFireTempleButtonPath, Keys.R);
            BuildFireMageButton = new Button(Content, BuildFireMageButtonFunction, UnclickedBuildFireTempleButtonPath, ClickedBuildFireTempleButtonPath, DisabledBuildFireTempleButtonPath, Keys.F);
            BuildClericButton = new Button(Content, BuildClericButtonFunction, UnclickedAbbeyButtonPath, ClickedBuildAbbeyButtonPath, DisabledBuildAbbeyButtonPath, Keys.C);
            BuildNecromanceButton = new Button(Content, BuildNecromancerButtonFunction, UnclickedBuildBonePitButtonPath, ClickedBuildBonePitButtonPath, DisabledBuildBonePitnButtonPath, Keys.E);

            // Initialize Utility Buttons.
            BackButton = new Button(Content, BackButtonFunction, UnclickedBackButtonPath, ClickedBackButtonPath, null, Keys.Escape);
            NextButton = new Button(Content, NextButtonFunction, UnclickedNextButtonPath, ClickedNextButtonPath, null, Keys.N);

            // Initialize Rally Buttons.
            RallyRedButton = new Button(Content, RedRallyButtonFunction, UnclickedRedRallyButtonPath, ClickedRedRallyButtonPath, null, Keys.R);
            RallyBlueButton = new Button(Content, BlueRallyButtonFunction, UnclickedBlueRallyButtonPath, ClickedBlueRallyButtonPath, null, Keys.B);
            RallyGreenButton = new Button(Content, GreenRallyButtonFunction, UnclickedGreenRallyButtonPath, ClickedGreenRallyButtonPath, null, Keys.G);
            RallyYellowButton = new Button(Content, YellowRallyButtonFunction, UnclickedYellowRallyButtonPath, ClickedYellowRallyButtonPath, null, Keys.Y);
            RallyPurpleButton = new Button(Content, PurpleRallyButtonFunction, UnclickedPurpleRallyButtonPath, ClickedPurpleRallyButtonPath, null, Keys.P);

            // Initialize Purchase Buttons.
            PurchaseDragonCaveButton = new Button(Content, BuyDragonCaveButtonFunction, UnclickedPurchaseDragonCaveButtonPath, ClickedPurchaseDragonCaveButtonPath, DisabledPurchaseDragonCaveButtonPath, Keys.D);
            PurchaseFireTempleButton = new Button(Content, BuyFireTempleButtonFunction, UnclickedPurchaseFireTempleButtonPath, ClickedPurchaseFireTempleButtonPath, DisabledPurchaseFireTempleButtonPath, Keys.F);
            PurchaseLibraryButton = new Button(Content, BuyLibraryButtonFunction, UnclickedPurchaseLibraryButtonPath, ClickedPurchaseLibraryButtonPath, DisabledPurchaseLibraryButtonPath, Keys.R);
            PurchaseBonePitButton = new Button(Content, BuyBonePitButtonFunction, UnclickedPurchaseBonePitButtonPath, ClickedPurchaseBonePitButtonPath, DisabledPurchaseBonePitnButtonPath, Keys.E);
            PurchaseWolfpenButton = new Button(Content, BuyWolfPenButtonFunction, UnclickedPurchaseWolfPenButtonPath, ClickedPurchaseWolfPenButtonPath, DisabledPurchaseWolfPenButtonPath, Keys.W);
            PurchaseAbbeyButton = new Button(Content, BuyAbbeyButtonFunction, UnclickedPurchaseAbbeyButtonPath, ClickedPurchaseAbbeyButtonPath, DisabledPurchaseAbbeyButtonPath, Keys.C);
            PurchaseArmoryButton = new Button(Content, BuyAmroryButtonFunction, UnclickedPurchaseArmoryButtonPath, ClickedPurchaseArmoryButtonPath, DisabledPurchaseArmoryButtonPath, Keys.A);
            PurchaseBarracksButton = new Button(Content, BuyBarracksButtonFunction, UnclickedPurchaseBarracksButtonPath, ClickedPurchaseBarracksButtonPath, DisabledPurchaseBarracksButtonPath, Keys.B);

            // Upgrade Buttons
            UpgradeAttackStructurePosition1 = new Button(Content, UpgradeAttackButtonFunction1, UnclickedUpgradeAttackButton, ClickedUpgradeAttackButton, DisabledUpgradeAttackButton, Keys.A);
            UpgradeAttackStructurePosition2 = new Button(Content, UpgradeAttackButtonFunction2, UnclickedUpgradeAttackButton, ClickedUpgradeAttackButton, DisabledUpgradeAttackButton, Keys.A);
            UpgradeAttackStructurePosition3 = new Button(Content, UpgradeAttackButtonFunction3, UnclickedUpgradeAttackButton, ClickedUpgradeAttackButton, DisabledUpgradeAttackButton, Keys.A);
            UpgradeAttackStructurePosition4 = new Button(Content, UpgradeAttackButtonFunction4, UnclickedUpgradeAttackButton, ClickedUpgradeAttackButton, DisabledUpgradeAttackButton, Keys.A);
            UpgradeAttackStructurePosition5 = new Button(Content, UpgradeAttackButtonFunction5, UnclickedUpgradeAttackButton, ClickedUpgradeAttackButton, DisabledUpgradeAttackButton, Keys.A);
            UpgradeDefenseStructurePosition1 = new Button(Content, UpgradeDefenseButtonFunction1, UnclickedUpgradeDefenseButton, ClickedUpgradeDefenseButton, DisabledUpgradeDefenseButton, Keys.D);
            UpgradeDefenseStructurePosition2 = new Button(Content, UpgradeDefenseButtonFunction2, UnclickedUpgradeDefenseButton, ClickedUpgradeDefenseButton, DisabledUpgradeDefenseButton, Keys.D);
            UpgradeDefenseStructurePosition3 = new Button(Content, UpgradeDefenseButtonFunction3, UnclickedUpgradeDefenseButton, ClickedUpgradeDefenseButton, DisabledUpgradeDefenseButton, Keys.D);
            UpgradeDefenseStructurePosition4 = new Button(Content, UpgradeDefenseButtonFunction4, UnclickedUpgradeDefenseButton, ClickedUpgradeDefenseButton, DisabledUpgradeDefenseButton, Keys.D);
            UpgradeDefenseStructurePosition5 = new Button(Content, UpgradeDefenseButtonFunction5, UnclickedUpgradeDefenseButton, ClickedUpgradeDefenseButton, DisabledUpgradeDefenseButton, Keys.D);

            // Spell Buttons
            CurseButton = new Button(Content, CurseButtonFunction, UnclickedCurseButtonPath, ClickedCurseButtonPath, DisabledCurseButtonPath, Keys.D);
            BlessingButton = new Button(Content, BlessingButtonFunction, UnclickedBlessingButtonPath, ClickedBlessingButtonPath, DisabledBlessingButtonPath, Keys.I);

            // Tutorial Buttons
            LeftArrowButton = new Button(Content, LeftArrowButtonFunction, ClickedLeftArrowButtonPath, ClickedLeftArrowButtonPath, null, Keys.Left);
            RightArrowButton = new Button(Content, RightArrowButtonFunction, ClickedRightArrowButtonPath, ClickedRightArrowButtonPath, null, Keys.Right);
            QuitButton = new Button(Content, QuitGame, UnclickedQuitButtonPath1, ClickedQuitButtonPath1 );
            SaveButton = new Button(Content, SaveButtonFunciton, UnclickedSaveButtonPath, ClickedSaveButtonPath);
        }