Skip to content

Commit

Permalink
refactor(loader): change file_name to file_path
Browse files Browse the repository at this point in the history
  • Loading branch information
parsariyahi committed Dec 11, 2023
1 parent a1380cb commit 47c38d5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions progature/engine/core/game/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@

class GameLoader:
@staticmethod
def load(file_name: str) -> Game:
def load(game_path: str) -> Game:
"""Game loader that loads games inside app,
This class is an interface between app and json files to be loaded.
Parameters
----------
file_name: str
game_path: str
Path of the game we want to work with.
Returns
-------
Game
Instance of the game's file Game.
"""
# path = Path(GAME_DIR_PATH) / file_name
with open(file_name, "r", encoding="utf8") as file:
with open(game_path, "r", encoding="utf8") as file:
content = file.read()
game_json = json.loads(content)
chapters_json = game_json["chapters"]
Expand Down Expand Up @@ -67,7 +66,7 @@ def load(file_name: str) -> Game:

skill = Skill(game_json["skill"])
game = Game(
file_name,
game_json["file_name"],
game_json["name"],
skill,
is_complete=game_json["is_complete"],
Expand Down

0 comments on commit 47c38d5

Please sign in to comment.