예제 #1
0
파일: menu.py 프로젝트: co/TheLastRogue
 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
예제 #2
0
    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))
예제 #3
0
 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
예제 #4
0
파일: menu.py 프로젝트: co/TheLastRogue
 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()
예제 #5
0
파일: menu.py 프로젝트: co/TheLastRogue
 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
예제 #6
0
파일: menu.py 프로젝트: co/TheLastRogue
 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()
예제 #7
0
파일: menu.py 프로젝트: co/TheLastRogue
    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))
예제 #8
0
파일: menu.py 프로젝트: co/TheLastRogue
 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
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
 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()
예제 #12
0
 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
예제 #13
0
 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()
예제 #14
0
def monster_status_rect():
    return geo.Rect(geo.zero2d(), constants.LEFT_SIDE_BAR_WIDTH, constants.MONSTER_STATUS_BAR_HEIGHT)
예제 #15
0
파일: menu.py 프로젝트: co/TheLastRogue
 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
예제 #16
0
파일: menu.py 프로젝트: co/TheLastRogue
 def draw(self, offset=geo.zero2d()):
     self.bg_rectangle.draw(offset)
     self.text_stack_panel.draw(offset)
예제 #17
0
 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)
예제 #18
0
def full_screen_rect():
    return geo.Rect(geo.zero2d(), settings.SCREEN_WIDTH,
                    settings.SCREEN_HEIGHT)
예제 #19
0
 def draw(self, offset=geo.zero2d()):
     self.bg_rectangle.draw(offset)
     self.text_stack_panel.draw(offset)
예제 #20
0
def full_screen_rect():
    return geo.Rect(geo.zero2d(), settings.SCREEN_WIDTH, settings.SCREEN_HEIGHT)
예제 #21
0
def monster_status_rect():
    return geo.Rect(geo.zero2d(), constants.LEFT_SIDE_BAR_WIDTH,
                    constants.MONSTER_STATUS_BAR_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)
예제 #23
0
파일: menu.py 프로젝트: co/TheLastRogue
 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)