def __init__(self, text, functions, can_activate=(lambda: True), payload=None): self._functions = functions self.can_activate = can_activate self._selected = gui.TextBox(text, geo.zero2d(), colors.TEXT_SELECTED) self._unselected = gui.TextBox(text, geo.zero2d(), colors.TEXT_UNSELECTED) self._inactive = gui.TextBox(text, geo.zero2d(), colors.TEXT_INACTIVE) self.payload = payload
def __init__(self, text, selected_graphic_char, unselected_graphic_char, functions, can_activate=(lambda: True), payload=None): super(MenuOptionWithSymbols, self).__init__(text, functions, can_activate, payload=payload) self.selected_graphic_char = selected_graphic_char self.unselected_graphic_char = unselected_graphic_char self._selected = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._selected.append( gui.SymbolUIElement(geo.zero2d(), self.selected_graphic_char)) self._selected.append( gui.TextBox(text, geo.zero2d(), colors.TEXT_SELECTED)) self._unselected = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._unselected.append( gui.SymbolUIElement(geo.zero2d(), self.unselected_graphic_char)) self._unselected.append( gui.TextBox(text, geo.zero2d(), colors.TEXT_UNSELECTED)) self._inactive = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._inactive.append( gui.SymbolUIElement(geo.zero2d(), self.unselected_graphic_char)) self._inactive.append( gui.TextBox(text, geo.zero2d(), colors.TEXT_INACTIVE))
def __init__(self, offset, item, player, state_stack, margin=geo.zero2d(), vertical_space=1, may_escape=True): super(ItemActionsMenu, self).__init__(offset, state_stack, margin=margin, vertical_space=vertical_space, may_escape=may_escape) self._actions = sorted(item.get_children_with_tag("user_action"), key=lambda action: action.display_order) self._player = player self.update()
def __init__(self, offset, player, equipment_slot, state_stack, selected_payload_callback, margin=geo.zero2d(), may_escape=True): super(EquipSlotMenu, self).__init__(offset, state_stack, margin=margin, may_escape=may_escape, selected_payload_callback=selected_payload_callback) self.player = player self.try_set_index_to_valid_value() self.equipment_slot = equipment_slot
def __init__(self, offset, menu_items, state_stack, margin=geo.zero2d(), vertical_space=1, may_escape=True, vi_keys_accepted=True, selected_payload_callback=None): super(StaticMenu, self).__init__(offset, state_stack, margin=margin, vertical_space=vertical_space, may_escape=may_escape, vi_keys_accepted=vi_keys_accepted, selected_payload_callback=selected_payload_callback) self.menu_items = menu_items self._recreate_option_list() self.try_set_index_to_valid_value()
def __init__(self, text, selected_graphic_char, unselected_graphic_char, functions, can_activate=(lambda: True), payload=None): super(MenuOptionWithSymbols, self).__init__(text, functions, can_activate, payload=payload) self.selected_graphic_char = selected_graphic_char self.unselected_graphic_char = unselected_graphic_char self._selected = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._selected.append(gui.SymbolUIElement(geo.zero2d(), self.selected_graphic_char)) self._selected.append(gui.TextBox(text, geo.zero2d(), colors.TEXT_SELECTED)) self._unselected = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._unselected.append(gui.SymbolUIElement(geo.zero2d(), self.unselected_graphic_char)) self._unselected.append(gui.TextBox(text, geo.zero2d(), colors.TEXT_UNSELECTED)) self._inactive = gui.StackPanelHorizontal(geo.zero2d(), horizontal_space=1) self._inactive.append(gui.SymbolUIElement(geo.zero2d(), self.unselected_graphic_char)) self._inactive.append(gui.TextBox(text, geo.zero2d(), colors.TEXT_INACTIVE))
def __init__(self, offset, state_stack, margin=geo.zero2d(), vertical_space=1, may_escape=True, vi_keys_accepted=True, selected_payload_callback=None): super(Menu, self).__init__(margin) self.menu_items = [] self._state_stack = state_stack self._selected_index = None self.offset = offset self._wrap = True self.may_escape = may_escape self._item_stack_panel = gui.StackPanelVertical((0, 0), vertical_space=vertical_space) self.vi_keys_accepted = vi_keys_accepted self.selected_payload_callback = selected_payload_callback
def __init__(self, offset, player, state_stack, selected_payload_callback, margin=geo.zero2d(), may_escape=True): super(EquipmentMenu, self).__init__( offset, state_stack, margin=margin, may_escape=may_escape, selected_payload_callback=selected_payload_callback) self.player = player
def __init__(self, offset, player, equipment_slot, state_stack, selected_payload_callback, margin=geo.zero2d(), may_escape=True): super(EquipSlotMenu, self).__init__( offset, state_stack, margin=margin, may_escape=may_escape, selected_payload_callback=selected_payload_callback) self.player = player self.try_set_index_to_valid_value() self.equipment_slot = equipment_slot
def __init__(self, offset, state_stack, margin=geo.zero2d(), vertical_space=1, may_escape=True, vi_keys_accepted=True, selected_payload_callback=None): super(Menu, self).__init__(margin) self.menu_items = [] self._state_stack = state_stack self._selected_index = None self.offset = offset self._wrap = True self.may_escape = may_escape self._item_stack_panel = gui.StackPanelVertical( (0, 0), vertical_space=vertical_space) self.vi_keys_accepted = vi_keys_accepted self.selected_payload_callback = selected_payload_callback
def __init__(self, offset, menu_items, state_stack, margin=geo.zero2d(), vertical_space=1, may_escape=True, vi_keys_accepted=True, selected_payload_callback=None): super(StaticMenu, self).__init__( offset, state_stack, margin=margin, vertical_space=vertical_space, may_escape=may_escape, vi_keys_accepted=vi_keys_accepted, selected_payload_callback=selected_payload_callback) self.menu_items = menu_items self._recreate_option_list() self.try_set_index_to_valid_value()
def monster_status_rect(): return geo.Rect(geo.zero2d(), constants.LEFT_SIDE_BAR_WIDTH, constants.MONSTER_STATUS_BAR_HEIGHT)
def __init__(self, offset, player, state_stack, selected_payload_callback, margin=geo.zero2d(), may_escape=True): super(EquipmentMenu, self).__init__(offset, state_stack, margin=margin, may_escape=may_escape, selected_payload_callback=selected_payload_callback) self.player = player
def draw(self, offset=geo.zero2d()): self.bg_rectangle.draw(offset) self.text_stack_panel.draw(offset)
def draw(self, offset=geo.zero2d()): real_offset = geo.int_2d( geo.add_2d(geo.add_2d(self.offset, offset), self.margin)) self._item_stack_panel.draw(real_offset)
def full_screen_rect(): return geo.Rect(geo.zero2d(), settings.SCREEN_WIDTH, settings.SCREEN_HEIGHT)
def __init__(self): super(DungeonCreatorVisualizer, self).__init__() self.dungeon_level = dgen.get_full_wall_dungeon(70, 55, 0) self.camera = camera.Camera(geo.zero2d(), geo.zero2d(), self)
def draw(self, offset=geo.zero2d()): real_offset = geo.int_2d(geo.add_2d(geo.add_2d(self.offset, offset), self.margin)) self._item_stack_panel.draw(real_offset)