import npyscreen from yaml_parser import parse_datafile as parse class GameNavigator(npyscreen.Form): def afterEditing(self): # TODO: the game needs to happen after this inital main menu self.parentApp.setNextForm(None) def create(self): 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.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Filename:") 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): self.gamelib = parse('gamedata/gamelib.yaml') # Intalize a game renderer for most game windows self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') # Initalize a savegameSelector that allows a user to choose a savegame self.addForm('MENU', MainMenu, name='Welcome to the main menu') # Initalize a savegameSelector that allows a user to choose a savegame self.addForm('MAIN', AlphaWarning, name='Welcome to 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! adventure_game.run()