当前位置: 首页>>代码示例>>C#>>正文


C# Cue.Stop方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Audio.Cue.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Cue.Stop方法的具体用法?C# Cue.Stop怎么用?C# Cue.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Audio.Cue的用法示例。


在下文中一共展示了Cue.Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SoundManager

 private SoundManager()
 {
     _audioEngine = new AudioEngine("Content/Sounds/TetrisGame.xgs");
     _waveBank = new WaveBank(_audioEngine, "Content/Sounds/WaveBank.xwb");
     _soundBank = new SoundBank(_audioEngine, "Content/Sounds/SoundBank.xsb");
     _audioEngine.Update();
     _currentMusic = _soundBank.GetCue("m_Silence");
     _currentMusic.Stop(AudioStopOptions.Immediate);
     _currentSounds = new Cue[20];
     SetMusicVolume(100);
     SetSoundVolume(100);
 }
开发者ID:kavengagne,项目名称:TetrisGame,代码行数:12,代码来源:SoundManager.cs

示例2: GameOverScreen

        public GameOverScreen(PlayerIndex p1Index, PlayerIndex? p2Index, Player p1, Player p2, Cue actionBgm)
            : base("Game Over")
        {
            this.p1Index = p1Index;
            this.p2Index = p2Index;
            this.p1 = p1;
            this.p2 = p2;

            if (actionBgm.IsPlaying) actionBgm.Stop(AudioStopOptions.Immediate);

            MenuEntry share = new MenuEntry("Share Highscore");
            MenuEntry restart = new MenuEntry("Restart Game");
            MenuEntry back = new MenuEntry("Exit to Menu");

            share.Selected += ShareSelected;
            restart.Selected += RestartSelected;
            back.Selected += BackSelected;

            MenuEntries.Add(restart);
            MenuEntries.Add(share);
            MenuEntries.Add(back);
        }
开发者ID:rossmas,项目名称:zomination,代码行数:22,代码来源:GameOverScreen.cs

示例3: Restart

        public void Restart()
        {
            firstPlayerHasJoined = false;
            App.Instance.Model.AddPlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnAddPlayer);
            App.Instance.Model.RemovePlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnRemovePlayer);
            App.Instance.Model.NewEnemy += new EventHandler<SurfaceTower.Model.EventArguments.EnemyArgs>(OnNewEnemy);
            App.Instance.Model.Tower.ZeroHealth += new EventHandler(Tower_ZeroHealth);

            heartbeatCue = soundBank.GetCue("Hearbeat");
            introCue = soundBank.GetCue("Intro");
            introCue.Play();

            audioEngine.GetCategory("Music").SetVolume(MelodyPlayer.musicVolume);
            audioEngine.GetCategory("Drums").SetVolume(DrumPlayer.drumVolume);
            
            if(heartbeatCue.IsPlaying)
                heartbeatCue.Stop(AudioStopOptions.Immediate);

            if(heartbeatOnlyMode)
                heartbeatOnlyMode = false;

            if (outroCue != null && outroCue.IsPlaying)
                outroCue.Stop(AudioStopOptions.Immediate);
        }
开发者ID:Daniel-Nichol,项目名称:ox-g1-surface,代码行数:24,代码来源:EffectPlayer.cs

示例4: Update

        public virtual void Update(DodgerX gameobject, GameTime gameTime)
        {
            if (prevmousestate == null) prevmousestate = Mouse.GetState();
            ElapseCounter += gameTime.ElapsedGameTime;
            if (ElapseCounter > SpawnObjectDelay)
            {

                ElapseCounter = ElapseCounter - SpawnObjectDelay;
                for (int i = 0; i < 2; i++)
                {
                    AttackingObject ao = new AttackingObject(new Vector2(0, 0), new Vector2(0, 0),
                                                             gameobject.attackerTexture);
                    ao.SetRandomStartPosition(gameobject, 8);

                    grd.Attackers.Add(ao);
                }

            }
            _grd.Update(gameobject, gameTime);
            MenuSelect = DodgerX.soundBank.GetCue("MenuSel");
            //Update the selected item based on the mouse position.
            MenuStateItem foundhit = null;
            foreach (var msi in MenuItems)
            {

                if (msi.HitTest(gameobject, new Vector2(Mouse.GetState().X, Mouse.GetState().Y)))
                {
                    foundhit = msi;
                    break;
                }

            }
            if (SelectedItem != foundhit)
            {
                if (MenuSelect.IsPlaying) MenuSelect.Stop(AudioStopOptions.AsAuthored);
                try
                {
                    MenuSelect.Play();
                } catch
                {
                }
            }
            SelectedItem = foundhit;
            Debug.Print("SelectedItem is now " + (SelectedItem==null?"Null":SelectedItem.Caption));

            if (SelectedItem != null)
            {

                if (Mouse.GetState().LeftButton == ButtonState.Pressed && prevmousestate.Value.LeftButton==ButtonState.Released)
                {

                    //gameobject.CurrentState = SelectedItem.AdvanceState;
                    InvokeClick(SelectedItem,gameobject);
                    SelectedItem.AdvanceRoutine(SelectedItem, gameobject);

                }

            }

            prevmousestate = Mouse.GetState();
        }
开发者ID:BCProgramming,项目名称:DodgerX,代码行数:61,代码来源:MenuState.cs

示例5: stopCue

 /// <summary>
 /// Stops a sound immediately.
 /// </summary>
 /// <param name="cue">The handle of the sound to stop.</param>
 public static void stopCue(Cue cue)
 {
     cue.Stop(AudioStopOptions.Immediate);
 }
开发者ID:BNHeadrick,项目名称:Bros,代码行数:8,代码来源:SoundEngine.cs

示例6: ChangeGameState

        public void ChangeGameState(GameState state, int level)
        {
            currentGameState = state;
            CancelPowerUps();

            switch (currentGameState)
            {
                case GameState.LEVEL_CHANGE:
                    splashScreen.SetData("Level " + (level + 1),
                        GameState.LEVEL_CHANGE);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;

                    //Stop the sound track look
                    trackCue.Stop(AudioStopOptions.Immediate);
                    break;

                case GameState.PLAY:
                    modelManager.Enabled = true;
                    modelManager.Visible = true;
                    splashScreen.Enabled = false;
                    splashScreen.Visible = false;

                    if (trackCue.IsPlaying)
                        trackCue.Stop(AudioStopOptions.Immediate);

                    //To play a stopped cue, get the cue from the sound back a gian
                    trackCue = soundBank.GetCue("Tracks");
                    trackCue.Play();
                    break;

                case GameState.END:
                    splashScreen.SetData("Game Over.\nLevel: " + (level + 1) +
                        "\nScore: " + score, GameState.END);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;

                    //Stop the sound loop
                    trackCue.Stop(AudioStopOptions.Immediate);
                    break;

            }
        }
开发者ID:CS583,项目名称:3D-Game,代码行数:47,代码来源:Game1.cs

示例7: Stop

 public Cue Stop(Cue cue)
 {
     cue.Stop(AudioStopOptions.AsAuthored);
     return cue;
 }
开发者ID:bradleat,项目名称:trafps,代码行数:5,代码来源:Audio.cs

示例8: StopSound

        /// <summary>
        /// stops the sound
        /// </summary>
        /// <param name="cue">playing sound</param>
        public bool StopSound(Cue cue)
        {
            if (soundOn == false || cue == null)
                return false;

            if (cue.IsPaused || cue.IsPlaying)
            {
                cue.Stop(AudioStopOptions.Immediate);
                return true;
            }

            return false;
        }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:17,代码来源:SoundManager.cs

示例9: StopSound

 /// <summary>
 /// Immediatly stops the sound currently playing.
 /// </summary>
 /// <param name="cue">The sound to be stopped</param>
 public static void StopSound(Cue cue)
 {
     cue.Stop(AudioStopOptions.AsAuthored);
 }
开发者ID:Acemond,项目名称:PopNTouch,代码行数:8,代码来源:AudioController.cs

示例10: Stop

 /// <summary>
 /// Stops a previously playing cue
 /// </summary>
 /// <param name="cue">The cue to stop that you got returned from Play(sound)
 /// </param>
 public static void Stop(Cue cue)
 {
     if (cue != null)
     {
         cue.Stop(AudioStopOptions.Immediate);
     }
 }
开发者ID:JesterScribble,项目名称:MonoGame,代码行数:12,代码来源:Sound.cs

示例11: ChangeGameState

        public void ChangeGameState(GameState state, int level)
        {
            if(splashDelay < 0){
            currentGameState = state;
            CancelPowerUps();

            switch (currentGameState)
            {
                case GameState.START:
                    splashDelay = 10;
                    splashScreen.SetData("Welcome to space Defender!",
                        GameState.START);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;
                    startMenu.Visible = false;
                    startMenu.Enabled = false;
                    break;

                case GameState.LEVEL_CHANGE:
                    splashScreen.SetData("Level " + (level + 1),
                        GameState.LEVEL_CHANGE);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;

                    //Stop the sound track look
                    trackCue.Stop(AudioStopOptions.Immediate);
                    break;

                case GameState.PLAY:
                    modelManager.Enabled = true;
                    modelManager.Visible = true;
                    splashScreen.Enabled = false;
                    splashScreen.Visible = false;

                    if (trackCue.IsPlaying)
                        trackCue.Stop(AudioStopOptions.Immediate);

                    //To play a stopped cue, get the cue from the sound back a gian
                    trackCue = soundBank.GetCue("Tracks");
                    trackCue.Play();
                    break;

                case GameState.END:
                    splashScreen.SetData("Game Over.\nLevel: " + (level + 1) +
                        "\nScore: " + score, GameState.END);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;

                    //Stop the sound loop
                    trackCue.Stop(AudioStopOptions.Immediate);
                    break;

                case GameState.PAUSE:
                    splashScreen.SetData("Game Paused",
                        GameState.PAUSE);
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = true;
                    splashScreen.Visible = true;

                    //Stop the sound track look
                    trackCue.Stop(AudioStopOptions.Immediate);
                    break;

                case GameState.MENU:
                    splashDelay = 10;
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = false;
                    splashScreen.Visible = false;
                    startMenu.Visible = true;
                    startMenu.Enabled = true;
                    about.Visible = false;
                    about.Enabled = false;
                    instructions.Visible = false;
                    instructions.Enabled = false;
                    break;

                case GameState.ABOUT:
                    splashDelay = 10;
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
                    splashScreen.Enabled = false;
                    splashScreen.Visible = false;
                    startMenu.Visible = false;
                    startMenu.Enabled = false;
                    about.Visible = true;
                    about.Enabled = true;
                    break;

                case GameState.INSTRUCTIONS:
                    splashDelay = 10;
                    modelManager.Enabled = false;
                    modelManager.Visible = false;
//.........这里部分代码省略.........
开发者ID:CS583,项目名称:Final-Toches-for-Demo,代码行数:101,代码来源:Game1.cs

示例12: play

        /// <summary>
        /// Begin playing the music and beat tracking.
        /// </summary>
        public void play()
        {
            tick.Reset();
            ResetBeats();

            try
            {
            #if WINDOWS
                // System.Diagnostic.Debug.WriteLine("Playing: " + track.IsPlaying +
                    //"\n Stopped: " + track.IsStopped +
                    //"\n Stopping: " + track.IsStopping +
                    //"\n Prepared: " + track.IsPrepared +
                    //"\n Preparing: " + track.IsPreparing +
                    //"\n Created: " + track.IsCreated;
            #endif
                //if (!track.IsPlaying)//Sometimes track.IsPlaying is true although track.IsDisposed is also true
                {
                    track = soundBank.GetCue(currentTrack);
                    track.Play();
                }
            }
            catch (Exception e)
            {
                //System.Diagnostics.Debug.WriteLine(e.Message);
                if (track.IsPlaying)
                {
                    track.Stop(AudioStopOptions.Immediate);
                }
                track = soundBank.GetCue(currentTrack);
                while (track.IsPreparing)
                {
                }
                track.Play();
            }
            tick.Start();
            shouldPlay = true;
        }
开发者ID:Jamedjo,项目名称:BeatShift,代码行数:40,代码来源:SoundTrack.cs

示例13: Stop

 public void Stop(Cue cue)
 {
     cue.Stop(AudioStopOptions.Immediate);
 }
开发者ID:bsmr,项目名称:openc1,代码行数:4,代码来源:SoundEngine.cs

示例14: StopSoundMainSE

 private void StopSoundMainSE(string se)
 {
     if (engineSound2 != null)
     {
         engineSound2 = soundBank2.GetCue(se);
         engineSound2.Stop(AudioStopOptions.AsAuthored);
         waveBank2.Dispose();
         soundBank2.Dispose();
         engineSound2.Dispose();
         audioEngine.Update();
         engineSound2 = null;
     }
 }
开发者ID:utau1116b,项目名称:Hello-World,代码行数:13,代码来源:WindowsGameSound.cs

示例15: CloseSoundMain

 private void CloseSoundMain()
 {
     if (engineSound != null)
     {
         engineSound = soundBank.GetCue(bgmname);
         engineSound.Stop(AudioStopOptions.AsAuthored);
         waveBank.Dispose();
         soundBank.Dispose();
         engineSound.Dispose();
         audioEngine.Update();
     }
 }
开发者ID:utau1116b,项目名称:Hello-World,代码行数:12,代码来源:WindowsGameSound.cs


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