Root/
#region File Description //----------------------------------------------------------------------------- // PhoneMainMenuScreen.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion using System; using GameStateManagement; using GameStateManagementSample; using Microsoft.Xna.Framework; namespace GameStateManagement { class PhoneMainMenuScreen : PhoneMenuScreen { public PhoneMainMenuScreen() : base ( "Main Menu" ) { // Create a button to start the game Button playButton = new Button( "Play" ); playButton.Tapped += playButton_Tapped; MenuButtons.Add(playButton); // Create two buttons to toggle sound effects and music. This sample just shows one way // of making and using these buttons; it doesn't actually have sound effects or music BooleanButton sfxButton = new BooleanButton( "Sound Effects" , true ); sfxButton.Tapped += sfxButton_Tapped; MenuButtons.Add(sfxButton); BooleanButton musicButton = new BooleanButton( "Music" , true ); musicButton.Tapped += musicButton_Tapped; MenuButtons.Add(musicButton); } void playButton_Tapped( object sender, EventArgs e) { // When the "Play" button is tapped, we load the GameplayScreen LoadingScreen.Load(ScreenManager, true , PlayerIndex.One, new GameplayScreen()); } void sfxButton_Tapped( object sender, EventArgs e) { BooleanButton button = sender as BooleanButton; // In a real game, you'd want to store away the value of // the button to turn off sounds here. :) } void musicButton_Tapped( object sender, EventArgs e) { BooleanButton button = sender as BooleanButton; // In a real game, you'd want to store away the value of // the button to turn off music here. :) } protected override void OnCancel() { ScreenManager.Game.Exit(); base .OnCancel(); } } } |
Source at commit db1caed4b78a created 12 years 7 months ago. By Nathan Adams, Adding tcc command to AxiosCommandConsole to toggle the ability to control |
---|