From 13027fc5e4ed971e78f66753a528c3b666d54b90 Mon Sep 17 00:00:00 2001 From: gnomerd Date: Thu, 21 Nov 2019 11:54:20 +0100 Subject: [PATCH] Character screen UI stuff --- .../engine/derma/menus/menu_character.lua | 64 +------------------ 1 file changed, 3 insertions(+), 61 deletions(-) diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 9b01544..53a96d2 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -508,67 +508,9 @@ function menu.open( dt ) info:SetPos( p.w/2 - info.w/2, p.h/2 - info.h/2 ) end - - local count = 0 - for k, v in pairs( Quantum.Client.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 + ----------------------------------------------------- + menu.charScroll.add( Quantum.Client.Chars, clist ) -- add the panels + ----------------------------------------------------- if( selectedChar && p.mdl ~= nil ) then p.mdl:SetModel( selectedChar.char.model ) -- set the char model