Exemple #1
0
 def loginMenu(self):
     screen = Screen()
     screen.setTitle("Login")
     users = self.userLoader.getOptions()
     userName = None
     options = ["Create game"]
     if len(users) > 0:
         options.append("Load game")
     options.reverse()
     for option in options:
         screen.addOption(option)
     action = screen.displayAndChoose(
         "Do you wish to load a game or start a new one?")
     if action == "Load game":
         screen.clearOptions()
         users.append("None of these")
         for user in users:
             screen.addOption(user)
         userName = screen.displayAndChoose("Which user are you?")
         if userName == "None of these":
             self.newUserMenu()
             self.loginMenu()
         else:
             self.loginUser(userName)
     else:
         self.newUserMenu()  #logs in if successful
Exemple #2
0
    def customizeMenu(self):
        done = False
        screen = Screen()
        screen.setTitle(f'Cusomizing {self.name}')
        while not done and self.customizationPoints > 0:
            screen.addBodyRows(self.getStatDisplayList())

            exit = "Save changes and exit"
            options = [exit]
            canIncrease = []
            canDecrease = []
            for statName, stat in self.stats.items():
                if not stat.is_max():
                    canIncrease.append(statName)
                if not stat.is_min():
                    canDecrease.append(statName)
            options.extend(canIncrease)  # choose stat to increase first
            options.reverse()

            for option in options:
                screen.addOption(option)
            increaseMe = screen.displayAndChoose(
                "Which stat do you want to increase?")
            if increaseMe == exit:
                done = True
            else:
                screen.clearOptions()
                options = [exit]
                for statName in canDecrease:
                    if statName != increaseMe:
                        options.append(statName)
                options.reverse()

                for option in options:
                    screen.addOption(option)

                decreaseMe = screen.displayAndChoose(
                    "Which stat do you want to decrease?")

                if decreaseMe == exit:
                    done = True
                else:
                    self.setStatBase(increaseMe,
                                     self.stats[increaseMe].get_base() + 1)
                    self.setStatBase(decreaseMe,
                                     self.stats[decreaseMe].get_base() - 1)
                    self.calcStats()
                    self.customizationPoints -= 1
                    screen.clearBody()