Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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();
        }