From 880c0af3c27f5dc66b2bb0d29672b69ef6b15e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Mon, 6 Apr 2020 01:00:02 +0200 Subject: [PATCH] Move updating time text view to Ui class --- src/game/EventManager.py | 2 +- src/ui/Ui.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/EventManager.py b/src/game/EventManager.py index d8a3bca..fffb38a 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -22,7 +22,7 @@ class EventManager: def handleEvents(self): pygame.event.pump() - self.game.screen.ui.timerTextView.changeText(self.game.ingameTimer.getPrettyTime()) + self.game.screen.ui.updateTime() keys = pygame.key.get_pressed() for event in pygame.event.get(): diff --git a/src/ui/Ui.py b/src/ui/Ui.py index a2b63c1..ccb64ad 100644 --- a/src/ui/Ui.py +++ b/src/ui/Ui.py @@ -91,6 +91,13 @@ class Ui(): elif event.button == 5: console.writeConsoleLines(console.topWrittenLineInd - 1) + def updateTime(self): + self.timerTextView.changeText(self.timer.getPrettyTime()) + if self.timer.isItDay(): + self.isDayTextView.changeText("Day") + else: + self.isDayTextView.changeText("Night") + class Colors(Enum): RED = (255, 0, 0)