本文整理汇总了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]);
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}