Compare commits

...

2 Commits

Author SHA1 Message Date
mibi88 3c8f8b69ef Small improvements at show_text, ask_choice and show_old_messages. 2023-01-08 18:48:59 +01:00
mibi88 fb88a41da6 Small fix 2023-01-08 16:40:32 +01:00
1 changed files with 7 additions and 6 deletions

View File

@ -69,7 +69,8 @@ class Scii:
def _default_intext(self):
return "> "
def _input(self):
i = input(self.get_input_text())
try: i = input(self.get_input_text())
except: i = input(self.get_input_text(self))
if len(i) > 0:
self.last_key = i[0]
return self.last_key
@ -207,7 +208,7 @@ class Scii:
i["animations"]["coords_animations"][key]["animation_frame"] = 0
layerc += 1
self._dvram()
def show_text(self, text, portrait = None):
def _show_text(self, text, portrait = None):
if portrait: dwidth = self.screen_width - (2 + self.portrait_width)
else: dwidth = self.screen_width - 2
self._cvram()
@ -261,6 +262,8 @@ class Scii:
if portrait: self._draw_portrait(portrait)
self._dvram()
if msg != "": self._add_message(msg)
def show_text(self, text, portrait = None):
self._show_text(text, portrait)
input("End of the text > ")
def _draw_portrait(self, portrait):
for i in range(self.screen_height):
@ -293,10 +296,8 @@ class Scii:
input("Go back > ")
c = len(self.old_messages)
for i in [i for i in self.old_messages[::-1]]:
self.show_text(i)
self._show_text(i)
c -= 1
self._cvram()
self._dvram()
if c < 1: input("Go back > ")
else: intxt = input("Next message > ")
if len(intxt) > 0:
@ -310,7 +311,7 @@ class Scii:
if c < len(choices): newtext += "{}:{}\n".format(c, i)
else: newtext += "{}:{}".format(c, i)
c += 1
self.show_text(newtext, portrait)
self._show_text(newtext, portrait)
try:
choice = int(input("Choice > "))
except: choice = -1