local inv = {} local sc = nrequire("sh_skillcommon.lua") --the gui elements local elements = {} local set_xp_of = function(name,ammt) local lvl,frac = sc.levelfunc(ammt) elements[name].label:SetText(string.format("%s : %d (%2.5f%%)",name,lvl,frac)) elements[name].bar:SetFraction(frac) end inv.DrawOnDPanel = function(self,panel) local sheet = vgui.Create( "DColumnSheet", panel ) sheet:Dock( FILL ) for k,v in pairs(sc.SkillList()) do local spanel = vgui.Create("DPanel", sheet) spanel:Dock(FILL) local layout = vgui.Create("DListLayout", spanel) layout:MakeDroppable("skill_layout") for i,j in pairs(v) do local ipanel = vgui.Create("DListLayout",layout) local label = vgui.Create("DLabel",ipanel) label:Dock(TOP) label:SetDark(true) label:SetWrap(true) local bar = vgui.Create("DProgress",ipanel) bar:Dock(TOP) elements[j] = { ["label"] = label, ["bar" ] = bar, } set_xp_of(j,self.skills[j] or 0) ipanel:Add(label) ipanel:Add(bar) ipanel:InvalidateLayout() ipanel:SizeToChildren(true,true) layout:Add(ipanel) end layout:Dock(FILL) sheet:AddSheet(k, spanel, sc.IconFor(k)) end local prox = {} prox.Put = function(s,position,item) set_xp_of(position[1],self.skills[position[1]] or item.ammt)--Observer might be called before our put() end prox.Remove = function(s,position) set_xp_of(position[1],self.skills[position[1]] or itm.ammt) end return prox end return inv