Exemplo n.º 1
0
    def disp_unit(self, unit):
        self.current_unit = unit

        # Face
        self.smile()  # Check these
        self.talk()
        unit.portrait.create_image()
        pixmap = create_pixmap(
            Engine.transform_scale(unit.portrait.image.convert_alpha(),
                                   (96 * 2, 80 * 2)), self.window)
        self.portrait.setPixmap(pixmap)
        self.portrait_pos_boxes[0].setValue(unit.portrait.blink_position[0])
        self.portrait_pos_boxes[1].setValue(unit.portrait.blink_position[1])
        self.portrait_pos_boxes[2].setValue(unit.portrait.mouth_position[0])
        self.portrait_pos_boxes[3].setValue(unit.portrait.mouth_position[1])

        # Char data
        self.name.setText(unit.name)
        # self.team.setCurrentIndex(self.teams.index(unit.team))
        self.gender.setValue(unit.gender)
        self.level.setValue(unit.level)
        self.faction.setText(unit.faction)
        self.lord.setChecked('Lord' in unit.tags)
        self.boss.setChecked('Boss' in unit.tags)
        self.desc.setText(unit.desc)
        self.klass.setCurrentIndex([k['name']
                                    for k in class_data].index(unit.klass))

        for index, (stat_name, stat) in enumerate(unit.stats.iteritems()):
            self.stat_bases[index].setValue(stat.base_stat)
            self.stat_growths[index].setValue(unit.growths[index])

        for index, wexp in enumerate(unit.wexp):
            self.wexp[index].setValue(wexp)

        self.clear_items()
        for index, item in enumerate(unit.items):
            self.add_item()
            item_box, drop_box, event_box = self.items[index]
            drop_box.setChecked(item.droppable)
            event_box.setChecked(item.event_combat)
            item_box.setCurrentIndex([i.name
                                      for i in item_data].index(item.name))

        self.clear_skills()
        for index, skill in enumerate(unit.skills):
            self.add_skill()
            skill_box = self.skills[index]
            skill_box.setCurrentIndex([s.id
                                       for s in skill_data].index(skill.id))
Exemplo n.º 2
0
    def tick(self):
        # Update global sprite counters
        current_time = self.elapsed_timer.elapsed()

        if GC.PASSIVESPRITECOUNTER.update(current_time):
            for index, klass in enumerate(class_data):
                klass['icon'] = create_icon(
                    klass['images'][GC.PASSIVESPRITECOUNTER.count], window)
                self.klass.setItemIcon(index, klass['icon'])

        if self.current_unit:
            self.current_unit.portrait.update(current_time)
            self.current_unit.portrait.create_image()
            pixmap = create_pixmap(
                Engine.transform_scale(
                    self.current_unit.portrait.image.convert_alpha(),
                    (96 * 2, 80 * 2)), self.window)
            self.portrait.setPixmap(pixmap)
Exemplo n.º 3
0
    def __init__(self, view, window=None):
        super(TileInfoMenu, self).__init__(window)
        self.grid = QGridLayout()
        self.setLayout(self.grid)
        self.window = window

        self.view = view

        self.list = SignalList(self)
        self.list.setMinimumSize(128, 320)
        self.list.uniformItemSizes = True
        self.list.setIconSize(QSize(32, 32))

        # Ingest Data
        self.info = sorted(kinds.values(), key=lambda x: x.num)
        for info in self.info:
            image = Engine.transform_scale(info.image, (32, 32))
            pixmap = EditorUtilities.create_pixmap(image)

            item = QListWidgetItem(info.name)
            item.setIcon(QIcon(pixmap))
            self.list.addItem(item)

        self.grid.addWidget(self.list, 0, 0)