import npyscreen from npyscreen import NotEnoughSpaceForWidget from yaml_parser import parse_datafile as parse class GameNavigator(npyscreen.Form): def afterEditing(self): self.parentApp.setNextForm(None) # Nothing to do after this but exit the game. def create(self): self.artBox = self.add(npyscreen.BoxBasic, name='ArtBox', max_width=100, max_height=20, relx=21) self.artBox.footer = 'Unknown Location' self.artBox = self.add(npyscreen.BoxBasic, name='Inventory', max_width=20, max_height=20, relx=1, rely=2) self.DialogueBox = self.add(npyscreen.BoxBasic, name='Type Here', max_width=20, max_height=20, relx=1, rely=2) #self.myName = self.add(npyscreen.TitleText, name='Name') #self.myDepartment = self.add(npyscreen.TitleSelectOne, scroll_exit=True, max_height=3, name='Department', # values=['Department 1', 'Department 2', 'Department 3']) #self.myDate = self.add(npyscreen.TitleDateCombo, name='Date Employed') class MainMenu(npyscreen.Form): def afterEditing(self): # TODO: the game needs to happen after this inital main menu self.parentApp.setNextForm('GAME') def create(self): 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.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False) class AlphaWarning(npyscreen.Popup): def afterEditing(self): self.parentApp.setNextForm('MENU') def create(self): self.add(npyscreen.Pager, values=['Welcome to Unnamed Adventure game!', 'Please enjoy your stay and report any bugs at', 'kitsunehosting.net'], editable=False) class AdventureGame(npyscreen.NPSAppManaged): # Do on creation def onStart(self): # Setup some important 'global' values we'll need later self.gamelib = parse( 'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu self.playerSaveLocation = None # We'll load the save location after the player gets to the save select screen # Draw game windows 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('MAIN', AlphaWarning, name='Welcome to the alpha!') # This window is only needed for the ALPHA # TODO: Create a 'splash screen' or, traditional "main menu" if __name__ == '__main__': # Make a new adventure game if not imported adventure_game = AdventureGame() # Run the game! try: adventure_game.run() except NotEnoughSpaceForWidget: # This exception should catch if a player tries to play in a screen that is too small. print('Your screen is too small!\nOr, Joe has not fixed https://kitsunehosting.net/gitea/Kenwood/SNHU-IT-140/issues/7')