##### # Config scene ##### import logging from Remake_1869 import Utils from pyglet.window import key from pyglet.window import mouse class ConfigScene: def __init__(self): self.sceneName = "CONFIG" print('Current Scene: {}'.format(self.sceneName)) self.isAlive = True self.isInTransfer = False self.targetScene = None self.mouse_x = 0 self.mouse_y = 0 self.current_ScenePhase = 1 def initializeSceneLogic(self,game): game.register_animation(game.d_active_sprites['configSprite'],'FadeIn') game.setStopwatch(game.d_active_sprites['configSprite'],5*60) def close(self,game): #ensure everything must be closed or Fade-out is fadeout game.clearStopwatchTask(game.d_active_sprites['blackscreen']) game.register_animation(game.d_active_sprites['blackscreen'],'FadeInSlow') game.setStopwatch(game.d_active_sprites['blackscreen'],5*60) def on_mouse_motion(self, game, x, y, dx, dy): self.mouse_x = x self.mouse_y = y def on_mouse_press(self,game, x, y, button, modifiers): if button == 1: # Left click pass def on_key_press(self, game, symbol, modifiers): pass def prepareSprites(self, game, d_sprites): d_sprites['configSprite'].opacity = 0 d_sprites['blackscreen'].opacity = 0 self.initializeSceneLogic(game) def killSprites(self,game, d_sprites): pass def prepareLabels(self, game, d_labels): pass def killLabels(self, game, d_labels): pass def prepareWidgets(self, game, d_widgets): d_widgets['mainInput'].set_opacity(0) def killWidgets(self, game ,d_widgets): pass def maintain_SpriteAnimations(self, l_deactivateAnims, sprite, animationType): if animationType is 'FadeIn': if Utils.fadeIn_sprite(sprite,sprite.opacity,5) is False: l_deactivateAnims.append(sprite) if animationType is 'FadeInSlow': if Utils.fadeIn_sprite(sprite,sprite.opacity,2) is False: l_deactivateAnims.append(sprite) if animationType is 'FadeOut': if Utils.fadeOut_sprite(sprite,sprite.opacity,5) is False: l_deactivateAnims.append(sprite) def maintain_LabelAnimations(self, l_deactivateAnims, label, animationType): if animationType is 'ToggleAlpha': Utils.toggle_label(label, label.color) l_deactivateAnims.append(label) if animationType is 'FadeIn': if Utils.fadeIn_label(label,label.color,5) is False: l_deactivateAnims.append(label) def maintain_WidgetAnimations(self, l_deactivateAnims, widget, animationType): if animationType is 'FadeIn': if Utils.fadeIn_widget(widget,widget.get_opacity(),5) is False: l_deactivateAnims.append(widget) if animationType is 'FadeOut': if Utils.fadeOut_widget(widget,widget.get_opacity(),5) is False: l_deactivateAnims.append(widget) def doSceneLogic(self, game): if self.current_ScenePhase == 1: if game.checkStopwatch(game.d_active_sprites['configSprite'],0): self.current_ScenePhase = 2 if self.current_ScenePhase == 2: if game.checkStopwatch(game.d_active_widgets['mainInput'],0): game.register_animation(game.d_active_widgets['mainInput'],'FadeIn') game.setStopwatch(game.d_active_widgets['mainInput'],1*15) self.current_ScenePhase = 3 if self.current_ScenePhase == 3: pass def run(self, game): game.stopwatch_tick() self.doSceneLogic(game) if self.isInTransfer is True: if game.checkStopwatch(game.d_active_sprites['blackscreen'],0): self.isAlive = False self.targetScene = 'NextScene' return self.targetScene