/// <summary> /// Construct new menu that is only a TextField /// </summary> /// <param name="t">Title of menu</param> /// <param name="g">The game that this menu is associated with</param> public Menu(TextField t, Game g) : base(g) { menuButtons = new List<MenuButton>(); bodyText = new List<TextField>(); textures = new List<Texture2D>(); title = t; g.IsMouseVisible = true; }
/// <summary> /// Construct new menu /// </summary> /// <param name="t">Title of menu</param> /// <param name="t2D">Textures to be drawn on screen</param> /// <param name="body">List containing body text fields</param> /// <param name="button">List containing buttons for menu</param> /// <param name="g">The game this menu is associated with</param> public Menu(TextField t, List <Texture2D> t2D, List<TextField> body, List<MenuButton> button, Game g) : this(t, t2D, body, g) { menuButtons = button; }
/// <summary> /// Construct new menu without any buttons or extra textures /// </summary> /// <param name="t">Title of menu</param> /// <param name="t2D">Textures to be drawn on screen</param> /// <param name="body">List of text fields for the body text</param> /// <param name="g">The game this menu is associated with</param> public Menu(TextField t, List<Texture2D> t2D, List<TextField> body, Game g) : this(t,t2D,g) { menuButtons = new List<MenuButton>(); bodyText = body; }
/// <summary> /// Construct new menu that is a title and series of textures. Extra textures are not buttons and will not check for user input /// </summary> /// <param name="t">Title of menu</param> /// <param name="t2D">List of textures to be drawn</param> /// <param name="g">Game that this menu is associated with</param> public Menu(TextField t, List<Texture2D> t2D, Game g) : this(t, g) { textures = t2D; }
public virtual void AddMenuText(TextField t) { bodyText.Add(t); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { graphics.PreferredBackBufferHeight = (graphics.GraphicsDevice.DisplayMode.Height - (graphics.GraphicsDevice.DisplayMode.Height / 9)); graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width - (graphics.GraphicsDevice.DisplayMode.Width / 7); graphics.ApplyChanges(); #region Textures playerBrig = Content.Load<Texture2D>("PlayerImages/Brig2_1"); playerFrigate = Content.Load<Texture2D>("PlayerImages/Frigate"); playerManOfWar = Content.Load<Texture2D>("PlayerImages/ManOfWar"); enemyBrig = Content.Load<Texture2D>("EnemyImages/Brig2_1 - Enemy"); enemyFireBoat = Content.Load<Texture2D>("EnemyImages/FireBoat"); enemyFrigate = Content.Load<Texture2D>("EnemyImages/Frigate - Enemy"); enemyManOfWar = Content.Load<Texture2D>("EnemyImages/ManOfWar - Enemy"); healthPowerup = Content.Load<Texture2D>("HealthPowerup"); BossTexture = Content.Load<Texture2D>("EnemyImages/Boss"); #endregion BOSS_POSITION = new Vector2(BossTexture.Width / 2, graphics.PreferredBackBufferHeight / 2 - BossTexture.Height / 2); #region Main Menu logo = Content.Load<Texture2D>("BeardCoded2_1"); logoFont = Content.Load<SpriteFont>("Fonts/LogoFont"); mottoFont = Content.Load<SpriteFont>("Fonts/MottoFont"); #endregion #region GameMaterial // Create a new SpriteBatch, which can be used to draw textures. // player = new Player_Brig(Content); //player = new Player_Frigate(Content); playerStartingPos = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2); EnemyList = new List<Enemy>(); spriteBatch = new SpriteBatch(GraphicsDevice); playerInteractableList = new List<PlayerInteractable>(); friendlyList = new List<FriendlyShips>(); //load player ship textures playerCBTexture = Content.Load<Texture2D>("CannonBall"); enemyCBTexture = Content.Load<Texture2D>("CannonBall_Enemy"); playerCBPowerUpTexture = Content.Load<Texture2D>("CannonBall_PowerUp"); //Load HUD HUDFont = Content.Load<SpriteFont>("Fonts/HUDFont"); healthBar = Content.Load<Texture2D>("healthBar"); multiplierTexture = Content.Load<Texture2D>("Multiplier"); #endregion #region Time Variables #endregion //Load object data #region ObjectData PLAYER_BRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_BrigData"); PLAYER_FRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_FrigateData"); PLAYER_MOW_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_ManOfWarData"); FIREBOAT_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FireboatData"); ENEMY_BRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_BrigData"); ENEMY_FRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_FrigateData"); ENEMY_MOW_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_ManOfWarData"); FRIENDLY_SHIPS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FriendlyShipsData"); BOSS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/BossData"); HEALTH_POWER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/HealthPowerupData"); MULTIPLIER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/MultiplierData"); #endregion #region Sounds //load songs from folder and put in list BackgroundSongs = new List<Song>(); //main menu theme mainMenuSong = Content.Load<SoundEffect>("Sounds/PirateWarsMainMenu"); mainMenuSongInstance = mainMenuSong.CreateInstance(); mainMenuSongInstance.IsLooped = true; //game music gameSong = Content.Load<SoundEffect>("Sounds/GIOmetryWars"); gameSongInstance = gameSong.CreateInstance(); gameSongInstance.IsLooped = true; //game over gameOverSong = Content.Load<SoundEffect>("Sounds/GameOver"); gameOverSongInstance = gameOverSong.CreateInstance(); #endregion #region Menus //General buttons startButtonPos = new Vector2(300, 300); startButton = new GameButton(Content.Load<Texture2D>("StartButton"), startButtonPos); returnToMenu = new GameButton(Content.Load<Texture2D>("ReturnToMenu"), new Vector2(250, 325)); resumeGame = new GameButton(Content.Load<Texture2D>("StartButton"), new Vector2(250, 500)); //Boot Menu TextField motto = new TextField(("Omnis Erigere Niger Vexillum"), new Vector2(200, 600)); GameButton logoB = new GameButton(logo, new Vector2(graphics.PreferredBackBufferWidth / 2 - logo.Width / 2, graphics.PreferredBackBufferHeight / 2 - logo.Height / 2)); bootMenu = new Menu(motto, this); bootMenu.AddMenuButton(logoB, ToMainMenu); //MainMenu TextField menuTitle = new TextField(("BOATS BOATS BOATS"), CenterText("BOATS BOATS BOATS", logoFont)); mainMenu = new Menu(menuTitle, this); mainMenu.AddMenuButton(startButton, ToShipSelection); //PauseMenu TextField pauseTitle = new TextField("PAUSE", CenterText("PAUSE", logoFont)); pauseMenu = new Menu(pauseTitle, this); pauseMenu.AddMenuButton(resumeGame, ToGameOn); pauseMenu.AddMenuButton(returnToMenu, ToMainMenu); //ShipSelectionMenu float x1 = (float)graphics.PreferredBackBufferWidth / 6 - playerBrig.Width / 2; float x2 = (x1 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerFrigate.Width / 2); float x3 = (x2 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerManOfWar.Width / 2); Vector2 ship1Pos = new Vector2(x1, (graphics.PreferredBackBufferHeight / 2) - playerBrig.Height / 2); Vector2 ship2Pos = new Vector2(x2, (graphics.PreferredBackBufferHeight / 2) - playerFrigate.Height / 2); Vector2 ship3Pos = new Vector2(x3, (graphics.PreferredBackBufferHeight / 2) - playerManOfWar.Height / 2); brigButton = new GameButton(playerBrig, ship1Pos); frigateButton = new GameButton(playerFrigate, ship2Pos); manOfWarButton = new GameButton(playerManOfWar, ship3Pos); TextField shipSelectionTitle = new TextField("CHOOSE YOUR SHIP", CenterText("CHOOSE YOUR SHIP", logoFont)); shipSelectionMenu = new Menu(shipSelectionTitle, this); shipSelectionMenu.AddMenuButton(brigButton, LoadPlayerBrig); shipSelectionMenu.AddMenuButton(frigateButton, LoadPlayerFrig); shipSelectionMenu.AddMenuButton(manOfWarButton, LoadPlayerMOW); shipSelectionMenu.AddMenuText(new TextField(PLAYER_BRIG_DATA.PrintData(), new Vector2(brigButton.Position.X, brigButton.Position.Y + brigButton.Texture.Height + 20))); shipSelectionMenu.AddMenuText(new TextField(PLAYER_FRIG_DATA.PrintData(), new Vector2(frigateButton.Position.X, frigateButton.Position.Y + brigButton.Texture.Height + 20))); shipSelectionMenu.AddMenuText(new TextField(PLAYER_MOW_DATA.PrintData(), new Vector2(manOfWarButton.Position.X, manOfWarButton.Position.Y + brigButton.Texture.Height + 20))); #endregion }