| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #region File Description
- //-----------------------------------------------------------------------------
- // PhoneMainMenuScreen.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- #endregion
- using Microsoft.Xna.Framework;
- using System;
- namespace GameStateManagementSample
- {
- 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. :)
- }
- #if !__IOS__
- protected override void OnCancel()
- {
- //ScreenManager.Game.Exit();
- base.OnCancel();
- }
- #endif
- }
- }
|