java.lang.Object
com.example.project.models.gameScreens.GameScreenModel
com.example.project.models.gameScreens.LevelModel

public class LevelModel extends GameScreenModel
Represents the level model.
  • Property Details

    • wordPoints

      public javafx.beans.property.ReadOnlyIntegerProperty wordPointsProperty
      See Also:
    • wordMulti

      public javafx.beans.property.ReadOnlyIntegerProperty wordMultiProperty
      See Also:
  • Constructor Details

    • LevelModel

      public LevelModel(Session session)
      Parameters:
      session - game session.
  • Method Details

    • getTileScoreSoundPlayer

      public wordTileScoreChimeAscending getTileScoreSoundPlayer()
      Gets the tile score sound effect player.
      Returns:
      LevelTileScoreSoundPlayer.
    • getWordRowTilesProperty

      public javafx.beans.property.ReadOnlyListProperty<LetterTile> getWordRowTilesProperty()
      Returns:
      Read-only list of tiles currently in the word area
    • getTileRackRowTilesProperty

      public javafx.beans.property.ReadOnlyListProperty<LetterTile> getTileRackRowTilesProperty()
      Returns:
      Read-only list of tiles currently in the rack
    • getRedrawRowTilesProperty

      public javafx.beans.property.ReadOnlyListProperty<LetterTile> getRedrawRowTilesProperty()
      Returns:
      Read-only list of tiles currently in the redraw window.
    • getPlayersTotalPoints

      public javafx.beans.property.ReadOnlyIntegerProperty getPlayersTotalPoints()
      Returns:
      the total points property to observe.
    • wordPointsProperty

      public javafx.beans.property.ReadOnlyIntegerProperty wordPointsProperty()
      Returns:
      the sum combo points property to observe.
    • wordMultiProperty

      public javafx.beans.property.ReadOnlyIntegerProperty wordMultiProperty()
      Returns:
      the multi combo points property to observe.
    • getIsRedrawActive

      public javafx.beans.property.ReadOnlyBooleanProperty getIsRedrawActive()
      gets the redraw property.
      Returns:
      returns indication if redraw active.
    • getCurrentRedraws

      public javafx.beans.property.ReadOnlyIntegerWrapper getCurrentRedraws()
      gets the redraws property.
      Returns:
      the current redraws.
    • getCurrentPlays

      public javafx.beans.property.ReadOnlyIntegerProperty getCurrentPlays()
      gets the current plays.
      Returns:
      current plays remaining.
    • getUpgradeTilesProprety

      public javafx.beans.property.ReadOnlyListProperty<UpgradeTile> getUpgradeTilesProprety()
      gets the upgrades tiles observable property.
      Returns:
      the user's session upgrade tiles.
    • getMaxWordSize

      public int getMaxWordSize()
      gets the max word size.
      Returns:
      int.
    • getLevelRequirement

      public int getLevelRequirement()
      gets points need to win the current level.
      Returns:
      points need to win the current level.
    • getHandSize

      public int getHandSize()
      gets the hand size.
      Returns:
      int.
    • getRedrawWindowSize

      public Integer getRedrawWindowSize()
      gets the redraw window size (number of slots in the window).
      Returns:
      int.
    • onLostLevel

      public void onLostLevel()
      Called when the level has been lost. resets the players session info and logs back out to the login screen.
    • onWonLevel

      public void onWonLevel()
      Called when level has been won. reset the per level info: redraws plays. Goes to shop window.
    • hasWon

      public boolean hasWon()
      returns true if player has won.
      Returns:
      value indicating if player has won.
    • hasLost

      public boolean hasLost()
      true if player has lost
      Returns:
      value indicating if player has lost.
    • tryMoveTileToRedrawArea

      public boolean tryMoveTileToRedrawArea(LetterTile tile)
      Attempts to move a tile from rack to redraw area
      Parameters:
      tile - The tile to move
      Returns:
      true if move was successful, false otherwise
    • tryMoveTile

      public boolean tryMoveTile(LetterTile tile)
      determines where tile should go and moves it
      Parameters:
      tile - The tile to move
      Returns:
      true if move was successful, false otherwise
    • getCurrentWord

      public String getCurrentWord()
      Gets the current word formed by tiles in the word area
      Returns:
      returns current word string.
    • isWordValid

      public boolean isWordValid()
      returns true if word is in dictionary.
      Returns:
      value indicating if word is valid.
    • redrawTiles

      public void redrawTiles()
      redraws tiles into the tile rack and removes from redraw window.
    • addToCombo

      public void addToCombo(LetterTile tile)
      add combo sum and multiCombo TODO: this will changed when implementing modifiers
      Parameters:
      tile - tile.
    • calcTotalScore

      public int calcTotalScore()
      TODO: adding modifiers
      Returns:
      total score int
    • setTotalScore

      public void setTotalScore(int totalScore)
      Parameters:
      totalScore - from calcTotalScore sets Total Score
    • playTiles

      public void playTiles()
      clears the word row tiles. and refills the tile rack. and decreases the plays left.
    • returnRedrawTilesToTheRack

      public void returnRedrawTilesToTheRack()
      sends the selected redraw tiles back to the rack
    • toggleRedrawState

      public void toggleRedrawState()
      changes active redraw status
    • setupNewLevel

      public void setupNewLevel()
      Initialise new level. Clears word row, redraw rack. draws new tiles for the player's tile rack.
    • resetCombo

      public void resetCombo()
      resets counts for sum and multi in combo