當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。