def on_index(self, *args, **kwargs): super(BikeMenuCarousel, self).on_index(*args, **kwargs) bikes_screen = ValidObject.bikes_screen(self._screen()) if app_config('bike', 'title') == self.current_slide.item['title']: bikes_screen.ids['title'].text = self.title_active() else: self.char_btn_disabled('character_wrap_power') self.char_btn_disabled('character_wrap_speed') self.char_btn_disabled('character_wrap_acceleration') self.char_btn_disabled('character_wrap_agility') color = self.define_color('bike') bikes_screen.ids['title'].color = color bike_model = get_bike_by_title(self.current_slide.item['title']) self.change_prop_title('character_wrap_price', str(bike_model.price), color) self.change_prop_title('character_wrap_power', str(bike_model.power), color) self.change_prop_title('character_wrap_speed', str(bike_model.speed), color) self.change_prop_title('character_wrap_acceleration', str(bike_model.acceleration), color) self.change_prop_title('character_wrap_agility', str(bike_model.agility), color)
def on_press(self, *args, **kwargs): _screen = self._current_screen() menu_screen = ValidObject.menu_screen(_screen.manager.get_screen('menu')) bikes_screen = ValidObject.bikes_screen(_screen.manager.get_screen('bikes')) maps_screen = ValidObject.maps_screen(_screen.manager.get_screen('maps')) shop_screen = ValidObject.shop_screen(_screen.manager.get_screen('shop')) screens = [menu_screen, bikes_screen, maps_screen, shop_screen] if 'BikesScreen' == _screen.__class__.__name__: if not app_config('bike', 'title'): bike_model = get_bike_by_title(bikes_screen.ids['title'].text) rest_rm = calc_rest_rm(bike_model.price) if Bike.buy(bike_model): RightPanelBtn.change_rm(screens, rest_rm) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_price'], bike_model.price) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_power'], bike_model.power) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_speed'], bike_model.speed) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_acceleration'], bike_model.acceleration) RightPanelBtn.change_character_wrap(bikes_screen.ids['character_wrap_agility'], bike_model.agility) RightPanelBtn.cancel_animation_button(screens, 'left_panel_menu_bikes') self.init_item(menu_screen.init_bike) RightPanelBtn.change_bottom_right_btn(menu_screen) bikes_screen.ids['title'].color = UColor.hex(UColor.WHITE) else: Clock.schedule_once(self._create_animation_fail, 0) Clock.schedule_once(self._clear_animation, .5) elif 'MapsScreen' == _screen.__class__.__name__: if not app_config('map', 'title'): map_model = get_map_by_title(maps_screen.ids['title'].text) rest_rm = calc_rest_rm(map_model.price) if BaseLevel.buy(map_model): RightPanelBtn.change_rm(screens, rest_rm) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_price'], map_model.price) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_record'], '/dev/') RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_level'], map_model.level) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_map'], map_model.map) RightPanelBtn.change_character_wrap(maps_screen.ids['character_wrap_total_way'], map_model.total_way) RightPanelBtn.cancel_animation_button(screens, 'left_panel_menu_maps') self.init_item(menu_screen.init_map) RightPanelBtn.change_bottom_right_btn(menu_screen) maps_screen.ids['title'].color = UColor.hex(UColor.WHITE) else: Clock.schedule_once(self._create_animation_fail, 0) Clock.schedule_once(self._clear_animation, .5)
def char_btn_disabled(self, sid: str): bikes_screen = ValidObject.bikes_screen(self._screen()) box_layout = bikes_screen.ids[sid].children[1] btn = box_layout.children[0] btn.disabled = True btn.opacity = 0.2
def set_title(self, value): if self.parent: screen = ValidObject.bikes_screen(self._screen()) screen.ids['title'].text = value