static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); OtheloUI othello = new OtheloUI(); othello.RunGame(); }
private void OnClick(object sender, EventArgs e) { this.moveOnClick(sender, e); this.DrawBoard(OtheloUI.m_GameEngine.Board); if (OtheloUI.menuSelection == 2) { this.moveOnClick(sender, e); } OtheloUI.GameNextMoves(); this.Refresh(); }
private void moveOnClick(object sender, EventArgs e) { Button button = sender as Button; int i = this.buttonOnBoardList.IndexOf(button); int n = OtheloBoard.BoardSize; this.playerPoint.X = i / n; this.playerPoint.Y = i % n; OtheloUI.GameMoves(playerPoint); this.buttonOnBoardList[i].Enabled = false; if (OtheloUI.isPlayerOne) { this.buttonOnBoardList[i].BackgroundImage = this.blackPiecePicture; this.buttonOnBoardList[i].BackgroundImageLayout = ImageLayout.Stretch; this.Text = "Othello - Whites's Turn (" + OtheloUI.m_GameEngine.Player2.PlayerName + ")"; } else { if (OtheloUI.menuSelection == 1) { this.buttonOnBoardList[i].BackgroundImage = this.whitePiecePicture; this.buttonOnBoardList[i].BackgroundImageLayout = ImageLayout.Stretch; } else if (OtheloUI.menuSelection == 2) { this.pcMove.Show(); this.Refresh(); System.Threading.Thread.Sleep(1000); this.pcMove.Hide(); } this.Text = "Othello - Black's Turn (" + OtheloUI.m_GameEngine.Player1.PlayerName + ")"; } OtheloUI.isPlayerOne = !OtheloUI.isPlayerOne; this.Refresh(); }
private void buttonPlayVsHuman_Click(object sender, EventArgs e) { this.Hide(); OtheloUI.StartPlay(OtheloBoard.BoardSize, 1); }