// Set a handle to the Game object so this class can update it public void SetGameObjectHandle(ref CGame cGame) { mcGameHandle = cGame; mcGameHandle.meGame = EGames.ProfileSettings; }
// If eNewGame is different than the current Game, start playing the New Game private void PlayGame(EGames eNewGame) { // If the Game type should be changed if (mcGame.meGame != eNewGame) { // If the screen Transition hasn't started yet if (!msTransition.bPerfromingTransition) { // Reset the Transition variables msTransition.Reset(); // Record that we are now performing a Transition msTransition.bPerfromingTransition = true; // Save which Game to switch to during the Transition msTransition.eGameToSwitchTo = eNewGame; // Set the color to fade with msTransition.sColor = Color.Black; // Set Duration based on which Game we are switching to switch (eNewGame) { case EGames.ProfileSettings: msTransition.iDurationInMilliseconds = 0; msTransition.fEndOpacity = 0.7f; break; default: msTransition.iDurationInMilliseconds = 500; break; } } // Else we are in the middle of the Transition else { // Check which Game to switch to switch (eNewGame) { default: case EGames.MainMenu: // Make sure the Windows Media Player controls are hidden and not playing playerWindowsMediaPlayer.Visible = false; playerWindowsMediaPlayer.Ctlcontrols.stop(); playerWindowsMediaPlayer.URL = ""; mcGame = new CMainMenu(); break; case EGames.Spong: mcGame = new CSpong(); break; case EGames.ShootingGallery: mcGame = new CShootingGallery(playerWindowsMediaPlayer); break; case EGames.PitchMatcher: mcGame = new CPitchMatcher(); break; case EGames.TargetPractice: mcGame = new CTargetPractice(); break; case EGames.HighScores: mcGame = new CHighScores(); break; case EGames.ProfileSettings: try { // Open and show the Profile Settings Form as a modal form formProfileSettings cProfileSettingsForm = new formProfileSettings(); cProfileSettingsForm.SetGameObjectHandle(ref mcGame); cProfileSettingsForm.ShowDialog(); } catch (Exception e) { MessageBox.Show(e.ToString(), "Error generating Profile Settings Form"); } break; } } } }