//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {License Information: Creative Commons} //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace ElementalGame { #region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; #endregion // The Pause Screen public class PauseScreen : GameScreen { private Texture2D hintsTexture; private GameMenu playerPauseMenu; // Constructor: public PauseScreen() { //Instantiate the GameMenu menu = new GameMenu("", 0, 0); playerPauseMenu = new GameMenu("Paused", 150, 30);//ElementalGame.GAME_WINDOW_WIDTH / 2, ElementalGame.GAME_WINDOW_HEIGHT / 2); playerPauseMenu.SetDrawMenuTitle(false); playerPauseMenu.AddMenuOption("Invert rotation", "No", "Yes"); playerPauseMenu.AddMenuOption("Rumble", "Yes", "No"); playerPauseMenu.AddMenuOption("ShadowMap1", "Yes", "No"); playerPauseMenu.AddMenuOption("ShadowMap2", "Yes", "No"); playerPauseMenu.AddMenuOption("Terrain Bump Mapping", "Yes", "No"); playerPauseMenu.AddMenuOption("Terrain Multi-Texturing", "Yes", "No"); //playerPauseMenu.AddMenuOption("Number Of Terrain Textures", "4", "3", "2"); playerPauseMenu.AddMenuOption("Light Sources", "2", "1"); playerPauseMenu.AddMenuOption("Music", "On", "Off"); playerPauseMenu.AddMenuOption("Sound Effects", "On", "Off"); } public GameMenu GetPlayerPauseMenu() { return playerPauseMenu; } public void SetHintsTexture(Texture2D hints) { hintsTexture = hints; } public void SetPlayerOptions(Human player) { if (player.controlsInverted) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Invert rotation")).SetCurrentIndex(1); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Invert rotation")).SetCurrentIndex(0); } if (player.rumbleEnabled) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Rumble")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Rumble")).SetCurrentIndex(1); } } public void SetDefaults() { // ShadowMap1 if (XML.SystemSettings.enableShadowMap1) { ((GameMenuOption)playerPauseMenu.GetMenuElement("ShadowMap1")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("ShadowMap1")).SetCurrentIndex(1); } if (XML.SystemSettings.enableShadowMap2) { ((GameMenuOption)playerPauseMenu.GetMenuElement("ShadowMap2")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("ShadowMap2")).SetCurrentIndex(1); } if (XML.SystemSettings.enableTerrainBumpMapping) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Terrain Bump Mapping")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Terrain Bump Mapping")).SetCurrentIndex(1); } if (XML.SystemSettings.enableTerrainMultiTexturing) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Terrain Multi-Texturing")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Terrain Multi-Texturing")).SetCurrentIndex(1); } //if (ElementalGame.numberOfTerrainTextures == 4) //{ // ((GameMenuOption)playerPauseMenu.GetMenuElement(6)).SetCurrentIndex(0); //} //else //{ // ((GameMenuOption)playerPauseMenu.GetMenuElement(6)).SetCurrentIndex(1); //} if (XML.SystemSettings.singleLightSource) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Light Sources")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Light Sources")).SetCurrentIndex(1); } if (XML.SystemSettings.music) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Music")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Music")).SetCurrentIndex(1); } if (XML.SystemSettings.soundFX) { ((GameMenuOption)playerPauseMenu.GetMenuElement("Sound Effects")).SetCurrentIndex(0); } else { ((GameMenuOption)playerPauseMenu.GetMenuElement("Sound Effects")).SetCurrentIndex(1); } } public new void Draw() { ElementalGame.graphics.GraphicsDevice.Viewport = ElementalGame.defaultViewport; base.Draw(); // Now draw the menu for THIS player if (ElementalGame.playerThatPaused != -1) { //Figure out how many players there are and if we need to shrink the font if (XML.SystemSettings.TOTAL_PLAYERS > 2) { //use smaller font playerPauseMenu.SetFont(FontWriter.ComicSansSmall); } else { //use bigger font playerPauseMenu.SetFont(FontWriter.ComicSans); } ElementalGame.spriteBatch.End(); ElementalGame.graphics.GraphicsDevice.Viewport = ElementalGame.viewportList[ElementalGame.playerThatPaused]; ElementalGame.spriteBatch.Begin(SpriteBlendMode.AlphaBlend); //draw hints background if (hintsTexture != null) { ElementalGame.spriteBatch.Draw(hintsTexture, new Rectangle(0, 0, ElementalGame.graphics.GraphicsDevice.Viewport.Width, ElementalGame.graphics.GraphicsDevice.Viewport.Height), Color.White); } playerPauseMenu.Draw(); ElementalGame.spriteBatch.End(); //restart spritebatch for later ElementalGame.spriteBatch.Begin(SpriteBlendMode.AlphaBlend); } } } }