class Director(renpy.Displayable):

    #Debe sobreescribirse el constructor
    def __init__(self, scenes, data, **kwargs):
        super(Director, self).__init__(scenes, data, **kwargs)
 


        self.height = 500
        self.width = 500

        #Para calcular tiempos
        self.oldst = None
        self.result = None # To end variable
        self.stuck = True

        # Para control del juego
        self.scenes = scenes
        self.current_scene = self.scenes["init"]
        self.data = data
        self.current_scene = self.scenes["init"]
        self.current_scene.load(self.data) # Se le manda el diccionario de datos para que se configure.




    '''
    Renderiza el objeto en la escena.
    Heredado de renpy.Displayable
    width, height
        The amount of space available to this displayable, in pixels.
    st
        A float, the shown timebase, in seconds. The shown timebase 
        begins when this displayable is first shown on the screen.
    at
        A float, the animation timebase, in seconds. The animation timebase begins when 
        an image with the same tag was shown, without being hidden.
        (When the displayable is shown without a tag, this is the same as 
            the shown timebase.) '''
    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        # Para poder saber el tiempo
        if self.oldst is None:
            self.oldst = st

        dtime = st - self.oldst
        self.oldst = st
        # actualiza la escena
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result

        # dibuja la pantalla
        self.current_scene.on_draw(screen)


        if self.current_scene.next:
            self.change_scene()

        renpy.redraw(self, 0)
        return screen



    def change_scene(self):
        self.current_scene.finish(self.data) # Se le manda el diccionario de datos para que lo actualice.
        self.current_scene = self.scenes[self.current_scene.next]
        self.current_scene.load(self.data) # Se le manda el diccionario de datos para que se configure.



    '''
    ev
        An event object
    x, y
        The x and y coordinates of the event, relative to the upper-left 
        corner of the displayable. These should be used in preference to 
        position information found in the pygame event objects.
    st
        A float, the shown timebase, in seconds.
    An event is generated at the start of each interaction, and renpy.timeout() 
    can be used to cause another event to occur.'''
    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()

    '''
    Similar a update de pygame'''
    def per_interact(self):
        pass

    '''
    Devuelve la lista de hijos '''
    def visit(self):
        return [] 
0bb1a12342139c7c724e04f9d65433b57714292f
class Director(renpy.Displayable):
    <mask token>
    <mask token>

    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        if self.oldst is None:
            self.oldst = st
        dtime = st - self.oldst
        self.oldst = st
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result
        self.current_scene.on_draw(screen)
        if self.current_scene.next:
            self.change_scene()
        renpy.redraw(self, 0)
        return screen
    <mask token>
    <mask token>

    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()
    <mask token>

    def per_interact(self):
        pass
    <mask token>

    def visit(self):
        return []

class Director(renpy.Displayable):

    def __init__(self, scenes, data, **kwargs):
        super(Director, self).__init__(scenes, data, **kwargs)
        self.height = 500
        self.width = 500
        self.oldst = None
        self.result = None
        self.stuck = True
        self.scenes = scenes
        self.current_scene = self.scenes['init']
        self.data = data
        self.current_scene = self.scenes['init']
        self.current_scene.load(self.data)
    <mask token>

    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        if self.oldst is None:
            self.oldst = st
        dtime = st - self.oldst
        self.oldst = st
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result
        self.current_scene.on_draw(screen)
        if self.current_scene.next:
            self.change_scene()
        renpy.redraw(self, 0)
        return screen
    <mask token>
    <mask token>

    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()
    <mask token>

    def per_interact(self):
        pass
    <mask token>

    def visit(self):
        return []

class Director(renpy.Displayable):

    def __init__(self, scenes, data, **kwargs):
        super(Director, self).__init__(scenes, data, **kwargs)
        self.height = 500
        self.width = 500
        self.oldst = None
        self.result = None
        self.stuck = True
        self.scenes = scenes
        self.current_scene = self.scenes['init']
        self.data = data
        self.current_scene = self.scenes['init']
        self.current_scene.load(self.data)
    <mask token>

    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        if self.oldst is None:
            self.oldst = st
        dtime = st - self.oldst
        self.oldst = st
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result
        self.current_scene.on_draw(screen)
        if self.current_scene.next:
            self.change_scene()
        renpy.redraw(self, 0)
        return screen

    def change_scene(self):
        self.current_scene.finish(self.data)
        self.current_scene = self.scenes[self.current_scene.next]
        self.current_scene.load(self.data)
    <mask token>

    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()
    <mask token>

    def per_interact(self):
        pass
    <mask token>

    def visit(self):
        return []

class Director(renpy.Displayable):

    def __init__(self, scenes, data, **kwargs):
        super(Director, self).__init__(scenes, data, **kwargs)
        self.height = 500
        self.width = 500
        self.oldst = None
        self.result = None
        self.stuck = True
        self.scenes = scenes
        self.current_scene = self.scenes['init']
        self.data = data
        self.current_scene = self.scenes['init']
        self.current_scene.load(self.data)
    """
    Renderiza el objeto en la escena.
    Heredado de renpy.Displayable
    width, height
        The amount of space available to this displayable, in pixels.
    st
        A float, the shown timebase, in seconds. The shown timebase 
        begins when this displayable is first shown on the screen.
    at
        A float, the animation timebase, in seconds. The animation timebase begins when 
        an image with the same tag was shown, without being hidden.
        (When the displayable is shown without a tag, this is the same as 
            the shown timebase.) """

    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        if self.oldst is None:
            self.oldst = st
        dtime = st - self.oldst
        self.oldst = st
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result
        self.current_scene.on_draw(screen)
        if self.current_scene.next:
            self.change_scene()
        renpy.redraw(self, 0)
        return screen

    def change_scene(self):
        self.current_scene.finish(self.data)
        self.current_scene = self.scenes[self.current_scene.next]
        self.current_scene.load(self.data)
    """
    ev
        An event object
    x, y
        The x and y coordinates of the event, relative to the upper-left 
        corner of the displayable. These should be used in preference to 
        position information found in the pygame event objects.
    st
        A float, the shown timebase, in seconds.
    An event is generated at the start of each interaction, and renpy.timeout() 
    can be used to cause another event to occur."""

    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()
    """
    Similar a update de pygame"""

    def per_interact(self):
        pass
    """
    Devuelve la lista de hijos """

    def visit(self):
        return []

class Director(renpy.Displayable):

    #Debe sobreescribirse el constructor
    def __init__(self, scenes, data, **kwargs):
        super(Director, self).__init__(scenes, data, **kwargs)
 


        self.height = 500
        self.width = 500

        #Para calcular tiempos
        self.oldst = None
        self.result = None # To end variable
        self.stuck = True

        # Para control del juego
        self.scenes = scenes
        self.current_scene = self.scenes["init"]
        self.data = data
        self.current_scene = self.scenes["init"]
        self.current_scene.load(self.data) # Se le manda el diccionario de datos para que se configure.




    '''
    Renderiza el objeto en la escena.
    Heredado de renpy.Displayable
    width, height
        The amount of space available to this displayable, in pixels.
    st
        A float, the shown timebase, in seconds. The shown timebase 
        begins when this displayable is first shown on the screen.
    at
        A float, the animation timebase, in seconds. The animation timebase begins when 
        an image with the same tag was shown, without being hidden.
        (When the displayable is shown without a tag, this is the same as 
            the shown timebase.) '''
    def render(self, width, height, st, at):
        screen = renpy.Render(self.width, self.height)
        # Para poder saber el tiempo
        if self.oldst is None:
            self.oldst = st

        dtime = st - self.oldst
        self.oldst = st
        # actualiza la escena
        result = self.current_scene.on_update(dtime)
        if result:
            self.result = result

        # dibuja la pantalla
        self.current_scene.on_draw(screen)


        if self.current_scene.next:
            self.change_scene()

        renpy.redraw(self, 0)
        return screen



    def change_scene(self):
        self.current_scene.finish(self.data) # Se le manda el diccionario de datos para que lo actualice.
        self.current_scene = self.scenes[self.current_scene.next]
        self.current_scene.load(self.data) # Se le manda el diccionario de datos para que se configure.



    '''
    ev
        An event object
    x, y
        The x and y coordinates of the event, relative to the upper-left 
        corner of the displayable. These should be used in preference to 
        position information found in the pygame event objects.
    st
        A float, the shown timebase, in seconds.
    An event is generated at the start of each interaction, and renpy.timeout() 
    can be used to cause another event to occur.'''
    def event(self, ev, x, y, st):
        dtime = st - self.oldst
        self.current_scene.on_event(dtime, ev)
        if self.result:
            return self.result
        else:
            raise renpy.IgnoreEvent()

    '''
    Similar a update de pygame'''
    def per_interact(self):
        pass

    '''
    Devuelve la lista de hijos '''
    def visit(self):
        return [] 