Пример #1
0
 def __init__(self, width, height, pokemon=None, pokemonMenuEntry=None, showHP=True):
     """ Initialize the Pokemon Stats View """
     if pokemon is not None:
         self.pokemon = pokemon
         pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
     else:
         self.pokemon = pokemonMenuEntry.getPokemon()
     MenuEntryWidget.__init__(self, pokemonMenuEntry, width, height, fontSize=self.FONT_SIZE)
         
     self.showHP = showHP
     self.setLevelLabel()
     self.setHealthLabel()
     self.healthBarView = HealthBarView(self.pokemon, width, height*.1)
Пример #2
0
    def __init__(self,
                 width,
                 height,
                 pokemon=None,
                 pokemonMenuEntry=None,
                 showHP=True):
        """ Initialize the Pokemon Stats View """
        if pokemon is not None:
            self.pokemon = pokemon
            pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
        else:
            self.pokemon = pokemonMenuEntry.getPokemon()
        MenuEntryWidget.__init__(self,
                                 pokemonMenuEntry,
                                 width,
                                 height,
                                 fontSize=self.FONT_SIZE)

        self.showHP = showHP
        self.setLevelLabel()
        self.setHealthLabel()
        self.healthBarView = HealthBarView(self.pokemon, width, height * .1)
Пример #3
0
class PokemonStatsView(MenuEntryWidget):
    """ View for a Pokemon's Stats in a Battle """
    FONT_SIZE = 24
    
    def __init__(self, width, height, pokemon=None, pokemonMenuEntry=None, showHP=True):
        """ Initialize the Pokemon Stats View """
        if pokemon is not None:
            self.pokemon = pokemon
            pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
        else:
            self.pokemon = pokemonMenuEntry.getPokemon()
        MenuEntryWidget.__init__(self, pokemonMenuEntry, width, height, fontSize=self.FONT_SIZE)
            
        self.showHP = showHP
        self.setLevelLabel()
        self.setHealthLabel()
        self.healthBarView = HealthBarView(self.pokemon, width, height*.1)
        
    def setLevelLabel(self):
        """ Set the Level Label """
        self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()), size=self.FONT_SIZE)
        
    def setHealthLabel(self):
        """ Set the Health Label """
        hpString = "{0}/{1}".format(self.pokemon.getCurrHP(), self.pokemon.getStat("HP"))
        self.healthLabel = Label(hpString, size=self.FONT_SIZE)
        
    def drawSurface(self):
        """ Draw the Pokemon Stats View """
        pkmnSurface = self.mainLabel.draw()
        self.drawOnSurface(pkmnSurface, left=0, top=0)
        
        levelSurface = self.levelLabel.draw()
        self.drawOnSurface(levelSurface, right=1, top=0)
        
        healthBarSurface = self.healthBarView.draw()
        self.drawOnSurface(healthBarSurface, left=0, top=(pkmnSurface.get_height()+10.0)/self.height)
        
        if self.showHP:
            healthSurface = self.healthLabel.draw()
            self.drawOnSurface(healthSurface, right=1, 
                    top=(pkmnSurface.get_height()+healthBarSurface.get_height()+15.0)/self.height)
        
    def update(self):
        """ Update the Pokemon Stats View """
        MenuEntryWidget.update(self)
        self.setLevelLabel()
        self.setHealthLabel()
Пример #4
0
class PokemonStatsView(MenuEntryWidget):
    """ View for a Pokemon's Stats in a Battle """
    FONT_SIZE = 24

    def __init__(self,
                 width,
                 height,
                 pokemon=None,
                 pokemonMenuEntry=None,
                 showHP=True):
        """ Initialize the Pokemon Stats View """
        if pokemon is not None:
            self.pokemon = pokemon
            pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
        else:
            self.pokemon = pokemonMenuEntry.getPokemon()
        MenuEntryWidget.__init__(self,
                                 pokemonMenuEntry,
                                 width,
                                 height,
                                 fontSize=self.FONT_SIZE)

        self.showHP = showHP
        self.setLevelLabel()
        self.setHealthLabel()
        self.healthBarView = HealthBarView(self.pokemon, width, height * .1)

    def setLevelLabel(self):
        """ Set the Level Label """
        self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()),
                                size=self.FONT_SIZE)

    def setHealthLabel(self):
        """ Set the Health Label """
        hpString = "{0}/{1}".format(self.pokemon.getCurrHP(),
                                    self.pokemon.getStat("HP"))
        self.healthLabel = Label(hpString, size=self.FONT_SIZE)

    def drawSurface(self):
        """ Draw the Pokemon Stats View """
        pkmnSurface = self.mainLabel.draw()
        self.drawOnSurface(pkmnSurface, left=0, top=0)

        levelSurface = self.levelLabel.draw()
        self.drawOnSurface(levelSurface, right=1, top=0)

        healthBarSurface = self.healthBarView.draw()
        self.drawOnSurface(healthBarSurface,
                           left=0,
                           top=(pkmnSurface.get_height() + 10.0) / self.height)

        if self.showHP:
            healthSurface = self.healthLabel.draw()
            self.drawOnSurface(healthSurface,
                               right=1,
                               top=(pkmnSurface.get_height() +
                                    healthBarSurface.get_height() + 15.0) /
                               self.height)

    def update(self):
        """ Update the Pokemon Stats View """
        MenuEntryWidget.update(self)
        self.setLevelLabel()
        self.setHealthLabel()