Example #1
0
    def render(self, display):
        display.fill((255, 255, 255))
        pygame.draw.polygon(display, (246, 250, 253), ((0, 0), (132, 0), (40, 600), (0, 600)))
        # pygame.draw.polygon(display, (206, 51, 65), TeamMenu.t_poly_2)

        g_x = 106
        g_y = 60

        _time = utils.current_milli_time() - self.open_time
        part_time = _time % 2000
        poke_y = 0
        if part_time < 900:
            poke_y = 0
        elif part_time < 950 or 1950 <= part_time:
            poke_y = 1
        elif part_time < 1000 or 1900 <= part_time:
            poke_y = 3
        elif part_time < 1900:
            poke_y = 5

        for i in range(self.player.get_non_null_team_number()):

            self.draw_pokemon(display,  self.player.team[i], g_x, g_y, poke_y,
                              (0, 0, 0) if self.selected == i else (255, 255, 255),
                              (0, 0, 0) if self.selected != i else (255, 255, 255)
                              )
            g_y += 90

        # action hud
        if self.action_selected != -1:
            _y = 60 + 90 * self.selected
            _x = 1060 * 0.31
            utils.draw_select_box(display, _x, _y, self.text_2, self.action_selected, 100)
Example #2
0
    def render(self, display):
        display.fill((255, 255, 255))
        pygame.draw.polygon(display, (241, 65, 78), TeamMenu.t_poly_1)
        pygame.draw.polygon(display, (206, 51, 65), TeamMenu.t_poly_2)
        pygame.draw.rect(display, (0, 0, 0), (0, 570, 1060, 30))
        display.blit(self.cat_image, (10, 10))
        display.blit(game.FONT_BOLD_58.render(
            game.get_game_instance().get_message("team").upper(), True, (0, 0, 0)), (74, 10))

        g_x = SURFACE_SIZE[0] * 0.1
        g_y = 70

        _time = utils.current_milli_time() - self.open_time
        part_time = _time % 2000
        poke_y = 0
        if part_time < 900:
            poke_y = 0
        elif part_time < 950 or 1950 <= part_time:
            poke_y = 1
        elif part_time < 1000 or 1900 <= part_time:
            poke_y = 3
        elif part_time < 1900:
            poke_y = 5

        for i in range(self.player.get_non_null_team_number()):

            if self.move != i:
                color = (0, 0, 0) if self.selected == i else (255, 255, 255)
                text_color = (0, 0, 0) if self.selected != i else (255, 255, 255)
                utils.draw_pokemon(display, self.player.team[i], (int(g_x), int(g_y)),
                                   poke_y, color=color, text_color=text_color)
            g_y += 80

        # draw move
        if self.move != -1:
            color = (0, 0, 0) if self.selected == self.move else (255, 255, 255)
            text_color = (0, 0, 0) if self.selected != self.move else (255, 255, 255)
            utils.draw_pokemon(display, self.player.team[self.move], (int(g_x + SURFACE_SIZE[0] * 0.04),
                                                                      int(self.selected * SURFACE_SIZE[1] * 0.15 +
                                                                          SURFACE_SIZE[1] * 0.05)), poke_y,
                               color=color, text_color=text_color)

        select = self.player.team[self.selected]
        if select:
            display.blit(select.get_front_image(4), (SURFACE_SIZE[0] * 0.5, SURFACE_SIZE[1] * 0.2))

        # action hud
        if self.action_selected != -1:
            _y = (-35 if self.selected == 5 else 40) + SURFACE_SIZE[1] * 0.15 * self.selected
            _x = SURFACE_SIZE[0] * 0.31
            if self.action_type == 0:
                utils.draw_select_box(display, _x, _y, self.text_2, self.action_selected, 100)
            else:
                utils.draw_select_box(display, _x, _y, self.box_object, self.action_selected, 100)

        utils.draw_button_info(display, **self.keys)
Example #3
0
    def draw_items(self, display: pygame.Surface):
        center = 795

        x, y = center - (20 * (len(self.categories))), 40
        for i in range(len(self.categories)):
            display.blit(self.categories_surface[self.category_select == i][i],
                         (x, y))
            x += 40

        pygame.draw.polygon(display, "#e38c22",
                            ((center - 100, 80), (center + 100, 80),
                             (center + 100 - 26 * (265 / 600), 106),
                             (center - 100 - 26 * (265 / 600), 106)))
        cat_tx = game.FONT_20.render(
            game.game_instance.get_message(
                f'item.category.{self.categories[self.category_select]}'),
            True, (255, 255, 255))
        display.blit(cat_tx, (center - cat_tx.get_size()[0] // 2,
                              93 - cat_tx.get_size()[1] // 2))

        if len(self.items) > 0:
            x = center - 160
            y = 115
            select_y = -1
            for i in range(*self.get_range()):
                if self.item_selected == i:
                    select_y = y
                self.draw_item(display, (x, y),
                               *self.items[i],
                               is_selected=self.item_selected == i)
                y += 40
            y = 445
            try:
                select = self.items[self.item_selected][0]
                pygame.draw.polygon(display, "#e38c22",
                                    ((530, y), (1060, y), (1060, y + 26),
                                     (530 - 26 * (265 / 600), y + 26)))
                display.blit(cat_tx, (540, y + 13 - cat_tx.get_size()[1] // 2))
                y += 30
                for p_l in hud.Dialog.split(select.get_lore(), 55):
                    display.blit(game.FONT_16.render(p_l, True, (0, 0, 0)),
                                 (545, y))
                    y += game.FONT_SIZE_16[1] + 5
            except IndexError:
                self.item_selected = 0

            if self.action_selected != -1 and self.poke_select == -1:
                it = self.items[self.item_selected]
                opt = []
                if it[0].is_giveable(self.condition):
                    opt.append(self.box_text[0])
                if it[0].is_usable(self.condition):
                    opt.append(self.box_text[1])
                opt.append(self.box_text[2])
                utils.draw_select_box(display, 850, select_y, opt,
                                      self.action_selected, 100)
Example #4
0
    def render(self, display):
        display.fill((255, 255, 255))
        pygame.draw.polygon(display, (241, 65, 78), TeamMenu.t_poly_1)
        pygame.draw.polygon(display, (206, 51, 65), TeamMenu.t_poly_2)
        pygame.draw.rect(display, (0, 0, 0), (0, 570, 1060, 30))
        g_x = SURFACE_SIZE[0] * 0.1
        g_y = SURFACE_SIZE[1] * 0.1

        _time = utils.current_milli_time() - self.open_time
        part_time = _time % 2000
        poke_y = 0
        if part_time < 900:
            poke_y = 0
        elif part_time < 950 or 1950 <= part_time:
            poke_y = 1
        elif part_time < 1000 or 1900 <= part_time:
            poke_y = 3
        elif part_time < 1900:
            poke_y = 5

        for i in range(len(self.progress)):

            if self.move != i:
                self.draw_pokemon(display, i, g_x, g_y, poke_y)
            g_y += SURFACE_SIZE[1] * 0.15

        # draw move
        if self.move != -1:
            self.draw_pokemon(
                display, self.move, g_x + SURFACE_SIZE[0] * 0.04,
                self.selected * SURFACE_SIZE[1] * 0.15 +
                SURFACE_SIZE[1] * 0.05, poke_y)

        # action hud
        if self.action_selected != -1:
            _y = SURFACE_SIZE[1] * 0.13 + SURFACE_SIZE[1] * 0.15 * self.selected
            _x = SURFACE_SIZE[0] * 0.31
            utils.draw_select_box(display, _x, _y, self.text_2,
                                  self.action_selected, 100)

        utils.draw_button_info(display, **self.keys)