import api_game as api_game
import game_1 as quest_game

str_path_img="data\\img\\"
str_img_menu=str_path_img+"menu\\game\\object_select.jpg"

music_location="data\\sound\\lost-night-beach.ogg"

def on_create():
	global music_location
	api_game.load_stream(music_location,1)
	api_game.fade_music(music_location,0,3)

	str_path_icon=str_path_img+"lev\\"+__name__+"\\objects_icon\\"
	str_path_m_icon=str_path_img+"lev\\"+__name__+"\\items\\"
	quest_game.set_path_small_icon(str_path_img+"lev\\"+__name__+"\\icons\\")

	api_game.load_stream("data\\sound\\quest\\q_gorenie.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\q_gorenie.ogg",0.1)

	api_game.load_stream("data\\sound\\quest\\amb_sea.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\amb_sea.ogg",0.2)
	api_game.play_sound("data\\sound\\quest\\amb_sea.ogg",1)

	api_game.load_stream("data\\sound\\quest\\amb_les_water.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\amb_les_water.ogg",0.2)
	api_game.play_sound("data\\sound\\quest\\amb_les_water.ogg",1)

	api_game.enable_visibility(0,"bonfire", 0)
	api_game.enable_visibility(0,"fifth_object", 0)
	api_game.enable_visibility(0,"light", 0)
	api_game.enable_visibility(0,"flag", 0)
	api_game.enable_visibility(0,"first_object_full",0)
	api_game.enable_visibility(0,"coal",0)
	api_game.enable_visibility(0,"item5_4_burn",0)
	
	p_part = api_game.get_child(0,"part_layer0")
	api_game.enable_visibility(p_part,"fire1_dust",0)
	api_game.enable_visibility(p_part,"fire1_flame",0)
	api_game.enable_visibility(p_part,"fire1_light",0)

	api_game.enable_visibility(0,"vkl_1", 0)
	api_game.enable_update(0,"vkl_1", 0)
	api_game.enable_visibility(0,"vkl_2", 0)
	api_game.enable_update(0,"vkl_2", 0)
	api_game.enable_visibility(0,"vkl_3", 0)
	api_game.enable_update(0,"vkl_3", 0)

	str_icons_menu=[str_path_icon+"item1_1.jpg",str_path_icon+"item1_1.jpg",str_path_icon+"item1_1.jpg",str_path_icon+"item1_1.jpg",str_path_icon+"item1_1.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item1_1m.jpg",str_path_m_icon+"item1_1m.jpg",str_path_m_icon+"item1_1m.jpg",str_path_m_icon+"item1_1m.jpg",str_path_m_icon+"item1_1m.jpg","","",""]
	str_objects_on_loc=["item1_1","item1_2","item1_3","item1_4","item1_5","","",""]
	quest_game.add_of("first_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,0,0,0)

	str_icons_menu=[str_path_icon+"item5_2.jpg",str_path_icon+"item5_3.jpg","","","","","",""]
	str_icon_mouse=[str_path_m_icon+"item5_2m.jpg",str_path_m_icon+"item5_3m.jpg","","","","","",""]
	str_objects_on_loc=["item5_2","item5_3","","","","","",""]
	quest_game.add_of("fifth_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,0,0,0)

	str_icons_menu=[str_path_icon+"item2_2.jpg",str_path_icon+"item2_5.jpg",str_path_icon+"item3_2.jpg",str_path_icon+"item3_1.jpg","","","",""]
	str_icon_mouse=[str_path_m_icon+"item2_2m.jpg",str_path_m_icon+"item2_5m.jpg",str_path_m_icon+"item3_2m.jpg",str_path_m_icon+"item3_1m.jpg","","","",""]
	str_objects_on_loc=["item2_2","item2_5","item3_2","item3_1","","","",""]
	quest_game.add_of("second_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,3.6,0,0)

	str_icons_menu=[str_path_icon+"item3_4.jpg",str_path_icon+"item3_5.jpg",str_path_icon+"item2_1.jpg",str_path_icon+"item2_3.jpg",str_path_icon+"item2_4.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item3_4m.jpg",str_path_m_icon+"item3_5m.jpg",str_path_m_icon+"item2_1m.jpg",str_path_m_icon+"item2_3m.jpg",str_path_m_icon+"item2_4m.jpg","","",""]
	str_objects_on_loc=["item3_4","item3_5","item2_1","item2_3","item2_4","","",""]
	quest_game.add_of("three_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,3.14,0,0)

	str_icons_menu=[str_path_icon+"item4_1.jpg",str_path_icon+"item4_3.jpg",str_path_icon+"item4_4.jpg",str_path_icon+"item4_5.jpg",str_path_icon+"item5_1.jpg",str_path_icon+"item5_5.jpg",str_path_icon+"coal_icon.jpg",""]
	str_icon_mouse=[str_path_m_icon+"item4_1m.jpg",str_path_m_icon+"item4_3m.jpg",str_path_m_icon+"item4_4m.jpg",str_path_m_icon+"item4_5m.jpg",str_path_m_icon+"item5_1m.jpg",str_path_m_icon+"item5_5m.jpg",str_path_m_icon+"coal_big.jpg",""]
	str_objects_on_loc=["item4_1","item4_3","item4_4","item4_5","item5_1","item5_5","coal",""]
	quest_game.add_of("flag_rect", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,2,0,0)

	str_icons_menu=[str_path_icon+"fork_icon.jpg","","","","","","",""]
	str_icon_mouse=[str_path_m_icon+"fork_big.jpg","","","","","","",""]
	str_objects_on_loc=["item5_4_burn","","","","","","",""]
	quest_game.add_of("first_object_full", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,2,0,0)

	quest_game.add_oc("basket", "data\\img\\lev\\loc_18_1\\mini\\secret_1.gif", "vkl_1")
	quest_game.set_state_of("first_object", 2)

	api_game.set_goal("goal_18_1")

def on_mouse_down_of(object_name, p_object, state):
	if object_name == "first_object" and state == 3:
		quest_game.show_object("fifth_object","quest_anim",0.5,0,0)
		quest_game.add_oc("chest", "data\\img\\lev\\loc_18_1\\mini\\secret_3.gif", "vkl_3")
		quest_game.set_state_of("fifth_object", 2)	
		api_game.set_goal("goal_18_2")
	elif object_name == "second_object" and state == 3:
		api_game.set_goal("goal_18_3")
		quest_game.set_state_of("three_object", 2)
		quest_game.show_object("bonfire","quest_anim",0.5,0,0)
	elif object_name == "three_object" and state == 3:
		api_game.set_goal("goal_18_4")
		api_game.play_sound("data\\sound\\quest\\q_gorenie.ogg",1)
		quest_game.show_object("light","quest_anim",0.5,0,0)
		quest_game.show_object("coal","quest_anim",0.5,0,0)
		quest_game.set_state_of("flag_rect", 2)
		p_part = api_game.get_child(0,"part_layer0")
		api_game.enable_visibility(p_part,"fire1_dust",1)
		api_game.enable_visibility(p_part,"fire1_flame",1)
		api_game.enable_visibility(p_part,"fire1_light",1)
	elif object_name == "flag_rect" and state == 3:
		api_game.set_goal("goal_18_5")
		quest_game.show_object("flag","quest_anim",0.5,0,0)
		quest_game.show_object("item5_4_burn","quest_anim",0.5,0,0)
		quest_game.set_state_of("first_object_full", 2)
	elif object_name == "fifth_object" and state == 3:
		api_game.set_goal("goal_18_6")
		quest_game.set_state_of("second_object", 2)
		quest_game.add_oc("box", "data\\img\\lev\\loc_18_1\\mini\\secret_2.gif", "vkl_2")
		quest_game.show_object("first_object_full","quest_anim",0.5,0,0)
		quest_game.show_object("fifth_object","quest_anim",0.5,1,0)
	elif object_name == "first_object_full" and state == 3:
#		api_game.attach_game("data\\menu\\levels\\loc_18_2")
#		api_game.activate_game("loc_18_2",1)
		api_game.game_win()
		

#def on_event(object_name, p_object, event):
#	if event == 11000 and object_name == "loc_18_2":
#		api_game.activate_game("loc_18_2",0)		
#		api_game.game_win()		
            
		
#def on_fade_event(i_state, str_def):
#	if str_def == "loc_18_2" and i_state == 1:
#		api_game.activate_game("loc_18_2",1)
