def handle_events(self): wotsuicontainers.ScrollableContainer.handle_events(self) if self.reload_indicator: self.load_animation_data() self.reload_indicator = False if self.viewable_area.contains(wotsuievents.mouse_pos): if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: if self.edit_animation_button.selected: pass elif self.delete_animation_button.selected: pass else: for label in self.attack_labels: if label.contains(wotsuievents.mouse_pos): if self.allow_multiple_select: if label.selected: label.handle_deselected() if self.selected_animation == self.get_animation(label.animation_name): self.selected_animation = None else: label.handle_selected() else: for other_label in self.attack_labels: if other_label.selected: other_label.handle_deselected() label.handle_selected() elif pygame.MOUSEBUTTONUP in wotsuievents.event_types: for label in self.attack_labels: if label.contains(wotsuievents.mouse_pos): self.selected_animation = self.get_animation( label.attack_name ) if self.edit_animation_button.selected: self.edit_animation_button.handle_deselected() frameeditor.load( self.animation_type, copy.deepcopy(self.get_animation(label.attack_name)), self.gamestate_mode ) gamestate.mode = gamestate.Modes.FRAMEEDITOR self.edit_animation_help_text.hide() self.reload_indicator = True elif self.delete_animation_button.selected: actionwizard.delete_animation( self.animation_type, self.get_animation(label.attack_name) ) self.selected_animation = None self.delete_animation_button.handle_deselected() self.delete_animation_help_text.hide() self.reload_indicator = True if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: if self.new_animation_button.contains(wotsuievents.mouse_pos): self.new_animation_button.handle_selected() self.selected_animation = animationexplorer.create_WOTS_animation() if self.edit_animation_button.selected: self.edit_animation_button.handle_deselected() if self.edit_animation_button.contains(wotsuievents.mouse_pos): if self.edit_animation_button.selected: self.edit_animation_button.handle_deselected() self.edit_animation_help_text.hide() else: self.edit_animation_button.handle_selected() self.edit_animation_help_text.show() if self.delete_animation_button.contains(wotsuievents.mouse_pos): if self.delete_animation_button.selected: self.delete_animation_button.handle_deselected() self.delete_animation_help_text.hide() else: self.delete_animation_button.handle_selected() self.delete_animation_help_text.show() elif pygame.MOUSEBUTTONUP in wotsuievents.event_types: if (self.new_animation_button.selected and self.new_animation_button.contains(wotsuievents.mouse_pos)): if self.selected_animation != None: new_animation = copy.deepcopy(self.selected_animation) new_animation.name = '' frameeditor.load( self.animation_type, new_animation, self.gamestate_mode ) gamestate.mode = gamestate.Modes.FRAMEEDITOR self.reload_indicator = True self.new_animation_button.handle_deselected()
def get_new_animation(self): animation = create_WOTS_animation() animation.frames.append(copy.deepcopy(animation.frames[0])) return animation