Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
0
Indexable
Never
using System;
using System.Windows.Forms;
using TicTacToe;

public class GameModeForm : Form
{
    private Button localGameButton;
    private Button aiGameButton;
    private Game game;
    private GameMode gameMode;
    public GameModeForm(Game game)
    {
        this.game = game;
        this.Text = "Select Game Mode";
        this.Size = new Size(200, 200);

        localGameButton = new Button() { Text = "Local Game", Location = new Point(50, 30), Size = new Size(100, 30) };
        aiGameButton = new Button() { Text = "AI Game", Location = new Point(50, 70), Size = new Size(100, 30) };

        localGameButton.Click += LocalGameButton_Click;
        aiGameButton.Click += AIGameButton_Click;

        Controls.Add(localGameButton);
        Controls.Add(aiGameButton);
    }

    private void LocalGameButton_Click(object sender, EventArgs e)
    {
        game.SetGameMode(GameMode.Local);
        gameMode = GameMode.Local; // Přidáno
        this.Close();
    }



    private void AIGameButton_Click(object sender, EventArgs e)
    {
        game.SetGameMode(GameMode.AI);
        gameMode = GameMode.AI; // Přidáno
        this.Close();
    }

}