add path to GameStorage and add option to enable store game state (default its disabled)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from server.Files import save_file
|
||||
import os
|
||||
|
||||
class GameStorage:
|
||||
def __init__(self, snake:str):
|
||||
def __init__(self, snake:str, path:str):
|
||||
self.snake_type = snake
|
||||
self.folder = path
|
||||
|
||||
def start_new_game(self, game_type:dict, game_board:dict, snake:dict):
|
||||
self.game_type = game_type
|
||||
@@ -19,7 +21,7 @@ class GameStorage:
|
||||
self.snake_history = snake_history_state
|
||||
|
||||
def save(self, path:str, callback=None, **kwargs):
|
||||
save_file(path, {
|
||||
save_file(os.path.join(self.folder, path), {
|
||||
"snake": {
|
||||
"type": self.snake_type,
|
||||
"choices": self.snake_history,
|
||||
|
||||
Reference in New Issue
Block a user