This commit is contained in:
Yohann D'ANELLO 2020-11-11 20:36:43 +01:00
parent f33d8b8170
commit 53077aacb0
4 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,5 @@
from typing import List
from dungeonbattle.menus import Menu, MainMenu
from .display import Display
@ -54,7 +56,7 @@ class MenuDisplay(Display):
return self.trueheight + 2
@property
def values(self):
def values(self) -> List[str]:
return [str(a) for a in self.menu.values]

View File

@ -93,7 +93,7 @@ class Game:
elif key == ' ':
return KeyValues.SPACE
def handle_key_pressed(self, key: KeyValues, screen) -> None:
def handle_key_pressed(self, key: KeyValues, screen: Any) -> None:
"""
Indicates what should be done when the given key is pressed,
according to the current game state.

View File

@ -31,13 +31,16 @@ class MainMenuValues(Enum):
class MainMenu(Menu):
values = [e for e in MainMenuValues]
class SettingsMenu(Menu):
def __init__(self):
super().__init__()
def update_values(self, settings : Settings):
def update_values(self, settings: Settings) -> None:
s = settings.dumps_to_string()
self.values = s[6:-2].replace("\"", "").split(",\n ")
class ArbitraryMenu(Menu):
def __init__(self, values: list):
super().__init__()