Example #1
0
    def __init__(self, screen, resolution, game, name="SUCCESS"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay
        self.text = ["Joining. Please wait..."]
Example #2
0
    def __init__(self, screen, resolution, game, name="Dialog Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay
        self.dialog_stack = []
Example #3
0
    def __init__(self, screen, resolution, game, name="Main Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.first_run = True
        self.save = False
        self.state = "closed"
        self.visible = False

        #self.menu_icons_paths = ['resources/gfx/ui/menu/journal.png',
        #                         'resources/gfx/ui/menu/tuxemon.png',
        #                         'resources/gfx/ui/menu/backpack.png',
        #                         'resources/gfx/ui/menu/player.png',
        #                         'resources/gfx/ui/menu/save.png',
        #                         'resources/gfx/ui/menu/load.png',
        #                         'resources/gfx/ui/menu/settings.png',
        #                         'resources/gfx/ui/menu/exit.png',]

        # Load all the menu icon images
        #for path in self.menu_icons_paths:
        #    icon_surface = pygame.image.load(path).convert_alpha()
        #    icon_surface = pygame.transform.scale(icon_surface, (icon_surface.get_width() * prepare.SCALE, icon_surface.get_height() * prepare.SCALE))
        #    self.menu_icons.append(icon_surface)

        self.menu_select_sound = mixer.Sound(
            prepare.BASEDIR +
            "resources/sounds/interface/50561__broumbroum__sf3-sfx-menu-select.ogg"
        )
Example #4
0
    def __init__(self, screen, resolution, game, name="Main Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.first_run = True
        self.save = False
        self.state = "closed"
        self.visible = False
        
        #self.menu_icons_paths = ['resources/gfx/ui/menu/journal.png',
        #                         'resources/gfx/ui/menu/tuxemon.png',
        #                         'resources/gfx/ui/menu/backpack.png',
        #                         'resources/gfx/ui/menu/player.png',
        #                         'resources/gfx/ui/menu/save.png',
        #                         'resources/gfx/ui/menu/load.png',
        #                         'resources/gfx/ui/menu/settings.png',
        #                         'resources/gfx/ui/menu/exit.png',]

        # Load all the menu icon images
        #for path in self.menu_icons_paths:
        #    icon_surface = pygame.image.load(path).convert_alpha()
        #    icon_surface = pygame.transform.scale(icon_surface, (icon_surface.get_width() * prepare.SCALE, icon_surface.get_height() * prepare.SCALE))
        #    self.menu_icons.append(icon_surface)
        
        self.menu_select_sound = mixer.Sound(
            "resources/sounds/interface/50561__broumbroum__sf3-sfx-menu-select.ogg")
Example #5
0
 def __init__(self, screen, resolution, game, name="Save Menu"):
     Menu.__init__(self, screen, resolution, game, name)
     
     self.slots = 3
     self.selected_menu_item = 0
     self.slot_surfaces = {}
     self.save_data = {}
     self.first_run = True
Example #6
0
    def __init__(self, screen, resolution, game, name="HOSTING"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay
        self.text = ["Server started:"]
        for ip in self.game.server.ips:
            self.text.append(ip)
Example #7
0
    def __init__(self, screen, resolution, game, name="Interaction Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.first_run = True
        self.save = False
        self.state = "closed"
        self.visible = False

        self.menu_select_sound = mixer.Sound(
            prepare.BASEDIR + "resources/sounds/interface/50561__broumbroum__sf3-sfx-menu-select.ogg")
Example #8
0
    def __init__(self, screen, resolution, game, name="Bottom Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        # Adding static variables for menus for the bottom 1/2 of the screen
        # (mainly for states.combat)
        self.difference_x = ((resolution[0]/4))
        self.difference_y = ((resolution[1]/4))
        # Native resolution is similar to the old gameboy resolution. This is used for scaling.
        self.native_resolution = [240, 160]
        # Scaling the shit outa those menus!
        self.scale = int( (resolution[0] / self.native_resolution[0]) )
        for picture, border in self.border.items():
            self.border[picture] = pygame.transform.scale(border,
                (border.get_width() * self.scale, border.get_height() * self.scale) )
        self.difference = self.border["left-top"].get_width()
Example #9
0
    def __init__(self, screen, resolution, game, name="Bottom Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        # Adding static variables for menus for the bottom 1/2 of the screen
        # (mainly for states.combat)
        self.difference_x = ((resolution[0] / 4))
        self.difference_y = ((resolution[1] / 4))
        # Native resolution is similar to the old gameboy resolution. This is used for scaling.
        self.native_resolution = [240, 160]
        # Scaling the shit outa those menus!
        self.scale = int((resolution[0] / self.native_resolution[0]))
        for picture, border in self.border.items():
            self.border[picture] = pygame.transform.scale(
                border, (border.get_width() * self.scale,
                         border.get_height() * self.scale))
        self.difference = self.border["left-top"].get_width()
Example #10
0
    def __init__(self, screen, resolution, game, name="Item Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, name)

        # Give this menu instance access to the main game object.
        self.game = game

        # Set the background color of our menu
        self.color = (32, 104, 96)

        # Load the item menu background image
        self.background_image = prepare.BASEDIR + "resources/gfx/ui/item/item_menu_bg.png"
        self.background_surface = pygame.image.load(self.background_image).convert()
        self.background_surface = pygame.transform.scale(self.background_surface,
            (prepare.SCREEN_SIZE[0], prepare.SCREEN_SIZE[1]))

        # Create the item menu's submenus.
        self.decision_menu = Menu(screen, resolution, game)
        self.item_list = Menu(screen, resolution, game)
        self.info_menu = Menu(screen, resolution, game)

        # Add the submenus as this menu's children
        self.add_child(self.decision_menu)
        self.add_child(self.item_list)
        self.add_child(self.info_menu)

        # Scale the sides of all the submenus
        for menu in self.children:

            # Scale the font and selection arrow to the appropriate size.
            menu.font = pygame.font.Font(
                prepare.BASEDIR + "resources/font/PressStart2P.ttf", menu.font_size * prepare.SCALE)
            menu.arrow = pygame.transform.scale(
                menu.arrow,
                (menu.arrow.get_width() * prepare.SCALE, menu.arrow.get_height() * prepare.SCALE))

            # Scale the window's borders based on the game's scale.
            for key, border in menu.border.items():
                menu.border[key] = pygame.transform.scale(
                    border,
                    (border.get_width() * prepare.SCALE, border.get_height() * prepare.SCALE))

        # Set up our submenus.
        self.decision_menu.size_x = prepare.SCREEN_SIZE[0] / 5
        self.decision_menu.size_y = prepare.SCREEN_SIZE[1] / 6
        self.decision_menu.pos_x = prepare.SCREEN_SIZE[0] - self.decision_menu.size_x - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.pos_y = prepare.SCREEN_SIZE[1] - self.decision_menu.size_y - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.visible = False
        self.decision_menu.interactable = False

        self.info_menu.size_x = prepare.SCREEN_SIZE[0]
        self.info_menu.size_y = int(prepare.SCREEN_SIZE[1] / 4.2)
        self.info_menu.pos_x = 0
        self.info_menu.pos_y = prepare.SCREEN_SIZE[1] - self.info_menu.size_y
        #self.info_menu.color = (0, 120, 192)
        self.info_menu.visible = True
        self.info_menu.interactable = False

        self.item_list.size_x = int((prepare.SCREEN_SIZE[0] / 3) * 2)
        self.item_list.size_y = int(prepare.SCREEN_SIZE[1] - self.info_menu.size_y)
        self.item_list.pos_x = int(prepare.SCREEN_SIZE[0] / 3)
        self.item_list.pos_y = 0
        self.item_list.visible = True
        self.item_list.interactable = True

        # Load the backpack icon
        self.backpack = {}
        self.backpack['image'] = prepare.BASEDIR + "resources/gfx/ui/item/backpack.png"
        self.backpack['surface'] = pygame.image.load(self.backpack['image']).convert_alpha()
        self.backpack['surface'] = pygame.transform.scale(
            self.backpack['surface'],
            (self.backpack['surface'].get_width() * prepare.SCALE,
             self.backpack['surface'].get_height() * prepare.SCALE))
        self.backpack['pos_x'] = (self.item_list.pos_x / 2) - \
            (self.backpack['surface'].get_width() / 2)
        self.backpack['pos_y'] = prepare.SCREEN_SIZE[1] - self.info_menu.size_y - \
            (self.backpack['surface'].get_height() * 1.2)
Example #11
0
    def __init__(self, screen, resolution, game, name="Dialog Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay
Example #12
0
    def __init__(self, screen, resolution, game, name="Monster Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, name)
        
        # Give this menu instance access to the main game object.
        self.game = game
        
        # Set the background color of our menu
        self.color = (32, 104, 96)

        # Load the item menu background image
        _resources = "resources/gfx/ui/monster/"
        self.background_image = _resources + "monster_menu_bg.png"
        self.background_surface = pygame.image.load(self.background_image).convert()
        self.background_surface = pygame.transform.scale(self.background_surface,
            (prepare.SCREEN_SIZE[0], prepare.SCREEN_SIZE[1]))
        

        # Create the item menu's submenus.
        self.active_monster_menu = Menu(screen, resolution, game)
        self.inactive_monsters_menu = Menu(screen, resolution, game)
        self.decision_menu = Menu(screen, resolution, game)
        self.monster_slots = []
        self.monster_hp_bars = []

        # Create a submenu for each monster slot
        from core.components import menu
        for monster_number in range(0, self.game.player1.party_limit):
            self.monster_slots.append(Menu(screen,
                                           resolution,
                                           game,
                                           background=_resources + "filled_monster_slot_bg.png"))
            self.monster_hp_bars.append(menu.interface.HpBar(screen))

        # Set up the border images used for the monster slots
        self.monster_slot_border = {}
        _border_types = ["empty", "filled", "active"]
        _borders = ["left", "right", "top", "bottom", "left-top",
                    "left-bottom", "right-top", "right-bottom", "bg"]
        for border_type in _border_types:
            self.monster_slot_border[border_type] = {}
            for item in _borders:
                img = pygame.image.load(
                    _resources + border_type + "_monster_slot_" + item + ".png").convert()
                self.monster_slot_border[border_type][item] = img

            # Scale the borders according to the game's scale.
            self.monster_slot_border[border_type] = self.scale_borders(
                self.monster_slot_border[border_type])

        # Add the submenus as this menu's children
        self.add_child(self.active_monster_menu)
        self.add_child(self.inactive_monsters_menu)
        self.add_child(self.decision_menu)

        # Set up border images for both inactive and active slots.
        for monster_slot in self.monster_slots:
            self.add_child(monster_slot)

        # Scale the sides of all the submenus
        for menu in self.children:
            # Scale the font and selection arrow to the appropriate size.
            menu.font = pygame.font.Font(
                "resources/font/PressStart2P.ttf", menu.font_size * prepare.SCALE)
            menu.arrow = pygame.transform.scale(
                menu.arrow, 
                (menu.arrow.get_width() * prepare.SCALE, menu.arrow.get_height() * prepare.SCALE))

            # Scale the window's borders based on the game's scale.
            menu.border = menu.scale_borders(menu.border)

        # Set up our submenus.
        self.decision_menu.size_x = prepare.SCREEN_SIZE[0] / 5
        self.decision_menu.size_y = prepare.SCREEN_SIZE[1] / 6
        self.decision_menu.pos_x = prepare.SCREEN_SIZE[0] - self.decision_menu.size_x - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.pos_y = prepare.SCREEN_SIZE[1] - self.decision_menu.size_y - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.visible = False
        self.decision_menu.interactable = False

        # Set the positions of our monster slots
        slot_x = (prepare.SCREEN_SIZE[0] / 2) - (self.monster_slots[0].border['left'].get_width() * 2)
        slot_y = (prepare.SCREEN_SIZE[1] / 10)
        for monster_slot in self.monster_slots:
            monster_slot.size_x = int(prepare.SCREEN_SIZE[0] / 2)
            monster_slot.size_y = int(prepare.SCREEN_SIZE[1] /
                (self.game.player1.party_limit * 2 + 2))
            monster_slot.pos_x = slot_x
            monster_slot.pos_y = slot_y

            spacing = int(8 * prepare.SCALE) + monster_slot.size_y
            slot_y += spacing

        self.selected_monster = None
Example #13
0
    def __init__(self, screen, resolution, game, name="Item Menu"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, name)

        # Give this menu instance access to the main game object.
        self.game = game

        # Set the background color of our menu
        self.color = (32, 104, 96)

        # Load the item menu background image
        self.background_image = prepare.BASEDIR + "resources/gfx/ui/item/item_menu_bg.png"
        self.background_surface = pygame.image.load(
            self.background_image).convert()
        self.background_surface = pygame.transform.scale(
            self.background_surface,
            (prepare.SCREEN_SIZE[0], prepare.SCREEN_SIZE[1]))

        # Create the item menu's submenus.
        self.decision_menu = Menu(screen, resolution, game)
        self.item_list = Menu(screen, resolution, game)
        self.info_menu = Menu(screen, resolution, game)

        # Add the submenus as this menu's children
        self.add_child(self.decision_menu)
        self.add_child(self.item_list)
        self.add_child(self.info_menu)

        # Scale the sides of all the submenus
        for menu in self.children:

            # Scale the font and selection arrow to the appropriate size.
            menu.font = pygame.font.Font(
                prepare.BASEDIR + "resources/font/PressStart2P.ttf",
                menu.font_size * prepare.SCALE)
            menu.arrow = pygame.transform.scale(
                menu.arrow, (menu.arrow.get_width() * prepare.SCALE,
                             menu.arrow.get_height() * prepare.SCALE))

            # Scale the window's borders based on the game's scale.
            for key, border in menu.border.items():
                menu.border[key] = pygame.transform.scale(
                    border, (border.get_width() * prepare.SCALE,
                             border.get_height() * prepare.SCALE))

        # Set up our submenus.
        self.decision_menu.size_x = prepare.SCREEN_SIZE[0] / 5
        self.decision_menu.size_y = prepare.SCREEN_SIZE[1] / 6
        self.decision_menu.pos_x = prepare.SCREEN_SIZE[0] - self.decision_menu.size_x - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.pos_y = prepare.SCREEN_SIZE[1] - self.decision_menu.size_y - \
            (self.decision_menu.border["left-top"].get_height() * 2)
        self.decision_menu.visible = False
        self.decision_menu.interactable = False

        self.info_menu.size_x = prepare.SCREEN_SIZE[0]
        self.info_menu.size_y = int(prepare.SCREEN_SIZE[1] / 4.2)
        self.info_menu.pos_x = 0
        self.info_menu.pos_y = prepare.SCREEN_SIZE[1] - self.info_menu.size_y
        #self.info_menu.color = (0, 120, 192)
        self.info_menu.visible = True
        self.info_menu.interactable = False

        self.item_list.size_x = int((prepare.SCREEN_SIZE[0] / 3) * 2)
        self.item_list.size_y = int(prepare.SCREEN_SIZE[1] -
                                    self.info_menu.size_y)
        self.item_list.pos_x = int(prepare.SCREEN_SIZE[0] / 3)
        self.item_list.pos_y = 0
        self.item_list.visible = True
        self.item_list.interactable = True

        # Load the backpack icon
        self.backpack = {}
        self.backpack[
            'image'] = prepare.BASEDIR + "resources/gfx/ui/item/backpack.png"
        self.backpack['surface'] = pygame.image.load(
            self.backpack['image']).convert_alpha()
        self.backpack['surface'] = pygame.transform.scale(
            self.backpack['surface'],
            (self.backpack['surface'].get_width() * prepare.SCALE,
             self.backpack['surface'].get_height() * prepare.SCALE))
        self.backpack['pos_x'] = (self.item_list.pos_x / 2) - \
            (self.backpack['surface'].get_width() / 2)
        self.backpack['pos_y'] = prepare.SCREEN_SIZE[1] - self.info_menu.size_y - \
            (self.backpack['surface'].get_height() * 1.2)
Example #14
0
    def __init__(self, screen, resolution, game, name="MULTIPLAYER"):

        # Initialize the parent menu class's default shit
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay
Example #15
0
    def __init__(self, screen, resolution, game, name="JOIN_ENTER_IP"):

        # Stuff from the parent menu
        Menu.__init__(self, screen, resolution, game, name)
        self.delay = 0.5
        self.elapsed_time = self.delay