master
gnomerd 5 years ago
parent ea42c992fd
commit b36cdcb79d
  1. 71
      gamemode/engine/derma/menus/menu_character.lua

@ -321,6 +321,77 @@ local pages = {
return p, c return p, c
end end
} }
menu.charScroll = {}
menu.charScroll.del = function( clist )
for k, v in pairs( clist.panels ) do
v:Remove()
end
end
menu.charScroll.add = function( chars, clist )
local count = 0
local cpanels = {}
for k, v in pairs( chars ) do
count = count + 1
cpanels[count] = vgui.Create( "DButton", clist )
cpanels[count].index = count
cpanels[count].char = v -- give the panel it's character
if( !selectedChar ) then selectedChar = cpanels[1] end -- select the first one
cpanels[count]:SetText( "" )
cpanels[count]:SetSize( clist.w - padding, 100 * resScale )
cpanels[count].w, cpanels[count].h = cpanels[count]:GetSize()
cpanels[count]:SetPos( padding/2, (padding)*count + (cpanels[count].h * (count-1)) )
cpanels[count].Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, w, h )
if( self == selectedChar ) then
surface.SetDrawColor( 252, 186, 3, 100 )
surface.DrawOutlinedRect( 0, 0, w, h )
end
end
cpanels[count].DoClick = function( self ) -- if you press the char, then select it
selectedChar = self
surface.PlaySound( "UI/buttonclick.wav" )
p.mdl:SetModel( self.char.model || errorMdl )
end
local txt = vgui.Create( "DLabel", cpanels[count] )
txt:SetText( v.name || "[ERROR] NAME=nil" )
txt:SetFont( "q_charNameText" )
txt:SetTextColor( Color( 200, 200, 200, 220 ) )
txt:SizeToContents()
local txtW, txtH = txt:GetSize()
txt:SetPos( padding, cpanels[count].h/4 - txtH/2 )
local txtX, txtY = txt:GetPos()
local lvlTxt
if( v.job.level >= 0 ) then
lvlTxt = "Level " .. v.job.level .. " "
else
lvlTxt = ""
end
local lvl = vgui.Create( "DLabel", cpanels[count] )
lvl:SetText( lvlTxt .. v.job.title )
lvl:SetFont( "q_text2" )
lvl:SetTextColor( Color( 180, 180, 180, 225 ) )
lvl:SizeToContents()
local lvlW, lvlH = lvl:GetSize()
lvl:SetPos( txtX, txtY + lvlH )
local lvlX, lvlY = lvl:GetPos()
local class = vgui.Create( "DLabel", cpanels[count] )
class:SetText( v.class )
class:SetFont( "q_text2" )
class:SetTextColor( Color( 252, 186, 3, 180 ) )
class:SizeToContents()
local classW, classH = class:GetSize()
class:SetPos( txtX, lvlY + classH )
end
clist.panels = cpanels
return clist.panels
end
function menu.open( dt ) function menu.open( dt )
Quantum.Client.IsInMenu = true -- hide the hud Quantum.Client.IsInMenu = true -- hide the hud

Loading…
Cancel
Save