//USER INTERACTION #region User Interaction protected override void OnMouseMove(MouseEventArgs e) { Cursor = Cursors.Arrow; MouseOverCell = MouseLoc2Cell(e.Location); Cursor = Game.CanHumanGo(MouseOverCell) ? Cursors.Hand : Cursors.Arrow; Refresh(); }
protected override void OnMouseClick(MouseEventArgs e) { MouseOverCell = MouseLoc2Cell(e.Location); if (Game.CanHumanGo(MouseOverCell)) { Game.HumanMove(MouseOverCell); } }
private void DrawCells(Graphics g) { for (int i = 0; i < Game.Size.Width; i++) { for (int j = 0; j < Game.Size.Height; j++) { Cell cCell = new Cell(i, j); Game.Mark cCellMark = Game.BoardState[i, j]; if (cCellMark == Game.Mark.None) { if (MouseOverCell.Equals(cCell) && Game.State == Game.GameState.Ongoing && Game.CanHumanGo(cCell)) { DrawMark(g, Game.PlayerOnTurn, cCell, true, false, 1f); } } else { bool last = Game.BoardState.LastO.Equals(cCell) || Game.BoardState.LastX.Equals(cCell); DrawMark(g, cCellMark, cCell, false, last, Game.BoardState.Completion(cCell)); } } } }