本文整理汇总了C#中IBoard.ChangeBoardState方法的典型用法代码示例。如果您正苦于以下问题:C# IBoard.ChangeBoardState方法的具体用法?C# IBoard.ChangeBoardState怎么用?C# IBoard.ChangeBoardState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBoard
的用法示例。
在下文中一共展示了IBoard.ChangeBoardState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleRequest
/// <summary>
/// The implementation of the request handler dealing with coordinates outside of the board
/// </summary>
/// <param name="row">The passed int for row</param>
/// <param name="col">The passed int for column</param>
/// <param name="board">The current playing board</param>
public override void HandleRequest(int row, int col, IBoard board)
{
if (!board.IsInsideBoard(row, col))
{
board.ChangeBoardState(new Notification(GlobalMessages.OutOfBorders, BoardState.Pending));
}
else if (this.Successor != null)
{
this.Successor.HandleRequest(row, col, board);
}
}
示例2: HandleRequest
/// <summary>
/// The implementation of the request handler dealing with already revealed cells
/// </summary>
/// <param name="row">The row of the cell</param>
/// <param name="col">The column of the cell</param>
/// <param name="board">The current playing board</param>
public override void HandleRequest(int row, int col, IBoard board)
{
if (board.IsAlreadyShown(row, col))
{
board.ChangeBoardState(new Notification(GlobalMessages.CellAlreadyRevealed, BoardState.Pending));
}
else if (this.Successor != null)
{
this.Successor.HandleRequest(row, col, board);
}
}
示例3: HandleRequest
/// <summary>
/// The implementation of the request handler dealing with cells that contain bombs
/// </summary>
/// <param name="row">The row of the cell</param>
/// <param name="col">The column of the cell</param>
/// <param name="board">The current playing board</param>
public override void HandleRequest(int row, int col, IBoard board)
{
if (board.IsBomb(row, col))
{
board.ChangeBoardState(new Notification(GlobalMessages.GameOver, BoardState.Closed));
}
else if (this.Successor != null)
{
this.Successor.HandleRequest(row, col, board);
}
}
示例4: HandleRequest
/// <summary>
/// A method that checks whether the command is valid and deals with it or calls its successor to handle the request
/// </summary>
/// <param name="command">String with the incoming command</param>
/// <param name="board">The current playing board</param>
public override void HandleRequest(string command, IBoard board)
{
this.IsInvalid = false;
int row = -1;
int col = -1;
string trimmedCommand = command.Trim();
string[] commandComponents = trimmedCommand.Split(GlobalConstants.CommandParametersDivider);
if (commandComponents.Length < 2 || commandComponents.Length > 2)
{
this.IsInvalid = true;
}
else
{
bool rowIsNumeric = int.TryParse(commandComponents[0], out row);
bool colIsNumeric = int.TryParse(commandComponents[1], out col);
if (!(rowIsNumeric && colIsNumeric))
{
this.IsInvalid = true;
}
}
if (this.IsInvalid)
{
board.ChangeBoardState(new Notification(GlobalMessages.InvalidCommand, BoardState.Pending));
}
else if (this.Successor != null)
{
if (board.IsInsideBoard(row, col) && board.Cells[row, col].Content.Value == 0)
{
this.Accumulate(row, col, board);
// Reset list for next play command
this.visited.Clear();
}
else
{
this.Successor.HandleRequest(row, col, board);
}
}
base.HandleRequest(row, col, board);
base.HandleRequest(row + " " + col, board);
}
示例5: HandleRequest
/// <summary>
/// Method revealing the cell with the passed row and column and changing the board state
/// </summary>
/// <param name="row">The row of the cell</param>
/// <param name="col">The column of the cell</param>
/// <param name="board">The current playing board</param>
public override void HandleRequest(int row, int col, IBoard board)
{
board.RevealCell(row, col);
board.ChangeBoardState(new Notification(string.Empty, BoardState.Open));
}