public Chessponit() { chessIDInt = 0; leftUpChesspoint = null; upChesspoint = null; rightChesspoint = null; leftChesspoint = null; rightChesspoint = null; leftDownChesspoint = null; downChesspoint = null; rightDownChesspoint = null; }
/// <summary> /// 创建/初始化棋盘(给棋盘上每个点赋值定义) /// </summary> private void createChessBoard() { #region 初始化棋盘可行走的点的属性,并配置各个点之间的关联性 //绑定棋盘上的点到此类中 this.leftUpChesspoint = new Chessponit(); this.rightUpChesspoint = new Chessponit(); this.MiddleChesspoint = new Chessponit(); this.leftDownChesspoint = new Chessponit(); this.rightDownChesspoint = new Chessponit(); //1 this.leftUpChesspoint.ChessIDInt = 1; this.leftUpChesspoint.DownChesspoint = this.leftDownChesspoint; this.leftUpChesspoint.RightDownChesspoint = this.MiddleChesspoint; this.leftUpChesspoint.ChessPoint = new Point(INDEX_X - CHESS_WIDTH / 2, INDEX_Y - CHESS_HEIGHT / 2); //2 this.rightUpChesspoint.ChessIDInt = 2; this.rightUpChesspoint.LeftDownChesspoint = this.MiddleChesspoint; this.rightUpChesspoint.DownChesspoint = this.rightDownChesspoint; this.rightUpChesspoint.ChessPoint = new Point(INDEX_X + CHESS_BOARD_WIDTH - CHESS_WIDTH / 2, INDEX_Y - CHESS_HEIGHT / 2); //3 this.MiddleChesspoint.LeftUpChesspoint = this.leftUpChesspoint; this.MiddleChesspoint.RightUpChesspoint = this.rightUpChesspoint; this.MiddleChesspoint.LeftDownChesspoint = this.leftDownChesspoint; this.MiddleChesspoint.RightDownChesspoint = this.rightDownChesspoint; this.MiddleChesspoint.ChessPoint = new Point(INDEX_X + CHESS_BOARD_WIDTH / 2 - CHESS_WIDTH / 2, INDEX_Y + CHESS_BOARD_WIDTH / 2 - CHESS_HEIGHT / 2); //4 this.leftDownChesspoint.ChessIDInt = 3; this.leftDownChesspoint.UpChesspoint = this.leftUpChesspoint; this.leftDownChesspoint.RightUpChesspoint = this.MiddleChesspoint; this.leftDownChesspoint.RightChesspoint = this.rightDownChesspoint; this.leftDownChesspoint.ChessPoint = new Point(INDEX_X - CHESS_WIDTH / 2, INDEX_Y + CHESS_BOARD_WIDTH - CHESS_HEIGHT / 2); //5 this.rightDownChesspoint.ChessIDInt = 4; this.rightDownChesspoint.UpChesspoint = this.rightUpChesspoint; this.rightDownChesspoint.LeftUpChesspoint = this.MiddleChesspoint; this.rightDownChesspoint.LeftChesspoint = this.leftDownChesspoint; this.rightDownChesspoint.ChessPoint = new Point(INDEX_X + CHESS_BOARD_WIDTH - CHESS_WIDTH / 2, INDEX_Y + CHESS_BOARD_WIDTH - CHESS_HEIGHT / 2); #endregion }