Compare commits

..

No commits in common. "fa3e73498def8bb11bb8c6a05876aac21b5e2672" and "7eb8dfde07460ee9b6618bd2fb85a645754b123e" have entirely different histories.

3 changed files with 15 additions and 38 deletions

View File

@ -6,17 +6,13 @@ class QuitButton(npyscreen.ButtonPress):
def whenPressed(self): def whenPressed(self):
sys.exit(0) sys.exit(0)
class SendButton(npyscreen.ButtonPress):
class Render(npyscreen.ButtonPress):
def whenPressed(self): def whenPressed(self):
self.parent.artContent.value = 'Undraw!'
self.parent.artContent.display()
self.parent.parentApp.switchForm('GAME') self.parent.parentApp.switchForm('GAME')
class GameNavigator(npyscreen.FormBaseNew): class GameNavigator(npyscreen.FormBaseNew):
# def afterEditing(self): # def afterEditing(self):
# it self.parentApp.setNextForm('GAME') #it self.parentApp.setNextForm('GAME')
def create(self): def create(self):
top_division_height = 20 top_division_height = 20
@ -47,39 +43,24 @@ class GameNavigator(npyscreen.FormBaseNew):
rely=2, rely=2,
editable=False) editable=False)
self.logBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width,
max_height=9,
relx=1,
rely=top_division_height + 2,
editable=False)
self.logBox = self.add(npyscreen.Textfield,
name='Type Here',
max_width=inventory_width + art_width - 7,
max_height=7,
relx=2,
rely=top_division_height + 3,
editable=False)
self.dialogueBoxOutline = self.add(npyscreen.BoxBasic, self.dialogueBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width, max_width=inventory_width + art_width,
max_height=3, max_height=3,
relx=1, relx=1,
rely=top_division_height + 2 + 9, rely=top_division_height + 2,
editable=False) editable=False)
self.dialogueBox = self.add(npyscreen.Textfield, self.dialogueBox = self.add(npyscreen.Textfield,
name='Type Here', name='Type Here',
max_width=inventory_width + art_width - 14, max_width=inventory_width + art_width - 7,
max_height=1, max_height=1,
relx=2, relx=2,
rely=top_division_height + 3 + 9) rely=top_division_height + 3)
self.sendButton = self.add(Render, self.sendButton = self.add(SendButton,
name="Send", name="Send",
relx=inventory_width + art_width - 7, relx=inventory_width + art_width - 7,
rely=top_division_height + 3 + 9) rely=top_division_height + 3)
self.quitButton = self.add(QuitButton, self.quitButton = self.add(QuitButton,
name="Quit", name="Quit",
relx=1, relx=1,

View File

@ -1,9 +1,5 @@
import npyscreen import npyscreen
from Player import Player
class MainMenu(npyscreen.Form): class MainMenu(npyscreen.Form):
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
@ -12,6 +8,4 @@ class MainMenu(npyscreen.Form):
def create(self): def create(self):
self.add(npyscreen.FixedText, value='You cannot select a file yet! Just hit OK', editable=False) self.add(npyscreen.FixedText, value='You cannot select a file yet! Just hit OK', editable=False)
self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Your save file:") self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Your save file:")
self.parentApp.player = Player('playerdata/defaults/default_player.yaml')
self.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False) self.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False)

View File

@ -5,6 +5,7 @@ from os import system
from yaml_parser import parse_datafile as parse from yaml_parser import parse_datafile as parse
from GameNavigator import GameNavigator from GameNavigator import GameNavigator
from MainMenu import MainMenu from MainMenu import MainMenu
from Player import Player
class AlphaWarning(npyscreen.Popup): class AlphaWarning(npyscreen.Popup):
@ -23,14 +24,15 @@ class AdventureGame(npyscreen.NPSAppManaged):
# Setup some important 'global' values we'll need later # Setup some important 'global' values we'll need later
self.gamelib = parse( self.gamelib = parse(
'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu 'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu
self.playerSaveLocation = 'playerdata/defaults/default_player.yaml' #TODO: Actually load the player data
self.player = None # Intalize the player as none, the player will be created in the main menu. self.player = Player(self.playerSaveLocation)
# Set screen size before drawing windows # Set screen size before drawing windows
dimensions = self.gamelib['menu']['graphics']['dimensions'] dimensions = self.gamelib['menu']['graphics']['dimensions']
#system('mode con: cols={0} lines={1}'.format( system('mode con: cols={0} lines={1}'.format(
# dimensions['inventory_width']+dimensions['art_width'], dimensions['inventory_width']+dimensions['art_width'],
# 30)) # TODO: Finish setting this up. 30)) # TODO: Finish setting this up.
# 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
@ -42,7 +44,7 @@ class AdventureGame(npyscreen.NPSAppManaged):
if __name__ == '__main__': if __name__ == '__main__':
# Set the screen size bigger # Set the screen size bigger
system('mode con: cols={0} lines={1}'.format(124, 36)) system('mode con: cols={0} lines={1}'.format(124, 30))
# Make a new adventure game if not imported # Make a new adventure game if not imported
adventure_game = AdventureGame() adventure_game = AdventureGame()