예제 #1
0
파일: Piece.cs 프로젝트: JasonBock/Quixo
		internal Piece(QF.Piece piece)
			: this()
		{
			this.InitializeComponent();
			this.SetStyle(ControlStyles.UserPaint |
				ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
			this.piece = piece;
		}
예제 #2
0
파일: Board.cs 프로젝트: JasonBock/Quixo
		private void InitializeBoard(QF.Board board, IEngine playerX, IEngine playerO)
		{
			int x = 0, y = 0;

			if (this.pieces != null)
			{
				for (x = 0; x < QF.Board.Dimension; x++)
				{
					for (y = 0; y < QF.Board.Dimension; y++)
					{
						if (this.pieces[x, y] != null)
						{
							this.Controls.Remove(this.pieces[x, y]);
						}
					}
				}
			}

			this.source = null;
			this.playerX = playerX;
			this.playerO = playerO;

			if (board == null)
			{
				this.board = new QF.Board();
			}
			else
			{
				this.board = board;
			}

			this.pieces = new Piece[QF.Board.Dimension, QF.Board.Dimension];

			for (x = 0; x < QF.Board.Dimension; x++)
			{
				for (y = 0; y < QF.Board.Dimension; y++)
				{
					Point point = new Point(x, y);
					Piece newPiece = new Piece(new QF.Piece(point, this.board.GetPiece(point)));
					newPiece.Selected += this.OnPieceSelected;

					this.pieces[x, y] = newPiece;
					this.Controls.Add(newPiece);
				}
			}

			this.UpdatePieceStates();
		}
예제 #3
0
파일: Board.cs 프로젝트: JasonBock/Quixo
		public void Reset(QF.Board board, IEngine playerX, IEngine playerO)
		{
			this.InitializeBoard(board, playerX, playerO);
			this.CheckForMoveGeneration();
			this.RedrawBoard();
		}