public PhoneMainMenuScreen()
            : base("Racing Rage")
        {
            // Create a button to start the game
            Button playButton = new Button("Play");

            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);
            playButton.Size = new Vector2(300, 100);

            BooleanButton musicButton = new BooleanButton("Music", true);

            musicButton.Tapped += musicButton_Tapped;
            MenuButtons.Add(musicButton);

            BooleanButton sfxButton = new BooleanButton("Sound", true);

            sfxButton.Tapped += sfxButton_Tapped;
            MenuButtons.Add(sfxButton);

            Button controlButton = new Button("Control: Gyro");

            controlButton.Tapped += controlButton_Tapped;
            MenuButtons.Add(controlButton);

            Button creditsButton = new Button("Credits");

            creditsButton.Tapped += creditsButton_Tapped;
            MenuButtons.Add(creditsButton);
        }
        void sfxButton_Tapped(object sender, EventArgs e)
        {
            BooleanButton button = sender as BooleanButton;

            ScreenManager.enableSoundEffect = !ScreenManager.enableSoundEffect;
            checkButton();
        }
Ejemplo n.º 3
0
        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. :)
        }
        void musicButton_Tapped(object sender, EventArgs e)
        {
            BooleanButton button = sender as BooleanButton;

            ScreenManager.enableMusic = !ScreenManager.enableMusic;

            if (ScreenManager.enableMusic == false)
            {
                MediaPlayer.Stop();
            }
            else
            {
                MediaPlayer.Play(ScreenManager.cheesymusic);
            }
            checkButton();
        }
Ejemplo n.º 5
0
        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);
        }