Beispiel #1
0
 private void MainPage_Unloaded(object sender, RoutedEventArgs e)
 {
     if (vectorGameManager != null)
     {
         vectorGameManager.Dispose();
         vectorGameManager = null;
     }
 }
Beispiel #2
0
 void MainWindow_Closed(object sender, EventArgs e)
 {
     if (vectorGameManager != null)
     {
         vectorGameManager.Dispose();
         vectorGameManager = null;
     }
 }
Beispiel #3
0
        private void RestartGame()
        {
            // dispose the old game
            if (vectorGameManager != null)
            {
                vectorGameManager.Dispose();
                vectorGameManager = null;
            }

            try
            {
                SoundIOType soundIOType = SoundIOType.Direct;
                Enum.TryParse(Settings.Default.SoundIOType, out soundIOType);
                switch (soundIOType)
                {
                case SoundIOType.Direct:
                    // create our tempest... just a normal game that interacts with our keyboard
                    // commands and the internal audio
                    vectorGameManager = VectorGameManager.CreateNormalInstance();
                    break;

                case SoundIOType.Discovery:
                    vectorGameManager = VectorGameManager.CreateCOMPortInstance(Settings.Default.DiscoveryCOMPort);
                    break;

                case SoundIOType.Loopback:
                    vectorGameManager = VectorGameManager.CreateLoopbackInstance(
                        Settings.Default.LoopbackPort1,
                        Settings.Default.LoopbackPort2
                        );
                    break;

                case SoundIOType.MemoryStream:
                    // create our tempest... just a normal game that interacts with the sound &
                    // control panel via a memory stream
                    vectorGameManager = VectorGameManager.CreateStreamedInstance();
                    break;

                default:
                    throw new Exception("Unsupported I/O type: " + soundIOType);
                }

                // set it to running
                startTime = DateTime.Now;
                vectorGameManager.Start();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error starting game: " + e.Message);
            }
        }
Beispiel #4
0
        private void RestartGame()
        {
            // dispose the old game
            if (vectorGameManager != null)
            {
                vectorGameManager.Dispose();
                vectorGameManager = null;
            }

            // create our tempest... just a normal game that interacts with our keyboard
            // commands and the internal audio
            vectorGameManager = VectorGameManager.CreateNormalInstance();

            // set it to running
            startTime = DateTime.Now;
            vectorGameManager.Start();
        }