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-jungle.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_night_les.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\q_night_les.ogg",0.3)
	api_game.play_sound("data\\sound\\quest\\q_night_les.ogg",1)

	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.enable_update(0,"vkl_1", 0)
	api_game.enable_update(0,"vkl_2", 0)
	api_game.enable_visibility(0,"vkl_1", 0)
	api_game.enable_visibility(0,"vkl_2", 0)
	api_game.enable_visibility(0,"naves", 0)
	api_game.enable_visibility(0,"zavod", 0)
	api_game.enable_visibility(0,"light_koster", 0)
	api_game.enable_visibility(0,"fish", 0)
	api_game.enable_visibility(0,"vertel", 0)
	api_game.enable_visibility(0,"koster", 0)
	api_game.enable_visibility(0,"riba_vertel", 0)
	api_game.enable_visibility(0,"sachok", 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)

	str_icons_menu=[str_path_icon+"miniicon2.jpg",str_path_icon+"miniicon3.jpg",str_path_icon+"miniicon8.jpg",str_path_icon+"miniicon8.jpg",str_path_icon+"miniicon8.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"megaicon10.jpg",str_path_m_icon+"megaicon12.jpg",str_path_m_icon+"megaicon13.jpg",str_path_m_icon+"megaicon13.jpg",str_path_m_icon+"megaicon13.jpg","","",""]
	str_objects_on_loc=["palka","skin","liana_3","liana_2","liana","","",""]
	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+"miniicon7.jpg",str_path_icon+"miniicon13.jpg",str_path_icon+"miniicon13.jpg",str_path_icon+"miniicon13.jpg",str_path_icon+"miniicon10.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"megaicon11.jpg",str_path_m_icon+"megaicon6.jpg",str_path_m_icon+"megaicon6.jpg",str_path_m_icon+"megaicon6.jpg",str_path_m_icon+"megaicon15.jpg","","",""]
	str_objects_on_loc=["bamboo","leaf_2","leaf_3","leaf","koren","","",""]
	quest_game.add_of("second_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 2,0,0)

	str_icons_menu=[str_path_icon+"miniicon6.jpg",str_path_icon+"miniicon14.jpg",str_path_icon+"miniicon19.jpg",str_path_icon+"miniicon18.jpg",str_path_icon+"miniicon17.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"megaicon18.jpg",str_path_m_icon+"megaicon5.jpg",str_path_m_icon+"megaicon1.jpg",str_path_m_icon+"megaicon2.jpg",str_path_m_icon+"megaicon3.jpg","","",""]
	str_objects_on_loc=["branch","leaf_4","stone_2","stone_3","stone","","",""]
	quest_game.add_of("third_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 3.5,0,-7)

	str_icons_menu=[str_path_icon+"miniicon1.jpg",str_path_icon+"miniicon9.jpg",str_path_icon+"miniicon12.jpg",str_path_icon+"miniicon12.jpg",str_path_icon+"miniicon12.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"megaicon7.jpg",str_path_m_icon+"megaicon14.jpg",str_path_m_icon+"megaicon8.jpg",str_path_m_icon+"megaicon8.jpg",str_path_m_icon+"megaicon8.jpg","","",""]
	str_objects_on_loc=["cremen","moh","brevno_2","brevno_3","brevno_4","","",""]
	quest_game.add_of("four_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 3,0,0)

	str_icons_menu=[str_path_icon+"miniicon4.jpg",str_path_icon+"miniicon5.jpg",str_path_icon+"miniicon11.jpg",str_path_icon+"miniicon15.jpg",str_path_icon+"miniicon16.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"megaicon16.jpg",str_path_m_icon+"megaicon17.jpg",str_path_m_icon+"megaicon9.jpg",str_path_m_icon+"megaicon4.jpg",str_path_m_icon+"megaicon19.jpg","","",""]
	str_objects_on_loc=["fruit","onistar","sharp_stone","leaf_5","stone_4","","",""]
	quest_game.add_of("fish", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 3.7,0,0)

	quest_game.set_state_of("first_object", 2)

	api_game.loop_anim(0,"riba1","fish1_anim",25.0, 0)
	api_game.loop_anim(0,"riba2","fish2_anim",45.0, 0)
	api_game.set_goal("goal_6_1")	

def on_mouse_down_of(object_name, p_object, state):
	if object_name == "first_object" and state == 3:
		quest_game.show_object("naves","quest_anim",0.5,0,0)
		quest_game.set_state_of("second_object", 2)
		quest_game.add_oc("kust", "data\\img\\lev\\loc_6_1\\mini\\kust_glow.gif", "vkl_2")
		api_game.set_goal("goal_6_2")
	elif object_name == "second_object" and state == 3:
		quest_game.show_object("sachok","quest_anim",0.5,0,0)
		quest_game.set_state_of("third_object", 2)
		api_game.set_goal("goal_6_3")
	elif object_name == "third_object" and state == 3:
		quest_game.show_object("zavod","quest_anim",0.5,0,0)
		quest_game.add_oc("zavod", "data\\img\\lev\\loc_6_1\\objects\\zavod_glow.gif", "")
		quest_game.add_object_puzzle(0,"zavod")
	elif object_name == "four_object" and state == 3:
		quest_game.show_object("light_koster","quest_anim",0.5,0,0)
		quest_game.show_object("koster","quest_anim",0.5,0,0)
		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)
		quest_game.set_state_of("fish", 2)
		api_game.play_sound("data\\sound\\quest\\q_gorenie.ogg",1)
		quest_game.add_oc("inlock1", "data\\img\\lev\\loc_6_1\\mini\\inlock1_glow.gif", "vkl_1")
		api_game.set_goal("goal_6_6")
	elif object_name == "fish" and state == 3:
		quest_game.show_object("fish","quest_anim",0.5,1,0)
		quest_game.show_object("vertel","quest_anim",0.5,0,0)
		quest_game.show_object("riba_vertel","quest_anim",0.5,0,0)
		 
def on_mouse_down_oc(object_name, p_object):
	if object_name == "zavod":
		quest_game.remove_object_puzzle(0,"zavod")
		quest_game.remove_oc("zavod")
		api_game.attach_game("data\\menu\\levels\\loc_6_2")
		api_game.activate_game("loc_6_2",1)
		api_game.set_goal("tut_6_2")		

def on_event(object_name, p_object, event):
	if event == 11000 and object_name == "loc_6_2":
		api_game.activate_game("loc_6_2",0)
		quest_game.set_state_of("four_object", 2)
		quest_game.show_object("fish","quest_anim",0.5,0,0)
	elif event == 11004 and object_name == "loc_6_2":
		api_game.fade_off(1,"")
		api_game.set_goal("goal_6_5")


def on_stop_anim(object_name, anim_name, p_object, i_track):
	if object_name == "vertel":
		api_game.game_win()
