def __init__(self):
     """ Initialize the *** Controller """
     screen = PlayerNameScreen()
     ConsoleController.__init__(self, screen)
     self.index = 0
     self.addCommands(string.printable, self.addCharacterToName)
     self.addCommand(ENDL, self.submitName)
 def __init__(self, game):
     """ Initialize the Game Controller """
     self.game = game
     screen = GameScreen()
     ConsoleController.__init__(self,
                                screen,
                                commands={ENDL: self.nextMessage})
 def __init__(self, battle, screen):
     """ Initialize the Battle Message Controller """
     self.battle = battle
     self.messageBox = MessageBox(BattleMessage(""))
     screen.messageBox = self.messageBox
     cmds = {ENDL:self.battle.removeMessageFromQueue}
     ConsoleController.__init__(self, screen, commands=cmds)
 def __init__(self):
     """ Initialize the *** Controller """
     screen = PlayerNameScreen()
     ConsoleController.__init__(self, screen)
     self.index = 0
     self.addCommands(string.printable, self.addCharacterToName)
     self.addCommand(ENDL, self.submitName)
Beispiel #5
0
    def __init__(self, pokemon, targets, battle):
        """ Builds the Attack Controller """
        self.pokemon = pokemon
        self.targets = targets
        self.battle = battle
        self.action = None

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

        screen = ActionMenuScreen(self.menu, battle)
        cmds = {
            ENDL: self.menu.enter,
            KAO_UP: self.menu.up,
            KAO_DOWN: self.menu.down,
            KAO_RIGHT: self.menu.right,
            KAO_LEFT: self.menu.left
        }

        ConsoleController.__init__(self,
                                   screen,
                                   commands=cmds,
                                   cancellable=True)
Beispiel #6
0
 def __init__(self, numberOfPlayers, names):
     """ Initialize the Game Controller """
     self.game = Game(numberOfPlayers, names)
     screen = GameScreen(self.game)
     ConsoleController.__init__(self,
                                screen,
                                commands={ENDL: self.nextMessage})
 def __init__(self):
     """ Builds the Main Menu Controller """
     self.menu = TrainerMenu(self.play)
     screen = TrainerMenuScreen(self.menu)
     cmds = {KAO_UP:self.menu.up,
             KAO_DOWN:self.menu.down,
             ENDL:self.menu.enter}
     ConsoleController.__init__(self, screen, commands=cmds, cancellable=True)
Beispiel #8
0
 def __init__(self, player, matchPileManager):
     """ Initialize the Hit Controller """
     self.player = player
     self.matchPileManager = matchPileManager
     screen = HitScreen(matchPileManager)
     ConsoleController.__init__(self, screen, cancellable=True, commands={KAO_UP:self.previous,
                                                                          KAO_DOWN:self.next,
                                                                          ENDL:self.tryToHitAMatch})
Beispiel #9
0
    def __init__(self, round):
        """ Initialize Round Controller """
        self.round = round
        screen = RoundScreen(self.round)
        ConsoleController.__init__(self,
                                   screen,
                                   commands={ENDL: self.performATurn})

        self.performPlayerTurn = self.performPlayerTurn()
        self.performPlayerTurn.next()
 def __init__(self, filename):
     """ Initialize the Nyt Owl Text Editor Controller """
     textWindow = TextWindow()
     self.editor = NytOwlTextEditor(filename, textWindow)
     
     commands = GetTextStoreCommands(self.editor)
     commands.update(GetCursorCommands(self.editor))
     
     screen = NytowlScreen(self.editor)
     ConsoleController.__init__(self, screen, commands=commands)
 def __init__(self):
     """ Initialize the Game Setup Controller """
     self.playerCount = 0
     self.names = []
     screen = GameSetupScreen()
     ConsoleController.__init__(self, screen, commands={'1':self.setPlayerCount,
                                                        '2':self.setPlayerCount,
                                                        '3':self.setPlayerCount,
                                                        '4':self.setPlayerCount,
                                                        '5':self.setPlayerCount,
                                                        '6':self.setPlayerCount})
Beispiel #12
0
 def __init__(self, player, gameDeck):
     """ Initialize the Draw Controller """
     self.player = player
     self.gameDeck = gameDeck
     screen = DrawScreen(player, gameDeck)
     ConsoleController.__init__(self,
                                screen,
                                commands={
                                    '1': self.drawFromDeck,
                                    '2': self.drawFromDiscard
                                })
 def __init__(self, player, game):
     """ Initialize the Tile Picker Controller """
     self.board = game.board
     self.tilePicker = TilePicker(game.board)
     screen = TilePickerScreen(player, self.tilePicker)
     commands = {}
     for character in digits:
         commands[character] = screen.tilePickerWidget.setRow
     
     for character in ascii_lowercase:
         commands[character] = screen.tilePickerWidget.setColumn
     ConsoleController.__init__(self, screen, commands=commands)
Beispiel #14
0
 def __init__(self, player, players):
     """ Initialize the *** Controller """
     self.players = list(players)
     self.players.remove(player)
     self.players = [player for player in self.players if not player.skipped]
     
     screen = SkipScreen(self.players)
     ConsoleController.__init__(self, screen, commands={KAO_UP:self.previous,
                                                        KAO_DOWN:self.next,
                                                        ENDL:self.skipPlayer})
     
     if len(self.players) == 1:
         self.players[0].skipped = True
 def __init__(self, player):
     """ Initialize the Controller """
     self.player = player
     self.availableCards = list(self.player.hand)
     self.matchesToCards = {}
     for match in self.player.phase.matches:
         self.matchesToCards[match] = []
     
     self.screen = CompletePhaseScreen(self.player, self.availableCards, self.matchesToCards)
     ConsoleController.__init__(self, self.screen, cancellable=True, commands={'1':self.stopRunning,
                                                                               '2':self.tryToCompleteMatch,
                                                                               '3':self.tryToCompleteMatch,
                                                                               'c':self.completePhase})
Beispiel #16
0
 def __init__(self):
     """ Builds the Main Menu Controller """
     self.menu = TrainerMenu(self.play)
     screen = TrainerMenuScreen(self.menu)
     cmds = {
         KAO_UP: self.menu.up,
         KAO_DOWN: self.menu.down,
         ENDL: self.menu.enter
     }
     ConsoleController.__init__(self,
                                screen,
                                commands=cmds,
                                cancellable=True)
 def __init__(self, player, players, matchPileManager, deck):
     """ Initialize the Player Turn Controller """
     self.player = player
     self.players = players
     self.matchPileManager = matchPileManager
     self.deck = deck
     screen = PlayerTurnScreen(self.player, deck, self.matchPileManager)
     ConsoleController.__init__(self,
                                screen,
                                commands={
                                    '1': self.doRelevantAction,
                                    '2': self.discardACard
                                })
 def __init__(self):
     """ Builds the Main Menu Controller """
     entries = [TextMenuEntry("Start", self.startGame),
                TextMenuEntry("Options", self.runOptions),
                TextMenuEntry("Exit", self.stopRunning)]
     self.menu = Menu(entries)
     
     screen = MainMenuScreen(self.menu)
     cmds = {KAO_UP:self.menu.up,
             KAO_DOWN:self.menu.down,
             ENDL:self.menu.enter}
                  
     ConsoleController.__init__(self, screen, commands=cmds)
 def __init__(self):
     """ Initialize the Game Setup Controller """
     self.playerCount = 0
     self.names = []
     screen = GameSetupScreen()
     ConsoleController.__init__(self,
                                screen,
                                commands={
                                    '1': self.setPlayerCount,
                                    '2': self.setPlayerCount,
                                    '3': self.setPlayerCount,
                                    '4': self.setPlayerCount,
                                    '5': self.setPlayerCount,
                                    '6': self.setPlayerCount
                                })
 def __init__(self, player, matchPile):
     """ Initialize the Controller """
     self.player = player
     self.matchPile = matchPile
     screen = HitPileScreen(player, matchPile)
     ConsoleController.__init__(self, screen, cancellable=True, commands={'1':self.tryToHitPile,
                                                                          '2':self.tryToHitPile,
                                                                          '3':self.tryToHitPile,
                                                                          '4':self.tryToHitPile,
                                                                          '5':self.tryToHitPile,
                                                                          '6':self.tryToHitPile,
                                                                          '7':self.tryToHitPile,
                                                                          '8':self.tryToHitPile,
                                                                          '9':self.tryToHitPile,
                                                                          '0':self.tryToHitPile,
                                                                          '-':self.tryToHitPile})        
 def __init__(self, match, availableCards, matchesToCards):
     """ Initialize the *** Controller """
     self.match = match
     self.availableCards = availableCards
     self.matchesToCards = matchesToCards
     self.screen = CompleteMatchScreen(match, availableCards, matchesToCards)
     ConsoleController.__init__(self, self.screen, cancellable=True, commands={'1':self.addCard,
                                                                               '2':self.addCard,
                                                                               '3':self.addCard,
                                                                               '4':self.addCard,
                                                                               '5':self.addCard,
                                                                               '6':self.addCard,
                                                                               '7':self.addCard,
                                                                               '8':self.addCard,
                                                                               '9':self.addCard,
                                                                               '0':self.addCard,
                                                                               '-':self.addCard})
Beispiel #22
0
    def __init__(self):
        """ Builds the Main Menu Controller """
        entries = [
            TextMenuEntry("Start", self.startGame),
            TextMenuEntry("Options", self.runOptions),
            TextMenuEntry("Exit", self.stopRunning)
        ]
        self.menu = Menu(entries)

        screen = MainMenuScreen(self.menu)
        cmds = {
            KAO_UP: self.menu.up,
            KAO_DOWN: self.menu.down,
            ENDL: self.menu.enter
        }

        ConsoleController.__init__(self, screen, commands=cmds)
    def __init__(self, pokemon, cancellable=True):
        """ Builds the Switch Controller """
        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 = PokemonMenuScreen(self.menu) # Need different screen

        cmds = {ENDL:self.menu.enter,
                KAO_UP:self.menu.up,
                KAO_DOWN:self.menu.down,
                KAO_RIGHT:self.menu.right,
                KAO_LEFT:self.menu.left}
                     
        ConsoleController.__init__(self, screen, commands=cmds, cancellable=cancellable)
    def __init__(self, player):
        """ Initialize the Controller """
        self.player = player
        self.availableCards = list(self.player.hand)
        self.matchesToCards = {}
        for match in self.player.phase.matches:
            self.matchesToCards[match] = []

        self.screen = CompletePhaseScreen(self.player, self.availableCards,
                                          self.matchesToCards)
        ConsoleController.__init__(self,
                                   self.screen,
                                   cancellable=True,
                                   commands={
                                       '1': self.stopRunning,
                                       '2': self.tryToCompleteMatch,
                                       '3': self.tryToCompleteMatch,
                                       'c': self.completePhase
                                   })
 def __init__(self, pokemon, battle):
     """ Builds the Action 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)
     
     screen = ActionMenuScreen(self.menu, battle)
     cmds = {ENDL:self.menu.enter,
             KAO_UP:self.menu.up,
             KAO_DOWN:self.menu.down,
             KAO_RIGHT:self.menu.right,
             KAO_LEFT:self.menu.left}
                  
     ConsoleController.__init__(self, screen, commands=cmds)
 def __init__(self, pokemon, targets, battle):
     """ Builds the Attack Controller """
     self.pokemon = pokemon
     self.targets = targets
     self.battle = battle
     self.action = None
     
     entries = []
     for attack in self.pokemon.getAttacks():
         entries.append(AttackMenuEntry(attack, self.setAction))
     self.menu = Menu(entries, columns=2)
     
     screen = ActionMenuScreen(self.menu, battle)
     cmds = {ENDL:self.menu.enter,
             KAO_UP:self.menu.up,
             KAO_DOWN:self.menu.down,
             KAO_RIGHT:self.menu.right,
             KAO_LEFT:self.menu.left}
                  
     ConsoleController.__init__(self, screen, commands=cmds, cancellable=True)
Beispiel #27
0
 def __init__(self, player, players, deck):
     """ Initialize the Discard Controller """
     self.player = player
     self.players = players
     self.deck = deck
     screen = DiscardScreen(self.player)
     ConsoleController.__init__(self,
                                screen,
                                commands={
                                    '1': self.discardACard,
                                    '2': self.discardACard,
                                    '3': self.discardACard,
                                    '4': self.discardACard,
                                    '5': self.discardACard,
                                    '6': self.discardACard,
                                    '7': self.discardACard,
                                    '8': self.discardACard,
                                    '9': self.discardACard,
                                    '0': self.discardACard,
                                    '-': self.discardACard
                                })
 def __init__(self, match, availableCards, matchesToCards):
     """ Initialize the *** Controller """
     self.match = match
     self.availableCards = availableCards
     self.matchesToCards = matchesToCards
     self.screen = CompleteMatchScreen(match, availableCards,
                                       matchesToCards)
     ConsoleController.__init__(self,
                                self.screen,
                                cancellable=True,
                                commands={
                                    '1': self.addCard,
                                    '2': self.addCard,
                                    '3': self.addCard,
                                    '4': self.addCard,
                                    '5': self.addCard,
                                    '6': self.addCard,
                                    '7': self.addCard,
                                    '8': self.addCard,
                                    '9': self.addCard,
                                    '0': self.addCard,
                                    '-': self.addCard
                                })
Beispiel #29
0
    def __init__(self, pokemon, cancellable=True):
        """ Builds the Switch Controller """
        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 = PokemonMenuScreen(self.menu)  # Need different screen

        cmds = {
            ENDL: self.menu.enter,
            KAO_UP: self.menu.up,
            KAO_DOWN: self.menu.down,
            KAO_RIGHT: self.menu.right,
            KAO_LEFT: self.menu.left
        }

        ConsoleController.__init__(self,
                                   screen,
                                   commands=cmds,
                                   cancellable=cancellable)
    def __init__(self, pokemon, battle):
        """ Builds the Action 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)

        screen = ActionMenuScreen(self.menu, battle)
        cmds = {
            ENDL: self.menu.enter,
            KAO_UP: self.menu.up,
            KAO_DOWN: self.menu.down,
            KAO_RIGHT: self.menu.right,
            KAO_LEFT: self.menu.left,
        }

        ConsoleController.__init__(self, screen, commands=cmds)
 def __init__(self, player, game):
     """ Initialize the Player Turn Controller """
     self.player = player
     self.game = game
     ConsoleController.__init__(self, None)
Beispiel #32
0
 def __init__(self, playerTrainer, oppTrainer):
     """ Builds the Battle Controller """
     self.battle = Battle(playerTrainer, oppTrainer)
     screen = BattleMessageScreen(self.battle)
     
     ConsoleController.__init__(self, screen)
 def __init__(self):
     """ Builds the Options Menu Controller """
     self.menu = OptionsMenu()
     screen = OptionsMenuScreen(self.menu)
     
     ConsoleController.__init__(self, screen, cancellable=True)
Beispiel #34
0
 def __init__(self, game):
     """ Initialize the Round Controller """
     self.game = game
     ConsoleController.__init__(self, None)
Beispiel #35
0
 def __init__(self, numberOfPlayers, names):
     """ Initialize the Game Controller """
     self.game = Game(numberOfPlayers, names)
     screen = GameScreen(self.game)
     ConsoleController.__init__(self, screen, commands={ENDL:self.nextMessage})
 def runController(self, controller):
     """ Runs the given controller """
     ConsoleController.runController(self, controller)
     if controller.action is not None:
         self.action = controller.action
         self.stopRunning()
Beispiel #37
0
 def __init__(self, board):
     """ Initialize the Board Controller """
     screen = BoardScreen(board)
     ConsoleController.__init__(self, screen)
Beispiel #38
0
    def __init__(self):
        """ Builds the Options Menu Controller """
        self.menu = OptionsMenu()
        screen = OptionsMenuScreen(self.menu)

        ConsoleController.__init__(self, screen, cancellable=True)
Beispiel #39
0
 def __init__(self, game):
     """ Initialize the Game Controller """
     self.game = game
     screen = GameScreen()
     ConsoleController.__init__(self, screen, commands={ENDL:self.nextMessage})
Beispiel #40
0
 def __init__(self):
     """ Initialize the *** Controller """
     screen = %ViewName%()
     ConsoleController.__init__(self, screen)
 def runController(self, controller):
     """ Runs the given controller """
     ConsoleController.runController(self, controller)
     if controller.action is not None:
         self.action = controller.action
         self.stopRunning()
Beispiel #42
0
 def __init__(self, game):
     """ Initialize the Round Controller """
     self.game = game
     ConsoleController.__init__(self, None)