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


C# Game.Pause方法代码示例

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


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

示例1: TestEventsRaised

        public void TestEventsRaised()
        {
            string started = "Started", paused = "Paused", resumed = "Resumed", stopped = "Stopped";

            List<string> receivedEvents = new List<string>();
            Game game = new Game(80, 20, 1, 1, new Point(40, 0));

            game.GameStartedEvent += () =>
            {
                receivedEvents.Add(started);
            };
            game.GamePausedEvent += () =>
            {
                receivedEvents.Add(paused);
            };
            game.GameResumedEvent += () =>
            {
                receivedEvents.Add(resumed);
            };
            game.GameStoppedEvent += () =>
            {
                receivedEvents.Add(stopped);
            };
            game.Start();
            game.Pause();;
            game.Resume();
            game.Stop();

            Assert.AreEqual(4, receivedEvents.Count);
            Assert.AreEqual(started, receivedEvents[0]);
            Assert.AreEqual(paused, receivedEvents[1]);
            Assert.AreEqual(resumed, receivedEvents[2]);
            Assert.AreEqual(stopped, receivedEvents[3]);
        }
开发者ID:songsinh88,项目名称:ZigZag-Game,代码行数:34,代码来源:GameTest.cs

示例2: ShouldPauseGameAndGrid

    public void ShouldPauseGameAndGrid()
    {
        IGrid gridMock = Substitute.For<IGrid>();

        Game game = new Game(gridMock, testSetting);

        game.OnUpdate();
        gridMock.Received().OnUpdate();
        gridMock.ClearReceivedCalls();

        game.Pause();
        game.OnUpdate();
        gridMock.DidNotReceive().OnUpdate();
    }
开发者ID:Mojopon,项目名称:ThreeSeven,代码行数:14,代码来源:GameTest.cs

示例3: TestPause_WrongStatus_2

 public void TestPause_WrongStatus_2()
 {
     Game game = new Game(80, 40, 1, 1, new Point(40, 0));
     game.GameStartedEvent += () => { };
     game.GamePausedEvent += () => { };
     game.Start();
     game.Pause();
     game.Pause();
 }
开发者ID:songsinh88,项目名称:ZigZag-Game,代码行数:9,代码来源:GameTest.cs

示例4: TestUsualLifecycle

 public void TestUsualLifecycle()
 {
     Game game = new Game(80, 40, 1, 1, new Point(40, 0));
     game.GameStartedEvent += () => { };
     game.GamePausedEvent += () => { };
     game.GameResumedEvent += () => { };
     game.GameStoppedEvent += () => { };
     Assert.AreEqual(GameStatus.ReadyToStart, game.Status);
     game.Start();
     Assert.AreEqual(GameStatus.InProgress, game.Status);
     game.Pause();
     Assert.AreEqual(GameStatus.Paused, game.Status);
     game.Resume();
     Assert.AreEqual(GameStatus.InProgress, game.Status);
     game.Stop();
     Assert.AreEqual(GameStatus.Completed, game.Status);
 }
开发者ID:songsinh88,项目名称:ZigZag-Game,代码行数:17,代码来源:GameTest.cs

示例5: TestUninitializedStopEvent

 public void TestUninitializedStopEvent()
 {
     Game game = new Game(80, 20, 1, 1, new Point(40, 0));
     game.GameStartedEvent += () => { };
     game.GamePausedEvent += () => { };
     game.GameResumedEvent += () => { };
     game.Start();
     game.Pause();
     game.Resume();
     game.Stop();
 }
开发者ID:songsinh88,项目名称:ZigZag-Game,代码行数:11,代码来源:GameTest.cs


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