Esempio n. 1
0
    def chatWindow(self, windowtext=None):

        """ Opens a new chat window
        """
        global desktopChat
        global move_to_next_chatwin_flag

        move_to_next_chatwin_flag = False  # so that the next window waits for the user to press enter
        # Disable other gui
        gui_buttons.gui_obj.disable_buttons()

        # Stopping the updation thread
        threades.pause_update_thread()

        # Custom Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style["bg-color"] = (0, 0, 0)

        # Calculating position and size of window from the size of the desktop
        position_win = threades.resize_pos((150.0, 50.0))
        size_win = threades.resize_pos((900, 800))
        # print 'size win is',size_win,'\n'

        # Creating window
        self.chatWin = gui.Window(
            position=position_win,
            size=size_win,
            parent=desktopChat,
            text="",
            style=win_style,
            closeable=False,
            shadeable=False,
            moveable=False,
        )
        self.chatWin.surf.fill((0, 0, 0, 140))
        self.chatWinFlag = True

        # NOTE: This part will be used once we know how to blit buttons on the chat window
        # self.button_skip = gui.Button(position = threades.resize_pos((500.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Skip",style = self.button_style)
        # self.button_next = gui.Button(position = threades.resize_pos((200.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Next >",style = self.button_style)
        # self.button_skip.onClick=self.closeChatWindow
        # self.button_skip.onMouseOver=self.closeChatWindow
        # print self.button_skip.enabled

        # creating label for writing the text
        self.label = gui.Label(
            position=threades.resize_pos((100.0, 760.0), (900.0, 800.0), self.chatWin.size),
            size=threades.resize_pos((700.0, 30.0), (900.0, 800.0), self.chatWin.size),
            parent=self.chatWin,
            text=model.text_file.proceed_text[0],
            style=self.labelStyleCopy,
        )
Esempio n. 2
0
    def chatWindow(self, windowtext=None):
        ''' Opens a new chat window
        '''
        global desktopChat
        global move_to_next_chatwin_flag

        move_to_next_chatwin_flag = False  #so that the next window waits for the user to press enter
        # Disable other gui
        gui_buttons.gui_obj.disable_buttons()

        # Stopping the updation thread
        threades.pause_update_thread()

        # Custom Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style['bg-color'] = (0, 0, 0)

        # Calculating position and size of window from the size of the desktop
        position_win = threades.resize_pos((150.0, 50.0))
        size_win = threades.resize_pos((900, 800))
        #print 'size win is',size_win,'\n'

        # Creating window
        self.chatWin = gui.Window(position=position_win,
                                  size=size_win,
                                  parent=desktopChat,
                                  text='',
                                  style=win_style,
                                  closeable=False,
                                  shadeable=False,
                                  moveable=False)
        self.chatWin.surf.fill((0, 0, 0, 140))
        self.chatWinFlag = True

        #NOTE: This part will be used once we know how to blit buttons on the chat window
        #self.button_skip = gui.Button(position = threades.resize_pos((500.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Skip",style = self.button_style)
        #self.button_next = gui.Button(position = threades.resize_pos((200.0,10.0),(900.0,800.0),self.size_win), size = threades.resize_pos((80.0,30.0),(900.0,800.0),self.size_win), parent = self.chatWin, text = "Next >",style = self.button_style)
        #self.button_skip.onClick=self.closeChatWindow
        #self.button_skip.onMouseOver=self.closeChatWindow
        #print self.button_skip.enabled

        #creating label for writing the text
        self.label = gui.Label(position=threades.resize_pos(
            (100.0, 760.0), (900.0, 800.0), self.chatWin.size),
                               size=threades.resize_pos((700.0, 30.0),
                                                        (900.0, 800.0),
                                                        self.chatWin.size),
                               parent=self.chatWin,
                               text=model.text_file.proceed_text[0],
                               style=self.labelStyleCopy)
Esempio n. 3
0
    def new_level_stats(self,data_file,graphics_file,level_no=-1):
        #global total_update_flag 
        global animation_obj
        threades.pause_update_thread()           
        self.graphics()
        self.level_no=level_no
        self.data_file=data_file
        self.graphics_file=graphics_file
        self.run=True
        level_updater=threading.Thread(target=self.level_reinit,args=[]).start()
        
        pygame.display.set_caption('FoodForce2')
        threades.screen.fill((0,0,0))
        threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))
        
        desktop_level.update()
        desktop_level.draw()
        pygame.display.update()
            
        while 1 :
            
            for e in gui.setEvents(pygame.event.get()):
                if e.type == pygame.QUIT:
                    print 'in pygame.quit'                    
                    safe_exit()
                if e.type == QUIT:
                    print 'in quit'
                    safe_exit()

            #if level_updater.is_alive()==False:
               # self.run=False      GREAT THIS IS APPLICABLE ONLY WITH PYTHON 2.6, SO HAVE TO SEARCH SOME OTHER MEANS
            if self.run==False:
                break
           
        #print 'now reached here\n'
        
            
        self.ff_logo = 0
        threades.initialize_facilities(True)
        threades.set_build_facility_placement_flag()
        threades.facility_placement_data_obj.clear_placement_data()
        #threades.current_level = proceduralFlow.storyboard_level
                
        threades.total_update_flag = True
        threades.resume_update_thread()
Esempio n. 4
0
    def new_level_stats(self, data_file, graphics_file, level_no=-1):
        #global total_update_flag
        global animation_obj
        threades.pause_update_thread()
        self.graphics()
        self.level_no = level_no
        self.data_file = data_file
        self.graphics_file = graphics_file
        self.run = True
        level_updater = threading.Thread(target=self.level_reinit,
                                         args=[]).start()

        pygame.display.set_caption('FoodForce2')
        threades.screen.fill((0, 0, 0))
        threades.screen.blit(self.ff_logo, threades.resize_pos((40, 90)))

        desktop_level.update()
        desktop_level.draw()
        pygame.display.update()

        while 1:

            for e in gui.setEvents(pygame.event.get()):
                if e.type == pygame.QUIT:
                    print 'in pygame.quit'
                    #safe_exit()
                if e.type == QUIT:
                    print 'in quit'
                    #safe_exit()

            #if level_updater.is_alive()==False:
            # self.run=False      GREAT THIS IS APPLICABLE ONLY WITH PYTHON 2.6, SO HAVE TO SEARCH SOME OTHER MEANS
            if self.run == False:
                break

        self.ff_logo = 0
        threades.initialize_facilities(True)
        threades.set_build_facility_placement_flag()
        #threades.current_level = proceduralFlow.storyboard_level

        threades.total_update_flag = True
        model.POPULATION_FACTOR = 0.5
        threades.resume_update_thread()
    def new_level_stats(self, data_file, graphics_file, level_no=-1):
        #global total_update_flag
        global animation_obj
        threades.pause_update_thread()
        self.graphics()
        self.level_no = level_no
        self.data_file = data_file
        self.graphics_file = graphics_file
        self.run = True
        level_updater = threading.Thread(target=self.level_reinit,
                                         args=[]).start()

        pygame.display.set_caption('FoodForce2')
        threades.screen.fill((0, 0, 0))
        threades.screen.blit(self.ff_logo, threades.resize_pos((40, 50)))

        desktop_level.update()
        desktop_level.draw()
        pygame.display.update()

        while 1:

            for e in gui.setEvents(pygame.event.get()):
                if e.type == pygame.QUIT:
                    print 'in pygame.quit'
                    safe_exit()
                if e.type == QUIT:
                    print 'in quit'
                    safe_exit()

            #if level_updater.is_alive()==False:
            # self.run=False      GREAT THIS IS APPLICABLE ONLY WITH PYTHON 2.6, SO HAVE TO SEARCH SOME OTHER MEANS
            if self.run == False:
                break

        print 'now reached here\n'

        self.ff_logo = 0
        threades.initialize_facilities()

        threades.total_update_flag = True
        threades.resume_update_thread()