This commit is contained in:
Yohann D'ANELLO
2020-12-07 21:22:06 +01:00
parent b24cc1877f
commit 57fab7db51
8 changed files with 80 additions and 70 deletions

View File

@ -73,15 +73,13 @@ class DisplayManager:
self.hbar.refresh(self.rows * 4 // 5, 0, 1, self.cols * 4 // 5)
self.vbar.refresh(0, self.cols * 4 // 5, self.rows, 1)
if self.game.state == GameMode.INVENTORY:
self.playerinventorydisplay.refresh(self.rows // 10,
self.cols // 2,
8 * self.rows // 10,
2 * self.cols // 5)
self.playerinventorydisplay.refresh(
self.rows // 10, self.cols // 2,
8 * self.rows // 10, 2 * self.cols // 5)
elif self.game.state == GameMode.STORE:
self.storeinventorydisplay.refresh(self.rows // 10,
self.cols // 2,
8 * self.rows // 10,
2 * self.cols // 5)
self.storeinventorydisplay.refresh(
self.rows // 10, self.cols // 2,
8 * self.rows // 10, 2 * self.cols // 5)
elif self.game.state == GameMode.MAINMENU:
self.mainmenudisplay.refresh(0, 0, self.rows, self.cols)
elif self.game.state == GameMode.SETTINGS:

View File

@ -110,10 +110,11 @@ class MainMenuDisplay(Display):
class InventoryDisplay(MenuDisplay):
message : str
message: str
def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2, self.message,
curses.A_BOLD | curses.A_ITALIC)
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
self.message, curses.A_BOLD | curses.A_ITALIC)
for i, item in enumerate(self.menu.values):
rep = self.pack[item.name.upper()]
selection = f"[{rep}]" if i == self.menu.position else f" {rep} "
@ -128,8 +129,10 @@ class InventoryDisplay(MenuDisplay):
def trueheight(self) -> int:
return 2 + super().trueheight
class PlayerInventoryDisplay(InventoryDisplay):
message = _("== INVENTORY ==")
class StoreInventoryDisplay(InventoryDisplay):
message = _("== STALL ==")