Debug inv tweaks
This commit is contained in:
parent
9d25f5751c
commit
838319327d
|
@ -225,7 +225,6 @@ if CLIENT then
|
||||||
table.insert( createlist[Class.Type], { ClassName = ClassName, Class = Class } )
|
table.insert( createlist[Class.Type], { ClassName = ClassName, Class = Class } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i, v in SortedPairs( createlist ) do
|
for i, v in SortedPairs( createlist ) do
|
||||||
local Collapse = itemlist:Add( "DCollapsibleCategory" )
|
local Collapse = itemlist:Add( "DCollapsibleCategory" )
|
||||||
Collapse:Dock( TOP )
|
Collapse:Dock( TOP )
|
||||||
|
@ -279,17 +278,60 @@ if CLIENT then
|
||||||
local active = GetConVar("benny_hud_tempactive"):GetString()
|
local active = GetConVar("benny_hud_tempactive"):GetString()
|
||||||
itemlist:Clear()
|
itemlist:Clear()
|
||||||
|
|
||||||
|
local maidlist = {}
|
||||||
|
local catesmade = {}
|
||||||
|
|
||||||
for i, v in pairs( ply:INV_ListFromBuckets() ) do
|
for i, v in pairs( ply:INV_ListFromBuckets() ) do
|
||||||
|
local class = inv[v].Class
|
||||||
|
local Class = WEAPONS[class]
|
||||||
|
|
||||||
|
if !catesmade[Class.Type] then
|
||||||
|
catesmade[Class.Type] = true
|
||||||
|
local cate = vgui.Create( "DButton" )
|
||||||
|
itemlist:AddItem( cate )
|
||||||
|
cate:SetSize( 1, ss(12) )
|
||||||
|
cate:Dock( TOP )
|
||||||
|
cate:DockMargin( 0, 0, 0, ss(2) )
|
||||||
|
|
||||||
|
cate.Text_Name = Class.Type
|
||||||
|
|
||||||
|
function cate:Paint( w, h )
|
||||||
|
surface.SetDrawColor( schemes[active]["bg"] )
|
||||||
|
surface.DrawRect( 0, 0, w, h )
|
||||||
|
surface.SetDrawColor( schemes[active]["fg"] )
|
||||||
|
surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) )
|
||||||
|
|
||||||
|
surface.SetTextColor( schemes[active]["fg"] )
|
||||||
|
surface.SetFont( "Benny_10" )
|
||||||
|
surface.SetTextPos( ss(2), ss(2) )
|
||||||
|
surface.DrawText( self.Text_Name )
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local button = vgui.Create( "DButton" )
|
local button = vgui.Create( "DButton" )
|
||||||
itemlist:AddItem( button )
|
itemlist:AddItem( button )
|
||||||
button:SetSize( 1, ss(30) )
|
button:SetSize( 1, ss(24) )
|
||||||
button:Dock( TOP )
|
button:Dock( TOP )
|
||||||
button:DockMargin( 0, 0, 0, ss(4) )
|
button:DockMargin( 0, 0, 0, ss(2) )
|
||||||
|
|
||||||
button.ID = v
|
button.ID = v
|
||||||
local Class = WEAPONS[inv[v].Class]
|
|
||||||
|
local mag = false
|
||||||
|
if class:Left( 4 ) == "mag_" then
|
||||||
|
mag = true
|
||||||
|
button:SetTall( ss(11) )
|
||||||
|
end
|
||||||
|
|
||||||
|
if !maidlist[class] then
|
||||||
|
maidlist[class] = table.Flip( ply:INV_Find( class ) )
|
||||||
|
end
|
||||||
|
local ml = maidlist[class]
|
||||||
|
|
||||||
button.Text_Name = Class.Name
|
button.Text_Name = Class.Name
|
||||||
button.Text_Desc = Class.Description
|
button.Text_Desc = Class.Description
|
||||||
|
button.Text_ID = "[" .. ml[v] .. "] " .. button.ID
|
||||||
|
|
||||||
-- PROTO: These functions don't need to be remade over and over like this.
|
-- PROTO: These functions don't need to be remade over and over like this.
|
||||||
function button:DoClick()
|
function button:DoClick()
|
||||||
|
@ -351,18 +393,20 @@ if CLIENT then
|
||||||
|
|
||||||
surface.SetTextColor( schemes[active]["bg"] )
|
surface.SetTextColor( schemes[active]["bg"] )
|
||||||
|
|
||||||
surface.SetFont( "Benny_16" )
|
surface.SetFont( !mag and "Benny_16" or "Benny_10" )
|
||||||
surface.SetTextPos( ss(4), ss(4) )
|
surface.SetTextPos( ss(2), ss(2) )
|
||||||
surface.DrawText( self.Text_Name )
|
surface.DrawText( self.Text_Name )
|
||||||
|
|
||||||
surface.SetFont( "Benny_12" )
|
if !mag then
|
||||||
surface.SetTextPos( ss(4), ss(4 + 12) )
|
surface.SetFont( "Benny_12" )
|
||||||
surface.DrawText( self.Text_Desc )
|
surface.SetTextPos( ss(2), ss(2 + 11) )
|
||||||
|
surface.DrawText( self.Text_Desc )
|
||||||
|
end
|
||||||
|
|
||||||
surface.SetFont( "Benny_12" )
|
surface.SetFont( "Benny_10" )
|
||||||
local tx = surface.GetTextSize( self.ID )
|
local tx = surface.GetTextSize( self.Text_ID )
|
||||||
surface.SetTextPos( w - ss(4) - tx, ss(4) )
|
surface.SetTextPos( w - ss(2) - tx, ss(2) )
|
||||||
surface.DrawText( self.ID )
|
surface.DrawText( self.Text_ID )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -370,13 +414,14 @@ if CLIENT then
|
||||||
concommand.Add("benny_debug_inv", function()
|
concommand.Add("benny_debug_inv", function()
|
||||||
if IsValid( base ) then base:Remove() end
|
if IsValid( base ) then base:Remove() end
|
||||||
base = vgui.Create("DFrame")
|
base = vgui.Create("DFrame")
|
||||||
base:SetSize( ss(400), ss(240) )
|
base:SetSize( ss(400), ss(400) )
|
||||||
base:MakePopup()
|
base:MakePopup()
|
||||||
base:SetKeyboardInputEnabled( false )
|
base:SetKeyboardInputEnabled( false )
|
||||||
base:Center()
|
base:Center()
|
||||||
|
local active = GetConVar("benny_hud_tempactive"):GetString()
|
||||||
|
|
||||||
function base:Paint( w, h )
|
function base:Paint( w, h )
|
||||||
surface.SetDrawColor( schemes["benny"]["bg"] )
|
surface.SetDrawColor( schemes[active]["bg"] )
|
||||||
surface.DrawRect( 0, 0, w, h )
|
surface.DrawRect( 0, 0, w, h )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue