예제 #1
0
    def __init__(self, pokemon, targets, environment, screen):
        """ Initialize the Attack Menu """
        self.pokemon = pokemon
        self.targets = targets
        self.environment = environment
        self.action = None

        entries = []
        for attack in self.pokemon.getAttacks():
            entries.append(AttackMenuEntry(attack, self.setAction))
        self.menu = Menu(entries, columns=2)

        screen.setBottomView(
            ActionMenuWidget(self.menu,
                             self.getWindow().width * .9,
                             self.getWindow().height * .3,
                             MenuEntryWidget=AttackMenuEntryWidget))
        cmds = {
            commands.UP: self.menu.up,
            commands.DOWN: self.menu.down,
            commands.LEFT: self.menu.left,
            commands.RIGHT: self.menu.right,
            commands.SELECT: self.menu.enter,
            commands.EXIT: self.stopRunning
        }
        PygameController.__init__(self, screen, commands=cmds)
예제 #2
0
    def __init__(self, pokemon, battle, screen):
        """ Initialize the Battle Round Controller """
        self.pokemon = pokemon
        self.battle = battle
        self.action = None

        entries = [
            TextMenuEntry("Fight", self.chooseAttack),
            TextMenuEntry("Switch", self.switch),
            TextMenuEntry("Item", None),
            TextMenuEntry("Run", None)
        ]
        self.menu = Menu(entries, columns=2)

        self.view = ActionMenuWidget(self.menu,
                                     self.getWindow().width * .9,
                                     self.getWindow().height * .3)
        screen.setBottomView(self.view)
        cmds = {
            commands.UP: self.menu.up,
            commands.DOWN: self.menu.down,
            commands.LEFT: self.menu.left,
            commands.RIGHT: self.menu.right,
            commands.SELECT: self.menu.enter
        }
        PygameController.__init__(self, screen, commands=cmds)
 def __init__(self, event, lastScreen):
     """ Initialize the Learn Attack Controller """
     screen = LearnAttackScreen(lastScreen)
     PygameController.__init__(self, screen)
     self.event = event
     self.done = False
     self.coroutine = self.performLearnAttackLoop()
 def __init__(self, event, lastScreen):
     """ Initialize the Learn Attack Controller """
     screen = LearnAttackScreen(lastScreen)
     PygameController.__init__(self, screen)
     self.event = event
     self.done = False
     self.coroutine = self.performLearnAttackLoop()
예제 #5
0
 def runController(self, controller):
     """ Runs the given controller """
     PygameController.runController(self, controller)
     if controller.action is None:
         self.screen.setBottomView(self.view)
     else:
         self.action = controller.action
         self.stopRunning()
    def __init__(self, trainer):
        """ Initialize the Marathon Controller """
        self.marathon = Marathon()
        self.trainer = trainer
        screen = MarathonScreen(self.marathon)

        cmds = {commands.SELECT: self.select, commands.EXIT: self.stopRunning}
        PygameController.__init__(self, screen, commands=cmds)
 def runController(self, controller):
     """ Runs the given controller """
     PygameController.runController(self, controller)
     if controller.action is None:
         self.screen.setBottomView(self.view)
     else:
         self.action = controller.action
         self.stopRunning()
 def __init__(self):
     """ Builds the Main Menu Controller """
     self.menu = TrainerMenu(self.performBattle)
     screen = TrainerMenuScreen(self.menu)
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.EXIT:self.stopRunning,
             commands.SELECT:self.menu.enter}
     PygameController.__init__(self, screen, commands=cmds)
예제 #9
0
 def __init__(self, trainer):
     """ Initialize the Marathon Controller """
     self.marathon = Marathon()
     self.trainer = trainer
     screen = MarathonScreen(self.marathon)
     
     cmds = {commands.SELECT:self.select,
             commands.EXIT:self.stopRunning}
     PygameController.__init__(self, screen, commands=cmds)
예제 #10
0
 def __init__(self, message, lastScreen, autoClose=False):
     """ Initialize the Message Box Controller """
     self.message = message
     self.autoClose = autoClose
     
     screen = MessageBoxScreen(message, lastScreen)
     cmds = {commands.SELECT:self.closeMessageBox}
     
     PygameController.__init__(self, screen, commands=cmds)
 def __init__(self):
     """ Builds the Main Menu Controller """
     self.menu = TrainerMenu(self.performBattle)
     screen = TrainerMenuScreen(self.menu)
     cmds = {
         commands.UP: self.menu.up,
         commands.DOWN: self.menu.down,
         commands.EXIT: self.stopRunning,
         commands.SELECT: self.menu.enter
     }
     PygameController.__init__(self, screen, commands=cmds)
예제 #12
0
 def __init__(self, lastController):
     """ Initialize the Zone Menu Controller """
     entries = [TextMenuEntry("Exit", self.exitZone)]
     self.menu = Menu(entries)
     self.lastController = lastController
     
     screen = ZoneMenuScreen(self.menu, lastController.screen)
     PygameController.__init__(self, screen, commands = {commands.UP:self.menu.up,
                                                         commands.DOWN:self.menu.down,
                                                         commands.EXIT:self.stopRunning,
                                                         commands.SELECT:self.menu.enter})
    def __init__(self, lastController):
        """ Initialize the Zone Menu Controller """
        entries = [TextMenuEntry("Exit", self.exitZone)]
        self.menu = Menu(entries)
        self.lastController = lastController

        screen = ZoneMenuScreen(self.menu, lastController.screen)
        PygameController.__init__(self,
                                  screen,
                                  commands={
                                      commands.UP: self.menu.up,
                                      commands.DOWN: self.menu.down,
                                      commands.EXIT: self.stopRunning,
                                      commands.SELECT: self.menu.enter
                                  })
예제 #14
0
 def __init__(self, message, lastScreen):
     """ Initialize the Yes/No Controller """
     self.message = BattleMessage(message.message)
     self.lastScreen = lastScreen
     
     entries = [TextMenuEntry("Yes", self.select),
                TextMenuEntry("No", self.back)]
     self.menu = Menu(entries)
     
     screen = YesNoScreen(self.menu, lastScreen)
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.SELECT:self.menu.enter,
             commands.EXIT:self.back}
     PygameController.__init__(self, screen, commands=cmds)
     
     self.answer = False
     self.displayedMessage = False
 def __init__(self, pokemon, lastScreen):
     """ Initialize the Attack Picker Controller """
     self.pokemon = pokemon
     self.attack = None
     
     entries = []
     for attack in self.pokemon.getAttacks():
         entries.append(AttackMenuEntry(attack, self.pickAttack))
     self.menu = Menu(entries, columns=2)
     menuWidget = ActionMenuWidget(self.menu, self.getWindow().width*.9, self.getWindow().height*.3, MenuEntryWidget=AttackMenuEntryWidget)
     
     screen = AttackPickerScreen(menuWidget, lastScreen)
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.LEFT:self.menu.left,
             commands.RIGHT:self.menu.right,
             commands.SELECT:self.menu.enter,
             commands.EXIT:self.stopRunning}
     PygameController.__init__(self, screen, commands=cmds)
예제 #16
0
    def __init__(self, currentPlayer):
        """ Initialize the Mode Menu Controller """
        self.currentPlayer = currentPlayer

        entries = [
            TextMenuEntry("Story", self.playStory),
            TextMenuEntry("Marathon", self.runMarathon),
            TextMenuEntry("Back", self.stopRunning)
        ]
        self.menu = Menu(entries)

        screen = MainMenuScreen(self.menu, self.currentPlayer)
        PygameController.__init__(self,
                                  screen,
                                  commands={
                                      commands.UP: self.menu.up,
                                      commands.DOWN: self.menu.down,
                                      commands.EXIT: self.stopRunning,
                                      commands.SELECT: self.menu.enter
                                  })
 def __init__(self, pokemon, targets, environment, screen):
     """ Initialize the Attack Menu """
     self.pokemon = pokemon
     self.targets = targets
     self.environment = environment
     self.action = None
     
     entries = []
     for attack in self.pokemon.getAttacks():
         entries.append(AttackMenuEntry(attack, self.setAction))
     self.menu = Menu(entries, columns=2)
     
     screen.setBottomView(ActionMenuWidget(self.menu, self.getWindow().width*.9, self.getWindow().height*.3, MenuEntryWidget=AttackMenuEntryWidget))
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.LEFT:self.menu.left,
             commands.RIGHT:self.menu.right,
             commands.SELECT:self.menu.enter,
             commands.EXIT:self.stopRunning}
     PygameController.__init__(self, screen, commands=cmds)
 def __init__(self, pokemon, battle, screen):
     """ Initialize the Battle Round Controller """
     self.pokemon = pokemon
     self.battle = battle
     self.action = None
     
     entries = [TextMenuEntry("Fight", self.chooseAttack),
                TextMenuEntry("Switch", self.switch),
                TextMenuEntry("Item", None),
                TextMenuEntry("Run", None)]
     self.menu = Menu(entries, columns=2)
     
     self.view = ActionMenuWidget(self.menu, self.getWindow().width*.9, self.getWindow().height*.3)
     screen.setBottomView(self.view)
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.LEFT:self.menu.left,
             commands.RIGHT:self.menu.right,
             commands.SELECT:self.menu.enter}
     PygameController.__init__(self, screen, commands=cmds)
 def __init__(self):
     """ Initialize the Main Menu Controller """
     self.currentPlayer = PlayerFactory.getLastPlayer()
     
     
     entries = [TextMenuEntry("New", self.newGame),
                TextMenuEntry("Options", self.runOptions),
                TextMenuEntry("Exit", self.stopRunning)]
     self.menu = Menu(entries)
     
     if self.currentPlayer is not None:
         continueMenuEntry = TextMenuEntry("Continue", self.continueGame)
         entries.insert(1, continueMenuEntry)
         self.menu.down()
     
     screen = MainMenuScreen(self.menu, self.currentPlayer)
     PygameController.__init__(self, screen, commands = {commands.UP:self.menu.up,
                                                         commands.DOWN:self.menu.down,
                                                         commands.EXIT:self.stopRunning,
                                                         commands.SELECT:self.menu.enter})
 def __init__(self, pokemon, cancellable=True):
     """ Initialize the Switch Menu """
     self.pokemon = pokemon
     self.action = None
     
     entries = []
     for pokemon in self.pokemon.getTrainer().beltPokemon:
         entries.append(PokemonMenuEntry(pokemon, self.setAction))
     self.menu = Menu(entries, columns=2)
     
     screen = SwitchMenuScreen(self.menu)
     cmds = {commands.UP:self.menu.up,
             commands.DOWN:self.menu.down,
             commands.LEFT:self.menu.left,
             commands.RIGHT:self.menu.right,
             commands.SELECT:self.menu.enter}
     if cancellable:
         cmds[commands.EXIT] = self.stopRunning
             
     PygameController.__init__(self, screen, commands=cmds)
예제 #21
0
 def __init__(self, trainer, zone, row, column, doneCallback=None):
     """ Initialize the Zone Controller """
     self.zone = zone
     self.doneCallback = doneCallback
     self.zone.setCallbacks(self.handleZoneEvents)
     self.playerPerson = TrainerPerson(self.zone.tiles[row][column], "trainer", trainer, causeEnterEvents=True)
     
     screen = ZoneScreen(self.playerPerson, self.zone)
     
     cmds = {commands.UP:self.playerPerson.up,
             (commands.UP, RELEASED):self.playerPerson.stopMovingUp,
             commands.DOWN:self.playerPerson.down,
             (commands.DOWN, RELEASED):self.playerPerson.stopMovingDown,
             commands.LEFT:self.playerPerson.left,
             (commands.LEFT, RELEASED):self.playerPerson.stopMovingLeft,
             commands.RIGHT:self.playerPerson.right,
             (commands.RIGHT, RELEASED):self.playerPerson.stopMovingRight,
             commands.SELECT:self.select,
             commands.EXIT:self.runZoneMenu}
     
     PygameController.__init__(self, screen, commands=cmds)
예제 #22
0
    def __init__(self, currentPlayer):
        """ Initialize the Mode Menu Controller """
        self.currentPlayer = currentPlayer

        entries = [
            TextMenuEntry("Story", self.playStory),
            TextMenuEntry("Marathon", self.runMarathon),
            TextMenuEntry("Back", self.stopRunning),
        ]
        self.menu = Menu(entries)

        screen = MainMenuScreen(self.menu, self.currentPlayer)
        PygameController.__init__(
            self,
            screen,
            commands={
                commands.UP: self.menu.up,
                commands.DOWN: self.menu.down,
                commands.EXIT: self.stopRunning,
                commands.SELECT: self.menu.enter,
            },
        )
    def __init__(self, battle, screen):
        """ Initialize the Battle Round Controller """
        self.battle = battle
        PygameController.__init__(self, screen)

        self.coroutine = self.performEntireRound()
 def __init__(self):
     """ Builds the Options Menu Controller """
     self.menu = OptionsMenu()
     screen = OptionsMenuScreen(self.menu)
     cmds = {commands.EXIT:self.stopRunning}
     PygameController.__init__(self, screen, commands=cmds)
 def __init__(self, battle, screen):
     """ Initialize the Battle Aftermath Controller """
     self.battle = battle
     PygameController.__init__(self, screen)
예제 #26
0
 def __init__(self, playerTrainer, oppTrainer):
     """ Builds the Battle Controller """
     self.battle = Battle(playerTrainer, oppTrainer)
     screen = BattleScreen(self.battle)
     PygameController.__init__(self, screen)
 def __init__(self, battle, screen):
     """ Initialize the Battle Introduction Controller """
     self.battle = battle
     PygameController.__init__(self, screen)
예제 #28
0
 def __init__(self, playerTrainer, oppTrainer):
     """ Builds the Battle Controller """
     self.battle = Battle(playerTrainer, oppTrainer)
     screen = BattleScreen(self.battle)
     PygameController.__init__(self, screen)
 def __init__(self, battle, screen):
     """ Initialize the Battle Round Controller """
     self.battle = battle
     PygameController.__init__(self, screen)
     
     self.coroutine = self.performEntireRound()
 def __init__(self, battle, screen):
     """ Initialize the Battle Aftermath Controller """
     self.battle = battle
     PygameController.__init__(self, screen)
예제 #31
0
 def __init__(self):
     """ Initialize the *** Controller """
     screen = %ViewName%()
     PygameController.__init__(self, screen)
 def __init__(self):
     """ Builds the Options Menu Controller """
     self.menu = OptionsMenu()
     screen = OptionsMenuScreen(self.menu)
     cmds = {commands.EXIT: self.stopRunning}
     PygameController.__init__(self, screen, commands=cmds)