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


C# Audio.Dispose方法代码示例

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


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

示例1: Check

 public bool Check()
 {
     try
     {
         Audio a = new Audio(this.FileName);
         a.Dispose();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
开发者ID:zhuangyy,项目名称:Motion,代码行数:13,代码来源:DirectXPlayer.cs

示例2: Run


//.........这里部分代码省略.........
                        }
                        break;
                    case GAME_SCENE:
                        if (bgm != null && !bgm.Playing)
                        {
                            bgm.Play();
                        }
                        switch (game.Tick(input.GetCurrentGameInput()))
                        {
                            case GameScene.NONE:
                                if (timer.ShouldRender() && video.CheckDrawable())
                                {
                                    video.Begin();
                                    video.DrawGameScene(game);
                                    video.DrawFps(timer.GetCurrentFps());
                                    video.End();
                                    video.Present();
                                }
                                sound.PlayGameSound(game);
                                break;
                            case GameScene.RESET_GAME:
                                sound.StopSounds();
                                game = stages[currentStageIndex].CreateGame();
                                break;
                            case GameScene.CLEAR_GAME:
                                sound.StopSounds();
                                currentStageIndex = (currentStageIndex + 1) % numStages;
                                game = stages[currentStageIndex].CreateGame();
                                break;
                            case GameScene.SELECT:
                                if (timer.ShouldRender() && video.CheckDrawable())
                                {
                                    video.Begin();
                                    video.DrawGameScene(game);
                                    video.DrawFps(timer.GetCurrentFps());
                                    video.End();
                                    video.Present();
                                }
                                sound.PlayGameSound(game);
                                select.CurrentStage = currentStageIndex;
                                state = SELECT_SCENE_GAME;
                                break;
                            case GameScene.GOTO_TITLE:
                                sound.StopSounds();
                                state = TITLE_SCENE;
                                break;
                        }
                        break;
                    case SELECT_SCENE_GAME:
                        game.Tick(GameInput.Empty);
                        {
                            int result = select.Tick(input.GetCurrentSelectInput());
                            switch (result)
                            {
                                case SelectScene.NONE:
                                    if (timer.ShouldRender() && video.CheckDrawable())
                                    {
                                        video.Begin();
                                        video.DrawGameScene(game);
                                        video.DrawSelectScene(select);
                                        video.DrawFps(timer.GetCurrentFps());
                                        video.End();
                                        video.Present();
                                    }
                                    sound.PlayGameSound(game);
                                    sound.PlaySelectSound(select);
                                    break;
                                case SelectScene.GOTO_TITLE:
                                    sound.StopSounds();
                                    state = TITLE_SCENE;
                                    break;
                                default:
                                    sound.StopSounds();
                                    game = stages[currentStageIndex = result].CreateGame();
                                    state = GAME_SCENE;
                                    break;
                            }
                        }
                        break;
                }
                Application.DoEvents();
                timer.Wait();
            }

            if (bgm != null)
            {
                if (bgm.Playing)
                {
                    bgm.Stop();
                }
                bgm.Dispose();
                bgm = null;
            }
            video.Dispose();
            video = null;
            sound.Dispose();
            sound = null;
            input.Dispose();
            input = null;
        }
开发者ID:sinshu,项目名称:mafia,代码行数:101,代码来源:MafiaApplication.cs


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