
.namespace s07_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
	--On définit le nom du tableau
		if  SampleLevel.IsEqual("s07_search_3","unstarted") then 
		liste_07_03.Enabled = true
		Pince_hotspot.Enabled = true
		bureau_area.Enabled = true
		end
		
end

function OnEnter()
	
	if SampleLevel.IsEqual("s07_firstenter",true) then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_700",nil,nil)
		SampleLevel.Set("s07_firstenter",false)
	end	
	if SampleLevel.IsEqual("s07_search_3","finished") and SampleLevel.IsEqual("s07_c01_search_6","finished") then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_709",nil,nil)
		
	end
	if SampleLevel.IsEqual("s07_c01_search_6","finished") then
	bureau_area.Enabled =false
	end
	if SampleLevel.IsEqual("s07_pince",true) then
	Cursor.ChangeCursor(10)
	-- CURSOR_GENERIQUE = 10
	Pince_hotspot.Enabled= false
	end
end


function UpdateAll()
	
end

function OnPickObject(objname)
	if objname == "obj_tabouret" then
	SampleLevel.Set("Page_3",true)
	PopupManager.OpenPopup("msg_ig_livre",nil,"Livre")
	end
end

function OnSearchEnd(typesearch)
	if typesearch == 3 then
	InventoryParchemin.Equipped = true
		InventoryManager.AddInInventory("InventoryParchemin","msg_ig_inventaire")	
		SampleLevel.Set("Page_3",true)
		UserData.Set("s06_discovered",false)
		UserData.Set("s08_discovered",true)
		LeftLocations.UpdateVignettes()
	end
end

function OnPopupLeave(objname)
	if objname == "InventoryParchemin" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_704",nil,nil)
		PlaySoundEffect("gmp_storm")
	end

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

function CondSpecificToFinish()

end

function OnDocumentUse(docname)
	if docname == "InventoryPince" then
		Pince_hotspot.Enabled = false
		InventoryManager.RemoveFromInventory("InventoryPince")
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_706",nil,nil)
		SampleLevel.Set("s07_pince",true)
		-- CURSOR_GENERIQUE = 10
		Cursor.ChangeCursor(10)
		
		return true
	end
	return false
end