
.namespace s03_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
--	if s03_liste01.Enabled == true then
--	end
	if SampleLevel.IsEqual("s03_search_3","unstarted") then
		liste_s03_3.Enabled = true
		fissure_ouverte.Enabled = false
		tableau.Enabled = true
	end
	if SampleLevel.IsEqual("s03_search_1","unstarted") then
		liste_s03_1.Enabled = true
	end
	if SampleLevel.IsEqual("s03_tableau",false) then
		tableau.Enabled = false
	end
--Afficher ou non les listes ŕ récuperer
	if not SampleLevel.IsEqual("s03_search_3","unstarted") then 

		fissure_ouverte_hotspot.Enabled = true
	end
	if SampleLevel.IsEqual("s03_fissure_open",true) then 
		fissure_ouverte.Enabled = true
		--sprite liste true
	else
		fissure_ouverte_hotspot.Enabled = true
	end
	
	if SampleLevel.IsEqual("s03_search_1","started") or SampleLevel.IsEqual("s03_search_1","finished") then 
		--Ici code sprite liste false
	end
	
	
	
	
end

function OnEnter()

		
	if SampleLevel.IsEqual("s03_firstenter",true) then
		SampleLevel.Set("s03_firstenter",false)
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_300",nil,nil)
	end		
	if SampleLevel.IsEqual("s03_fissure_open",true) then
	fissure_ouverte_hotspot.Enabled = false
	end


end

function OnSequenceEnd(keyword)
	if  UserData.IsEqual("displayTutorial", true) then
		if keyword == "GP_311" then
		NewTutorialManager.OpenPopupTuto("TU_09",nil,206,484,"waitforanyclic")
		popups_tuto.SetFrame(1)
		end
	end
	if  UserData.IsEqual("displayTutorial", true) then
		if keyword == "GP_308" then
		popups_tuto.SetFrame(0)
		NewTutorialManager.OpenPopupTuto("TU_10",nil,181,412,"waitforanyclic")
		end
	end
end


function UpdateAll()
	
end

function OnPickObject(objname)
	
	if objname == "obj_cartepostale" then
		SampleLevel.Set("Page_0",true)
		PopupManager.OpenPopup("msg_ig_livre",nil,"Livre")
		LeftInterface_book.Flags_Visible=true
	end
	
	if objname == "obj_escabeau" and SampleLevel.IsEqual("s03_tableau",true) then
		tableau.Enabled = false
		tableau_anim.Play()
		SampleLevel.Set("s03_tableau",false)
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_302",nil,nil)
		PlaySoundEffect("gmp_painting")
	end
	if NewTutorialManager.g_message == "TU_09" then
		NewTutorialManager.ClosePopupTuto()
	end
end



function OnTakeList(typesearch)
	if typesearch == 3 then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_311",s03_SearchSite,nil)
	end
	
	if typesearch == 1 then

		InventoryManager.AddInInventory("InventoryCodeCadenas","msg_ig_inventaire")	
		InventoryCodeCadenas.Equipped = true
		--documents_parent.Enabled = true
		--indice.Enabled = true
		--plan_maison.Enabled = false
		-- SetVariables("CurrentGamePhase","Document")
		-- DocumentViewer.Image = "media/graph/documents/indice_"..DebugOptions.curlanguage..".png"
		-- documents_parent.Enabled = true
	end
end

function OnSearchEnd(typesearch)
	if typesearch == 3 then

		
		InventoryManager.AddInInventory("InventoryPiedBiche","msg_ig_inventaire")	
		InventoryPiedBiche.Equipped = true

	end
	if typesearch == 1 then
		SampleLevel.Set("Page_0",true)
		LeftInterface_book.Flags_Visible=true
		if InventoryPile.Equipped == true then
			InventoryManager.AddInInventory("InventoryLampeTorcheOn","msg_ig_inventaire")	
			InventoryLampeTorcheOn.Equipped = true
			InventoryManager.RemoveFromInventory("InventoryPile")
		else
			InventoryManager.AddInInventory("InventoryLampeTorcheOff","msg_ig_inventaire")	
			InventoryLampeTorcheOff.Equipped = true

		end
	end
end
function OnPopupLeave(objname)
	if objname == "InventoryPiedBiche" then
		fissure_ouverte_hotspot.Enabled = true
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_306",nil,nil)
	end
	if objname == "InventoryLampeTorcheOff" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_304",nil,nil)
	end
	if objname == "InventoryCodeCadenas" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_303",nil,nil)
	end
	
	if objname == "Livre" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_308",s03_SearchSite,nil)
	end
end



function OnDocumentLeave(docname)
	if docname == "InventoryCodeCadenas" then
		OPLog.Log("Test : OnDocumentLeave fonctionne")
	end
	
end


function CondSpecificToFinish()

end