diff --git a/untitled/app.py b/untitled/app.py index 49f8f5f..fd3370c 100644 --- a/untitled/app.py +++ b/untitled/app.py @@ -7,6 +7,12 @@ from untitled import PACKAGE_ROOT, content, model, persistence, screens, ui class App: def __init__(self): self.debug = os.path.exists("DEBUG_MODE") + self.save = None + + def game(self): + if self.save is None: + return + screens.house(self.save) def run(self): # Intro @@ -42,3 +48,5 @@ class App: print("Saving...") persistence.save(save) print("Save complete.") + self.save = save + self.game() diff --git a/untitled/screens/__init__.py b/untitled/screens/__init__.py new file mode 100644 index 0000000..883ece3 --- /dev/null +++ b/untitled/screens/__init__.py @@ -0,0 +1,3 @@ +from untitled.screens.adoption import adoption as adoption +from untitled.screens.common import options as options +from untitled.screens.house import house as house diff --git a/untitled/screens.py b/untitled/screens/adoption.py similarity index 100% rename from untitled/screens.py rename to untitled/screens/adoption.py diff --git a/untitled/screens/common.py b/untitled/screens/common.py new file mode 100644 index 0000000..cf63d48 --- /dev/null +++ b/untitled/screens/common.py @@ -0,0 +1,12 @@ +from untitled import ui + + +def options(): + while True: + match ui.select("Please choose an option:", ["Save", "Save and quit", "Back"]): + case "Back": + return "back" + case "Save": + return "save" + case "Save and quit": + return "savequit" diff --git a/untitled/screens/house.py b/untitled/screens/house.py new file mode 100644 index 0000000..2115604 --- /dev/null +++ b/untitled/screens/house.py @@ -0,0 +1,23 @@ +from untitled import model, persistence, ui +from untitled.screens.common import options + + +def house(save: model.Save): + print("Welcome to your house!") + while True: + match ui.select("What do you want to do?", ["Check on your cat", "Menu"]): + case "Check on your cat": + print(save.cat.name) + case "Menu": + result = options() + match result: + case "save": + print("Saving...") + persistence.save(save) + print("Done") + case "savequit": + if ui.confirm("Are you sure you want to quit?"): + print("Saving...") + persistence.save(save) + print("Done") + break