Exemplo n.º 1
0
        private void setupValues()
        {
            boatsOnBoard.Clear();
            setupBoardTable.Controls.Clear();
            playerDisplay.displayBoard();

            boatsListDataGrid.Rows.Clear();
            // set the DataGridView to the possible boats, also styles to rows, red not placed, green = placed
            boatsListDataGrid.RowsDefaultCellStyle.SelectionBackColor = Color.Transparent;
            boatsListDataGrid.DefaultCellStyle.SelectionForeColor     = Color.Black;

            for (int i = 0; i < GameLogic.possibleBoats.Count; i++)
            {
                boatsListDataGrid.Rows.Add(
                    GameLogic.possibleBoats[i].index,
                    GameLogic.possibleBoats[i].name,
                    GameLogic.possibleBoats[i].length,
                    GameLogic.possibleBoats[i].color.Name,
                    "Add",
                    "Remove");
                boatsListDataGrid.Rows[i].Cells["boatColorColumn"].Style.ForeColor = GameLogic.possibleBoats[i].color;
            }

            setDataGridStatus();
            boatsListDataGrid.Sort(boatsListDataGrid.Columns[1], ListSortDirection.Descending);
            boatsListDataGrid.ClearSelection();
            currentBoatIndex           = -1;
            placementStatusLabel.Text  = "";
            unselectBoatButton.Visible = false;
        }
Exemplo n.º 2
0
        private void setupValues()
        {
            playerDisplay.displayBoard();
            opponentDisplay.displayBoard();
            game = new GameLogic(gameType, AIDifficuly);

            if (game.gameType == GameLogic.GameTypes.AI)
            {
                writeToLog($"Game started, {playerName} vs AI level {game.AILevel}");
            }
            else
            {
                writeToLog($"Local game started");
            }

            sendGameLogic = game.startGame(playerBoats, RecieveGameResponse);
        }