|
#region File Description
//-----------------------------------------------------------------------------
// PauseMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using Microsoft.Xna.Framework;
#endregion
namespace SkyWar
{
/// <summary>
/// The pause menu comes up over the top of the game,
/// giving the player options to resume or quit.
/// </summary>
class PauseMenuScreen : MenuScreen
{
#region Initialization
/// <summary>
/// Constructor.
/// </summary>
public PauseMenuScreen()
: base("Paused")
{
// Create our menu entries.
MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
// Hook up menu event handlers.
resumeGameMenuEntry.Selected += OnCancel;
resumeGameMenuEntry.Tapped += resumeGameMenuEntry_Tapped;
quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
quitGameMenuEntry.Tapped += quitGameMenuEntry_Tapped;
// Add entries to the menu.
MenuEntries.Add(resumeGameMenuEntry);
MenuEntries.Add(quitGameMenuEntry);
}
void resumeGameMenuEntry_Tapped(object sender, System.EventArgs e)
{
OnCancel(PlayerIndex.One);
}
void quitGameMenuEntry_Tapped(object sender, System.EventArgs e)
{
LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
new MainMenuScreen());
//const string message = "Are you sure you want to quit this game?";
//MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);
//confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
//ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
}
#endregion
#region Handle Input
/// <summary>
/// Event handler for when the Quit Game menu entry is selected.
/// </summary>
void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
{
LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
new MainMenuScreen());
//const string message = "Are you sure you want to quit this game?";
//MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);
//confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
//ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
}
/// <summary>
/// Event handler for when the user selects ok on the "are you sure
/// you want to quit" message box. This uses the loading screen to
/// transition from the game back to the main menu screen.
/// </summary>
void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
{
//LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
// new MainMenuScreen());
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
2+ year of experience in Information Technology with the extensive exposure of Treasury & Capital, Health Care and ERP domain.
Area of interest - Multithreading, Files, WPF, WCF, Jquery, Mvc, Sql Server, Perceptual programming
Heavily Worked on desktop application ,Web application and WCF Services.
Also worked on small games application for learning purpose.
Latest interest - Windows 8 , Perceptual Programming, Windows Phone, WCF etc