Пример #1
0
 def __init__(self, size, center, colors, text, border_width=3):
     self.size = size
     self.location = (center[0] - size[0] / 2, center[1] - size[1] / 2)
     self.surface = pygame.Surface(size)
     self.surface.fill(colors[1])
     self.surface.fill(colors[0],
                       (border_width, border_width, size[0] -
                        2 * border_width, size[1] - 2 * border_width))
     util.text(self.surface, text, (size[0] / 2, size[1] / 2))
Пример #2
0
    async def _setup(self):
        # Create organization category or get the existing handle
        organization = await self._management.get_or_create_category(
            text(CHANNEL_CATEGORY))
        await self._management.get_or_create_text_channel(
            text(CHANNEL_LOBBY), organization)
        await self._management.get_or_create_voice_channel(
            text(CHANNEL_LOBBY), organization)
        await self._management.get_or_create_text_channel(
            text(CHANNEL_SETUP), organization)

        # Create roles
        await self._management.get_or_create_role(
            text(QUIZ_MASTER), discord.Colour(COLOR_QUIZ_MASTER))
Пример #3
0
    def __init__(self, type, priority, speed=None):
        self.type = type
        self.priority = priority
        self.speed = speed

        self.card = pygame.image.load(f'cards/{type}.png')
        for i, digit in enumerate(f'{priority:03d}'):
            self.card.blit(digits[digit], (64 + i * 18, 13))

        if speed:
            self.card.blit(
                pygame.transform.scale(digits[str(speed)], (13 * 2, 21 * 2)),
                (128 / 2 - 13, 192 / 2 - 10))
        util.text(self.card,
                  type.upper().replace('_', ' '), (128 / 2, 192 - 25))
Пример #4
0
    async def organize(self,
                       ctx,
                       quiz_type: str = None,
                       team_size: str = None):
        if ctx.channel.name != text(CHANNEL_SETUP):
            return

        if quiz_type not in ['normal', 'jeopardy', 'only connect']:
            quiz_type = 'normal'

        if not team_size:
            team_size = 2

        team_size = min(max(int(team_size), 2), 8)

        self._quiz = Quiz(quiz_type, ctx.message.author, team_size)
        self._quiz_message = await ctx.send(self._quiz.organization_text())

        await self._quiz_message.add_reaction(EMOJI_OK)
        await self._quiz_message.add_reaction(EMOJI_ACCEPT)
        await self._quiz_message.add_reaction(EMOJI_DECLINE)

        try:
            for team_id in range(1, team_size + 1):
                role = await self._management.get_or_create_role('Team ' +
                                                                 str(team_id))
                team = Team(role, team_id)
                self._quiz.add_team(team)
                await self._quiz_message.add_reaction(EMOJI_TEAM[team_id - 1])
        except Exception as e:
            print(e)

        await ctx.message.delete()
Пример #5
0
 def __init__(self, screen, size, W, H):
     self.W = W
     self.H = H
     self.grade = 0
     self.size = size
     self.act_shape = []
     self.start_pos = [self.W / 2 - 1, 0]
     self.START = (100, 100)
     self.screen = screen
     self.tile_list = []
     self.ground_flage = False
     self.can_t_move = False
     self.text = util.text(size=80)
     self.is_over = False
Пример #6
0
 def __init__(self, screen, size, W, H):
     self.size = size
     self.W = W
     self.H = H
     self.screen = screen
     self.text = util.text(size=100)
Пример #7
0
 def organization_text(self) -> str:
     return text(NEW_QUIZ).format(self._type, self.participant_list())