Package dev.laszlomocsy.tzaar.utils
Class GameStateManager
java.lang.Object
dev.laszlomocsy.tzaar.utils.GameStateManager
This class is responsible for saving and loading the game state.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Board
generateBoard
(GameState gameState) Converts a game state to a board.static GameState
generateGameState
(Board board, String player1Name, String player2Name) Converts a board to a game state.loadFromFile
(File file) Loads a game state from a file.Loads a game state from a file.static void
Saves the given game state to a file.static boolean
saveToFile
(GameState gameState, File file) Saves the given game state to a file.
-
Method Details
-
saveGame
Saves the given game state to a file.- Parameters:
gameState
- The game state to save.dialogParent
- The parent component of the dialog.
-
loadGame
Loads a game state from a file.- Parameters:
dialogParent
- The parent component of the dialog.- Returns:
- The loaded game state.
-
saveToFile
Saves the given game state to a file.- Parameters:
gameState
- The game state to save.file
- The file to save the game state to.- Returns:
- True if the game state was saved successfully, false otherwise.
-
loadFromFile
Loads a game state from a file.- Parameters:
file
- The file to load the game state from.- Returns:
- The loaded game state.
-
generateGameState
Converts a board to a game state.- Parameters:
board
- The board to convert.player1Name
- The name of player 1.player2Name
- The name of player 2.- Returns:
- The game state generated from the board.
-
generateBoard
Converts a game state to a board.- Parameters:
gameState
- The game state to convert.- Returns:
- The board generated from the game state.
-