Use new printToConsole method in Ui class
This commit is contained in:
parent
085beb263a
commit
21ea6cf1de
14
src/ui/Ui.py
14
src/ui/Ui.py
@ -46,7 +46,7 @@ class Ui:
|
|||||||
|
|
||||||
# If no font was given then load it from predefined file.
|
# If no font was given then load it from predefined file.
|
||||||
if font is None:
|
if font is None:
|
||||||
font = self.__loadFont__(font)
|
font = self.__loadFont__()
|
||||||
self.font = font
|
self.font = font
|
||||||
|
|
||||||
self.timer = timer
|
self.timer = timer
|
||||||
@ -116,7 +116,9 @@ class Ui:
|
|||||||
"""
|
"""
|
||||||
consoleLines = ["Health: " + str(statistics.hp), "Hunger: " + str(statistics.hunger),
|
consoleLines = ["Health: " + str(statistics.hp), "Hunger: " + str(statistics.hunger),
|
||||||
"Stamina: " + str(statistics.stamina), "Thirst: " + str(statistics.thirst)]
|
"Stamina: " + str(statistics.stamina), "Thirst: " + str(statistics.thirst)]
|
||||||
self.console.addLinesToConsoleAndScrollToDisplayThem(consoleLines)
|
|
||||||
|
for line in consoleLines:
|
||||||
|
self.console.printToConsole(line)
|
||||||
|
|
||||||
def updateBarsBasedOnPlayerStats(self, statistics: Statistics):
|
def updateBarsBasedOnPlayerStats(self, statistics: Statistics):
|
||||||
"""
|
"""
|
||||||
@ -151,8 +153,7 @@ class Ui:
|
|||||||
:param playerStats:
|
:param playerStats:
|
||||||
:param pickedObject:
|
:param pickedObject:
|
||||||
"""
|
"""
|
||||||
self.console.addLinesToConsoleAndScrollToDisplayThem(
|
self.console.printToConsole(self.timer.getPrettyTime() + " - Picked object " + str(pickedObject.id) + ":")
|
||||||
[self.timer.getPrettyTime() + " - Picked object " + str(pickedObject.id) + ":"])
|
|
||||||
self.updateConsoleBasedOnPlayerStats(playerStats)
|
self.updateConsoleBasedOnPlayerStats(playerStats)
|
||||||
|
|
||||||
def updateOnPlayerInteraction(self, playerStats, interactedObject: Interactable):
|
def updateOnPlayerInteraction(self, playerStats, interactedObject: Interactable):
|
||||||
@ -163,7 +164,7 @@ class Ui:
|
|||||||
:param playerStats:
|
:param playerStats:
|
||||||
:param interactedObject:
|
:param interactedObject:
|
||||||
"""
|
"""
|
||||||
self.console.addLinesToConsoleAndScrollToDisplayThem([self.timer.getPrettyTime() + " - Player interacted with " + str(interactedObject.id) + ":"])
|
self.console.printToConsole(self.timer.getPrettyTime() + " - Player interacted with " + str(interactedObject.id) + ":")
|
||||||
self.updateConsoleBasedOnPlayerStats(playerStats)
|
self.updateConsoleBasedOnPlayerStats(playerStats)
|
||||||
|
|
||||||
def updateOnDeath(self, player: Player):
|
def updateOnDeath(self, player: Player):
|
||||||
@ -191,7 +192,8 @@ class Ui:
|
|||||||
|
|
||||||
consoleLines.append("Time alive: " + str(player.timeAlive / 1000) + "s")
|
consoleLines.append("Time alive: " + str(player.timeAlive / 1000) + "s")
|
||||||
|
|
||||||
self.console.addLinesToConsoleAndScrollToDisplayThem(consoleLines)
|
for line in consoleLines:
|
||||||
|
self.console.printToConsole(line)
|
||||||
|
|
||||||
def updateTime(self):
|
def updateTime(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user