Compare commits
No commits in common. "8b3dba02cc5e512afb17219a3fe4a8e2a9bc8aae" and "2dd8b15a9d7f82ce5406abe525ca257a0057cced" have entirely different histories.
8b3dba02cc
...
2dd8b15a9d
|
@ -10,30 +10,13 @@ class QuitButton(npyscreen.ButtonPress):
|
||||||
|
|
||||||
|
|
||||||
class GameNavigator(npyscreen.FormBaseNew):
|
class GameNavigator(npyscreen.FormBaseNew):
|
||||||
"""
|
# def afterEditing(self):
|
||||||
This class handles all the drawing and 'graphics' of our game.
|
# it self.parentApp.setNextForm('GAME')
|
||||||
only basic logic like initial loading should happen here. re-drawing
|
|
||||||
and game logic should be done in Handler.py
|
|
||||||
TODO: Find a fix for initial room startup
|
|
||||||
TODO: Find a way to reset the cursor after a user hits sendButton
|
|
||||||
"""
|
|
||||||
|
|
||||||
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',
|
||||||
|
@ -66,7 +49,7 @@ class GameNavigator(npyscreen.FormBaseNew):
|
||||||
rely=top_division_height + 2,
|
rely=top_division_height + 2,
|
||||||
editable=False)
|
editable=False)
|
||||||
|
|
||||||
self.logBox = self.add(npyscreen.MultiLineEdit,
|
self.logBox = self.add(npyscreen.Textfield,
|
||||||
max_width=inventory_width + art_width - 7,
|
max_width=inventory_width + art_width - 7,
|
||||||
max_height=7,
|
max_height=7,
|
||||||
relx=2,
|
relx=2,
|
||||||
|
|
|
@ -5,10 +5,6 @@ from Player import Player
|
||||||
|
|
||||||
|
|
||||||
class MainMenu(npyscreen.Form):
|
class MainMenu(npyscreen.Form):
|
||||||
"""
|
|
||||||
This is the main menu, code here should only be for
|
|
||||||
initializing the player data and any settings they want to change
|
|
||||||
"""
|
|
||||||
def afterEditing(self):
|
def afterEditing(self):
|
||||||
# TODO: the game needs to happen after this inital main menu
|
# TODO: the game needs to happen after this inital main menu
|
||||||
self.parentApp.setNextForm('GAME')
|
self.parentApp.setNextForm('GAME')
|
||||||
|
|
|
@ -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.update_log(self.parent.dialogueBox.value)
|
self.parent.logBox.value = 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')
|
|
@ -32,10 +32,6 @@ class AdventureGame(npyscreen.NPSAppManaged):
|
||||||
# dimensions['inventory_width']+dimensions['art_width'],
|
# dimensions['inventory_width']+dimensions['art_width'],
|
||||||
# 30)) # TODO: Finish setting this up.
|
# 30)) # TODO: Finish setting this up.
|
||||||
|
|
||||||
# Set theme
|
|
||||||
#TODO: modify custom theme?
|
|
||||||
npyscreen.setTheme(npyscreen.Themes.ElegantTheme)
|
|
||||||
|
|
||||||
# Draw game windows
|
# Draw game windows
|
||||||
self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') # This window should draw the actual game
|
self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') # This window should draw the actual game
|
||||||
self.addForm('MENU', MainMenu, name='Welcome to the main menu') # This window should draw the main menu
|
self.addForm('MENU', MainMenu, name='Welcome to the main menu') # This window should draw the main menu
|
||||||
|
|
Loading…
Reference in New Issue