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


C# SoundEffectInstance.Resume方法代码示例

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


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

示例1: MouseClicked


//.........这里部分代码省略.........
                    player.Health = player.MaxHealth;
                    player.Stamina = 100;
                    wepUnl = "";
                    player.Weapon = Shooting.weapons[1];
                    player.FrameLevel = 1;
                    currentLevel = 1;
                    enemies.Clear();
                    Items.Clear();
                    projectiles.Clear();
                    timer = 0;
                    gameState = "LevelSwitch";
                    CheckGameState();
                }
            }
               //puased screen
               else if (gameState == "Paused") {
                if (mouseClickRect.Intersects(exitbuttonRect)) {
                    saveLevelClears();
                    song.Stop();
                    songPlaying = false;
                    gameState = "StartMenu";
                    CheckGameState();
                } else if (mouseClickRect.Intersects(optionsButtonPosition)) {
                    try {
                        gameState = "OptionsMenu";
                        lastState = "Paused";
                        CheckGameState();
                    } catch (GameStateNotFoundException e) {
                        Console.WriteLine(e.ToString());
                        gameState = "";
                    }
                } else if (mouseClickRect.Intersects(resumeButtonPosition)) {
                    try {
                        song.Resume();
                        gameState = "Playing";
                        CheckGameState();
                    } catch (GameStateNotFoundException e) {
                        Console.WriteLine(e.ToString());
                        gameState = "";
                    }
                }
            }

            //options screen method
            else if (gameState == "OptionsMenu") {
                // back button clicked
                if (mouseClickRect.Intersects(backButtonPosition)) {
                    try {
                        gameState = lastState;
                        CheckGameState();
                    } catch (GameStateNotFoundException e) {
                        Console.WriteLine(e.ToString());
                        gameState = "";
                        lastState = "";
                    }
                }
                // sounds button clicked
                else if (mouseClickRect.Intersects(soundsButtonPosition)) {
                    try {
                        gameState = "SoundsMenu";
                    } catch (GameStateNotFoundException e) {
                        Console.WriteLine(e.ToString());
                        gameState = "";
                    }
                }
                // graphics button clicked
开发者ID:JoeyTheAsian,项目名称:Just-Force,代码行数:67,代码来源:GameStateManager.cs

示例2: updateState

 public bool updateState(KeyboardState State, KeyboardState oldState, ref bool songPlaying, ref SoundEffectInstance song) {
     if (gameState == "Playing" && State.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)) {
         try {
             song.Pause();
             gameState = "Paused";
             CheckGameState();
         } catch (GameStateNotFoundException e) {
             Console.WriteLine(e.ToString());
             gameState = "";
         }
         return false;
     } else if (gameState == "Paused") {
         if (State.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)) {
             try {
                 song.Resume();
                 gameState = "Playing";
                 CheckGameState();
             } catch (GameStateNotFoundException e) {
                 Console.WriteLine(e.ToString());
                 gameState = "";
             }
         }
         return false;
     }
     if (gameState == "Loading" && isLoading) {
         isLoading = true;
         return true;
     }
     return false;
 }
开发者ID:JoeyTheAsian,项目名称:Just-Force,代码行数:30,代码来源:GameStateManager.cs

示例3: playSoundLoop

        public static void playSoundLoop(string filename, ContentManager Content)
        {
            int index = 1;
                if (loopInstance != null)
                    loopInstance.Stop();
                if (lookUpTable.ContainsKey(filename))
                {

                    lookUpTable.TryGetValue(filename, out index);
                    loopInstance = mySounds.ElementAt(index);
                    if (loopInstance.State == SoundState.Paused)
                    {
                        loopInstance.Resume();
                    }
                    else if (loopInstance.State == SoundState.Stopped)
                    {
                        loopInstance.Play();
                    }
                }
                else
                {
                    soundEngine = Content.Load<SoundEffect>(filename);
                    loopInstance = soundEngine.CreateInstance();
                    mySounds.Add(loopInstance);

                    lookUpTable.Add(filename, numSounds);
                    numSounds++;
                    loopInstance.IsLooped = true;
                    loopInstance.Volume = 0.5f;
                    loopInstance.Play();
                }
        }
开发者ID:foolmoron,项目名称:Rolling,代码行数:32,代码来源:Sound.cs


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