Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
0
    def run_main(self):
        """
        Runs the menu and then the game based on what the user does in the menu
        """
        clock = pygame.time.Clock()  # TODO: Fix time step
        Menu(self.screen)
        Run(self.user_id, self.user, self.highscore, self.screen, 1500, 900)

        clock.tick(60)  # Use for later reference
 def setUp(self):
     """ Build the Menu and Entries for the test """
     self.menu = Menu()
     self.firstEntry = TextMenuEntry("1", None)
     self.secondEntry = TextMenuEntry("2", None)
     self.thirdEntry = TextMenuEntry("3", None)
     self.menu.entries = [
         self.firstEntry, self.secondEntry, self.thirdEntry
     ]
     self.menu.selectEntry()
    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
                                  })
Exemplo n.º 7
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, 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)
Exemplo n.º 9
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
                                  })
Exemplo n.º 10
0
 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, 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)
Exemplo n.º 12
0
 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})
Exemplo n.º 13
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)
Exemplo n.º 14
0
    def run_main(self):
        clock = pygame.time.Clock()  # TODO: Fix time step
        Menu(self.screen)
        Run(self.user_id, self.user, self.screen, 1500, 900)

        clock.tick(60)  # Use for later reference
Exemplo n.º 15
0
import pygame
from Menu.menu import Menu
from Menu.savesettings import GetRes

#Code to initialise Menu and program
pygame.init()
width = int(GetRes()[0])
height = int(GetRes()[1])

mode = (GetRes()[2])
if mode == "fullscreen":
    screen = pygame.display.set_mode((width, height), pygame.FULLSCREEN)
else:
    screen = pygame.display.set_mode([width, height])

mainmenu = Menu(screen)
mainmenu.MainMenu()