예제 #1
0
        protected void OnCellClick(object sender, EventArgs args)
        {
            ReversiCell cell = (ReversiCell)sender;

            if (CellClick != null)
            {
                CellClick(cell.x, cell.y);
            }
        }
예제 #2
0
 public void UpdateBoard()
 {
     for (int x = 0; x < board.Width; ++x)
     {
         for (int y = 0; y < board.Height; ++y)
         {
             ReversiCell cell = this.cells[x, y];
             cell.SetColor(board[x, y]);
         }
     }
     Invalidate();
 }
    IEnumerator BlackAiThinking(int cell_X, int cell_Y, ReversiCell cell)
    {
        yield return(new WaitForSeconds(1.0f));

        cell.ReversiCellState = ReversiCell.ReversiCellStates.Black;
        AddTurnOverCells(cell_X, cell_Y, cell.ReversiCellState);
        foreach (var item in PlaceableList)
        {
            if (item.m_cell_X == cell.m_cell_X && item.m_cell_Y == cell.m_cell_Y)
            {
                continue;
            }
            item.isWhitePlaceable = false;
            item.isBlackPlaceable = false;
        }
        yield return(new WaitForSeconds(1.0f));

        cell.isWhitePlaceable = false;
        cell.isBlackPlaceable = false;
        m_turnState           = TurnState.WhiteTurn;
        isChecked             = true;
    }
예제 #4
0
        private void CreateCells()
        {
            int image_width  = none_image.Width;
            int image_height = none_image.Height;

            cells = new ReversiCell[board.Width, board.Height];
            this.Controls.Clear();
            for (int x = 0; x < board.Width; ++x)
            {
                for (int y = 0; y < board.Height; ++y)
                {
                    ReversiCell cell = new ReversiCell(x, y, this);
                    cell.Location = new Point(image_width * x, image_height * y);
                    cell.Size     = new Size(image_width, image_height);
                    cell.SetColor(board[x, y]);
                    cell.Click += new EventHandler(OnCellClick);
                    this.Controls.Add(cell);
                    this.cells[x, y] = cell;
                }
            }
            this.Width  = board.Width * image_width;
            this.Height = board.Height * image_height;
        }
예제 #5
0
		private void CreateCells()
		{
			int image_width  = none_image.Width;
			int image_height = none_image.Height;

			cells = new ReversiCell[board.Width, board.Height];
			this.Controls.Clear();
			for(int x=0; x<board.Width; ++x)
				for(int y=0; y<board.Height; ++y)
				{
					ReversiCell cell = new ReversiCell(x, y, this);
					cell.Location = new Point(image_width*x, image_height*y);
					cell.Size = new Size(image_width, image_height);
					cell.SetColor(board[x, y]);
					cell.Click += new EventHandler(OnCellClick);
					this.Controls.Add(cell);
					this.cells[x,y] = cell;
				}
			this.Width = board.Width * image_width;
			this.Height = board.Height * image_height;
		}