
.namespace s01_closeup_hotspot

function OnActivate()
	
	--OPLog.Log("onactivate "..self.Name)
	--Closeup 1 : Entrée dans la chambre
	if self.Name == "c01_liste_s02_1_hotspot" then
		NewTutorialManager.ClosePopupTuto()
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("GP_110",s01_c01,nil)
		porte_chambre_02_hotspot.Flags_Visible = true
		c01_liste_s02_1_hotspot.Flags_Visible = false
		c01_liste_s02_1.Flags_Visible = false
		PlaySoundEffect("gmp_grabpaper")
		-- SampleLevel.Set("s02_liste",true)
		 SampleLevel.Set("s02_search_1","started")
	end
	if self.Name == "porte_chambre_02_hotspot" then
		PlaySoundEffect("gmp_opendoor")
		NavigationManager.SwitchTo(nil,"s02_SearchSite")
		PlaySoundEffect("gmp_opendoor")
	end
	--Closeup 2 : Entrée dans la bibliotheque (mini jeu)
	if self.Name == "up1"  then
		cadena_1=cadena("up",cadena_1)
		OPLog.Log("cadena 1 "..cadena_1)
	end
	if self.Name == "down1"  then
		cadena_1=cadena("down",cadena_1)
		OPLog.Log("cadena 1 "..cadena_1)
	end
	if self.Name == "up2"  then
		cadena_2=cadena("up",cadena_2)
		OPLog.Log("cadena 2 "..cadena_2)
	end
	if self.Name == "down2"  then
		cadena_2=cadena("down",cadena_2)
		OPLog.Log("cadena 2 "..cadena_2)
	end
	if self.Name == "up3"  then
		cadena_3=cadena("up",cadena_3)
		OPLog.Log("cadena 3 "..cadena_3)
	end
	if self.Name == "down3"  then
		cadena_3=cadena("down",cadena_3)
		OPLog.Log("cadena 3 "..cadena_3)
	end
	cadena_1t.Text=tostring(cadena_1)
	cadena_2t.Text=tostring(cadena_2)
	cadena_3t.Text=tostring(cadena_3)
end

function OnEnable()
	AreaHotspot.OnEnable()
	--self.firstclick = true
	OPLog.Log("mon onenable "..self.Name)
	cadena_1 = 3
	cadena_2 = 6
	cadena_3 = 2
	cadena_1t.Text=tostring(cadena_1)
	cadena_2t.Text=tostring(cadena_2)
	cadena_3t.Text=tostring(cadena_3)
end

function cadena(direction,variable)
PlaySoundEffect("gmp_lockclick")

	if direction == "up" then
		if variable < 9 then
			return variable+1
		else
			return variable
		end
	elseif direction == "down" then
		if variable > 0 then
			return variable-1
		else
			return variable
		end
	end
end

function GetSpecificCursor()
	if self.Name == "porte_chambre_02_hotspot" then
		return 4,"s02"
	elseif self.Name == "c01_liste_s02_1_hotspot" then
		return 3
	else
		return CURSOR_AREA_HOTSPOT
	end
end

function PrivateCanClickOn()
	
	if IsEqualVariables("CurrentGamePhase","Tutorial") and NewTutorialManager.g_message == "TU_03" then
		 return true
	elseif  IsEqualVariables("CurrentGamePhase","Tutorial") then
		return false
	end
	return true
end