本文整理汇总了C#中IRenderable.PrintField方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderable.PrintField方法的具体用法?C# IRenderable.PrintField怎么用?C# IRenderable.PrintField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderable
的用法示例。
在下文中一共展示了IRenderable.PrintField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginGame
/// <summary>
/// Method that is responsible for communication between the user and the engine.
/// Handles user input and outputs game response.
/// </summary>
private void BeginGame(IRenderable render)
{
ScoreBoard scoreBoard = new ScoreBoard();
render.PrintField(this.gameField.GetFieldNumbers());
bool gameIsFinished = false;
int moves = 0;
string inputCommand = render.Read("give me command: ").Trim();
while (inputCommand != "exit")
{
switch (inputCommand)
{
case "top":
render.PrintScoreboard(scoreBoard.Scores());
break;
case "restart":
this.StartNewGame(render, true);
break;
default:
moves = MoveNumberIfValid(render, moves, inputCommand);
break;
}
render.PrintField(this.gameField.GetFieldNumbers());
gameIsFinished = this.gameField.IsSolved();
if (gameIsFinished)
{
string message = string.Format("Congratulations! You won the game in {0} moves.", moves);
render.Write(message);
this.AddUserToScoreBoard(scoreBoard, moves, render);
moves = 0;
this.StartNewGame(render);
}
inputCommand = render.Read("give me command: ").Trim();
}
}