Exemplo n.º 1
0
        public inGameMenu(int w, int h, ContentManager content,
                            GraphicsDeviceManager _graphics)
            : base(0,0,w,h)
        {
            instance = this;
            this.visible = false;
             //assign variables from the economics class
            chickenCost = gameWorld.instance.player.chickenCost;
            chickenSell = gameWorld.instance.player.chickenSell;
            roosterCost = gameWorld.instance.player.roosterCost;
            roosterSell = gameWorld.instance.player.roosterSell;
            eggSell = gameWorld.instance.player.eggSell;
            eggSellEnd = gameWorld.instance.player.eggSellEnd;
            UI.ImageLabel menuBackground = new UI.ImageLabel((w/4), 80,
                            content.Load<Texture2D>("menuImages/chickenCoopMenuPoster"));
            menuBackground.resize(rect.Width/2, rect.Height-200);
            addComponent(menuBackground);//add a background image for the menu system

            UI.ImageLabel inGameMenu = new UI.ImageLabel((w/4)+100, 130,
                                content.Load<Texture2D>("menuImages/tutorialtipbox"));
            inGameMenu.resize(menuBackground.getWidth()-200,menuBackground.getHeight()-100);
            addComponent(inGameMenu);//add a panel to the image for button placement

            leftColumnMargin = inGameMenu.getPos().X +(buttonHeight/2);
            //rightColumnMargin = (inGameMenu.getPos().X + buttonHorizontalSpacing;
            middleColumnMargin = (inGameMenu.getPos().X + (inGameMenu.getWidth() / 2));
            //world = new gameWorld(w, h, content,_graphics,gameTime);
            //addComponent(world);
             //add the gameworld object to the display list

             //add interactive buttons to the game screen
             //purchase/buy on the Left, Sell on the right. Play at the top. Save/Start/Quit on the bottom row

            UI.PushButton returnToPlayButton = new UI.PushButton(middleColumnMargin-
                            (buttonWidth/2), 115,
                            content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                            content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                                                 "");
            returnToPlayButton.resize(buttonWidth, buttonHeight);
            addComponent(returnToPlayButton);
            returnToPlayButton.setClickEventHandler(returnToPlayClicked);

             //local variable to set button positions
            Point location_L = returnToPlayButton.getPos(); //keeps track of spacing on the Left side of the menu
             Point location_R = returnToPlayButton.getPos();//keeps track of spacing on the Right side of the menu

             //load the text onto the button so the size is appropriate for the button
             UI.TextLabel playText = new UI.TextLabel(location_L.X, location_L.Y,
                                returnToPlayButton.getWidth(),
                                returnToPlayButton.getHeight(), "Resume Game", 0.3f, Color.White);
             addComponent(playText);

             //a button to hide the menu system when X is clicked
             UI.PushButton hideMenuButton = new UI.PushButton((inGameMenu.getPos().X +
                                inGameMenu.getWidth()) - (buttonHeight), inGameMenu.getPos().Y
                                - (buttonHeight / 2),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
             hideMenuButton.resize(buttonHeight,buttonHeight);
             //addComponent(hideMenuButton);
             hideMenuButton.setClickEventHandler(hideMenuClicked);
             location_R = hideMenuButton.getPos();
             UI.TextLabel hideMenuText = new UI.TextLabel(location_R.X, location_R.Y,
                                hideMenuButton.getWidth(), hideMenuButton.getHeight(),
                                "X", 0.3f, Color.White);
            // addComponent(hideMenuText); remove this button

             //v2.0 speckled rooster addition
            //UI.PushButton buySpeckledRoosterButton = new UI.PushButton(menuBackground.getWidth()
            //              / 2 - (buttonHorizontalSpacing), menuBackground.getHeight() + (panelGap * 2),
            //              content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
            //              content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
            //              "Buy Rooster");
            //buySpeckledRoosterButton.resize(buttonWidth, buttonHeight);
            //addComponent(buySpeckledRoosterButton);
            //buySpeckledRoosterButton.setClickEventHandler(buySpeckledRoosterClicked);
             UI.PushButton eatEggButton = new UI.PushButton(leftColumnMargin,
                                (location_R.Y + buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
             eatEggButton.resize(buttonWidth, buttonHeight);
             addComponent(eatEggButton);
             eatEggButton.setClickEventHandler(eatEggClicked);

             //local variable to set button positions
             location_L = eatEggButton.getPos(); //keeps track of spacing on the Left side of the menu

             //load the text onto the button so the size is appropriate for the button
             UI.TextLabel eatEggText = new UI.TextLabel(location_L.X, location_L.Y,
                            eatEggButton.getWidth(),
                            eatEggButton.getHeight(), "Eat Egg", 0.3f, Color.White);
             addComponent(eatEggText);

            UI.PushButton sellEggsButton = new UI.PushButton(middleColumnMargin,
                            (location_R.Y+buttonVerticalSpacing) ,
                             content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                             content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                             "");
            sellEggsButton.resize(buttonWidth, buttonHeight);
            addComponent(sellEggsButton);
            sellEggsButton.setClickEventHandler(sellEggClicked);
            location_R = sellEggsButton.getPos();
            sellEggsText = new UI.TextLabel(location_R.X, location_R.Y, sellEggsButton.getWidth(),
                             sellEggsButton.getHeight(), "Sell Eggs $" + Convert.ToString(eggSell),
                             0.3f, Color.White);
            addComponent(sellEggsText);

            UI.PushButton buyChickenButton = new UI.PushButton(leftColumnMargin,
                            (location_R.Y + buttonVerticalSpacing),
                             content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                             content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                             "");
            buyChickenButton.resize(buttonWidth, buttonHeight);
            addComponent(buyChickenButton);
            buyChickenButton.setClickEventHandler(buyChickenClicked);

            location_L = buyChickenButton.getPos();

            UI.TextLabel buyChickenText = new UI.TextLabel(location_L.X, location_L.Y,
                             buyChickenButton.getWidth(),
                             buyChickenButton.getHeight(), "Buy Chicken $" +
                             Convert.ToString(chickenCost), 0.3f, Color.White);
            addComponent(buyChickenText);
            //v2.0 variety chicken colors for purchase
            //UI.PushButton buyRedChickenButton = new UI.PushButton(menuBackground.getWidth()
            //               / 2 - (buttonHorizontalSpacing), menuBackground.getHeight() + (panelGap * 2),
            //               content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
            //               content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
            //               "Buy Chicken");
            //buyRedChickenButton.resize(buttonWidth, buttonHeight);
            //addComponent(buyRedChickenButton);
            //buyRedChickenButton.setClickEventHandler(buyRedChickenClicked);

            //UI.PushButton buyGoldChickenButton = new UI.PushButton(menuBackground.getWidth()
            //               / 2 - (buttonHorizontalSpacing), menuBackground.getHeight() + (panelGap * 2),
            //               content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
            //               content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
            //               "Buy Chicken");
            //buyGoldChickenButton.resize(buttonWidth, buttonHeight);
            //addComponent(buyGoldChickenButton);
            //buyChickenButton.setClickEventHandler(buyGoldChickenClicked);

            UI.PushButton buyRoosterButton = new UI.PushButton(leftColumnMargin,
                                (location_L.Y + buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            buyRoosterButton.resize(buttonWidth, buttonHeight);
            addComponent(buyRoosterButton);
            buyRoosterButton.setClickEventHandler(buyRoosterClicked);

            location_L = buyRoosterButton.getPos();
            UI.TextLabel buyRoosterText = new UI.TextLabel(location_L.X, location_L.Y,
                                buyRoosterButton.getWidth(),
                                buyRoosterButton.getHeight(), "Buy Rooster $" +
                                Convert.ToString(roosterCost), 0.3f, Color.White);
            addComponent(buyRoosterText);

            UI.PushButton sellChickenButton = new UI.PushButton(middleColumnMargin,
                                (location_R.Y+buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            sellChickenButton.resize(buttonWidth, buttonHeight);
            addComponent(sellChickenButton);
            sellChickenButton.setClickEventHandler(sellChickenClicked);
            location_R = sellChickenButton.getPos();
            UI.TextLabel sellChickenText = new UI.TextLabel(location_R.X, location_R.Y,
                                sellChickenButton.getWidth(),
                                sellChickenButton.getHeight(), "Sell Chicken $" +
                                Convert.ToString(chickenSell), 0.3f, Color.White);
            addComponent(sellChickenText);

            UI.PushButton sellRoosterButton = new UI.PushButton(middleColumnMargin,
                                (location_R.Y+buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            sellRoosterButton.resize(buttonWidth, buttonHeight);
            addComponent(sellRoosterButton);
            sellRoosterButton.setClickEventHandler(sellRoosterClicked);
            location_R = sellRoosterButton.getPos();
            UI.TextLabel sellRoosterText = new UI.TextLabel(location_R.X, location_R.Y,
                                sellRoosterButton.getWidth(),
                                sellRoosterButton.getHeight(), "Sell Rooster $" +
                                Convert.ToString(roosterSell), 0.3f, Color.White);
            addComponent(sellRoosterText);

            UI.PushButton saveGameButton = new UI.PushButton(leftColumnMargin,
                                (location_R.Y+buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            saveGameButton.resize(buttonWidth, buttonHeight);
            //addComponent(saveGameButton);
            saveGameButton.setClickEventHandler(saveClicked);
            location_R = saveGameButton.getPos();
            UI.TextLabel saveGameText = new UI.TextLabel(location_R.X, location_R.Y,
                                saveGameButton.getWidth(),
                                saveGameButton.getHeight(), "Save Game", 0.3f, Color.White);
            //addComponent(saveGameText);

            UI.PushButton returnToStartButton = new UI.PushButton(middleColumnMargin, location_R.Y,
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            returnToStartButton.resize(buttonWidth, buttonHeight);
            //addComponent(returnToStartButton);
            returnToStartButton.setClickEventHandler(returnToStartClicked);

            location_R = returnToStartButton.getPos();

            UI.TextLabel returnToStartText = new UI.TextLabel(location_R.X, location_R.Y,
                                returnToStartButton.getWidth(),
                                returnToStartButton.getHeight(), "Return To Start", 0.3f,
                                Color.White);
               // addComponent(returnToStartText);

            UI.PushButton quitGameButton = new UI.PushButton(middleColumnMargin -
                                (buttonWidth / 2), (location_R.Y+buttonVerticalSpacing),
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            quitGameButton.resize(buttonWidth, buttonHeight);
            addComponent(quitGameButton);
            quitGameButton.setClickEventHandler(quitClicked);
            location_R = quitGameButton.getPos();
            UI.TextLabel quitGameText = new UI.TextLabel(location_R.X, location_R.Y,
                                quitGameButton.getWidth(),
                                quitGameButton.getHeight(), "Save / Quit Game", 0.3f,
                                Color.White);
            addComponent(quitGameText);
            //statPanel = new StatsPanel(w - panelWidth - panelGap, h - panelHeight - panelGap, content);
            //addComponent(statPanel);
            pausedText = new UI.TextLabel(menuBackground.getPos().X+
                                (menuBackground.getWidth()/2)-150, menuBackground.getPos().Y - 100,
                                menuBackground.getWidth() / 2, 100, "***Game Paused***", Color.Red);
            addComponent(pausedText);
        }
Exemplo n.º 2
0
        private int totalMoney; //total money after selling eggs

        #endregion Fields

        #region Constructors

        //button for interface, causes the in-game menu to display
        // private UI.PushButton menuButton;
        //button to hide this interface will be in the game-world. showInterface/hideInterface
        //this will allow players to remove the interface if it is in their view of eggs
        public gameInterface(int w, int h, ContentManager content,
                            GraphicsDeviceManager _graphics)
            : base(0,0,w,h)
        {
            instance = this;
            //updateStats();

            characterPicture = content.Load<Texture2D>("menuImages/farmerBoyImage");

             //add an additional panel to the gameInterface that holds the in-game Menu features
            menuPanel = new inGameMenu(w , h , content,_graphics);
            addComponent(menuPanel);

            //add an additional panel that displays the end of day summary
            summaryPanel = new EndDaySummary(w, h, content, _graphics);
            addComponent(summaryPanel);

            //winlossPanel = new VictoryLossScreen(w, h, content);
            //addComponent(winlossPanel);

            //initialize default summary page to timed goal intro
            //summaryPanel.setSummaryState(EndDaySummary.SummaryState.timedGoal);

            //add an additional panel that displays tutorial tips

             //add an additional panel to the gameInterface that displays a sun
                            //graphic to show time/day passing
            sunPanel = new sunPanel(w, h, content, _graphics);
            addComponent(sunPanel);

             //add the panels for the screen interfaces
            UI.ImageLabel gameInterfaceBackground = new UI.ImageLabel
                                (0, _graphics.PreferredBackBufferHeight-panelHeight,
                                content.Load<Texture2D>("menuImages/gameInterfacePanel"));
            gameInterfaceBackground.resize(_graphics.PreferredBackBufferWidth, panelHeight);
            addComponent(gameInterfaceBackground);//dark panel

             //variables to set alignment positions for panel components
            verticalSpacing = gameInterfaceBackground.getPos().Y+70;
            leftColumnMargin = gameInterfaceBackground.getPos().X;
            middleLeftColumnMargin = gameInterfaceBackground.getPos().X +
                                ((gameInterfaceBackground.getWidth()/2) -350);
            middleRightColumnMargin = gameInterfaceBackground.getPos().X +
                                ((gameInterfaceBackground.getWidth()/2) -50);
            rightColumnMargin = gameInterfaceBackground.getPos().X + (gameInterfaceBackground.getWidth());
            textLabelWidth = 150;

             //image Labels for the interface Panel, will each have an associated txt label to display values
            characterImage = new UI.ImageLabel(leftColumnMargin + 10, verticalSpacing -30,
                                characterPicture);
            characterImage.resize(50,50);
            addComponent(characterImage);

            Point location = characterImage.getPos(); //keeps track of where to set the text Label

             isEquippedText = new UI.TextLabel(location.X + characterImage.getWidth(), location.Y+30,
                                textLabelWidth, characterImage.getHeight(), "", 0.3f, Color.Yellow);
            addComponent(isEquippedText);
            //load the text next to the appropriate image
            characterHealthText = new UI.TextLabel(location.X + characterImage.getWidth(),
                                location.Y, textLabelWidth, characterImage.getHeight(),
                                "Health "+Convert.ToString(hitPoints)+" / " +
                                Convert.ToString(gameWorld.instance.myCharacter.maxHP),
                                0.3f, Color.White);
            addComponent(characterHealthText);

            UI.ImageLabel chickenImage = new UI.ImageLabel(middleLeftColumnMargin,
                                verticalSpacing, content.Load<Texture2D>("menuImages/chickenImage"));
            chickenImage.resize(40,40);
            addComponent(chickenImage);

            location = chickenImage.getPos();

            chickenNumberText = new UI.TextLabel(location.X + characterImage.getWidth(),
                                location.Y, textLabelWidth, chickenImage.getHeight(),
                                "Chickens " + Convert.ToString(chickenNumber) + " / " +
                                Convert.ToString(gameWorld.instance.maxChicken),
                                0.3f, Color.White);
            addComponent(chickenNumberText);

            UI.ImageLabel roosterImage = new UI.ImageLabel(middleLeftColumnMargin,
                                verticalSpacing - 50, content.Load<Texture2D>
                                ("menuImages/RoosterImage"));
            roosterImage.resize(40,40);
            addComponent(roosterImage);

            location = roosterImage.getPos();

            roosterNumberText = new UI.TextLabel(location.X + characterImage.getWidth(),
                                location.Y, textLabelWidth, chickenImage.getHeight(),
                                "Roosters " + Convert.ToString(roosterNumber) + " / " +
                                Convert.ToString(gameWorld.instance.maxRooster),
                                0.3f, Color.White);
            addComponent(roosterNumberText);

            UI.ImageLabel eggImage = new UI.ImageLabel(middleRightColumnMargin,
                                verticalSpacing -50, content.Load<Texture2D>
                                ("menuImages/eggImage"));
            eggImage.resize(30,30);
            addComponent(eggImage);

            location = eggImage.getPos();

            eggNumberText = new UI.TextLabel(location.X + characterImage.getWidth(),
                                location.Y, textLabelWidth, chickenImage.getHeight(),
                                "Eggs " + Convert.ToString(eggNumber) + " / Broken " +
                                Convert.ToString(brokenEggNumber), 0.3f, Color.White);
            addComponent(eggNumberText);

            UI.ImageLabel moneyImage = new UI.ImageLabel(middleRightColumnMargin,
                                verticalSpacing, content.Load<Texture2D>
                                ("menuImages/dollarSignImage"));
            moneyImage.resize(40,40);
            addComponent(moneyImage);

            location = moneyImage.getPos();

            moneyText = new UI.TextLabel(location.X + characterImage.getWidth(),
                                location.Y, textLabelWidth, chickenImage.getHeight(),
                                "  $ " + Convert.ToString(totalMoney) + " / Upkeep " +
                                Convert.ToString(farmUpkeep), 0.3f, Color.White);
            addComponent(moneyText);

            UI.ImageLabel sunImage = new UI.ImageLabel(rightColumnMargin - 400,
                                verticalSpacing - 50, content.Load<Texture2D>
                                ("menuImages/sunIcon"));
            sunImage.resize(40, 40);
            addComponent(sunImage);
            location = sunImage.getPos();

            sunText = new UI.TextLabel(location.X + characterImage.getWidth(), location.Y,
                                textLabelWidth, chickenImage.getHeight(), "Day light " +
                                Convert.ToString(daytimePast) + " / " + Convert.ToString
                                (gameWorld.instance.endDay), 0.3f, Color.White);
            addComponent(sunText);

            UI.ImageLabel goalImage = new UI.ImageLabel(rightColumnMargin -400, verticalSpacing,
                                content.Load<Texture2D>("menuImages/goalImage"));
            goalImage.resize(40, 40);
            addComponent(goalImage);

            location = goalImage.getPos();

            goalText = new UI.TextLabel(location.X + characterImage.getWidth(), location.Y,
                                textLabelWidth, chickenImage.getHeight(), "Goal Timer " +
                                Convert.ToString(goalAchievedT) + " / " + Convert.ToString
                                (gameWorld.instance.winLoss.timeWin), 0.3f, Color.White);
            addComponent(goalText);

            //add interactive buttons to the game screen
            UI.PushButton inGameMenuButton = new UI.PushButton(rightColumnMargin -
                                (buttonWidth)-20, verticalSpacing -
                                gameInterfaceBackground.getHeight()/2,
                                content.Load<Texture2D>("MenuImages/blankbuttonGlow"),
                                content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"),
                                "");
            inGameMenuButton.resize(buttonWidth, buttonHeight);
            addComponent(inGameMenuButton);
            inGameMenuButton.setClickEventHandler(inGameMenuClicked);

             //local variable to set button positions
            Point location_L = inGameMenuButton.getPos(); //keeps track of spacing on the Left side of the menu
            Point location_R = inGameMenuButton.getPos();//keeps track of spacing on the Right side of the menu

             //load the text onto the button so the size is appropriate for the button
             //activate this menu with M or assigned xbox control
            UI.TextLabel inGameMenuText = new UI.TextLabel(location_L.X - 10, location_L.Y,
                                inGameMenuButton.getWidth(), inGameMenuButton.getHeight(),
                                "  Menu<M>", 0.3f, Color.White);
             addComponent(inGameMenuText);

             foxWarning = new UI.ImageLabel(_graphics.PreferredBackBufferWidth/2-50, _graphics.PreferredBackBufferHeight/10
                                            , content.Load<Texture2D>("menuImages/foxWarning"));
             foxWarning.resize(100, 100);
             addComponent(foxWarning);
             foxWarning.visible = false;
        }
Exemplo n.º 3
0
        public tutorialScreen(int w, int h, ContentManager content,
                            GraphicsDeviceManager _graphics)
            : base(0,0,w,h)
        {
            instance = this;
            graphicsH = _graphics.PreferredBackBufferHeight;
            graphicsW = _graphics.PreferredBackBufferWidth;
            //add the panels for the screen interfaces
            UI.ImageLabel tutorialBackground = new UI.ImageLabel
                                (0, _graphics.PreferredBackBufferHeight - panelHeight,
                                content.Load<Texture2D>("menuImages/gameInterfacePanel"));
            tutorialBackground.resize(_graphics.PreferredBackBufferWidth, panelHeight);
            addComponent(tutorialBackground);//panel across the bottom that says tutorial

             Point location = tutorialBackground.getPos();

             UI.ImageLabel tutorialTitle = new UI.ImageLabel(location.X, location.Y, content.Load<Texture2D>("menuImages/tutorialLeveltext"));
             addComponent(tutorialTitle);

             //tutorial header
             tutorialBoxHeader = new UI.ImageLabel((_graphics.PreferredBackBufferWidth / 4)+20, 20, content.Load<Texture2D>("menuImages/tutorialtipbox"));
             //tutorialBoxBackground.resize(panelWidth / 4, panelWidth / 3);
             tutorialBoxHeader.resize(panelWidth / 4, panelWidth / 15);
             addComponent(tutorialBoxHeader);

             location = tutorialBoxHeader.getPos();

             tutorialHeaderText = new UI.TextLabel(location.X, location.Y, tutorialBoxHeader.getWidth(), tutorialBoxHeader.getHeight(),tutorialHeader, Color.White);
             tutorialHeaderText.changeFontScale(0.3f);
             addComponent(tutorialHeaderText);

             //UI.TextLabel tutorialTitle = new UI.TextLabel(location.X, location.Y+20, 1280, 20, "Tutorial Level", Color.White);
             //tutorialTitle.changeFontScale(1);
             //addComponent(tutorialTitle);
             tutorialBoxBackground = new UI.ImageLabel(20, 20,content.Load<Texture2D>("menuImages/tutorialtipbox"));
             //tutorialBoxBackground.resize(panelWidth / 4, panelWidth / 3);
             tutorialBoxBackground.resize(panelWidth / 4, panelWidth / 8);
             addComponent(tutorialBoxBackground);

             location = tutorialBoxBackground.getPos();

            tutorialText = new UI.TextLabel(location.X,location.Y,tutorialBoxBackground.getWidth(), tutorialBoxBackground.getHeight(),tutorialInfo, Color.White);
            tutorialText.changeFontScale(0.3f);
             addComponent(tutorialText);

             menuPanelTutorial = new inGameMenu(w, h, content, _graphics);
             addComponent(menuPanelTutorial);
        }