Пример #1
0
 def __init__(self,
              model,
              shop,
              camp,
              width=360,
              purchase_price=True,
              **kwargs):
     self.model = model
     self.shop = shop
     self.width = width
     if purchase_price:
         self.image = pbge.render_text(
             pbge.BIGFONT,
             "${:,}".format(shop.calc_purchase_price(camp, model)),
             width,
             justify=0,
             color=pbge.TEXT_COLOR)
     else:
         self.image = pbge.render_text(
             pbge.BIGFONT,
             "${:,}".format(shop.calc_sale_price(camp, model)),
             width,
             justify=0,
             color=pbge.TEXT_COLOR)
     self.height = self.image.get_height()
Пример #2
0
 def update(self):
     pilot = self.model.pilot
     if pilot not in self.camp.party:
         self.model.pilot = None
         pilot = None
     if not pilot and hasattr(self.model,"owner") and self.model.owner:
         self.image = pbge.render_text(self.font, 'Owner: {}'.format(str(self.model.owner)), self.width,
                                       justify=-1, color=pbge.INFO_HILIGHT)
     else:
         self.image = pbge.render_text(self.font,'Pilot: {}'.format(str(pilot)),self.width,justify=-1,color=pbge.INFO_HILIGHT)
Пример #3
0
 def update(self):
     mek = self.camp.get_pc_mecha(self.model)
     if mek:
         self.image = pbge.render_text(self.font,
                                       'Mecha: {}'.format(
                                           mek.get_full_name()),
                                       self.width,
                                       justify=-1,
                                       color=pbge.INFO_HILIGHT)
     else:
         self.image = pbge.render_text(self.font,
                                       'Mecha: None',
                                       self.width,
                                       justify=-1,
                                       color=pbge.INFO_HILIGHT)
Пример #4
0
 def update(self):
     if self.scene and self.scene.is_hostile_to_player(self.model):
         self.image = pbge.render_text(self.font, 'HOSTILE UNIT', self.width,justify=0, color=pbge.ENEMY_RED)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #5
0
    def __call__(self):
        pbge.my_state.screen.fill((0, 0, 0))
        dest = self.bg.bitmap.get_rect(
            center=(pbge.my_state.screen.get_width() // 2,
                    pbge.my_state.screen.get_height() // 2))
        self.bg.render(dest)

        self.title.render(self.TITLE_DEST.get_rect())

        pbge.my_state.screen.set_clip(dest)
        self.add_snow(dest)
        for sf in list(self.flakes):
            if sf.update():
                self.flakes.remove(sf)
            else:
                self.snow.render((sf.x, sf.y), sf.frame)
        pbge.my_state.screen.set_clip(None)
        versid = pbge.render_text(pbge.my_state.medium_font,
                                  VERSION,
                                  120,
                                  justify=1)
        pbge.my_state.screen.blit(
            versid,
            versid.get_rect(bottomright=(pbge.my_state.screen.get_width() - 8,
                                         pbge.my_state.screen.get_height() -
                                         8)))
Пример #6
0
 def update(self):
     if self.model and not self.model.check_design():
         self.image = pbge.render_text(self.font, 'INVALID DESIGN', self.width, justify=0, color=pbge.ENEMY_RED)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #7
0
 def __init__(self, model, shop, camp, width=360, **kwargs):
     self.model = model
     self.shop = shop
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT, "${:,}".format(shop.calc_purchase_price(camp, model)), width,
                                   justify=0, color=pbge.TEXT_COLOR)
     self.height = self.image.get_height()
Пример #8
0
    def __call__(self):
        pbge.my_state.screen.fill((0, 0, 0))

        w,h = pbge.my_state.screen.get_size()
        bigrect = pygame.Rect(0,(h-600)//2,w,600)
        rubblerect = pygame.Rect(0,(h-600)//2+600-self.rubble.frame_height,w,self.rubble.frame_height)

        self.sky.tile(bigrect,x_offset=self.sky_x)
        self.sky_x += 1
        if self.sky_x >= self.sky.frame_width:
            self.sky_x = 0

        self.cameo.render((w//2+self.cameo_pos[0],h//2+self.cameo_pos[1]))

        self.rubble.tile(rubblerect, x_offset=self.rubble_x)
        self.rubble_x += 2
        if self.rubble_x >= self.rubble.frame_width:
            self.rubble_x = 0

        self.mecha.render((self.mecha_x,(h-600)//2))
        self.mecha_x -= 1
        if self.mecha_x < -self.mecha.frame_width:
            self.mecha_x = w


        self.title.render(self.TITLE_DEST.get_rect())

        versid = pbge.render_text(pbge.my_state.medium_font, VERSION, 120, justify=1)
        pbge.my_state.screen.blit(versid, versid.get_rect(
            bottomright=(pbge.my_state.screen.get_width() - 8, pbge.my_state.screen.get_height() - 8)))
Пример #9
0
 def __init__(self, model, width=220, font=None, **kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     self.image = pbge.render_text(self.font,
                                   '{} + {}'.format(model.get_attack_skill().name, model.attack_stat.name), width,
                                   justify=0, color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #10
0
 def update(self):
     msg = "Trainer: {}\nActive: {}".format(self.model.pet_data.trainer,
                                            self.model.pet_data.active)
     self.image = pbge.render_text(self.font,
                                   msg,
                                   self.width,
                                   justify=-1,
                                   color=pbge.INFO_HILIGHT)
Пример #11
0
 def update(self):
     badgez = [b.name for b in self.model.badges]
     badgez.sort()
     self.image = pbge.render_text(self.font,
                                   'Badges: {}'.format(', '.join(
                                       badgez or ["None"])),
                                   self.width,
                                   justify=-1,
                                   color=pbge.INFO_GREEN)
Пример #12
0
 def __init__(self, model, width=220, **kwargs):
     self.model = model
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT,
                                   model.get_full_name(),
                                   width,
                                   justify=0,
                                   color=pbge.WHITE)
     self.height = self.image.get_height()
Пример #13
0
 def __init__(self, items, width=220, **kwargs):
     self.items = items
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT,
                                   '\n'.join([str(i) for i in items]),
                                   width,
                                   justify=-1,
                                   color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #14
0
 def update(self):
     tagz = [b.name for b in self.model.get_tags()]
     tagz.sort()
     self.image = pbge.render_text(self.font,
                                   'Tags: {}'.format(', '.join(
                                       tagz or ["None"])),
                                   self.width,
                                   justify=-1,
                                   color=pbge.INFO_GREEN)
Пример #15
0
 def __init__(self, model, width=220, **kwargs):
     self.model = model
     self.width = width
     if model.ench_list:
         self.image = pbge.render_text(pbge.SMALLFONT,', '.join([e.name for e in model.ench_list]),width,justify=-1,color=pbge.INFO_HILIGHT)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #16
0
 def __init__(self, model, width=220, **kwargs):
     self.model = model
     self.width = width
     if model.ench_list:
         self.image = pbge.render_text(pbge.SMALLFONT,', '.join([e.name for e in model.ench_list]),width,justify=-1,color=pbge.INFO_HILIGHT)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #17
0
 def __init__(self, model, width=220, font=None, **kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     self.image = pbge.render_text(self.font,
                                   model.desc,
                                   width,
                                   justify=-1,
                                   color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #18
0
 def update(self):
     self.image = pbge.render_text(pbge.BIGFONT,
                                   '\n '.join([
                                       '{}: {}'.format(*rew)
                                       for rew in self.mission_seed.results
                                   ]),
                                   self.width,
                                   justify=0,
                                   color=pbge.INFO_HILIGHT)
     self.height = self.image.get_height()
Пример #19
0
 def _get_text_image(self):
     return pbge.render_text(self.font,
                    "Mass: {:.1f} tons \n Armor: {} \n Mobility: {} \n Speed: {} \n Sensor Range: {} \n E-War Progs: {}".format(
                        self.model.mass / 10000.0,
                        self.model.calc_average_armor(),
                        self.model.calc_mobility(),
                        self.model.get_max_speed(),
                        self.model.get_sensor_range(self.model.scale),
                        self.model.get_ewar_rating()),
                    self.width, justify=0, color=pbge.INFO_GREEN)
Пример #20
0
 def update(self):
     if hasattr(self.model, "owner") and self.model.owner:
         self.image = pbge.render_text(self.font,
                                       'Owner: {}'.format(
                                           str(self.model.owner)),
                                       self.width,
                                       justify=-1,
                                       color=pbge.INFO_HILIGHT)
     else:
         self.image = None
Пример #21
0
 def _get_text_image(self):
     return pbge.render_text(self.font,
                    "Mass: {:.1f} tons \n Armor: {} \n Mobility: {} \n Speed: {} \n Sensor Range: {} \n E-War Progs: {}".format(
                        self.model.mass / 10000.0,
                        self.model.calc_average_armor(),
                        self.model.calc_mobility(),
                        self.model.get_max_speed(),
                        self.model.get_sensor_range(self.model.scale),
                        self.model.get_ewar_rating()),
                    self.width, justify=0, color=pbge.INFO_GREEN)
Пример #22
0
 def __init__(self, cost, width):
     self._cost = cost
     self.width = width
     msg = '${:,}'.format(cost)
     self.image = pbge.render_text(pbge.BIGFONT,
                                   msg,
                                   self.width,
                                   justify=0,
                                   color=pbge.TEXT_COLOR)
     self.height = self.image.get_height()
Пример #23
0
 def update(self):
     pilot = self.model.pilot
     if pilot not in self.camp.party:
         self.model.pilot = None
         pilot = None
     self.image = pbge.render_text(self.font,
                                   'Pilot: {}'.format(str(pilot)),
                                   self.width,
                                   justify=-1,
                                   color=pbge.INFO_HILIGHT)
Пример #24
0
 def update(self):
     self.image = pbge.render_text(
         self.font,
         'XP: {}/{}'.format(
             self.model.experience[self.model.TOTAL_XP] -
             self.model.experience[self.model.SPENT_XP],
             self.model.experience[self.model.TOTAL_XP]),
         self.width,
         justify=0,
         color=pbge.INFO_GREEN)
Пример #25
0
 def update(self):
     self.images = dict()
     for o in self.mission_seed.objectives:
         if not o.secret:
             self.images[o] = pbge.render_text(self.font,
                                               self.get_objective_text(o),
                                               self.width,
                                               self.get_objective_color(o),
                                               justify=0)
     self.height = sum(i.get_height() for i in list(self.images.values(
     ))) + self.PADDING * (len(list(self.images.values())) - 1)
Пример #26
0
 def update(self):
     skillz = [
         sk.name for sk in list(self.model.statline.keys())
         if sk in stats.NONCOMBAT_SKILLS
     ]
     skillz.sort()
     self.image = pbge.render_text(self.font,
                                   'Skills: {}'.format(', '.join(
                                       skillz or ["None"])),
                                   self.width,
                                   justify=-1,
                                   color=pbge.INFO_GREEN)
Пример #27
0
 def __init__(self,
              title="Title Block!",
              title_color=pbge.INFO_HILIGHT,
              width=220,
              **kwargs):
     self.title = title
     self.width = width
     self.image = pbge.render_text(pbge.my_state.huge_font,
                                   title,
                                   width,
                                   justify=0,
                                   color=title_color)
     self.height = self.image.get_height()
Пример #28
0
 def __init__(self,model,width=220,font=None,**kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     attatts = model.get_attributes()
     if attatts:
         attnames = [att.name for att in attatts]
         attnames.sort()
         self.image = pbge.render_text(self.font,', '.join(attnames),width,justify=0,color=pbge.INFO_HILIGHT)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #29
0
 def __init__(self, model, width = 220, font = None, color = None, **kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     self.color = color or pbge.INFO_HILIGHT
     items = list(self.get_items())
     if items:
         items.sort()
         self.image = pbge.render_text(self.font, ', '.join(items), width, justify = 0, color = self.color)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #30
0
 def __init__(self,
              model,
              width=220,
              year=158,
              font=None,
              color=None,
              **kwargs):
     self.model = model
     self.year = year
     self.width = width
     self.font = font or pbge.SMALLFONT
     self.color = color or pbge.INFO_GREEN
     self._generate_commentary()
     self._image = pbge.render_text(self.font, self._text, self.width,
                                    self.color)
     self.height = self._image.get_height()
Пример #31
0
 def __init__(self, model, width=220, font=None, **kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     attatts = model.get_attributes()
     if attatts:
         attnames = [att.name for att in attatts]
         attnames.sort()
         self.image = pbge.render_text(self.font,
                                       ', '.join(attnames),
                                       width,
                                       justify=0,
                                       color=pbge.INFO_HILIGHT)
         self.height = self.image.get_height()
     else:
         self.image = None
         self.height = 0
Пример #32
0
    def __init__(self, model, width=220, font=None, color=None, **keywords):
        self.model = model
        self.width = width
        self.font = font or pbge.BIGFONT
        self.color = color or pbge.WHITE

        msg = self.get_text()
        if msg:
            self.image = pbge.render_text(self.font,
                                          msg,
                                          self.width,
                                          justify=0,
                                          color=self.color)
            self.height = self.image.get_height()
        else:
            self.image = None
            self.height = 0
Пример #33
0
 def __init__(self,model,width=220,font=None,**kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     self.image = pbge.render_text(self.font,'{} + {}'.format(model.get_attack_skill().name,model.attack_stat.name),width,justify=0,color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #34
0
 def update(self):
     self.image = pbge.render_text(self.font, 'XP: {}/{}'.format(
         self.model.experience[self.model.TOTAL_XP] - self.model.experience[self.model.SPENT_XP], self.model.experience[self.model.TOTAL_XP]),
                                   self.width, justify=0, color=pbge.INFO_GREEN)
Пример #35
0
 def update(self):
     tagz = [b.name for b in self.model.get_tags()]
     tagz.sort()
     self.image = pbge.render_text(self.font, 'Tags: {}'.format(', '.join(tagz or ["None"])), self.width, justify=-1, color=pbge.INFO_GREEN)
Пример #36
0
 def __init__(self,model,width=220,**kwargs):
     self.model = model
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT,str(model),width,justify=0)
     self.height = self.image.get_height()
Пример #37
0
 def __init__(self,items,width=220,**kwargs):
     self.items = items
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT,'\n'.join([str(i) for i in items]),width,justify=-1,color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #38
0
 def color(self, value):
     self._color = value
     self._image = pbge.render_text(self.font, self.text, self.w,
                                    self.color)
Пример #39
0
 def update(self):
     pilot = self.model.pilot
     if pilot not in self.camp.party:
         self.model.pilot = None
         pilot = None
     self.image = pbge.render_text(self.font,'Pilot: {}'.format(str(pilot)),self.width,justify=-1,color=pbge.INFO_HILIGHT)
Пример #40
0
 def update(self):
     self.image = pbge.render_text(pbge.BIGFONT,'\n '.join(['{}: {}'.format(*rew) for rew in self.mission_seed.results]),self.width,justify=0,color=pbge.INFO_HILIGHT)
     self.height = self.image.get_height()
Пример #41
0
 def __init__(self,title="Title Block!",title_color=pbge.INFO_HILIGHT,width=220,**kwargs):
     self.title = title
     self.width = width
     self.image = pbge.render_text(pbge.my_state.huge_font,title,width,justify=0,color=title_color)
     self.height = self.image.get_height()
Пример #42
0
 def __init__(self,model,width=220,**kwargs):
     self.model = model
     self.width = width
     self.image = pbge.render_text(pbge.BIGFONT,model.get_full_name(),width,justify=0,color=pbge.WHITE)
     self.height = self.image.get_height()
Пример #43
0
 def update(self):
     self.images = dict()
     for o in self.mission_seed.objectives:
         if not o.secret:
             self.images[o] = pbge.render_text(self.font,self.get_objective_text(o),self.width,self.get_objective_color(o),justify=0)
     self.height = sum(i.get_height() for i in self.images.values()) + self.PADDING * (len(self.images.values())-1)
Пример #44
0
 def __init__(self,model,width=220,font=None,**kwargs):
     self.model = model
     self.width = width
     self.font = font or pbge.MEDIUMFONT
     self.image = pbge.render_text(self.font,model.desc,width,justify=-1,color=pbge.INFO_GREEN)
     self.height = self.image.get_height()
Пример #45
0
 def update(self):
     skillz = [sk.name for sk in self.model.statline.keys() if sk in stats.NONCOMBAT_SKILLS]
     skillz.sort()
     self.image = pbge.render_text(self.font, 'Skills: {}'.format(', '.join(skillz or ["None"])), self.width, justify=-1, color=pbge.INFO_GREEN)
Пример #46
0
 def update(self):
     mek = self.camp.get_pc_mecha(self.model)
     if mek:
         self.image = pbge.render_text(self.font,'Mecha: {}'.format(mek.get_full_name()),self.width,justify=-1,color=pbge.INFO_HILIGHT)
     else:
         self.image = pbge.render_text(self.font,'Mecha: None',self.width,justify=-1,color=pbge.INFO_HILIGHT)
Пример #47
0
 def update(self):
     badgez = [b.name for b in self.model.badges]
     badgez.sort()
     self.image = pbge.render_text(self.font, 'Badges: {}'.format(', '.join(badgez or ["None"])), self.width, justify=-1, color=pbge.INFO_GREEN)