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; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> /// //test the scene Model //Model myScene; ////the aspect ratio determines how to scale 3d to 3d projection //float aspectRatio; protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // load your game content //myScene = Content.Load<Model>("Models\\chickenScene"); //aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio; new AudioManager(Content); UI.Component.font = Content.Load<SpriteFont>("UIFont"); UI.PushButton.disabledTexture = Content.Load<Texture2D>("MenuImages/darkMenuPaneltrans50"); //load the menu screens startScreen = new GameUI.startMenuScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); gameInterfaceScreen = new GameUI.gameInterface(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content, graphics); helpScreen = new GameUI.helpScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); optionsScreen = new GameUI.optionsMenuScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); creditsScreen = new GameUI.creditsScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); newGameScreen = new GameUI.NewGameMenu(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); splashScreen = new GameUI.splashScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); winlossScreen = new GameUI.VictoryLossScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content); tutorialScreen = new GameUI.tutorialScreen(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, Content, graphics); mouseCursor = new UI.MouseCursor(0, 0, Content.Load<Texture2D>("MenuImages/triangleIcon")); mouseCursor.resize(40, 40); startScreen.addComponent(mouseCursor); helpScreen.addComponent(mouseCursor); optionsScreen.addComponent(mouseCursor); creditsScreen.addComponent(mouseCursor); newGameScreen.addComponent(mouseCursor); winlossScreen.addComponent(mouseCursor); gameInterfaceScreen.addComponent(mouseCursor); GameUI.tutorialScreen.instance.menuPanelTutorial.addComponent(mouseCursor); setGameState(GameState.splash); Chicken.AudioManager.instance.roosterSpawnSound.Play(0.3f,0f,0f); }