Exemplo n.º 1
0
        public Game(GameOptions options)
        {
            //Инициализация игрового поля.
            gameField = new Cell[Consts.MaxX][];
            for (int i = 0; i < Consts.MaxX; i++)
            {
                gameField[i] = new Cell[Consts.MaxY];
                for (int j = 0; j < Consts.MaxY; j++)
                    gameField[i][j] = Cell.cEmpty;
            }

            formField = new ViewField();
            formHistory = new ViewHistory();

            this.options = options;
        }
Exemplo n.º 2
0
        private void button_start_new_game_Click(object sender, EventArgs e)
        {
            clientScore = serverScore = 0;
            //инициализируем начальные игровые настройки и создаем игру
            GameOptions options = new GameOptions();
            options.ip = IPAddr.Text;
            options.port = Port.Text;
            options.playerType = radioButton_server.Checked ? PlayerType.ptServer : PlayerType.ptClient;
            options.gameForm = this;
            options.playerMark = radioButton_server.Checked ? Cell.cCircle : Cell.cCross;

            game = new Game(options);
            game.Start();
        }