• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Engine.Game类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SiliconStudio.Xenko.Engine.Game的典型用法代码示例。如果您正苦于以下问题:C# Game类的具体用法?C# Game怎么用?C# Game使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Game类属于SiliconStudio.Xenko.Engine命名空间,在下文中一共展示了Game类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestAddRemoveListenerImpl

        private void TestAddRemoveListenerImpl(Game game)
        {
            var audio = game.Audio;
            var notAddedToEntityListener = new AudioListenerComponent();
            var addedToEntityListener = new AudioListenerComponent();

            // Add a listenerComponent not present in the entity system yet and check that it is correctly added to the AudioSystem internal data structures
            Assert.DoesNotThrow(() => audio.AddListener(notAddedToEntityListener), "Adding a listener not present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem does not contains the notAddedToEntityListener.");

            // Add a listenerComponent already present in the entity system and check that it is correctly added to the AudioSystem internal data structures
            var entity = new Entity("Test");
            entity.Add(addedToEntityListener);
            throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
            //game.Entities.Add(entity);
            Assert.DoesNotThrow(() => audio.AddListener(addedToEntityListener), "Adding a listener present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem does not contains the addedToEntityListener.");

            // Add a listenerComponent already added to audio System and check that it does not crash
            Assert.DoesNotThrow(()=>audio.AddListener(addedToEntityListener), "Adding a listener already added to the audio system failed.");

            // Remove the listeners from the AudioSystem and check that they are removed from internal data structures.
            Assert.DoesNotThrow(() => audio.RemoveListener(notAddedToEntityListener), "Removing an listener not present in the entity system failed.");
            Assert.IsFalse(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem still contains the notAddedToEntityListener.");
            Assert.DoesNotThrow(() => audio.RemoveListener(addedToEntityListener), "Removing an listener present in the entity system fails");
            Assert.IsFalse(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem still contains the addedToEntityListener.");

            // Remove a listener not present in the AudioSystem anymore and check the thrown exception
            Assert.Throws<ArgumentException>(() => audio.RemoveListener(addedToEntityListener), "Removing the a non-existing listener did not throw ArgumentException.");
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:30,代码来源:TestAudioSystem.cs


示例2: OneLoopTurnActionAftUpdate

            public void OneLoopTurnActionAftUpdate(Game game)
            {
                oneLoopTurnActionAftUpdate?.Invoke(game, loopCount, loopCountSum);

                ++loopCount;
                loopCountSum += loopCount;
            }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:TestUtilities.cs


示例3: Main

 static void Main(string[] args)
 {
     using (var game = new Game())
     {
         game.Run();
     }
 }
开发者ID:cg123,项目名称:xenko,代码行数:7,代码来源:SimpleParticlesApp.cs


示例4: CheckTextureFormat

 private static void CheckTextureFormat(Game game, string textureUrl, AlphaFormat expectedFormat)
 {
     var expectedPixelFormat = PlaformAndAlphaToPixelFormats[Tuple.Create(Platform.Type, expectedFormat)];
     var texture = game.Asset.Load<Texture>(textureUrl);
     Assert.AreEqual(expectedPixelFormat, texture.Format);
     game.Asset.Unload(texture);
 }
开发者ID:hsabaleuski,项目名称:paradox,代码行数:7,代码来源:AutoAlphaTests.cs


示例5: TestScriptAudioAccessImpl

 private static void TestScriptAudioAccessImpl(Game game)
 {
     using (var script = new ScriptClass(game.Services))
     {
         Assert.DoesNotThrow(() => script.AccessAudioService(), "Access to the audio service failed.");
         Assert.IsTrue(script.AudioServiceNotNull(), "The Audio service is null.");
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:8,代码来源:TestScriptContext.cs


示例6: TestInitializeAudioEngine

 private void TestInitializeAudioEngine(Game game)
 {
     var audio = game.Audio;
     AudioEngine audioEngine = null;
     Assert.DoesNotThrow(()=>audioEngine = audio.AudioEngine, "Failed to get the AudioEngine");
     Assert.IsNotNull(audioEngine, "The audio engine is null");
     Assert.IsFalse(audioEngine.IsDisposed, "The audio engine is disposed");
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:8,代码来源:TestAudioSystem.cs


示例7: EntityPositionUpdate

        private void EntityPositionUpdate(Game game, int loopCount, int loopCountSum)
        {
            rootSubEntity1.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
            rootSubEntity2.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);

            listComp1Entity.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
            listComp2Entity.Transform.Position -= new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:8,代码来源:TestAudioListenerProcessor.cs


示例8: OneLoopTurnActionAftUpdate

            public void OneLoopTurnActionAftUpdate(Game game)
            {
                if (oneLoopTurnActionAftUpdate != null)
                    oneLoopTurnActionAftUpdate(game, loopCount, loopCountSum);

                ++loopCount;
                loopCountSum += loopCount;
            }
开发者ID:cg123,项目名称:xenko,代码行数:8,代码来源:TestUtilities.cs


示例9: TestSoundMusicLoadingImpl

 private static void TestSoundMusicLoadingImpl(Game game)
 {
     SoundMusic sound = null;
     Assert.DoesNotThrow(() => sound = game.Content.Load<SoundMusic>("EffectBip"), "Failed to load the SoundMusic.");
     Assert.IsNotNull(sound, "The SoundMusic loaded is null.");
     sound.Play();
     // Should hear the sound here.
 }
开发者ID:cg123,项目名称:xenko,代码行数:8,代码来源:TestAssetLoading.cs


示例10: Main

 static void Main(string[] args)
 {
     // Profiler.EnableAll();
     using (game = new Game())
     {
         game.GraphicsDeviceManager.DeviceCreated += GraphicsDeviceManager_DeviceCreated;
         game.Run();
     }
 }
开发者ID:EmptyKeys,项目名称:UI_Examples,代码行数:9,代码来源:BasicUI_XenkoApp.cs


示例11: LiveAssemblyReloader

 public LiveAssemblyReloader(Game game, AssemblyContainer assemblyContainer, List<Assembly> assembliesToUnregister, List<Assembly> assembliesToRegister)
 {
     if (game != null)
         this.entities.AddRange(game.SceneSystem.SceneInstance);
     this.game = game;
     this.assemblyContainer = assemblyContainer;
     this.assembliesToUnregister = assembliesToUnregister;
     this.assembliesToRegister = assembliesToRegister;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:9,代码来源:LiveAssemblyReloader.cs


示例12: TestSoundMusicLoadingImpl

 private static void TestSoundMusicLoadingImpl(Game game)
 {
     Sound sound = null;
     Assert.DoesNotThrow(() => sound = game.Content.Load<Sound>("EffectBip"), "Failed to load the SoundMusic.");
     Assert.IsNotNull(sound, "The SoundMusic loaded is null.");
     testInstance = sound.CreateInstance(game.Audio.AudioEngine.DefaultListener);
     testInstance.Play();
     // Should hear the sound here.
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:9,代码来源:TestAssetLoading.cs


示例13: TestAccessToAudio

 public void TestAccessToAudio()
 {
     using (var game = new Game())
     {
         AudioSystem audioInterface = null;
         Assert.DoesNotThrow(()=>audioInterface = game.Audio, "Failed to get the audio interface");
         Assert.IsNotNull(audioInterface, "The audio interface supplied is null");
     }
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:9,代码来源:TestGame.cs


示例14: Start

        public override void Start()
        {
            IsRunning = true;

            UIGame = (Game)Services.GetServiceAs<IGame>();

            AdjustVirtualResolution(this, EventArgs.Empty);
            Game.Window.ClientSizeChanged += AdjustVirtualResolution;

            CreateScene();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:11,代码来源:UISceneBase.cs


示例15: TestAddAudioSysThenEntitySysSetup

        private void TestAddAudioSysThenEntitySysSetup(Game game)
        {
            var audio = game.Audio;

            BuildEntityHierarchy();
            CreateAndComponentToEntities();

            audio.AddListener(listComp1);
            audio.AddListener(listComp2);

            listComp2Entity.Transform.RotationEulerXYZ = new Vector3((float)Math.PI/2,0,0);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:12,代码来源:TestAudioListenerProcessor.cs


示例16: TestAttachDetachSounds

        public void TestAttachDetachSounds()
        {
            var testInst = new AudioEmitterComponent();
            using (var game = new Game())
            {
                Game.InitializeAssetDatabase();
                using (var audioStream1 = AssetManager.FileProvider.OpenStream("EffectToneA", VirtualFileMode.Open, VirtualFileAccess.Read))
                using (var audioStream2 = AssetManager.FileProvider.OpenStream("EffectBip", VirtualFileMode.Open, VirtualFileAccess.Read))
                using (var audioStream3 = AssetManager.FileProvider.OpenStream("EffectStereo", VirtualFileMode.Open, VirtualFileAccess.Read))
                {
                    var sound1 = SoundEffect.Load(game.Audio.AudioEngine, audioStream1);
                    var sound2 = SoundEffect.Load(game.Audio.AudioEngine, audioStream2);
                    var sound3 = SoundEffect.Load(game.Audio.AudioEngine, audioStream3);

                    // Attach two soundEffect and check that their controller are correctly created.

                    AudioEmitterSoundController soundController1 = null;
                    AudioEmitterSoundController soundController2 = null;
                    Assert.DoesNotThrow(() => testInst.AttachSoundEffect(sound1), "Adding a first soundEffect failed");
                    Assert.DoesNotThrow(() => soundController1 = testInst.SoundEffectToController[sound1], "There are no sound controller for sound1.");
                    Assert.IsNotNull(soundController1, "Sound controller for sound1 is null");

                    Assert.DoesNotThrow(() => testInst.AttachSoundEffect(sound2), "Adding a second soundEffect failed");
                    Assert.DoesNotThrow(() => soundController2 = testInst.SoundEffectToController[sound2], "There are no sound controller for sound1.");
                    Assert.IsNotNull(soundController2, "Sound controller for sound2 is null");

                    // Remove the two soundEffect and check that their controller are correctly erased.

                    Assert.DoesNotThrow(() => testInst.DetachSoundEffect(sound2), "Removing a first soundEffect failed");
                    Assert.IsFalse(testInst.SoundEffectToController.ContainsKey(sound2), "The controller for sound2 is still present in the list.");

                    Assert.DoesNotThrow(() => testInst.DetachSoundEffect(sound1), "Removing a second soundEffect failed");
                    Assert.IsFalse(testInst.SoundEffectToController.ContainsKey(sound1), "The controller for sound1 is still present in the list.");

                    Assert.IsTrue(testInst.SoundEffectToController.Keys.Count == 0, "There are some controller left in the component list.");

                    // Check the exception thrwon by attachSoundEffect.

                    Assert.Throws<ArgumentNullException>(() => testInst.AttachSoundEffect(null), "AttachSoundEffect did not throw ArgumentNullException");
                    Assert.Throws<InvalidOperationException>(() => testInst.AttachSoundEffect(sound3), "AttachSoundEffect did not throw InvalidOperationException.");

                    // Check the exception thrown by detachSoundEffect.

                    Assert.Throws<ArgumentNullException>(() => testInst.DetachSoundEffect(null), "DetachSoundEffect did not throw ArgumentNullException.");
                    Assert.Throws<ArgumentException>(() => testInst.DetachSoundEffect(sound1), "DetachSoundEffect did not throw ArgumentException ");
                }
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:48,代码来源:TestAudioEmitterComponent.cs


示例17: AddSoundEffectToEmitterComponents

        private void AddSoundEffectToEmitterComponents(Game game)
        {
            sounds = new List<SoundEffect>
                {
                    game.Content.Load<SoundEffect>("EffectBip"),
                    game.Content.Load<SoundEffect>("EffectToneA"),
                };

            emitComps[0].AttachSoundEffect(sounds[0]);
            emitComps[0].AttachSoundEffect(sounds[1]);

            soundControllers = new List<AudioEmitterSoundController>
                {
                    emitComps[0].GetSoundEffectController(sounds[0]),
                    emitComps[0].GetSoundEffectController(sounds[1]),
                };

            mainController = soundControllers[0];
        }
开发者ID:cg123,项目名称:xenko,代码行数:19,代码来源:TestController.cs


示例18: AddListenersToAudioSystem

 /// <summary>
 /// Add all the <see cref="AudioListenerComponent"/> to the <see cref="AudioSystem"/>.
 /// </summary>
 /// <param name="game"></param>
 private void AddListenersToAudioSystem(Game game)
 {
     foreach (var t in listComps)
         game.Audio.AddListener(t);
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:9,代码来源:TestAudioEmitterProcessor.cs


示例19: AddRootEntityToEntitySystem

 /// <summary>
 /// Add the root entity to the entity system
 /// </summary>
 /// <param name="game"></param>
 private void AddRootEntityToEntitySystem(Game game)
 {
     throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); // game.Entities.Add(rootEntity);
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:8,代码来源:TestAudioEmitterProcessor.cs


示例20: TestMulteListenerUpdate

        private void TestMulteListenerUpdate(Game game, int loopCount, int loopCountSum)
        {
            throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
            //var matchingEntities = game.Entities.Processors.OfType<AudioEmitterProcessor>().First().MatchingEntitiesForDebug;

            //var dataComp1 = matchingEntities[compEntities[0]];

            //if (loopCount == 0)
            //{
            //    soundControllers[0].Play();
            //}
            //else if (loopCount < 10)
            //{
            //    // check that the two instances are correctly create and playing
            //    var tupple1 = Tuple.Create(listComps[0], soundControllers[0]);
            //    var tupple2 = Tuple.Create(listComps[1], soundControllers[0]);
                
            //    Assert.IsTrue(dataComp1.ListenerControllerToSoundInstance.ContainsKey(tupple1));
            //    Assert.IsTrue(dataComp1.ListenerControllerToSoundInstance.ContainsKey(tupple2));

            //    var instance1 = dataComp1.ListenerControllerToSoundInstance[tupple1];
            //    var instance2 = dataComp1.ListenerControllerToSoundInstance[tupple2];

            //    Assert.AreEqual(SoundPlayState.Playing, instance1.PlayState);
            //    Assert.AreEqual(SoundPlayState.Playing, instance2.PlayState);
            //}
            //else
            //{
            //    game.Exit();
            //}
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:31,代码来源:TestAudioEmitterProcessor.cs



注:本文中的SiliconStudio.Xenko.Engine.Game类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Games.GameTime类代码示例发布时间:2022-05-26
下一篇:
C# TextureConverter.TexImage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap