
.namespace AreaInfo

function OnEnable()
	self.FlagsFunctions = FlagsFunctions
end


function OnWbpMouseLUp(x,y)
	if self.CanClickOn() then
		AssertPopup(self.SoundToPlay ~= "" , "SoundToPlay pas défini sur "..self.Name)
		--if self.IsASequence then
			SequencePlayer.Enabled = true
			SequencePlayer.PlaySequence(self.SoundToPlay)
		--else
		--	DisplaySimpleText(self.SoundToPlay,DEFAULTDISPLAYTIME)
		--end
		--[[if self.SoundToPlay~="" then
			PlaySoundEffect(self.SoundToPlay, nil, nil, GetCurrentManager())
		else
			PlaySoundEffect(self.Name, nil, nil, GetCurrentManager())
		end
		self.isPlayed=true
		if self.Single then
			self.Resolve()
			if IsEqualVariables("CurrentGamePhase", "SearchSite") or IsEqualVariables("CurrentGamePhase", "Closeup") then
				GetCurrentManager().UpdateAll()
			end
		end	]]
		
		return true
	end
end

function SetCursor()
	if self.CanClickOn() then
		Cursor.ChangeCursor(CURSOR_AREA_INFO)
		return true
	end
	
	return false
end



function CanClickOn()
	local res = IsVisible(self)

	if self.PrivateCanClickOn ~= nil  then
		res = res and self.PrivateCanClickOn()
	end
	
	res = res and IsEqualVariables("CurrentGamePhase","SearchSite")
	
	return res
end

