예제 #1
0
def handle_events():
    global UI_objects
    global loaded
    global exit_button
    global player_data
    
    if loaded == False:
        load()
    
    if pygame.MOUSEBUTTONDOWN in wotsuievents.event_types:
        if exit_button.contains(wotsuievents.mouse_pos):
            exit_button.handle_selected()
        
    if pygame.MOUSEBUTTONUP in wotsuievents.event_types:
        if exit_button.selected:
            exit_button.handle_deselected()
            
            if exit_button.contains(wotsuievents.mouse_pos):
                gamestate.mode = gamestate.Modes.VERSUSMOVESETSELECT
                unload()
                clear_data()
    
    if loaded:
        gamestate.screen.blit(UI_objects.background.surface, (0,0))
        exit_button.draw(gamestate.screen)
        UI_objects.stage_selector.draw(gamestate.screen)
        UI_objects.title_label.draw(gamestate.screen)
        UI_objects.stage_selector.handle_events()
        
        if UI_objects.stage_selected():
            if UI_objects.start_match_label_draw_timer >= UI_objects.start_match_label_draw_timeout:
                UI_objects.start_match_label.draw(gamestate.screen)
            else:
                UI_objects.start_match_label_draw_timer += gamestate.time_passed
            
            if ((UI_objects.stage_selector.contains(wotsuievents.mouse_pos) and
            pygame.MOUSEMOTION in wotsuievents.event_types) or 
            pygame.K_UP in wotsuievents.keys_pressed or
            pygame.K_DOWN in wotsuievents.keys_pressed):
               UI_objects.start_match_label_draw_timer = 0
               UI_objects.start_match_label.hide() 
            
            if (pygame.K_KP_ENTER in wotsuievents.keys_pressed or 
            pygame.K_RETURN in wotsuievents.keys_pressed):
                gamestate.screen.fill((0,0,0))
                splash.draw_loading_splash()
                
                gamestate.stage = UI_objects.stage_selector.selected_thumbnail.stage
                
                versusmode.init(player_data)
                
                #versusmode.local_state.init_recording(
                #    player1_moveset_select.selected_moveset.name,
                #    player2_moveset_select.selected_moveset.name
                #)
                
                unload()
                gamestate.mode = gamestate.Modes.VERSUSMODE
        else:
            UI_objects.start_match_label_draw_timer = 0            
            UI_objects.start_match_label.hide()
예제 #2
0
 elif gamestate.mode == gamestate.Modes.FRAMEEDITOR:
     frameeditor.handle_events(screen, \
                               mousePos, \
                               mouseButtonsPressed, \
                               events)
     
 elif gamestate.mode == gamestate.Modes.ANIMATIONEXPLORER:
     animationexplorer.handle_events(screen, \
                                     mousePos, \
                                     mouseButtonsPressed, \
                                     events)
 elif gamestate.mode == gamestate.Modes.MAINMENU:
     menupage.handle_events()
 elif gamestate.mode == gamestate.Modes.VERSUSMODE:
     if versusmode.initialized() == False:
         versusmode.init()
         
     versusmode.handle_events()
 elif gamestate.mode == gamestate.Modes.SETTINGSMODE:
     volume.handle_events()
 elif gamestate.mode == gamestate.Modes.MOVEBUILDER:
     movebuilder.handle_events()
 elif gamestate.mode == gamestate.Modes.MOVESETBUILDER:
     movesetbuilder.handle_events()
 elif gamestate.mode == gamestate.Modes.KEYBINDING:
     keybinding.handle_events()
 elif gamestate.mode == gamestate.Modes.MOVESETSELECT:
     movesetselect.handle_events()
 elif gamestate.mode == gamestate.Modes.VERSUSMOVESETSELECT:
     versusmovesetselect.handle_events()
 elif gamestate.mode == gamestate.Modes.ONLINEVERSUSMODE: