
.namespace s12_SearchSite

function OnEnable()
	SearchSite.OnEnable()
	OPLog.Log("OnEnable unit "..self.Name)
	--On définit le nom du tableau
	if  SampleLevel.IsEqual("s12_search_3","unstarted") then 
		planche_area.Enabled = true
		planche.Enabled = true
		planche_open.Enabled = false
		liste_12_03.Enabled = true
		Sparkle001.Enabled = false
	end
	if  SampleLevel.IsEqual("s12_search_3","finished") and InventoryLevier.Equipped == false then 
		planche_area.Enabled = false
		planche.Enabled = false
		liste_12_01.Enabled = true
		planche_open.Enabled = true
	end
end

function OnEnter()
	if SampleLevel.IsEqual("s12_firstenter",true) then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1201",nil,nil)
		SampleLevel.Set("s12_firstenter",false)
	end	
	
end


function UpdateAll()
	
end

function OnPickObject(objname)
	if objname == "obj_boussole2" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1204",nil,nil)
	end
	if objname == "obj_calendrier" then
	SampleLevel.Set("Page_6",true)
	PopupManager.OpenPopup("msg_ig_livre",nil,"Livre")
	end
end
function OnSequenceEnd (keyword)
-- if keyword == "GP_1203" then
		-- InventoryManager.AddInInventory("InventoryLevier","msg_ig_inventaire")
		-- InventoryLevier.Equipped = true
  -- end
  if keyword == "GP_1205" then
	NavigationManager.SwitchTo(nil,"s13_SearchSite")
  end
end

function OnSearchEnd(typesearch)
		if typesearch == 3 then
		InventoryManager.AddInInventory("InventoryLevier","msg_ig_inventaire")
		InventoryLevier.Equipped = true
		Sparkle001.Enabled = true
		end
		if typesearch == 1 then
		SampleLevel.Set("Page_6",true)
		InventoryManager.AddInInventory("InventoryIndicePort","msg_ig_inventaire")
		InventoryIndicePort.Equipped = true
		end
end

function OnDocumentLeave(docname)
	if docname == "avis_de_recherche" then
	SequencePlayer.PlaySequence("GP_1207",nil,nil)
	end

end

function OnPopupLeave(objname)
	if objname == "InventoryLevier" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1203",nil,nil)
	end
	if objname == "InventoryIndicePort" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_1205",s12_SearchSite,nil)
	end
end

function CondSpecificToFinish()

end