Пример #1
0
        public void updateBoard()
        {
            for (int cellRow = 0; cellRow < m_GameManager.BoardSize; cellRow++)
            {
                for (int cellColumn = 0; cellColumn < m_GameManager.BoardSize; cellColumn++)
                {
                    Cell boardCell = m_GameManager.Board[cellRow, cellColumn];

                    if (!boardCell.IsCellEmpty())
                    {
                        Soldier soldier = boardCell.Soldier;
                        m_ButtonsBoard[cellRow, cellColumn].Text = GlobalDefines.GetSoldierSign(soldier.Owner, soldier.SoldierType).ToString();
                    }
                    else
                    {
                        m_ButtonsBoard[cellRow, cellColumn].Text = string.Empty;
                    }
                }
            }
        }
Пример #2
0
        private CellButton createButtonByCell(int rowIndex, int colIndex, Cell boardCell)
        {
            CellButton boardButton = new CellButton(rowIndex, colIndex);

            boardButton.Size      = new Size(k_ButtonSize, k_ButtonSize);
            boardButton.BackColor = k_EnabledButtonColor;
            boardButton.Location  = new Point(k_BoardStartPoint.X + (colIndex * k_ButtonSize), k_BoardStartPoint.Y + (rowIndex * k_ButtonSize));
            boardButton.Click    += BoardButton_Click;
            boardButton.Enabled   = boardCell.IsEnabled;
            if (!boardButton.Enabled)
            {
                boardButton.BackColor = k_DisabledButtonColor;
            }

            if (!boardCell.IsCellEmpty())
            {
                Soldier soldier = boardCell.Soldier;
                boardButton.Text = GlobalDefines.GetSoldierSign(soldier.Owner, soldier.SoldierType).ToString();
            }

            return(boardButton);
        }
Пример #3
0
        private static void printCell(Cell i_Cell, bool i_IsLastInRow)
        {
            char k_CellDelimiter = '|';
            char cellContent;

            if (i_Cell.IsCellEmpty())
            {
                cellContent = ' ';
            }
            else
            {
                cellContent = GlobalDefines.GetSoldierSign(i_Cell.Soldier.Owner, i_Cell.Soldier.SoldierType);
            }

            if (!i_IsLastInRow)
            {
                Console.Write("{0} {1} ", k_CellDelimiter, cellContent);
            }
            else
            {
                Console.Write("{0} {1} {0}", k_CellDelimiter, cellContent);
            }
        }
Пример #4
0
 private void setPlayersNames(GameConfiguration i_GameConfiguration)
 {
     Player1Name.Text = string.Format("{0} ({1}):", i_GameConfiguration.PlayerConfigurations[0].PlayerName, GlobalDefines.GetSoldierSign(ePlayerTitles.PlayerOne, eSoldierTypes.Regular));
     Player2Name.Text = string.Format("{0} ({1}):", i_GameConfiguration.PlayerConfigurations[1].PlayerName, GlobalDefines.GetSoldierSign(ePlayerTitles.PlayerTwo, eSoldierTypes.Regular));
 }