
.namespace s02_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
	--On définit le nom du tableau
end

function OnEnter()
	if SampleLevel.IsEqual("s02_firstenter",true) then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_200",s02_SearchSite,nil)
		-- @ObjectManager.LaunchNewResearch("s02",1)
		SampleLevel.Set("s02_firstenter",false)
	end	
	--	PlaySoundEffect("gp_goutte",nil,30,nil,false)
end


function OnSequenceEnd(keyword)
	if  UserData.IsEqual("displayTutorial", true) then
		if keyword == "GP_200" then
		NewTutorialManager.OpenPopupTuto("TU_04",nil,157,254,"waitforaction")
		popups_tuto.SetFrame(0)
		end
	end
	if  UserData.IsEqual("displayTutorial", true) then
		if keyword == "GP_202" then
		NewTutorialManager.OpenPopupTuto("TU_06",nil,172,516,"waitforanyclic")
		popups_tuto.SetFrame(0)
		end
	end

end

function UpdateAll()
	
end

function OnPickObject(objname)
	if objname == "obj_lecteur_mp3" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_203",nil,nil)
	end
	if NewTutorialManager.g_message == "TU_04" then
		NewTutorialManager.ClosePopupTuto()
	end
	
end

function OnSearchEnd(typesearch)
	InventoryManager.AddInInventory("InventoryClefGrenier","msg_ig_inventaire")	
	InventoryClefGrenier.Equipped = true

end
function OnPopupLeave(objname)
	if objname == "InventoryClefGrenier" then
		PlaySoundEffect("gmp_atticnoise")
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_202",s02_SearchSite,nil)
	end
end


function CondSpecificToFinish()

end

function OnPopupTutoLeave(message)
OPLog.Log("test"..message)
	if  UserData.IsEqual("displayTutorial", true) then
		if message == "TU_04" then			
		GameVariables.Set("montreglobalcounter",150)
			NewTutorialManager.OpenPopupTuto("TU_05",nil,159,16,"waitforaction")
			popups_tuto.SetFrame(1)
		end
	end
	if  UserData.IsEqual("displayTutorial", true) then
		if message == "TU_06" then
			NewTutorialManager.OpenPopupTuto("TU_07",nil,178,137,"waitforaction")
			popups_tuto.SetFrame(1)
		end
	end
end