-- collect_ho_panel

collect_ho_panel.element = nil
collect_ho_panel.level_switch = nil


log_message("compiling collect_ho_panel.lua")

local panel = collect_ho_panel

----------------------------------------------------------------------------------------------------
function panel:show(elem, text, level_switch)

	local pos0 = collect_ho_panel.parent:getElement("object_place"):getPos(true)
	
	elem:setVisible(true)
	elem:setAlpha(1)
	elem:setActive(false)
	
	play_clip(elem:getCharacter(), {frame_begin = 1, frame_end = 1})
	panel:set_visible(true)
	panel:set_active(true)
	panel:play_clip("coll_ho_window", {frame_begin = 0, label_end = "stop"})
	
	elem:setPos(Vec2(0,0))
	elem:setParent(panel:get_parent():getElement("object_place"):getCharacter())
	collect_ho_panel.element = elem
	
	if text ~= nil then
		collect_ho_panel:get_element("text_area"):setText(text)
	else
		collect_ho_panel:get_element("text_area"):setText("")
	end
	
	collect_ho_panel.level_switch = level_switch
	
	--[[
	if level_switch ~= nil then
		level_mgr:switch_to_level(level_switch)
	end
	--]]
end

----------------------------------------------------------------------------------------------------
function panel:hide()
	
	--main_panel:set_mode("inv")
	
	if collect_ho_panel.level_switch ~= nil then
		level_mgr:switch_to_level(collect_ho_panel.level_switch)
	end
	
	inventory_:add_elem(collect_ho_panel.element)
	panel:set_visible(false)
	panel:set_active(false)
end

----------------------------------------------------------------------------------------------------
function collect_ho_panel_UPDATE()
	return 0
end

----------------------------------------------------------------------------------------------------
function collect_ho_panel_INIT()
	panel:set_element_eh("click", function() collect_ho_panel:hide() end)
end