Esempio n. 1
0
    def _init_slots(self):
        """
        Initialize the profile slots
        :return:
        """
        # margin between two buttons
        margin = 30
        width = (self.width / self._limit) - margin
        height = self.height - 40
        for i in range(self._limit):
            # draw the profile button for each profile
            x = self.x + ((width + margin) * i) + (margin / 2)
            y = self.y + 20

            btn = RectButton(
                x, y, width, height, color.STANDARDBTN, 0,
                Text(pygame.font.SysFont('Agency FB', 25), "Empty",
                     color.BLACK))
            remove_btn = RectButton(
                btn.x, (btn.y + self.height - 80) + 10, btn.width, 30,
                color.YELLOW, 0,
                Text(pygame.font.SysFont('Agency FB', 16), "Remove",
                     color.BLACK))
            s = RectLabel(
                btn.x, (btn.y + self.height - 120), btn.width, 30,
                color.STANDARDBTN, 0,
                Text(pygame.font.SysFont('Agency FB', 16), "dadsad",
                     color.BLACK))

            s.set_transparent_background(True)
            self._stats_list.append(s)
            self._remove_btn_list.append(remove_btn)
            self._btn_list.append(btn)
            self._profile_list.add(btn)
Esempio n. 2
0
    def __init__(self):

        self.bg = pygame.image.load(WOOD)
        self.frame = pygame.image.load(FRAME)
        self.frame = pygame.transform.scale(self.frame, (400, 100))

        self.accept_button = RectButton(
            550 - 75, 310, 75, 50, Color.ORANGE, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Accept", Color.GREEN2))
        self.accept_button.change_bg_image(WOOD)
        self.accept_button.add_frame(FRAME)

        self.deny_button = RectButton(
            550 + 200, 310, 75, 50, Color.ORANGE, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Deny", Color.GREEN2))
        self.deny_button.change_bg_image(WOOD)
        self.deny_button.add_frame(FRAME)
        self.accept_button.on_click(self._accept_on_click)
        self.deny_button.on_click(self._deny_on_click)

        self.background = RectLabel(
            550, 300, 200, 75, Color.GREY, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Dodge?", Color.GREEN2))
        self.background.change_bg_image(WOOD)
        self.background.add_frame(FRAME)
        self.enabled = False
        self.disable()
    def driver_menu_popup(self, tile_model: TileModel):
        decision: int = 0
        targetTile: TileModel = self._set_target_tile()
        red_dice = targetTile.row
        black_dice = targetTile.column
        boardSprite: GameBoard = GameBoard.instance().top_ui
        self.label = RectLabel(
            200, 400, 600, 200, Color.BLACK, 0,
            Text(pygame.font.SysFont('Agency FB', 25),
                 f"Roll: {red_dice}, {black_dice}", Color.GREEN2))
        self.label.change_bg_image(WOOD)
        self.label.add_frame(FRAME)

        self.input1 = RectButton(
            200, 350, 150, 50, Color.BLACK, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Accept Roll",
                 Color.GREEN2))
        self.input1.change_bg_image(WOOD)
        self.input1.add_frame(FRAME)
        self.input2 = RectButton(
            350, 350, 150, 50, Color.BLACK, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Re-Roll Black Dice",
                 Color.GREEN2))
        self.input2.change_bg_image(WOOD)
        self.input2.add_frame(FRAME)
        self.input3 = RectButton(
            500, 350, 150, 50, Color.BLACK, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Re-Roll Red Dice",
                 Color.GREEN2))
        self.input3.change_bg_image(WOOD)
        self.input3.add_frame(FRAME)
        self.input4 = RectButton(
            650, 350, 150, 50, Color.BLACK, 0,
            Text(pygame.font.SysFont('Agency FB', 25), "Re-Roll Both Die",
                 Color.GREEN2))
        self.input4.change_bg_image(WOOD)
        self.input4.add_frame(FRAME)

        self.input1.on_click(self.input1_process, tile_model, red_dice,
                             black_dice)
        self.input2.on_click(self.input2_process, tile_model, red_dice,
                             black_dice)
        self.input3.on_click(self.input3_process, tile_model, red_dice,
                             black_dice)
        self.input4.on_click(self.input4_process, tile_model, red_dice,
                             black_dice)
        boardSprite.add(self.label)
        boardSprite.add(self.input1)
        boardSprite.add(self.input2)
        boardSprite.add(self.input3)
        boardSprite.add(self.input4)
Esempio n. 4
0
 def _init_btn_confirm(self, x_pos: int, y_pos: int, text: str, color: Color, color_text: Color):
     box_size = (130, 48)
     self.buttonConfirm = RectButton(x_pos, y_pos, box_size[0], box_size[1], color, 0,
                                     Text(pygame.font.SysFont('Agency FB', 25), text, Color.GREEN2))
     self.buttonConfirm.change_bg_image(MEDIA_CONSTS.WOOD)
     self.buttonConfirm.add_frame(MEDIA_CONSTS.FRAME)
     self.sprite_grp.add(self.buttonConfirm)
Esempio n. 5
0
 def _init_title_text(self):
     box_size = (400, 50)
     self.text_title = RectButton(400, 60, box_size[0], box_size[1], Color.BLACK, 0,
                                  Text(pygame.font.SysFont('Agency FB', 35), "Character Selection", Color.GREEN2))
     self.text_title.change_bg_image(MEDIA_CONSTS.WOOD)
     self.text_title.add_frame(MEDIA_CONSTS.FRAME)
     self.sprite_grp.add(self.text_title)
Esempio n. 6
0
    def __init__(self, wall_model: WallModel, orientation: str,
                 tile_sprite: TileSprite, tile_model: TileModel,
                 id: Tuple[int, int, str]):
        super().__init__()
        self.orientation = orientation
        self._game: GameStateModel = GameStateModel.instance()
        self._current_player = self._game.players_turn
        self._button = None
        self.tile_model = tile_model
        self.id = id
        self.wall_model = wall_model
        self.wall_model.add_observer(self)

        self.damaged = self.wall_model.wall_status == WallStatusEnum.DAMAGED
        self.destroyed = self.wall_model.wall_status == WallStatusEnum.DESTROYED
        self.tile_sprite = tile_sprite
        self._prev_x = self.tile_sprite.rect.x
        self._prev_y = self.tile_sprite.rect.y
        self.button_input = RectButton(
            self.tile_sprite.rect.x, self.tile_sprite.rect.y, 100, 25,
            Color.WOOD, 0,
            Text(pygame.font.SysFont('Agency FB', 20), "Chop Wall",
                 Color.GREEN2))
        pygame.draw.rect(self.button_input.image, Color.YELLOW,
                         [0, 0, 100, 25], 3)
        self.button_input.disable()
        self.can_chop = False
Esempio n. 7
0
 def _init_btn_register(self, x_pos, y_pos, text, clr, color_text):
     box_size = (130, 48)
     self.buttonRegister = RectButton(x_pos, y_pos, box_size[0], box_size[1], clr, 0,
                                      Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.buttonRegister.change_bg_image(WOOD)
     self.buttonRegister.add_frame(FRAME)
     self.buttonRegister.on_click(self.register_profile)
     self.sprite_grp.add(self.buttonRegister)
 def _init_btn_back(self, x_pos: int, y_pos: int, text: str, color: Color, color_text: Color):
     box_size = (130, 48)
     self.buttonBack = RectButton(x_pos, y_pos, box_size[0], box_size[1], color, 0,
                                  Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.buttonBack.on_click(EventQueue.post, CustomEvent(ChangeSceneEnum.CHOOSEBOARDSCENE))
     self.buttonBack.change_bg_image(WOOD)
     self.buttonBack.add_frame(FRAME)
     self.sprite_grp.add(self.buttonBack)
 def _init_button6(self, x_pos: int, y_pos: int, text: str, color: Color, color_text: Color):
     box_size = (130, 48)
     self.button_players6 = RectButton(x_pos, y_pos, box_size[0], box_size[1], color, 0,
                                  Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.button_players6.on_click(self.set_and_continue, 6)
     self.button_players6.change_bg_image(WOOD)
     self.button_players6.add_frame(FRAME)
     self.sprite_grp.add(self.button_players6)
    def _init_title_text(self):
        box_size = (500, 50)
        self.text_title = RectButton((int)(1280/2-250), 60, box_size[0], box_size[1], Color.BLACK, 0,
                                     Text(pygame.font.SysFont('Agency FB', 35), "Set Number of Max Players", Color.GREEN2))
        self.text_title.change_bg_image(WOOD)
        self.text_title.add_frame(FRAME)

        self.sprite_grp.add(self.text_title)
 def _init_duo(self, x_pos, y_pos, text,color, color_text):
     box_size = (130, 48)
     self.button_duo= RectButton(x_pos, y_pos, box_size[0], box_size[1], color, 0,
                                   Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.button_duo.change_bg_image(WOOD)
     self.button_duo.add_frame(FRAME)
     self.button_duo.on_click(self.set_and_continue, 2)
     self.sprite_grp.add(self.button_duo)
Esempio n. 12
0
 def _init_start_game_button(self):
     """Button for starting the game once all players have clicked ready."""
     box_size = (130, 48)
     self.start_button = RectButton(
         1050, 575, box_size[0], box_size[1], Color.GREY, 0,
         Text(pygame.font.SysFont('Agency FB', 25), "Start", Color.RED))
     self.start_button.change_bg_image(MEDIA_CONSTS.WOOD)
     self.start_button.add_frame(MEDIA_CONSTS.FRAME)
     self.sprite_grp.add(self.start_button)
Esempio n. 13
0
 def _init_selec_char(self, x_pos: int, y_pos: int, text: str, color: Color,
                      color_text: Color):
     box_size = (170, 48)
     self.buttonSelChar = RectButton(
         x_pos, y_pos, box_size[0], box_size[1], color, 0,
         Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.buttonSelChar.change_bg_image(MEDIA_CONSTS.WOOD)
     self.buttonSelChar.add_frame(MEDIA_CONSTS.FRAME)
     self.sprite_grp.add(self.buttonSelChar)
Esempio n. 14
0
 def _init_board2(self, x_pos, y_pos, text, color, color_text):
     box_size = (130, 48)
     self.button_board2 = RectButton(
         x_pos, y_pos, box_size[0], box_size[1], color, 0,
         Text(pygame.font.SysFont('Agency FB', 25), text, color_text))
     self.button_board2.on_click(self.set_and_continue,
                                 GameBoardTypeEnum.ALTERNATIVE)
     self.button_board2.change_bg_image(WOOD)
     self.button_board2.add_frame(FRAME)
     self.sprite_grp.add(self.button_board2)
Esempio n. 15
0
    def _init_save_elem(self, x_pos, y_pos, text, clr, color_text, save_data):
        box_size = (350, 32)

        user_box = RectButton(
            x_pos, y_pos, box_size[0], box_size[1], clr, 0,
            Text(pygame.font.SysFont('Agency FB', 20), text, color_text))
        user_box.change_bg_image(WOOD)
        pygame.draw.rect(user_box.image, color.YELLOW, [0, 0, 350, 32], 5)

        user_box.on_click(self.load_game, save_data)
        return user_box
Esempio n. 16
0
    def _init_ready(self, x_pos: int, y_pos: int, text: str, color: Color,
                    color_text: Color):

        box_size = (130, 48)
        self.isReady = False
        self.buttonReady = RectButton(
            x_pos, y_pos, box_size[0], box_size[1], color, 0,
            Text(pygame.font.SysFont('Agency FB', 25), text, Color.GREY))
        self.buttonReady.change_bg_image(MEDIA_CONSTS.WOOD)
        self.buttonReady.add_frame(MEDIA_CONSTS.FRAME)
        self.sprite_grp.add(self.buttonReady)
Esempio n. 17
0
    def _init_board1(self, x_pos: int, y_pos: int, text: str, color: Color,
                     color_text: Color):
        box_size = (130, 48)
        self.button_board1 = RectButton(
            x_pos, y_pos, box_size[0], box_size[1], color, 0,
            Text(pygame.font.SysFont('Agency FB', 25), text, color_text))

        self.button_board1.change_bg_image(WOOD)
        self.button_board1.add_frame(FRAME)
        self.button_board1.on_click(self.set_and_continue,
                                    GameBoardTypeEnum.ORIGINAL)
        self.sprite_grp.add(self.button_board1)
Esempio n. 18
0
 def _init_end_turn_button(self):
     btn = RectButton(1130,
                      500,
                      150,
                      50,
                      background=Color.ORANGE,
                      txt_obj=Text(pygame.font.SysFont('Arial', 23),
                                   "END TURN", Color.GREEN2))
     btn.change_bg_image(WOOD)
     btn.add_frame(FRAME)
     btn.on_click(self._end_turn)
     return btn
Esempio n. 19
0
    def create_butn_img(self, x, y, width, height, path: str, count: int):
        label = self.create_label(x, y, width, height, count)
        self.label_grp.add(label)
        self.sprite_grp.add(label)

        box_size = (width, height)
        self.this_img = RectButton(x, y, box_size[0], box_size[1], path)

        role: PlayerRoleEnum = self.decide_enum(count)

        self.this_img.on_click(self.click_img, label, role)

        self.sprite_grp.add(self.this_img)
 def _init_end_command_btn(self):
     # End command button
     self._end_command_btn = RectButton(
         1080,
         450,
         200,
         50,
         background=Color.ORANGE,
         txt_obj=Text(pygame.font.SysFont('Agency FB', 23), "END COMMAND",
                      Color.GREEN2))
     self._end_command_btn.change_bg_image(WOOD)
     self._end_command_btn.add_frame(FRAME)
     self._end_command_btn.on_click(self.end_command)
    def input3_process(self, tile: TileModel, red_dice: int, black_dice: int):
        self.max_input += 1
        board_sprite: GameBoard = GameBoard.instance().top_ui
        self.kill_all()
        new_tile: TileModel = self._set_target_tile(-1, black_dice)

        if self.max_input == 2:
            self.max_input = 0
            self.send_event_and_close_menu(tile, self.input1, new_tile.row,
                                           new_tile.column)

        else:
            red_dice = new_tile.row
            self.label = RectLabel(
                200, 400, 600, 200, Color.BLACK, 0,
                Text(pygame.font.SysFont('Agency FB', 25),
                     f"Roll: {red_dice}, {black_dice}", Color.GREEN2))
            self.label.change_bg_image(WOOD)
            self.label.add_frame(FRAME)
            self.input1 = RectButton(
                200, 350, 150, 50, Color.BLACK, 0,
                Text(pygame.font.SysFont('Agency FB', 25), "Accept Roll",
                     Color.GREEN2))
            self.input1.change_bg_image(WOOD)
            self.input1.add_frame(FRAME)
            self.input2 = RectButton(
                350, 350, 150, 50, Color.BLACK, 0,
                Text(pygame.font.SysFont('Agency FB', 25),
                     "Re-Roll Black Dice", Color.GREEN2))
            self.input2.change_bg_image(WOOD)
            self.input2.add_frame(FRAME)

            self.input1.on_click(self.input1_process, tile, new_tile.row,
                                 black_dice)
            self.input2.on_click(self.input2_process, tile, new_tile.row,
                                 black_dice)
            board_sprite.add(self.label)
            board_sprite.add(self.input1)
            board_sprite.add(self.input2)
Esempio n. 22
0
    def __init__(self):
        self.accept_button = RectButton(
            500 - 75, 310, 75, 50, Color.ORANGE, 0,
            Text(pygame.font.SysFont('Agency FB', 20), "Accept", Color.GREEN2))
        self.accept_button.change_bg_image(WOOD)
        self.accept_button.add_frame(FRAME)
        self.deny_button = RectButton(
            500 + 300, 310, 75, 50, Color.ORANGE, 0,
            Text(pygame.font.SysFont('Agency FB', 20), "Deny", Color.GREEN2))
        self.deny_button.change_bg_image(WOOD)
        self.deny_button.add_frame(FRAME)
        self.accept_button.on_click(self._accept_on_click)
        self.deny_button.on_click(self._deny_on_click)

        self._source = None
        self._target = None
        self.background = RectLabel(
            500, 300, 300, 75, Color.GREY, 0,
            Text(pygame.font.SysFont('Agency FB', 20), "Permission?",
                 Color.GREEN2))
        self.background.change_bg_image(WOOD)
        self.background.add_frame(FRAME)

        self._enabled = False