adventure-game #3
|
@ -13,10 +13,22 @@ class GameNavigator(npyscreen.FormBaseNew):
|
||||||
# def afterEditing(self):
|
# def afterEditing(self):
|
||||||
# it self.parentApp.setNextForm('GAME')
|
# it self.parentApp.setNextForm('GAME')
|
||||||
|
|
||||||
|
def update_log(self, newline):
|
||||||
|
self.logList.append(newline) # Append the newline
|
||||||
|
self.logList = self.logList[-7:] # Truncate to only the last 5 lines
|
||||||
|
|
||||||
|
res = '' # Convert the list to a string
|
||||||
|
for element in self.logList:
|
||||||
|
res = res + str(element) + '\n'
|
||||||
|
res = res.upper() # Log is always uppercase
|
||||||
|
|
||||||
|
self.logBox.value = res # Set the logbox to that value
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
top_division_height = 20
|
top_division_height = 20
|
||||||
inventory_width = 20
|
inventory_width = 20
|
||||||
art_width = 100
|
art_width = 100
|
||||||
|
self.logList = []
|
||||||
|
|
||||||
self.artBox = self.add(npyscreen.BoxBasic,
|
self.artBox = self.add(npyscreen.BoxBasic,
|
||||||
name='ArtBox',
|
name='ArtBox',
|
||||||
|
@ -49,7 +61,7 @@ class GameNavigator(npyscreen.FormBaseNew):
|
||||||
rely=top_division_height + 2,
|
rely=top_division_height + 2,
|
||||||
editable=False)
|
editable=False)
|
||||||
|
|
||||||
self.logBox = self.add(npyscreen.Textfield,
|
self.logBox = self.add(npyscreen.MultiLineEdit,
|
||||||
max_width=inventory_width + art_width - 7,
|
max_width=inventory_width + art_width - 7,
|
||||||
max_height=7,
|
max_height=7,
|
||||||
relx=2,
|
relx=2,
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Handler(npyscreen.ButtonPress):
|
||||||
3: re-render the screen
|
3: re-render the screen
|
||||||
"""
|
"""
|
||||||
def whenPressed(self):
|
def whenPressed(self):
|
||||||
self.parent.logBox.value = self.parent.dialogueBox.value
|
self.parent.update_log(self.parent.dialogueBox.value)
|
||||||
self.parent.dialogueBox.value = ''
|
self.parent.dialogueBox.value = ''
|
||||||
self.parent.artContent.display()
|
self.parent.artContent.display()
|
||||||
self.parent.parentApp.switchForm('GAME')
|
self.parent.parentApp.switchForm('GAME')
|
Loading…
Reference in New Issue