def __init__(self, position, title_text, animation_types): BuilderContainer.__init__(self) self.moveset = None self.position = position self.title = MovesetBuilderLabel(position, title_text, (255,255,255), 22) self.add_child(self.title) button_list = [] for type_tuple in animation_types: button_list.append(MoveTypeButton(type_tuple[0], type_tuple[1], 20)) self.buttons = button_list self.layout_buttons() self.add_children(button_list) self.buttons[0].handle_selected() navigator_position = (position[0] + 15, position[1] + self.height + 15) animation_navigator = AttackNavigator(navigator_position, 221, 250) animation_navigator.load_data(navigator_position, self.buttons[0].move_type) self.animation_navigator = animation_navigator self.add_child(animation_navigator) self.validation_tree = InputTree()
def __init__(self): BuilderContainer.__init__(self) self.position = (20, MovesetNameEntryBox._Y_POS + 60) title_position = (300, MovesetNameEntryBox._Y_POS + 60) self.title = MovesetBuilderLabel(title_position,"Create Attacks",(255,255,255),25) self.ValidationTree = InputTree() self.draw_tab = True attack_types = [(AttackTypes.KICK, "Kick"), (AttackTypes.PUNCH, "Punch")] self.animation_select_container = AttackSelectContainer( (20, self.position[1] + self.title.height + 15), "Select Attack Type", attack_types ) self.key_select_container = KeySetContainer( (300, self.position[1] + self.title.height + 15), "Select Attack Commands" ) self.key_select_container.inactivate() self.add_children([ self.title, self.animation_select_container, self.key_select_container ]) self.width = 750
def draw(self, surface): BuilderContainer.draw(self, surface) if self.draw_tab: point1 = (self.position[0], self.title.bottom_left()[1]) title_bottom_left = self.title.bottom_left() point2 = (title_bottom_left[0] - 10, title_bottom_left[1]) title_top_left = self.title.position point3 = (title_top_left[0] - 10, title_top_left[1] - 10) title_top_right = self.title.top_right() point4 = (title_top_right[0] + 10, title_top_left[1] - 10) title_bottom_right = self.title.bottom_right() point5 = (title_bottom_right[0] + 10, title_bottom_right[1]) point6 = (self.top_right()[0], title_bottom_right[1]) pygame.draw.line(surface, (255,255,255), point1, point2) pygame.draw.line(surface, (255,255,255), point2, point3) pygame.draw.line(surface, (255,255,255), point3, point4) pygame.draw.line(surface, (255,255,255), point4, point5) pygame.draw.line(surface, (255,255,255), point5, point6)
def collapse(self): BuilderContainer.collapse(self) self.draw_tab = False
def expand(self): BuilderContainer.expand(self) self.draw_tab = True
def __init__(self, position, title_text): BuilderContainer.__init__(self) self.active = True self.position = position self.title = MovesetBuilderLabel(position, title_text, (255,255,255), 22) self.add_child(self.title) key_container_position = (position[0], position[1] + self.title.height + 10) button_args = [ ((0,0), "FW", 18, InputActionTypes.FORWARD), ((0,0), "UP", 18, InputActionTypes.MOVE_UP), ((0,0), "DN", 18, InputActionTypes.MOVE_DOWN), ((0,0), "QK", 18, InputActionTypes.WEAK_KICK), ((0,0), "TK", 18, InputActionTypes.MEDIUM_KICK), ((0,0), "SK", 18, InputActionTypes.STRONG_KICK), ((0,0), "QP", 18, InputActionTypes.WEAK_PUNCH), ((0,0), "TP", 18, InputActionTypes.MEDIUM_PUNCH), ((0,0), "SP", 18, InputActionTypes.STRONG_PUNCH), ((0,0), "JU", 18, InputActionTypes.JUMP) ] self.key_buttons = KeyButtonContainer( key_container_position, 270, 250, "", KeyButton, button_args ) self.add_child(self.key_buttons) command_key_position = ( position[0] + self.key_buttons.width, key_container_position[1] + 10 ) self.command_key = KeyReferenceContainer(command_key_position) self.add_child(self.command_key) command_in_use_position = (position[0], position[1] + self.height - 10) self.command_in_use_label = button.Label( command_in_use_position, "this command is already in use", (255,0,0), 15 ) self.command_in_use_label.hide() self.add_child(self.command_in_use_label) self.key_combination = [] key_combination_position = ( position[0], position[1] + self.height ) self.key_combination_label = button.Label( key_combination_position, "--", (255,255,255), 22 ) self.add_child(self.key_combination_label) clear_button_position = (position[0], position[1] + self.height + 10) self.clear_button = button.TextButton( "Clear", 15 ) self.clear_button.set_position(clear_button_position) self.add_child(self.clear_button) self.thumbnail = None self.thumbnail_position = ( self.position[0] + 50, self.position[1] + self.height + 30 )