public menuSelector_Settings() { atTop_Color = true; atBottom_Color = false; atTop_Music = true; atBottom_Music = false; selector_color = new Rect(); selector_color.X = 25; selector_color.Y = 105; selector_color.Height = 15; selector_color.Width = 15; selector_music = new Rect(); selector_music.X = 345; selector_music.Y = 105; selector_music.Height = 15; selector_music.Width = 15; selection_color = ColorSelection.DarkOrange; selection_music = MusicSelection.Song1; }
//Plays music. This should be done through using the MediaPlayer static class. /* It also stops the previous song if it was playing or paused. * * You typically don't want multiple songs to be playing at once, so make * sure to stop the previous song. * * Trying to play a song already playing may crash your game. * */ public void Play(MusicSelection selection) { Song sng; if (songs.TryGetValue(selection, out sng)) { Stop(); MediaPlayer.Play(sng); } }
//Plays music. This should be done through using the MediaPlayer static class. /* It also stops the previous song if it was playing or paused. * * You typically don't want multiple songs to be playing at once, so make * sure to stop the previous song. * * Trying to play a song already playing may crash your game. * */ public void Play( MusicSelection selection ) { this.Stop(); Song song; if ( songs.TryGetValue( selection, out song ) ) { try { MediaPlayer.Play( song ); } catch { Console.WriteLine( "No speakers installed, not playing" ); } } else { Console.WriteLine( "Could not find song: " + selection.ToString() ); } }