def handle_events(self): if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: for button in self.key_buttons.buttons: if button.active and button.contains(wotsuievents.mouse_pos): button.handle_selected() if self.key_buttons.selected_button != None: self.key_buttons.selected_button.handle_deselected() self.key_buttons.selected_button = button break if self.clear_button.contains(wotsuievents.mouse_pos): self.clear_button.handle_selected() elif pygame.MOUSEBUTTONUP in wotsuievents.event_types: if (self.key_buttons.selected_button != None and self.key_buttons.selected_button.contains(wotsuievents.mouse_pos)): button = self.key_buttons.selected_button if not button.action_type in self.key_combination: self.key_combination.append(button.action_type) self.set_key_combination_text() button.handle_deselected() self.key_buttons.selected_button = None if (self.clear_button.selected and self.clear_button.contains(wotsuievents.mouse_pos)): self.set_key_combination([]) self.clear_button.handle_deselected()
def set_selected_button(self, button_text): for button in self.buttons: if button.is_match(button_text): button.handle_selected() if ((self.selected_button != None) and (self.selected_button != button)): self.selected_button.handle_deselected() self.selected_button = button break
def handle_events(self): for button in self.buttons: if (button.contains(wotsuievents.mouse_pos) and wotsuievents.mousebutton_pressed()): button.handle_selected() if ((self.selected_button != None) and (self.selected_button != button)): self.selected_button.handle_deselected() self.selected_button = button break
def handle_events(self): self.animation_navigator.handle_events() if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: for button in self.buttons: if button.contains(wotsuievents.mouse_pos): for other_button in self.buttons: if other_button.selected and other_button != button: self.save_selected_movement_animations() other_button.handle_deselected() button.handle_selected() self.animation_navigator.animation_type = button.move_type self.animation_navigator.load_animation_thumbnails() self.sync_to_moveset()
def handle_events(self): wotsuicontainers.ScrollableContainer.handle_events(self) if self.viewable_area.contains(wotsuievents.mouse_pos): if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: for button in self.buttons: if button.contains(wotsuievents.mouse_pos): if button.selected: button.handle_deselected() else: button.handle_selected() else: if button.selected: button.handle_deselected() elif pygame.KEYDOWN in wotsuievents.event_types: for button in self.buttons: if button.selected: button.key = wotsuievents.keys_pressed[0] button.handle_deselected()
def handle_events(self): self.moveset_select.handle_events() self.player_type_select.handle_events() self.player_difficulty_select.handle_events() self.player_color_select.handle_events() self.player_stats_widget.handle_events() if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: for button in self.player_type_select.buttons: if button.contains(wotsuievents.mouse_pos): button.handle_selected() if (self.player_type_select.selected_button != None) and ( self.player_type_select.selected_button != button ): self.player_type_select.selected_button.handle_deselected() self.player_type_select.selected_button = button break
def handle_events(self): reload_indicator = self.animation_navigator.reload_indicator self.animation_navigator.handle_events() if reload_indicator: self.sync_to_moveset() if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: for button in self.buttons: if button.contains(wotsuievents.mouse_pos): for other_button in self.buttons: if other_button.selected and other_button != button: other_button.handle_deselected() button.handle_selected() self.save_to_moveset() self.animation_navigator.animation_type = button.move_type self.animation_navigator.load_animation_data() self.animation_navigator.selected_animation = None self.sync_to_moveset()
def handle_events(self): if self.loaded == False: self.load() exit_button = self.UI_objects.exit_button start_match_label = self.UI_objects.start_match_label player1_type_select = self.UI_objects.player1_type_select player1_difficulty_select = self.UI_objects.player1_difficulty_select player1_moveset_select = self.UI_objects.player1_moveset_select player1_stats_widget = self.UI_objects.player1_stats_widget player1_color_select = self.UI_objects.player1_color_select player2_type_select = self.UI_objects.player2_type_select player2_difficulty_select = self.UI_objects.player2_difficulty_select player2_moveset_select = self.UI_objects.player2_moveset_select player2_stats_widget = self.UI_objects.player2_stats_widget player2_color_select = self.UI_objects.player2_color_select get_player_type = self.UI_objects.get_player_type get_player_difficulty = self.UI_objects.get_player_difficulty if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types: if exit_button.contains(wotsuievents.mouse_pos): exit_button.handle_selected() if start_match_label.active: if start_match_label.contains(wotsuievents.mouse_pos): start_match_label.handle_selected() for button in player1_type_select.buttons: if button.contains(wotsuievents.mouse_pos): button.handle_selected() if ((player1_type_select.selected_button != None) and (player1_type_select.selected_button != button)): player1_type_select.selected_button.handle_deselected() player1_type_select.selected_button = button if button.text == "Bot": player1_difficulty_select.activate() if player1_difficulty_select.selected_button != None: player1_difficulty_select.selected_button.handle_selected() else: player1_difficulty_select.buttons[0].handle_selected() player1_difficulty_select.selected_button = player1_difficulty_select.buttons[0] else: player1_difficulty_select.inactivate() break if player1_difficulty_select.active: player1_difficulty_select.handle_events() for button in player2_type_select.buttons: if button.contains(wotsuievents.mouse_pos): button.handle_selected() if ((player2_type_select.selected_button != None) and (player2_type_select.selected_button != button)): player2_type_select.selected_button.handle_deselected() player2_type_select.selected_button = button if button.text == "Bot": player2_difficulty_select.activate() if player2_difficulty_select.selected_button != None: player2_difficulty_select.selected_button.handle_selected() else: player2_difficulty_select.buttons[0].handle_selected() player2_difficulty_select.selected_button = player1_difficulty_select.buttons[0] else: player2_difficulty_select.inactivate() break if player2_difficulty_select.active: player2_difficulty_select.handle_events() if pygame.MOUSEBUTTONUP in wotsuievents.event_types: if exit_button.selected: exit_button.handle_deselected() if exit_button.contains(wotsuievents.mouse_pos): self.exit() elif start_match_label.selected: if start_match_label.contains(wotsuievents.mouse_pos): self.start_match() if self.loaded: player1_moveset_select.handle_events() player2_moveset_select.handle_events() player1_stats_widget.handle_events() player2_stats_widget.handle_events() player1_color_select.handle_events() player2_color_select.handle_events() if ((player1_moveset_select.selected_moveset != None) and (player1_type_select.selected_button != None) and (player2_moveset_select.selected_moveset != None) and (player2_type_select.selected_button != None)): if start_match_label.active == False: start_match_label.activate() else: if start_match_label.active: start_match_label.inactivate() exit_button.draw(gamestate.screen) start_match_label.draw(gamestate.screen) player1_type_select.draw(gamestate.screen) player1_difficulty_select.draw(gamestate.screen) player1_moveset_select.draw(gamestate.screen) player1_stats_widget.draw(gamestate.screen) player1_color_select.draw(gamestate.screen) player2_type_select.draw(gamestate.screen) player2_difficulty_select.draw(gamestate.screen) player2_moveset_select.draw(gamestate.screen) player2_stats_widget.draw(gamestate.screen) player2_color_select.draw(gamestate.screen)