예제 #1
0
#from model import *
import threades
import threading
import gui_buttons
import gui
import game_events
#from gui import *
#from chat import *
import model
import chat
#from Foodforce2 import Earthquake
import natural_calamities
import level_change
import defaultStyle

load_level_obj = level_change.change_level()

storyboardfile = None

# Event Types in case of non-event based conditions

FACILITYNUMBERCONDITION = 1
FACILITYLEVELCONDITION = 2
INDICATORVALUECONDITION = 3
RESOURCEVALUECONDITION = 4
MONEYVALUECONDITION = 5

# Conditions Related Classes

class condition:
    '''Class which defines the behaviour of each single condition
예제 #2
0
def main():

    global panel
    global chat_screen
    global level_setting
    
    # Displaying the WFP logo
    intro_thread = threading.Thread(target = load_images.load_images, args=[])
    intro_thread.start()
    # Loading and starting the sound play
    GameSounds.objMusic.start_music()
    
    level_setting=level_change.change_level()
    pause_screen()

    intro_thread.join()
    threades.initialize_facilities()

    #surface_middle = pygame.transform.scale(surface3,threades.resize_pos((1200,560)))
    
    # Processing regarding the storyboard
    proceduralFlow.openStoryBoardFile()
    storyboardObj = proceduralFlow.storyboardFlow()
    proceduralFlow.openStoryBoardFile()

    gui_buttons.initialize_gui()

    threades.screen.fill((0,0,0))
    panel = display_panel.display_panel()
    animation_obj = threades.Animation()
    animation_obj.update()
    # Starting of the threads
    update_thread = threading.Thread(target = threades.update_turn, args=[]).start()
    message_thread = threading.Thread(target = message_window, args=[]).start()
    mouse_flag = False
    chat_screen=chat.chat()
        
    model.game_controller.reset_time()
    # The main infinite loop
    while True:
        #clock.tick()
        model.game_controller.update_level_time()
        

        mouse_flag = False
            
        (x,y) = (0,0)
        x,y = pygame.mouse.get_pos()
        
        if ((x < threades.new_screen_size[0]) and (x > (threades.new_screen_size[0]-60))):
            threades.transform_obj.move_free((0,0))
            
        if (x < 60 and x > 0):
            threades.transform_obj.move_free((0,0))
            
        if (y < threades.resize_pt_y(900)) and (y > threades.resize_pt_y(840)):
            threades.transform_obj.move_free((0,0))
            
        if ((y < threades.resize_pt_y(60)) and (y > threades.resize_pt_y(0))):
            threades.transform_obj.move_free((0,0))
            
        if (x > threades.resize_pt_x(0)) and (x < threades.resize_pt_x(600)) and (y > threades.resize_pt_y(845)) and (y < threades.resize_pt_y(900)):
            mouse_flag = True
            
        pygame.display.set_caption('FoodForce2')

        for e in gui.setEvents(pygame.event.get()):
            event_handling(e)

        
        #pygame.draw.rect(threades.screen,(209,169,106),threades.resize_rect((0,40,1200,560)))
        animation_obj.update()


        # Claculate indicators again
        threades.calculate_indicators_starting()
        
        #For middle surface
        #surface_middle = pygame.transform.scale(surface3,threades.resize_pos((1200,560)))
        #threades.screen.blit(surface_middle,threades.resize_pos((0,40)))

        

        
        rects_list = get_update_region()
        panel.update()
        
        if (threades.total_update_flag or threades.map_update_flag or threades.facilities_update_flag or threades.panel_update_flag or panel.res.money_flag):
            threades.desktop.update()
            threades.desktop.draw()
        
        pygame.display.update(rects_list)

        model.iteration_time = clock.tick()
        model.global_time += model.iteration_time
        storyboardObj.flow()
예제 #3
0
import threading
import gui_buttons
import gui
import game_events
#from gui import *
#from chat import *
import model
import chat
#import texts_spa
#import texts_eng
#from Foodforce2 import Earthquake
import natural_calamities
import level_change
import defaultStyle

load_level_obj = level_change.change_level()

storyboardfile = None
storyboard_file = ''
GAME_END_FLAG = False

# Event Types in case of non-event based conditions

FACILITYNUMBERCONDITION = 1
FACILITYLEVELCONDITION = 2
INDICATORVALUECONDITION = 3
RESOURCEVALUECONDITION = 4
MONEYVALUECONDITION = 5

# Conditions Related Classes