示例#1
0
    def run (self, requester):
        if requester.get_name() == adonthell.gamedata_player ().get_name():
            # -- get characters' current state
            player_state = requester.is_paused ()
            npc_state = self.myself.is_paused ()
            
            # -- deactivate the schedule of the characters involved
            self.myself.pause ()
            requester.pause ()
            # player isn't event-driven yet
            requester.set_schedule_active (0)

            # -- don't allow access to main menu and stuff
            adonthell.gamedata_engine ().set_control_active (0)

            # -- look into the player's face
            self.myself.look_invert (requester.currentmove ())

            # -- init the dialogue engine
            dlg = adonthell.dialog_screen (self.myself, self.myself.get_dialogue (), 0)

            # -- make sure the engine isn't deleted when we leave the script
            dlg.thisown = 0

            # -- attach the callback
            dlg.py_signal_connect (self.restore_schedule, adonthell.win_event_CLOSE, (player_state, npc_state, requester, self.myself))

            # -- add the dialogue window to the win_manager
            adonthell.win_manager_get_active ().add (dlg)
            adonthell.win_manager_get_active ().set_focus (dlg)

            # -- start the dialogue
            dlg.run ()
示例#2
0
    def cleanup(self):
        adonthell.win_manager_get_active().remove(self.window)

        self.window.remove(self.bag_o)
        self.window.remove(self.bag_c)
        self.window.remove(self.bag_t)

        del self.bag_o
        del self.bag_c
        del self.bag_t

        adonthell.audio_fade_out_background(500)
        adonthell.audio_unload_background(0)
示例#3
0
    def cleanup (self):
        adonthell.win_manager_get_active ().remove (self.window)

        self.window.remove (self.bag_o)
        self.window.remove (self.bag_c)
        self.window.remove (self.bag_t)

        del self.bag_o
        del self.bag_c
        del self.bag_t

        adonthell.audio_fade_out_background (500)
        adonthell.audio_unload_background (0)
示例#4
0
    def make_bubble(self):
        (npc, text) = self.text[self.index]
        length = len(text) + 100

        if npc != None:
            # -- get color
            color = self.colors[npc.get_color()]

            # -- get position
            view = adonthell.gamedata_engine().get_mapview()
            area = adonthell.gamedata_engine().get_landmap().get_submap(7)

            offx = 0
            offy = 0

            if area.area_length() * 20 < view.length():
                offx = (view.length() - area.area_length() * 20) / 2
            if ((area.area_height() * 20) < view.height()):
                offy = (view.height() - area.area_height() * 20) / 2

            x = (npc.posx() - view.posx()) * 20 + offx + 10 - length / 2
            y = (npc.posy() - view.posy()) * 20 + offy - 15
        else:
            color = 'red'

        # -- make bubble
        bubble = adonthell.text_bubble(text, color, 'original', length)
        bubble.thisown = 0

        # -- move it to the right place
        if npc != None:
            bubble.move(x, y - bubble.height())
        else:
            bubble.move(160 - bubble.length() / 2, 20)

        # -- display
        bubble.set_visible(1)
        adonthell.win_manager_get_active().add(bubble)

        bubble.py_signal_connect(self.on_close_bubble,
                                 adonthell.win_event_CLOSE)
        return bubble
示例#5
0
    def zoom_to_chest(self):
        self.window = adonthell.win_container()
        self.window.move(0, 0)
        self.window.resize(320, 240)
        self.window.set_visible_border(0)
        self.window.add(self.wall)
        self.window.add(self.chest)
        self.window.set_activate(1)
        self.window.set_visible_all(1)
        self.window.py_signal_connect(self.on_draw, adonthell.win_event_UPDATE)

        self.draw_func = self.move_chest
        self.step = 0
        self.done = 1

        if self.bubble != None:
            adonthell.win_manager_get_active().remove(self.bubble)
            self.bubble = None

        adonthell.gamedata_engine().main(self.window, 'fmv')
示例#6
0
 def zoom_to_chest (self):
     self.window = adonthell.win_container ()
     self.window.move (0, 0)
     self.window.resize (320, 240)
     self.window.set_visible_border (0)
     self.window.add (self.wall)
     self.window.add (self.chest)
     self.window.set_activate (1)
     self.window.set_visible_all (1)
     self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE)
     
     self.draw_func = self.move_chest
     self.step = 0
     self.done = 1
     
     if self.bubble != None: 
         adonthell.win_manager_get_active ().remove (self.bubble)
         self.bubble = None
         
     adonthell.gamedata_engine ().main (self.window, 'fmv')
示例#7
0
 def make_bubble (self):
     (npc, text) = self.text[self.index]
     length = len(text) + 100
     
     if npc != None:
         # -- get color
         color = self.colors[npc.get_color ()]
         
         # -- get position
         view = adonthell.gamedata_engine ().get_mapview ()
         area = adonthell.gamedata_engine ().get_landmap ().get_submap (7)
         
         offx = 0
         offy = 0
         
         if area.area_length () * 20 < view.length ():
             offx = (view.length () - area.area_length () * 20) / 2
         if ((area.area_height() * 20) < view.height()):
             offy = (view.height () - area.area_height() * 20) / 2
         
         x = (npc.posx () - view.posx ()) * 20 + offx + 10 - length / 2
         y = (npc.posy () - view.posy ()) * 20 + offy - 15
     else:
         color = 'red'
     
     # -- make bubble
     bubble = adonthell.text_bubble (text, color, 'original', length)
     bubble.thisown = 0
     
     # -- move it to the right place
     if npc != None:
         bubble.move (x, y - bubble.height ())
     else:
         bubble.move (160 - bubble.length () / 2, 20)
     
     # -- display
     bubble.set_visible (1)
     adonthell.win_manager_get_active ().add (bubble)
     
     bubble.py_signal_connect (self.on_close_bubble, adonthell.win_event_CLOSE)
     return bubble
 def disable_veranda_hack (self):
     adonthell.win_manager_get_active ().remove (self.wnd)
     del self.wnd
     self.wnd = None
 def enable_veranda_hack (self):
     self.wnd = adonthell.win_container ()
     self.wnd.set_visible (0)
     self.wnd.thisown = 0
     self.wnd.py_signal_connect (self.on_draw, adonthell.win_event_DRAW, self.myself)
     adonthell.win_manager_get_active ().add (self.wnd)
示例#10
0
    def forest_animation(self):
        # -- animate
        if self.a1 >= 4:
            self.x[0] = self.update_wood(self.wood1, self.x[0])
            self.a1 = 0
        else:
            self.a1 = self.a1 + 1

        # Magic number
        if self.a2 >= 2:
            self.x[1] = self.update_wood(self.wood2, self.x[1])
            self.a2 = 0
        else:
            self.a2 = self.a2 + 1

        # Magic number
        if self.a3 >= 1:
            self.x[2] = self.update_wood(self.wood3, self.x[2])
            self.a3 = 0
        else:
            self.a3 = self.a3 + 1

        # -- draw
        self.draw_wood(self.wood1, self.x[0])
        self.draw_wood(self.wood2, self.x[1])
        self.alek_run.draw(110, 120, self.da)
        self.draw_wood(self.wood3, self.x[2])

        # -- fade in
        if self.step == 0:
            alpha = self.black.alpha() - 2
            if alpha >= 0:
                self.black.set_alpha(alpha)
                return
            else:
                adonthell.audio_load_background(2, "audio/at-demo-2.ogg")
                adonthell.audio_play_background(2)

                self.window.remove(self.black)
                self.step = 1

        # Alek running ...
        elif self.step == 1:
            if self.index < len(self.typeover):
                if self.cursor < len(self.typeover[self.index]):
                    self.delay = self.delay + 2.8

                    if self.delay >= 6:
                        if self.cursor == 0: self.label.set_text("")
                        txt = self.typeover[self.index][self.cursor]
                        self.label.add_text(txt)
                        self.cursor = self.cursor + 1

                        # -- little pause at the end of a sentence
                        if txt == '.': self.delay = -50
                        else: self.delay = 0
                else:
                    self.index = self.index + 1
                    self.cursor = 0
                    self.delay = -200
            else:
                self.delay = 0
                self.step = 2

        # -- wait some more
        elif self.step == 2:
            self.delay = self.delay + 3
            if self.delay >= 300:
                # -- audio
                adonthell.audio_fade_out_background(2000)
                self.window.add(self.black)
                self.step = 3

        # -- fade out
        elif self.step == 3:
            alpha = self.black.alpha() + 2
            if alpha <= 255:
                self.black.set_alpha(alpha)
                return
            else:
                self.letsexit = 1

                self.draw_func = self.scroll_credits
                self.window = self.make_credits()
                self.window.py_signal_connect(self.on_draw,
                                              adonthell.win_event_UPDATE)
                adonthell.win_manager_get_active().add(self.window)
示例#11
0
    def show_niche(self):
        if self.step == 0 and self.bubble == None:
            self.step = 1
            self.index = self.index + 1
            # -- "... well hidden and ..."
            self.bubble = self.make_bubble()

        # -- fade closed bag in
        elif self.step == 1:
            self.c_bag.set_alpha(1)
            self.c_bag.set_visible(1)
            self.window.add(self.c_bag)
            self.step = self.step + 1

        elif self.step > 1 and self.step <= 255:
            self.c_bag.set_alpha(self.step)
            self.step = self.step + 1
            return

        # -- fading done
        elif self.step == 256:
            self.window.remove(self.chest)
            self.window.remove(self.wall)
            del self.chest
            del self.wall
            self.step = 257

        elif self.step > 256 and self.step <= 306:
            self.step = self.step + 1
            return

        elif self.step == 307 and self.bubble == None:
            self.step = 308
            self.index = self.index + 1
            # -- "Right Here"
            self.bubble = self.make_bubble()

        # -- fade in open bag
        elif self.step == 308:
            self.o_bag.set_alpha(3)
            self.o_bag.set_visible(1)
            self.window.add(self.o_bag)
            self.step = self.step + 1

        elif self.step > 308 and self.step <= 561:
            self.o_bag.set_alpha(self.step - 307)
            self.step = self.step + 1

        # -- wait a little
        elif self.step > 561 and self.step <= 650:
            self.step = self.step + 1

        # -- zoom to bjarn's face
        elif self.step == 651:
            # -- audio
            adonthell.audio_load_background(1, "audio/at-demo-a.ogg")
            adonthell.audio_play_background(1)

            self.bjarn.set_visible(1)
            self.window.add(self.bjarn)
            self.window.remove(self.c_bag)
            self.window.remove(self.o_bag)
            del self.c_bag
            del self.o_bag

            self.step = 652
            self.index = self.index + 1
            # -- "But ..."
            self.bubble = self.make_bubble()

        elif self.step == 652 and self.bubble == None:
            self.step = 653
            self.index = self.index + 1
            # -- "... they are gone"
            self.bubble = self.make_bubble()

        # -- wait a little more
        elif self.step > 652 and self.step <= 850:
            if self.bubble == None: self.step = self.step + 1

        elif self.step == 851:
            if self.bubble != None:
                adonthell.win_manager_get_active().remove(self.bubble)
                self.bubble = None
            adonthell.gamedata_engine().main_quit()
            adonthell.gamedata_player().set_schedule_active(1)
            self.done = 0
            self.index = 25
示例#12
0
    def forest_animation (self):
        # -- animate
        if self.a1 >= 4:
            self.x[0] = self.update_wood (self.wood1, self.x[0])
            self.a1 = 0
        else: self.a1 = self.a1 + 1

        # Magic number
        if self.a2 >= 2:
            self.x[1] = self.update_wood (self.wood2, self.x[1])
            self.a2 = 0
        else: self.a2 = self.a2 + 1

        # Magic number
        if self.a3 >= 1:
            self.x[2] = self.update_wood (self.wood3, self.x[2])
            self.a3 = 0
        else: self.a3 = self.a3 + 1
 
        # -- draw
        self.draw_wood (self.wood1, self.x[0])
        self.draw_wood (self.wood2, self.x[1])
        self.alek_run.draw (110, 120, self.da)
        self.draw_wood (self.wood3, self.x[2])
        
        # -- fade in
        if self.step == 0:
            alpha = self.black.alpha () - 2
            if alpha >= 0:
                self.black.set_alpha (alpha)
                return
            else:
                adonthell.audio_load_background (2, "audio/at-demo-2.ogg")
                adonthell.audio_play_background (2)

                self.window.remove (self.black)
                self.step = 1
        
        # Alek running ...
        elif self.step == 1:
            if self.index < len (self.typeover):
                if self.cursor < len (self.typeover[self.index]):
                    self.delay = self.delay + 2.8
                    
                    if self.delay >= 6:
                        if self.cursor == 0: self.label.set_text ("")
                        txt = self.typeover[self.index][self.cursor]
                        self.label.add_text (txt)
                        self.cursor = self.cursor + 1
                        
                        # -- little pause at the end of a sentence
                        if txt == '.': self.delay = -50
                        else: self.delay = 0
                else:
                    self.index = self.index + 1
                    self.cursor = 0
                    self.delay = -200
            else:
                self.delay = 0
                self.step = 2
                
        # -- wait some more
        elif self.step == 2:
            self.delay = self.delay + 3
            if self.delay >= 300:
                  # -- audio
                  adonthell.audio_fade_out_background (2000)
                  self.window.add (self.black)
                  self.step = 3
        
        # -- fade out
        elif self.step == 3:
            alpha = self.black.alpha () + 2
            if alpha <= 255:
                self.black.set_alpha (alpha)
                return
            else:
                self.letsexit = 1

                self.draw_func = self.scroll_credits
                self.window = self.make_credits ()
                self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE)
                adonthell.win_manager_get_active ().add (self.window)        
示例#13
0
    def show_niche (self):
        if self.step == 0 and self.bubble == None:
            self.step = 1
            self.index = self.index + 1
            # -- "... well hidden and ..."
            self.bubble = self.make_bubble ()
            
        # -- fade closed bag in
        elif self.step == 1:
            self.c_bag.set_alpha (1)
            self.c_bag.set_visible (1)
            self.window.add (self.c_bag)
            self.step = self.step + 1            

        elif self.step > 1 and self.step <= 255:
            self.c_bag.set_alpha (self.step)
            self.step = self.step + 1
            return
        
        # -- fading done
        elif self.step == 256:
            self.window.remove (self.chest)
            self.window.remove (self.wall)
            del self.chest
            del self.wall
            self.step = 257

        elif self.step > 256 and self.step <= 306:
            self.step = self.step + 1
            return

        elif self.step == 307 and self.bubble == None:            
            self.step = 308
            self.index = self.index + 1
            # -- "Right Here"
            self.bubble = self.make_bubble ()
        
        # -- fade in open bag 
        elif self.step == 308:
            self.o_bag.set_alpha (3)
            self.o_bag.set_visible (1)
            self.window.add (self.o_bag)
            self.step = self.step + 1

        elif self.step > 308 and self.step <= 561:
            self.o_bag.set_alpha (self.step - 307)
            self.step = self.step + 1
        
        # -- wait a little
        elif self.step > 561 and self.step <= 650:
            self.step = self.step + 1

        # -- zoom to bjarn's face        
        elif self.step == 651:
            # -- audio
            adonthell.audio_load_background (1, "audio/at-demo-a.ogg")
            adonthell.audio_play_background (1)
            
            self.bjarn.set_visible (1)
            self.window.add (self.bjarn)
            self.window.remove (self.c_bag)
            self.window.remove (self.o_bag)
            del self.c_bag
            del self.o_bag
            
            self.step = 652
            self.index = self.index + 1
            # -- "But ..."
            self.bubble = self.make_bubble ()
        
        elif self.step == 652 and self.bubble == None:            
            self.step = 653
            self.index = self.index + 1
            # -- "... they are gone"
            self.bubble = self.make_bubble ()

        # -- wait a little more
        elif self.step > 652 and self.step <= 850:
            if self.bubble == None: self.step = self.step + 1
            
        elif self.step == 851:
            if self.bubble != None: 
                adonthell.win_manager_get_active ().remove (self.bubble)
                self.bubble = None
            adonthell.gamedata_engine ().main_quit ()
            adonthell.gamedata_player ().set_schedule_active (1)
            self.done = 0
            self.index = 25