
.namespace s10_c02

function OnEnable()
	Closeup.OnEnable("MiniGame")
	Reset()
	gamestart=true
	local lang = DebugOptions.curlanguage 
	parchemin_traduit.Image="media/graph/documents/bandelette_parchemin_"..lang..".png"
	if DebugOptions.DebugMode == true then
		InventoryManager.AddInInventory("InventoryParcheminTraduit")
	end	
end

function Reset()
	translaparch=0
	
end

function OnUpdate()
	-- OPLog.Log("valid "..valid)
	
	if translaparch==1 then
		if parchemin_traduit.Position_X > 700 then
			parchemin_traduit.Position_X = parchemin_traduit.Position_X - 5
		end
	end
	
	if translaparch==0 then
		if parchemin_traduit.Position_X < 1200 then
			parchemin_traduit.Position_X = parchemin_traduit.Position_X + 5
		end
	end
	
end

function Itsawin()
	s10_c02.Enabled = false
	NavigationManager.SwitchTo(nil,"TR_3")
	PlaySoundEffect("int_closeupwin")
	InventoryManager.RemoveFromInventory("InventoryParcheminTraduit")
end

function OnEnter()
	--SearchInterface.Enabled = false	
	SequencePlayer.Enabled = true
	SequencePlayer.PlaySequence("GP_1003",nil,nil)
	--interfaceclsp.Enabled = true
end

function OnSequenceEnd(dialogue)
	if dialogue == "GP_1003" then
		SequencePlayer.Enabled = true
		SequencePlayer.PlaySequence("AI_"..GetCurrentManager().Name,self,nil,"help")
		return true
	end
end

function OnDocumentUse(docname)
	if docname == "InventoryParcheminTraduit" then
		PlaySoundEffect("gmp_droppaper")
		parchemin_traduit.Enabled = true
		SpriteFader.Fade(parchemin_traduit,true,1,self)
		InventoryManager.RemoveFromInventory("InventoryParcheminTraduit")
		parchemin_traduit.Position_X = 700
		translaparch=-1
		return true
	end
	return false
end

function OnDocumentLeave(docname)
	-- SequencePlayer.Enabled = true
	-- SequencePlayer.PlaySequence("GP_1003",nil,nil)
end


function OnPickObject(objname)

end

function OnFaderEnd(ut, out)
	if ut.Name == "parchemin_traduit" then
		translaparch = 0
	end

end

function CondSpecificToFinish() 

end