Major UI bug fixes

master v0.2-alpha
AlmTech Software 5 years ago
parent d15cc3163c
commit 55e9f0bacb
  1. 14
      gamemode/engine/derma/lib/cl_menu_theme.lua
  2. 55
      gamemode/engine/derma/menus/menu_character.lua

@ -92,6 +92,20 @@ function theme.sharpbutton( b, inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s ) surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
end end
function theme.sharpblurrbutton( b, inClr )
local w, h = b:GetSize()
inClr = inClr || Color( 80, 80, 80, 150 )
theme.renderblur( b, 4, 8 )
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 255 )
else
surface.SetDrawColor( 120, 120, 120, 255 )
end
surface.DrawOutlinedRect( 0, 0, w, h )
end
function theme.skipbutton( b, inClr ) function theme.skipbutton( b, inClr )
local w, h = b:GetSize() local w, h = b:GetSize()
inClr = inClr || Color( 0, 0, 0, 0 ) inClr = inClr || Color( 0, 0, 0, 0 )

@ -305,11 +305,11 @@ local pages = {
local cr = vgui.Create( "DButton", p ) local cr = vgui.Create( "DButton", p )
cr:SetText( "Create Character" ) cr:SetText( "Create Character" )
cr:SetFont( "q_button2" ) cr:SetFont( "q_button2" )
cr:SetTextColor( Color( 0, 0, 0, 255 ) ) cr:SetTextColor( Color( 255, 255, 255, 255 ) )
cr:SizeToContents() cr:SizeToContents()
cr.w, cr.h = cr:GetSize() cr.w, cr.h = cr:GetSize()
cr:SetPos( name.x + name.w/2 - cr.w/2, name.y + cr.h + padding ) cr:SetPos( name.x + name.w/2 - cr.w/2, name.y + cr.h + padding )
cr.Paint = function( self ) theme.sharpbutton( self ) end cr.Paint = function( self ) theme.sharpblurrbutton( self ) end
cr.DoClick = function( self ) cr.DoClick = function( self )
-- create char -- create char
@ -366,7 +366,6 @@ end
menu.charScroll.add = function( chars, clist, p ) menu.charScroll.add = function( chars, clist, p )
local count = 0 local count = 0
local cpanels = {} local cpanels = {}
PrintTable(chars)
for k, v in pairs( chars ) do for k, v in pairs( chars ) do
count = count + 1 count = count + 1
cpanels[count] = vgui.Create( "DButton", clist ) cpanels[count] = vgui.Create( "DButton", clist )
@ -380,12 +379,16 @@ menu.charScroll.add = function( chars, clist, p )
cpanels[count].w, cpanels[count].h = cpanels[count]:GetSize() cpanels[count].w, cpanels[count].h = cpanels[count]:GetSize()
cpanels[count]:SetPos( padding/2, (padding)*count + (cpanels[count].h * (count-1)) ) cpanels[count]:SetPos( padding/2, (padding)*count + (cpanels[count].h * (count-1)) )
cpanels[count].Paint = function( self, w, h ) cpanels[count].Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 0 ) surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
if( self == Quantum.Client.selectedChar ) then if( self == Quantum.Client.selectedChar ) then
surface.SetDrawColor( 252, 186, 3, 100 ) surface.SetDrawColor( 252, 186, 3, 100 )
surface.DrawOutlinedRect( 0, 0, w, h ) else
surface.SetDrawColor( 255, 255, 255, 100 )
end end
surface.DrawOutlinedRect( 0, 0, w, h )
end end
cpanels[count].DoClick = function( self ) -- if you press the char, then select it cpanels[count].DoClick = function( self ) -- if you press the char, then select it
Quantum.Client.selectedChar = self Quantum.Client.selectedChar = self
@ -558,26 +561,34 @@ function menu.open( dt )
p.mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) ) p.mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) )
p.mdl:SetLookAt( eyepos ) p.mdl:SetLookAt( eyepos )
end end
-- create char button
if( table.Count( dt.cont ) < Quantum.CharacterLimit ) then local cr = vgui.Create( "DButton", p )
-- create char button cr:SetText("Create New Character")
local cr = vgui.Create( "DButton", p ) cr:SetFont( "q_button" )
cr:SetText("Create New Character") cr:SetTextColor( Color( 0, 0, 0, 255 ) )
cr:SetFont( "q_button" ) cr:SizeToContents()
cr:SetTextColor( Color( 0, 0, 0, 255 ) ) cr.w, cr.h = cr:GetSize()
cr:SizeToContents() cr:SetPos( Quantum.Client.CharMenuList.x + ( Quantum.Client.CharMenuList.w/2 - cr.w/2 ), Quantum.Client.CharMenuList.y + ( ( Quantum.Client.CharMenuList.h - cr.h ) - padding*2 ) )
cr.w, cr.h = cr:GetSize() cr.Paint = function( self )
cr:SetPos( Quantum.Client.CharMenuList.x + ( Quantum.Client.CharMenuList.w/2 - cr.w/2 ), Quantum.Client.CharMenuList.y + ( ( Quantum.Client.CharMenuList.h - cr.h ) - padding*2 ) ) theme.sharpbutton( self )
cr.Paint = function( self ) end
theme.sharpbutton( self ) cr.Think = function( self )
end if( table.Count(Quantum.Client.Chars) >= Quantum.CharacterLimit ) then
cr.DoClick = function() self:SetVisible( false )
surface.PlaySound( "UI/buttonclick.wav" ) else
p:SetVisible( false ) self:SetVisible( true )
local crPage = pages.charCreate( f )
end end
end
cr.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
p:SetVisible( false )
local crPage = pages.charCreate( f )
end
cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end if( table.Count(Quantum.Client.Chars) >= Quantum.CharacterLimit ) then
cr:SetVisible( false ) -- hide if max chars are set
end end
-- Delete char button -- Delete char button

Loading…
Cancel
Save