//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------
namespace DarkWynter.Engine.Menus.GameScreens
{
#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;
using DarkWynter.Engine;
using DWGame.Globals;
using DW.Stream;
#endregion
///
/// The Pause Screen
///
public class PauseScreen : GameScreen
{
private Texture2D hintsTexture;
private GameMenu playerPauseMenu;
///
/// Pause Screen constructor
///
public PauseScreen(Enums_Engine.MenuState GameEngineState)
:base(GameEngineState)
{
//Instantiate the GameMenu
menu = new GameMenu("", 0, 0);
playerPauseMenu = new GameMenu("Paused", 150, 30);
playerPauseMenu.SetDrawMenuTitle(false);
playerPauseMenu.AddMenuOption("Music", "On", "Off");
playerPauseMenu.AddMenuOption("Sound Effects", "On", "Off");
SetBackground(Renderer.content.Load("_textures/black"), 0.3f);
//pauseScreen.SetHintsTexture(Statics.content.Load("_textures/black"));
SetDefaults();
}
///
/// Set pause options for current player.
///
/// Player that paused.
public void SetPlayerOptions()
{
//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);
//}
}
///
/// Reset default values.
///
public void SetDefaults()
{
//if (Statics_Engine.SystemSettings.music)
//{
// ((GameMenuOption)playerPauseMenu.GetMenuElement("Music")).SetCurrentIndex(0);
//}
//else
//{
// ((GameMenuOption)playerPauseMenu.GetMenuElement("Music")).SetCurrentIndex(1);
//}
//if (Statics_Engine.SystemSettings.soundFX)
//{
// ((GameMenuOption)playerPauseMenu.GetMenuElement("Sound Effects")).SetCurrentIndex(0);
//}
//else
//{
// ((GameMenuOption)playerPauseMenu.GetMenuElement("Sound Effects")).SetCurrentIndex(1);
//}
}
///
/// Menu start button pressed method
///
/// Object Library
public override void MenuStart(int index)
{
//Audio.MenuStart();
//Commit menu changes
//Commit(objectLibrary);
//Resume the game
Statics.engineState = Enums_Engine.EngineState.GAME_MODE;
// Statics.screenSaverTimer.Reset();
// Statics.screenSaverTimer.Start();
}
///
/// Menu back button pressed method
///
public override void MenuBack()
{
// No going back from pause menu
}
///
/// Commit changes to the pause menu.
///
/// ObjectLibrary containing player that paused.
public void Commit()
{
//option = (GameMenuOption)playerPauseMenu.GetMenuElement("Music");
//if (option.GetActiveOption() == "On")
//{
// Statics_Engine.SystemSettings.music = true;
//}
//else
//{
// Statics_Engine.SystemSettings.music = false;
//}
//option = (GameMenuOption)playerPauseMenu.GetMenuElement("Sound Effects");
//if (option.GetActiveOption() == "On")
//{
// Statics_Engine.SystemSettings.soundFX = true;
//}
//else
//{
// Statics_Engine.SystemSettings.soundFX = false;
//}
}
///
/// Draw the pause menu.
///
/// Spritebatch used to draw.
/// Graphics device to draw.
public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
{
//graphicsDevice.Viewport = Statics_Stream.RenderSettings.defaultViewport;
//base.Draw(spriteBatch);
//// Now draw the menu for THIS player
//if (Statics_Engine.PlayerSettings.playerThatPaused != -1)
//{
// //Figure out how many players there are and if we need to shrink the font
// if (Statics_Engine.SystemSettings.TOTAL_PLAYERS > 2)
// {
// //use smaller font
// playerPauseMenu.SetFont(Statics_Stream.Fonts.ComicSansSmall);
// }
// else
// {
// //use bigger font
// playerPauseMenu.SetFont(Statics_Stream.Fonts.ComicSans);
// }
// spriteBatch.End();
// graphicsDevice.Viewport = Statics_Stream.RenderSettings.cameraList[Statics_Engine.PlayerSettings.playerThatPaused].viewport;
// spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
// //draw hints background
// if (hintsTexture != null)
// {
// spriteBatch.Draw(hintsTexture, new Rectangle(0,0,graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), Color.White);
// }
// playerPauseMenu.Draw(spriteBatch);
// spriteBatch.End();
// //restart spritebatch for later
// spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
//}
}
}
}