Exemple #1
0
 public Cell(Coordinates CellCoordinates, int WordMultiplier, int LetterMultiplier, Tile Tile, bool Visited)
 {
     this.CellCoordinates = CellCoordinates;
     this.WordMultiplier = WordMultiplier;
     this.LetterMultiplier = LetterMultiplier;
     this.Tile = Tile;
     this.Visited = Visited;
 }
Exemple #2
0
 public Cell(Coordinates coordinates, int WordMultiplier, int LetterMultiplier)
 {
     this.CellCoordinates = coordinates;
     this.WordMultiplier = WordMultiplier;
     this.LetterMultiplier = LetterMultiplier;
     this.Tile = null;
     this.Visited = false;
 }
Exemple #3
0
 public Cell(Cell ToCopyCell)
 {
     this.CellCoordinates = new Coordinates(ToCopyCell.GetXColumnCoordinate(), ToCopyCell.GetYRowCoordinate());
     this.WordMultiplier = ToCopyCell.GetWordMultiplier();
     this.LetterMultiplier = ToCopyCell.GetLetterMultiplier();
     if(ToCopyCell.GetTile() != null)
     {
         this.Tile = new Tile(ToCopyCell.GetTile());
     }
     else
     {
         this.Tile = null;
     }
     this.Visited = ToCopyCell.IsVisited();
 }
Exemple #4
0
        public void UpdateForm(UpdateViewEvent UpdateViewEvent)
        {
            foreach (Cell boardCell in UpdateViewEvent.BoardCells)
            {

                Coordinates coordinates = new Coordinates(boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate());
                CellValues.Remove(coordinates);
                CellValues.Add(coordinates, boardCell);

                if (boardCell.GetTile() != null)
                {
                    boardGridView[boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate()].Value =
                        boardCell.GetTile().GetLetter().ToString().ToUpper();
                }
                else
                {
                    boardGridView[boardCell.GetXColumnCoordinate(), boardCell.GetYRowCoordinate()].Value = "";
                }
            }

            for (int i = 0; i < 7; ++i)
            {
                FirstHeldCharactersDataGrid[i, FIRST_INDEX].Value = "";
                SecondHeldCharactersDataGrid[i, FIRST_INDEX].Value = "";

                FirstHeldCharactersDataGrid[i +8, FIRST_INDEX].Value = "";
                SecondHeldCharactersDataGrid[i+8, FIRST_INDEX].Value = "";
            }

            _GameInfo.Clear();
             _GameInfo = UpdateViewEvent.GameInfo;
            heldCharacters = UpdateViewEvent.HeldCharacters;
            _CurrentPlayer = UpdateViewEvent.CurrentPlayer;
            AddAllHeldCharacters();
            InitFormHelper.UpdateGameInfoBoard(GameInfoDataGrid, _GameInfo);
            UpdateHeldCharactersLabels();

            Invalidate();
            Update();
        }
Exemple #5
0
        /// <summary>
        /// Metoda aktualizuje litere na danej komórce, lub jeśli nie istnieje komórka o danych współrzędnych - dodaje nową.
        /// </summary>
        private void UpdateLetter(Coordinates Coordinates, bool isBlank, string blankValue)
        {
            if (CellValues.ContainsKey(Coordinates)) //TODO bug: if we comprare two object with the same coordinates we get false....
            {
                if (CellValues[Coordinates].GetTile() != null)
                {
                    CellValues[Coordinates].GetTile()
                        .SetLetter(blankValue.ToCharArray()[FIRST_INDEX]);
                    CellValues[Coordinates].GetTile().SetIsBlank(isBlank);
                }
                else
                {
                    CellValues[Coordinates].SetTile(new Tile(blankValue.ToCharArray()[FIRST_INDEX], isBlank));
                }

            }
            else
            {
                Cell Cell = new Cell(Coordinates, 0, 0, new Tile(TemporaryCopingCharacter.ToCharArray()[FIRST_INDEX], isBlank), false);
                CellValues.Add(Coordinates, Cell);
            }
        }
Exemple #6
0
 private void InitAllCellValues()
 {
     CellValues.Clear();
     for (int IndexYCoordinate = FIRST_INDEX; IndexYCoordinate < BOARD_SIZE; ++IndexYCoordinate)
     {
         for (int IndexXCoordinate = FIRST_INDEX; IndexXCoordinate < BOARD_SIZE; ++IndexXCoordinate)
         {
             Coordinates coordinates = new Coordinates(IndexXCoordinate, IndexYCoordinate);// test
             CellValues.Add(coordinates, new Cell(coordinates, 0, 0, new Tile(true), false));// test
         }
     }
 }
Exemple #7
0
        private void boardGridView_CellMouseUp(object s, DataGridViewCellMouseEventArgs e)
        {
            DataGridView Sender = (DataGridView)s;

            DataGridViewCell CurrentCell = Sender.CurrentCell;

            if (TemporaryCopingCharacter != null)
            {
                bool IsBlank = TemporaryCopingCharacter == " ";

                if (IsBlank)
                {
                    CurrentCell.Value = String.Copy(OpenFormAndGetBlankValue());

                }
                else
                {
                    CurrentCell.Value = String.Copy(TemporaryCopingCharacter);
                }

                Coordinates Coordinates = new Coordinates(CurrentCell.ColumnIndex, CurrentCell.RowIndex);
                UpdateLetter(Coordinates, IsBlank, CurrentCell.Value.ToString().ToLower());

                TemporaryCopingCharacter = null;
            }
        }