local CPanel = require "lib.simple_ui.level.cpanel"

local build

local layout = {}
function layout:update(dt)
    if self.characterPanel then self.characterPanel:update(dt) end

    local cid = Tree.level.selector:selected()
    if cid then
        self.characterPanel = CPanel(cid)
        self.characterPanel:show()
        self.characterPanel:update(dt)
    elseif Tree.level.selector:deselected() then
        self.characterPanel:hide()
    end
end

function layout:draw()
    if self.characterPanel then self.characterPanel:draw() end
end

return layout
