當前位置: 首頁>>代碼示例>>C#>>正文


C# Game.Exit方法代碼示例

本文整理匯總了C#中SiliconStudio.Xenko.Engine.Game.Exit方法的典型用法代碼示例。如果您正苦於以下問題:C# Game.Exit方法的具體用法?C# Game.Exit怎麽用?C# Game.Exit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SiliconStudio.Xenko.Engine.Game的用法示例。


在下文中一共展示了Game.Exit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestLocalizationCoherencyLoopImpl

        private void TestLocalizationCoherencyLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            // useless motion on the root entities just to check that is does not disturb to calculations.
            rootSubEntity1.Transform.Position += new Vector3(1, 2, 3);
            listCompEntities[0].Transform.Position += new Vector3(3, 2, -1);
            // have the emitter turn clockwise around the listener.
            emitCompEntities[0].Transform.Position = new Vector3((float)Math.Cos(loopCount * Math.PI / 100), 0, (float)Math.Sin(loopCount * Math.PI / 100));

            // the sound should turn around clockwise 
            if (loopCount == 800)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:14,代碼來源:TestAudioSystem.cs

示例2: TestDopplerCoherencyLoopImpl

        private void TestDopplerCoherencyLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            // useless motion on the root entities just to check that is does not disturb to calculations.
            rootSubEntity1.Transform.Position += new Vector3(1, 2, 3);
            listCompEntities[0].Transform.Position += new Vector3(3, 2, -1);
            // apply a left to right motion to the emitter entity
            emitCompEntities[0].Transform.Position = new Vector3(20*(loopCount-200), 0, 2);

            // the sound should be modified in pitch depending on which side the emitter is
            // ( first pitch should be increased and then decreased)
            if (loopCount == 400)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:15,代碼來源:TestAudioSystem.cs

示例3: TestAttenuationCoherencyLoopImpl

        private void TestAttenuationCoherencyLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            // put away progressively the emitter.
            emitCompEntities[0].Transform.Position = new Vector3(0, 0, loopCount / 10f);

            // the sound should progressively attenuate
            if (loopCount == 800)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:11,代碼來源:TestAudioSystem.cs

示例4: TestEffectsAndMusicLoopImpl

 private void TestEffectsAndMusicLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         // start the sound music in background.
         var music = game.Asset.Load<SoundMusic>("MusicFishLampMp3");
         music.Play();
     }
     // here we should hear the mp3.
     else if (loopCount == 240)
     {
         // check that AudioEmitterComponent can be played along with soundMusic.
         soundControllers[0].Play();
     }
     // here we should hear the soundEffect 0 and the mp3.
     else if (loopCount == 260)
     {
         // check that two AudioEmitterComponent can be played along with a soundMusic.
         soundControllers[2].Play();
     }
     // here we should hear the soundEffect 0 and 2 and the mp3.
     else if (loopCount == 500)
     {
         game.Exit();
     }
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:26,代碼來源:TestAudioSystem.cs

示例5: TestSeveralControllersLoopImpl

        private void TestSeveralControllersLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            // have the emitter turn around the listener to check that all sounds are coming from the same emitter.
            emitCompEntities[0].Transform.Position = new Vector3((float)Math.Cos(loopCount * Math.PI / 30), 0, (float)Math.Sin(loopCount * Math.PI / 30));

            if (loopCount == 0)
            {
                // start a first controller
                soundControllers[0].Play();
            }
            // here we should hear SoundEffect 0
            else if (loopCount == 30)
            {
                // start a second controller while controller 1 has not finished to play
                soundControllers[1].Play();
            }
            // here we should hear SoundEffect 0 and 1
            else if (loopCount == 60)
            {
                // start a third controller while controller 2 has not finished to play
                soundControllers[3].Play();
            }
            // here we should hear the soundEffect 1 and 2
            else if (loopCount == 120)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:28,代碼來源:TestAudioSystem.cs

示例6: TestRemoveListenerLoopImpl

 private void TestRemoveListenerLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         // check that initially the sound are hear via the two listeners.
         soundControllers[0].Play();
         soundControllers[2].Play();
     }
     // here we should hear the soundEffect 0 on left ear and the soundEffect 2 on right ear
     else if (loopCount == 60)
     {
         // remove listener 3 from the entity system => check that the sounds are now heard only via listener 1
         throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
         //game.Entities.Remove(listCompEntities[2]);
     }
     // here we should hear the soundEffect 0 on left ear only
     else if (loopCount == 120)
     {
         // remove listener 1 from the audio system  => check that the sounds are not outputted anymore.
         game.Audio.RemoveListener(listComps[0]);
     }
     // here we should hear nothing.
     else if (loopCount == 180)
     {
         game.Exit();
     }
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:27,代碼來源:TestAudioSystem.cs

示例7: TestAddRemoveEmitterLoopImpl

        private void TestAddRemoveEmitterLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            if (loopCount == 0)
            {
                // check there is no sound output if the emitterComponents are not added to the entity system.
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear nothing.
            else if (loopCount == 60)
            {
                // add emitter 1 to the entity system
                throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Add(emitCompEntities[0]);

                // check that emitter 1 can now be heard.
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear the soundEffect 0 on left ear only
            else if (loopCount == 120)
            {
                // add now emitter 2 to the entity system
                throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Add(emitCompEntities[1]);

                // test that now both emitters can be heard.
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear the soundEffect 0 on left ear and the soundEffect 2 on right ear
            else if (loopCount == 180)
            {
                // remove emitter 2 from the entity system  
                throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Remove(emitCompEntities[1]);

                // test that now only emitter 1 can be heard.
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear the soundEffect 0 on left ear only
            else if (loopCount == 240)
            {
                // remove emitter 1 from the entity system  
                throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Remove(emitCompEntities[0]);

                // check that there is not more audio output at all
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear nothing.
            else if (loopCount == 320)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:58,代碼來源:TestAudioSystem.cs

示例8: TestExitLoopLoopImpl

 private void TestExitLoopLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         mainController.Play();
     }
     // should hear the beginning of the sound
     else if (loopCount == 10)
     {
         // test a basic utilisation of exitLoop.
         mainController.ExitLoop();
     }
     // should hear the end of the sound
     else if (loopCount == 60)
     {
         Assert.IsTrue(mainController.IsLooped, "The value of isLooped has been modified by ExitLoop.");
         Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "The sound did not stopped after exitloop.");
     }
     // should hear nothing
     else if (loopCount == 80)
     {
         // check that performing an exitLoop before the play commit does not fail (bfr next AudioSystem.Uptade).
         mainController.Play();
         mainController.ExitLoop();
     }
     // should hear a sound not looped
     else if (loopCount == 140)
     {
         Assert.IsTrue(mainController.IsLooped, "The value of isLooped has been modified by ExitLoop just after play.");
         Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "The sound did not stopped after Exitloop just after play.");
     }
     // should hear nothing
     else if (loopCount == 160)
     {
         mainController.Play();
     }
     // should hear the beginning of the sound
     else if (loopCount == 170)
     {
         // check that performing an ExitLoop while the sound is paused does not fails.
         mainController.Pause();
         mainController.ExitLoop();
     }
     // should hear nothing
     else if (loopCount == 220)
     {
         mainController.Play();
     }
     // should hear the end of the sound (not looped)
     else if (loopCount == 270)
     {
         Assert.IsTrue(mainController.IsLooped, "The value of isLooped has been modified by ExitLoop after pause.");
         Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "The sound did not stopped after exitloop after pause.");
     }
     // should hear nothing
     else if (loopCount == 320)
     {
         // check that performing an exitLoop while the sound is stopped is ignored.
         mainController.ExitLoop();
         mainController.Play();
     }
     // should hear the sound looping
     else if (loopCount == 500)
     {
         Assert.IsTrue(mainController.IsLooped, "The value of isLooped has been modified by ExitLoop before play.");
         Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "The sound did not looped.");
         game.Exit();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:69,代碼來源:TestController.cs

示例9: TestAddListenerLoopImpl

        private void TestAddListenerLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            if (loopCount == 0)
            {
                // check that a controller play call output nothing if there is no listener currently listening.
                soundControllers[0].Play();
            }
            // nothing should come out from the speakers during this gap
            else if(loopCount == 60)
            {
                // check that the sound is correctly outputted when there is one listener
                game.Audio.AddListener(listComps[0]);
                soundControllers[0].Play();
            }
            // here we should hear soundEffect 0
            else if (loopCount == 120)
            {
                // isolate the two listeners such that emitter 1 can be heard only by listener 1 and emitter 2 by listener 2
                // and place emitters such that emitters 1 output on left ear and emitter 2 on right ear.
                listCompEntities[0].Transform.Position = listCompEntities[0].Transform.Position - new Vector3(1000, 0, 0);
                emitCompEntities[0].Transform.Position = emitCompEntities[0].Transform.Position - new Vector3(1, 0, 0);
                emitCompEntities[1].Transform.Position = emitCompEntities[1].Transform.Position + new Vector3(1, 0, 0);

                // add a new listener not present into the entity system yet to the audio system
                listComps.Add(new AudioListenerComponent());
                listCompEntities.Add(new Entity());
                listCompEntities[2].Add(listComps[2]);
                game.Audio.AddListener(listComps[2]);

                // check that the sound is not heard by the new listener (because not added to the entity system).
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear the soundEffect 0 on left ear only
            else if(loopCount == 180)
            {
                // add the new listener to the entity system
                throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Add(listCompEntities[2]);

                // check the sounds are heard by the two listeners.
                soundControllers[0].Play();
                soundControllers[2].Play();
            }
            // here we should hear the soundEffect 0 on left ear and the soundEffect 2 on right ear
            else if(loopCount > 240)
            {
                game.Exit();
            }
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:50,代碼來源:TestAudioSystem.cs

示例10: TestStopLoopImpl

 private void TestStopLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         // check that a call to stop works even though the call to play has not been comitted yet (next AudioSystem.Update).
         soundControllers[2].Play();
         soundControllers[2].Stop();
     }
     // should hear nothing
     else if (loopCount == 60)
     {
         Assert.AreEqual(SoundPlayState.Stopped, soundControllers[2].PlayState, "The sound play status was not stopped just after play.");
         soundControllers[2].Play();
     }
     // should hear the beginning of the sound
     else if (loopCount == 150)
     {
         // test the basic call to stop.
         soundControllers[2].Stop();
         Assert.AreEqual(SoundPlayState.Stopped, soundControllers[2].PlayState, "The sound play status was not stopped.");
     }
     // should hear nothing
     else if (loopCount == 200)
     {
         soundControllers[2].Play();
     }
     // should hear the beginning of the sound
     else if (loopCount == 400)
     {
         game.Exit();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:32,代碼來源:TestController.cs

示例11: TestPlayStateLoopImpl

 private void TestPlayStateLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 60)
     {
         // check that PlayState is automatically reset to 'Stopped' when all the subInstances have finished to play.
         Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "Value of playState with listeners is not valid after the end of the track.");
         game.Exit();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:9,代碼來源:TestController.cs

示例12: TestPlayLoopImpl

        private void TestPlayLoopImpl(Game game, int loopCount, int loopCountSum)
        {
            if (loopCount == 0)
            {
                // test that the sound does not play when playing a sound associated to an entity which has not been added to the system yet.
                mainController.Play();
            }
            // should hear nothing
            else if (loopCount == 100)
            {
                Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "The sound play status was playing eventhough the entity was not added.");

                // check the behavious of a basic call to play.
                AddRootEntityToEntitySystem(game);
                mainController.Play();
            }
            // should hear the beginning of the sound
            else if (loopCount == 120)
            {
                Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "The sound play status was not playing eventhough the entity was added.");
            }
            // should hear the end of the sound
            else if (loopCount == 160)
            {
                // add a longuer sound
                sounds.Add(game.Content.Load<SoundEffect>("EffectFishLamp"));
                emitComps[0].AttachSoundEffect(sounds[2]);
                soundControllers.Add(emitComps[0].GetSoundEffectController(sounds[2]));
                soundControllers[2].Play();
            }
            // should hear the beginning of the sound
            else if (loopCount == 300)
            {
                // check that the sound is stopped when removing the listeners.
                game.Audio.RemoveListener(listComps[0]);
                game.Audio.RemoveListener(listComps[1]);
                Assert.AreEqual(SoundPlayState.Stopped, soundControllers[2].PlayState, "The sound has not been stopped when the listeners have been removed.");
            }
            // should hear nothing
            else if (loopCount == 360)
            {
                game.Audio.AddListener(listComps[0]);
                game.Audio.AddListener(listComps[1]);
                soundControllers[2].Play();
            }
            // should hear the beginning of the sound
            else if (loopCount == 500)
            {
                // check that the sound is stopped when removing the sound Entity from the system.
                Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
                //game.Entities.Remove(rootEntity);
                Assert.AreEqual(SoundPlayState.Stopped, soundControllers[2].PlayState, "The sound has not been stopped when the emitter's entities have been removed.");
            }
            // should hear nothing
            else if (loopCount == 560)
            {
                game.Exit();
            }
        }
開發者ID:cg123,項目名稱:xenko,代碼行數:59,代碼來源:TestController.cs

示例13: TestIsLoopedLoopImpl

 private void TestIsLoopedLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         // check that the sound loops as it should.
         mainController.IsLooped = true;
         mainController.Play();
     }
     // should hear looped sound
     else if (loopCount == 100)
     {
         Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "The sound play status was stopped but the sound is supposed to be looped.");
         mainController.Stop();
     }
     // should hear nothing
     else if (loopCount == 150)
     {
         // check that the sound does not loop  as it should.
         mainController.IsLooped = false;
         mainController.Play();
     }
     // should hear not a looped sound
     else if (loopCount == 250)
     {
         Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "The sound play status was playing but the sound is supposed to do so.");
         mainController.Stop();
     }
     // should hear not a looped sound
     else if (loopCount == 300)
     {
         // check that setting the isLooped without listener works too
         game.Audio.RemoveListener(listComps[0]);
         game.Audio.RemoveListener(listComps[1]);
         mainController.IsLooped = true;
         game.Audio.AddListener(listComps[0]);
         game.Audio.AddListener(listComps[1]);
         mainController.Play();
     }
     // should hear looped sound
     else if (loopCount == 400)
     {
         Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "The sound play status was stopped but the sound is supposed to be looped.");
         mainController.Stop();
     }
     // should hear looped sound
     else if (loopCount == 450)
     {
         mainController.Play();
     }
     else if (loopCount == 475)
     {
         // check that IsLooped throws InvalidOperationException when modified while playing.
         Assert.Throws<InvalidOperationException>(() => mainController.IsLooped = true, "setting isLooped variable during playing sound did not throw InvalidOperationException");
         game.Exit();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:56,代碼來源:TestController.cs

示例14: TestVolumeLoopImpl

 private void TestVolumeLoopImpl(Game game, int loopCount, int loopCountSum)
 {
     if (loopCount == 0)
     {
         // check that setting the volume before play works.
         mainController.Volume = 0.1f;
         mainController.Play();
     }
     // should hear low volume
     else if(loopCount == 60)
     {
        mainController.Volume = 1f;
        mainController.Play();
     }
     // should hear normal volume
     else if (loopCount == 120)
     {
         // check that setting the volume without listener works too
         game.Audio.RemoveListener(listComps[0]);
         game.Audio.RemoveListener(listComps[1]);
         mainController.Volume = 0.1f;
         game.Audio.AddListener(listComps[0]);
         game.Audio.AddListener(listComps[1]);
         mainController.Play();
     }
     // should hear low volume
     else if (loopCount == 180)
     {
         mainController.Volume = 1f;
         mainController.Play();
     }
     // should hear normal volume
     else if (loopCount == 240)
     {
         mainController.Volume = 0f;
         mainController.IsLooped = true;
         mainController.Play();
     }
     else if(loopCount > 240)
     {
         // check that sound goes smoothly from nothing to full intensity
         mainController.Volume = Math.Abs((loopCount - 440) / 200f);
     }
     // the sound should go up and down
     if (loopCount == 640)
     {
         game.Exit();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:49,代碼來源:TestController.cs

示例15: Quit

        private static void Quit(Game game)
        {
            game.Exit();

#if SILICONSTUDIO_PLATFORM_ANDROID
            global::Android.OS.Process.KillProcess(global::Android.OS.Process.MyPid());
#endif
        }
開發者ID:hsabaleuski,項目名稱:paradox,代碼行數:8,代碼來源:GameTestingSystem.cs


注:本文中的SiliconStudio.Xenko.Engine.Game.Exit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。