diff options
Diffstat (limited to 'gamemode/client/cl_inventory.lua')
| -rw-r--r-- | gamemode/client/cl_inventory.lua | 110 |
1 files changed, 97 insertions, 13 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 762baae..a032a13 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -242,21 +242,45 @@ function PANEL:Init() i = 0 for k,v in SortedPairs(Resources) do - print(k) - print(v) - if (v == 0) then continue end local slot = vgui.Create("DButton", dpnl) slot:SetSize(dPanelWidth/5, 100) - slot:SetText(v) + slot:SetText("") + + slot.Paint = function() + + draw.RoundedBox( 0, 1, 1, slot:GetWide()-2, slot:GetTall()-2, Color( 250, 250, 250, 250 ) ) + draw.RoundedBox( 8, 4, 4, slot:GetWide()-8, slot:GetTall()-8, Color( 0, 0, 0, 250 ) ) + + + surface.SetFont( "ButtonText" ) + surface.SetTextColor( 255,255,255 ) + surface.SetTextPos( (slot:GetWide()/2) - ( surface.GetTextSize("x"..v)/2 ), (slot:GetTall()/2) + select( 2, surface.GetTextSize( "x"..v ) ) - 5 ) + surface.DrawText( "x"..v ) + + end + + local img = vgui.Create("DImage", slot) + img:SetPos(0, 0) + img:SetSize(slot:GetWide(), slot:GetTall()) + + if(GMS.Resources[k] == nil) then --This resource is not registered! + img:SetImage("vgui/avatar_default") + print("Resource:" .. k .. " not registed! This might be a bug!") + continue + elseif(GMS.Resources[k].Icon == nil) then + img:SetImage("vgui/avatar_default") + print("Resource:" .. k .. " does not have an .Icon field! This might be a bug!") + continue + else + img:SetImage(GMS.Resources[k].Icon) + slot:SetTooltip(k.."\n"..GMS.Resources[k].Description) + end slot.DoClick = function() - local menu = vgui.Create("DMenu") - --print("makeing menu for " .. k) - PrintTable(GMS.Resources[k]) createMenuFor(menu,GMS.Resources[k].Actions) menu:Open() @@ -264,12 +288,12 @@ function PANEL:Init() if (i % 5 != 0 ) then - slot:SetPos(row*dPanelWidth/5, (col-1)*100) + slot:SetPos(row*dPanelWidth/5, (col-1)*100 + 25) row=row+1 else row=0 col=col+1 - slot:SetPos(row*dPanelWidth/5, (col-1)*100) + slot:SetPos(row*dPanelWidth/5, (col-1)*100 + 25) row=row+1 end @@ -279,8 +303,19 @@ function PANEL:Init() end + + function PANEL:Paint() + resAmount = 0 + for k,v in pairs(Resources) do + resAmount = resAmount+v + end + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) + draw.RoundedBox(0,0,0,self:GetWide(),25,Color(0,0,0,250)) + + draw.SimpleText( "Total: " .. resAmount .. "/" .. 25 + ( GetSkill( "Survival" ) * 5 ), "ButtonText", 0, 0, Color(255,255,255) ) + end vgui.Register( "Inventory", PANEL, "DPanel" ) @@ -294,6 +329,7 @@ function PANEL:Init() local dpnl = vgui.Create( "DScrollPanel", self ) dpnl:SetSize( dPanelWidth, dPanelHeight ) dpnl:SetPos( 0, 0 ) + dpnl:SetVerticalScrollbarEnabled(true) local col = 0 @@ -406,7 +442,7 @@ function PANEL:Init() end function PANEL:Paint() - + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) end vgui.Register( "Equipment", PANEL, "DPanel" ) @@ -417,10 +453,47 @@ local PANEL = {} function PANEL:Init() + local dpnl = vgui.Create( "DScrollPanel", self ) + + dpnl:SetSize( 540, 400 ) + dpnl:SetPos( 0, 0 ) + + + local layout = vgui.Create( "DListLayout", dpnl) + layout:SetSize(dpnl:GetWide(), dpnl:GetTall()) + local labelnum = 0 + for k,v in pairs(GMS_SpawnLists) do + local DCollapsible = vgui.Create( "DCollapsibleCategory" ) + DCollapsible:SetLabel(k) + DCollapsible:SetSize(dpnl:GetWide(),200) + DCollapsible:SetPadding(5) + --DCollapsible:SetPos(0,labelnum) + DCollapsible:SetExpanded( 0 ) + layout:Add(DCollapsible) + labelnum = labelnum + 20 + local propgrid = vgui.Create("DTileLayout", DCollapsible) + propgrid:SetBaseSize( 64 ) -- Tile size + propgrid:Dock( FILL ) + propgrid:MakeDroppable( "unique_name" ) -- Allows us to rearrange children + DCollapsible:SetContents(propgrid) + for i,j in pairs(v) do + local itm = vgui.Create("DModelPanel", propgrid) + itm:SetCamPos( Vector( 50,50,50 ) ) + itm:SetLookAt( Vector( 0, 0, 20 ) ) + itm:SetModel(j) + itm:SetSize( 64, 64 ) + itm.DoClick = function() + RunConsoleCommand( "gm_spawn", j, 0 ) + end + propgrid:Add(itm) + end + --layout:Add(combipanel) + end + end function PANEL:Paint() - + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) end vgui.Register( "Props", PANEL, "DPanel" ) @@ -430,11 +503,22 @@ vgui.Register( "Props", PANEL, "DPanel" ) local PANEL = {} function PANEL:Init() + + self.Tools = vgui.Create( "DPanelList", self ) + self.Tools:EnableVerticalScrollbar( true ) + self.Tools:SetSize(dPanelWidth/3, dPanelWidth) + self.Tools:SetSpacing( 5 ) + self.Tools:SetPadding( 5 ) + function self.Tools:Paint() + draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 75, 75, 75 ) ) + end + + PrintTable(spawnmenu.GetTools()) end function PANEL:Paint() - + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) end vgui.Register( "Tools", PANEL, "DPanel" ) @@ -449,7 +533,7 @@ function PANEL:Init() end function PANEL:Paint() - + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) end vgui.Register( "Admin", PANEL, "DPanel" ) |
