Modified main menu to be able to override the current game with a new one
This commit is contained in:
parent
eca6b9af1f
commit
ae493337ed
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from dungeonbattle.entities.player import Player
|
|
||||||
from dungeonbattle.interfaces import Map
|
from dungeonbattle.interfaces import Map
|
||||||
from .display import Display
|
from .display import Display
|
||||||
|
|
||||||
|
|
||||||
class MapDisplay(Display):
|
class MapDisplay(Display):
|
||||||
player: Player
|
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
super().__init__(*args)
|
super().__init__(*args)
|
||||||
|
|
|
@ -12,6 +12,7 @@ from typing import Callable
|
||||||
class Game:
|
class Game:
|
||||||
map: Map
|
map: Map
|
||||||
player: Player
|
player: Player
|
||||||
|
# display_actions is a display interface set by the bootstrapper
|
||||||
display_actions: Callable[[DisplayActions], None]
|
display_actions: Callable[[DisplayActions], None]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
|
@ -24,7 +24,8 @@ class Menu:
|
||||||
|
|
||||||
|
|
||||||
class MainMenuValues(Enum):
|
class MainMenuValues(Enum):
|
||||||
START = 'Jouer'
|
START = 'Nouvelle partie'
|
||||||
|
RESUME = 'Continuer'
|
||||||
SETTINGS = 'Paramètres'
|
SETTINGS = 'Paramètres'
|
||||||
EXIT = 'Quitter'
|
EXIT = 'Quitter'
|
||||||
|
|
||||||
|
@ -46,6 +47,9 @@ class MainMenu(Menu):
|
||||||
if key == KeyValues.ENTER:
|
if key == KeyValues.ENTER:
|
||||||
option = self.validate()
|
option = self.validate()
|
||||||
if option == MainMenuValues.START:
|
if option == MainMenuValues.START:
|
||||||
|
game.new_game()
|
||||||
|
game.state = GameMode.PLAY
|
||||||
|
elif option == MainMenuValues.RESUME:
|
||||||
game.state = GameMode.PLAY
|
game.state = GameMode.PLAY
|
||||||
elif option == MainMenuValues.SETTINGS:
|
elif option == MainMenuValues.SETTINGS:
|
||||||
game.state = GameMode.SETTINGS
|
game.state = GameMode.SETTINGS
|
||||||
|
|
Loading…
Reference in New Issue