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; }
//private string summaryInfoTwo = "Amount"; public EndDaySummary(int w, int h, ContentManager content, GraphicsDeviceManager _graphics) : base(0, 0, w, h) { instance = this; this.visible = false; //assign variables from the economics class 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 + 80; rightColumnMargin = inGameMenu.getPos().X + (inGameMenu.getWidth())-(buttonHorizontalSpacing*2); 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 summaryTitle = new UI.TextLabel(middleColumnMargin, (location_R.Y + 55), 10, 10, summaryHeader, 0.35f, Color.White); addComponent(summaryTitle); summaryTextItem = new UI.TextLabel(leftColumnMargin+50, (location_R.Y + buttonVerticalSpacing), 100, 300, summaryInfoOne, 0.3f, Color.White); addComponent(summaryTextItem); //creates a seperate column for entering summary information //summaryTextAmount = new UI.TextLabel(rightColumnMargin, (location_R.Y + buttonVerticalSpacing), //10, 10, summaryInfoTwo, 0.3f, Color.White); //addComponent(summaryTextAmount); UI.PushButton menuButton = new UI.PushButton(location_L.X, (location_L.Y + buttonVerticalSpacing*5), content.Load<Texture2D>("MenuImages/blankbuttonGlow"), content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"), ""); menuButton.resize(buttonWidth, buttonHeight); addComponent(menuButton); menuButton.setClickEventHandler(menuClicked); location_R = menuButton.getPos(); UI.TextLabel menuText = new UI.TextLabel(location_R.X, location_R.Y, menuButton.getWidth(), menuButton.getHeight(), "Resource Menu", 0.3f, Color.White); addComponent(menuText); 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); setSummaryState(SummaryState.timedGoal);//default start summary is timed goal intro updateSummary(); //---------------------DebugButton------------------------------------ //UI.PushButton debugButton = new UI.PushButton(location_R.X-450, (location_L.Y + buttonVerticalSpacing*3), // content.Load<Texture2D>("MenuImages/blankbuttonGlow"), // content.Load<Texture2D>("MenuImages/blankbuttonDarkGlow"), // "Debug"); //addComponent(debugButton); //debugButton.setClickEventHandler(debugClicked); //---------------------DebugButton------------------------------------ }