def load_level_in_set(self, set_id=None, level_id_in_set=1): """ Load given level in given set with checking. :param set_id: id of the set to load. :param level_id_in_set: id of the level to load. :rtype: void """ if not set_id or not self.level_service.does_set_exist(set_id): set_id = self.level_service.get_last_set_unlocked() self.clear_widgets() self.current_set_id = set_id self.current_level_id_in_set = level_id_in_set # display popup if level need popup open_pop_up(self, 'open_level', set_id, level_id_in_set) self.level = Level( self.level_event_dispatcher, set_id, level_id_in_set ) self.add_widget(self.level) self.update_menu_level_bar() Window.bind(on_resize=self.update_menu_level_bar)
def credit_button_callback(self, _): """ When player click on credit button (Required method). :param _: :rtype: void """ open_pop_up(self, 'Credits')
def launch_level(self, value): """ Load level. :param value: :rtype: void """ set_id = value.cls[0] if self.level_service.can_load_set(set_id): propagate_event('LevelManager', self, set_id) else: open_pop_up(self, 'not_unlocked', set_id)
def do_level_up(self, _, completion_details, *unused): """ Save level up in the completed pool and open popup. :param _: :param completion_details: Player stats. :param unused: :rtype: void """ self.level_service.save_completion(completion_details) set_id_to_load = completion_details['set_id'] level_id_in_set_to_load = completion_details['level_id_in_set'] + 1 if level_id_in_set_to_load > 5: set_id_to_load = completion_details['set_id'] + 1 level_id_in_set_to_load = 1 open_pop_up(self, 'end_level', set_id_to_load, level_id_in_set_to_load, completion_details)
def do_level_up(self, instance, completion_details, *args): """ Save level up in the completed pool and open popup. :param instance: :param completion_details: :param args: :rtype: void """ self.level_service.save_completion(completion_details) set_id_to_load = completion_details['set_id'] level_id_in_set_to_load = completion_details['level_id_in_set'] + 1 if level_id_in_set_to_load >= 5: set_id_to_load = completion_details['set_id'] + 1 level_id_in_set_to_load = 1 open_pop_up(self, 'end_level', set_id_to_load, level_id_in_set_to_load, completion_details)
def load_level_in_set(self, set_id=None, level_id_in_set=1): """ Load given level in given set with checking. :param set_id: :param level_id_in_set: :rtype: void """ if not set_id or not self.level_service.does_set_exist(set_id): set_id = self.level_service.get_last_set_unlocked() self.clear_widgets() # add map self.add_widget(Level(self.level_event_dispatcher, set_id, level_id_in_set)) # add menu level self.update_menu_level_label(set_id, level_id_in_set) # display popup if level need popup open_pop_up(self, 'open_level', set_id, level_id_in_set)