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


C# IBoard.ChangeBoardState方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:Minesweeper-1,项目名称:HQC-Team-Minesweeper-1,代码行数:17,代码来源:IsInsideBoardHandler.cs

示例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);
     }
 }
开发者ID:Minesweeper-1,项目名称:HQC-Team-Minesweeper-1,代码行数:17,代码来源:IsAlreadyShownHandler.cs

示例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);
     }
 }
开发者ID:Minesweeper-1,项目名称:HQC-Team-Minesweeper-1,代码行数:17,代码来源:IsBombHandler.cs

示例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);
        }
开发者ID:Minesweeper-1,项目名称:HQC-Team-Minesweeper-1,代码行数:50,代码来源:IsValidPlayCommandHandler.cs

示例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));
 }
开发者ID:Minesweeper-1,项目名称:HQC-Team-Minesweeper-1,代码行数:11,代码来源:RevealCellHandler.cs


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