From d9a4366d5556ba423b6c618f83182e6e68aeb0f5 Mon Sep 17 00:00:00 2001 From: AlmTech Date: Wed, 16 Oct 2019 22:06:59 +0200 Subject: [PATCH] Progress on more stuff --- gamemode/engine/derma/lib/cl_menu_theme.lua | 7 ++--- .../engine/derma/menus/menu_character.lua | 30 +++++++++++++++---- gamemode/settings/sh_settings.lua | 15 ++++++++-- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/gamemode/engine/derma/lib/cl_menu_theme.lua b/gamemode/engine/derma/lib/cl_menu_theme.lua index 37a86c0..7dd7789 100644 --- a/gamemode/engine/derma/lib/cl_menu_theme.lua +++ b/gamemode/engine/derma/lib/cl_menu_theme.lua @@ -62,14 +62,13 @@ function theme.sharpbutton( b, inClr ) local w, h = b:GetSize() inClr = inClr || Color( 235, 64, 52, 255 ) - if( b:IsHovered() ) then + if( !b:IsHovered() ) then surface.SetDrawColor( 205, 205, 205, 255 ) else - surface.SetDrawColor( 50, 50, 50, 255 ) + surface.SetDrawColor( 120, 120, 120, 255 ) end - - surface.DrawRect( 0, 0, w, h ) + surface.DrawOutlinedRect( 0, 0, w, h ) surface.SetDrawColor( inClr ) surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s ) diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 408ac85..74acaeb 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -16,6 +16,13 @@ local sw, sh = ScrW(), ScrH() local padding = 10 * resScale local padding_s = 4 * resScale +local function getClassModels( class ) + if( Quantum.Classes[class] ) then + return Quantum.Classes[class].Models + else + Quantum.Error( "Unable to get models from class[" .. tostring( class ) .. "]." ) + end +end local function getMaxModel( tbl, index ) return tbl[math.Clamp( index, 1, #tbl )] end @@ -72,7 +79,7 @@ local pages = { local inputs = { gender = "Male", - class = "Citizen", + class = "Worker", modelIndex = 1, name = "" } @@ -92,7 +99,7 @@ local pages = { -- input panel contens -- local rheader = vgui.Create( "DLabel", ip ) - rheader:SetText("Select Model") + rheader:SetText("Select Class") rheader:SetFont( "q_button2" ) rheader:SetTextColor( Color( 255, 255, 255, 255 ) ) rheader:SizeToContents() @@ -105,7 +112,7 @@ local pages = { gbuttons.female = vgui.Create( "DButton", ip ) local selectedGenderButton = gbuttons.female -- select itself gbuttons.female:SetText( "Female" ) - gbuttons.female:SetTextColor( Color( 0, 0, 0, 255 ) ) + gbuttons.female:SetTextColor( Color( 255, 255, 255, 255 ) ) gbuttons.female:SetFont( "q_button2" ) gbuttons.female.Paint = function( self, w, h ) theme.sharpbutton( self ) @@ -163,11 +170,22 @@ local pages = { for n, class in pairs( Quantum.Classes ) do classCount = classCount + 1 -- keep count classButtons[classCount] = vgui.Create( "DButton", cscroll ) + classButtons[classCount].class = class classButtons[classCount]:SetText( class.Name ) classButtons[classCount]:SetFont( "q_button2" ) classButtons[classCount]:SetTextColor( Color( 255, 255, 255, 255 ) ) classButtons[classCount]:SizeToContents() - classButtons[classCount].Paint = function( self ) theme.sharpbutton( self, Color( 20, 20, 120, 100 ) ) end + classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize() + classButtons[classCount]:SetSize( ip.w - padding*2, classButtons[classCount].h ) + classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize() + classButtons[classCount]:SetPos( cscroll.w/2 - classButtons[classCount].w/2, (classCount-1) * ( padding + classButtons[classCount].h ) ) + classButtons[classCount].Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 0 ) ) end + classButtons[classCount].DoClick = function( self ) + if( inputs.class ~= class ) then + inputs.class = class + surface.PlaySound( "UI/buttonclick.wav" ) + end + end end --- set the model @@ -180,8 +198,8 @@ local pages = { mdl:SetLookAt( eyepos ) mdl.Think = function( self ) - if( self:GetModel() ~= getMaxModel( Quantum.Models.Player[inputs.class][inputs.gender], inputs.modelIndex ) ) then - self:SetModel( getMaxModel( Quantum.Models.Player[inputs.class][inputs.gender], inputs.modelIndex ) ) + if( self:GetModel() ~= getMaxModel( getClassModels( inputs.class )[inputs.gender], inputs.modelIndex ) ) then + self:SetModel( getMaxModel( getClassModels( inputs.class )[inputs.gender], inputs.modelIndex ) ) end end diff --git a/gamemode/settings/sh_settings.lua b/gamemode/settings/sh_settings.lua index ae1b63f..cf47709 100644 --- a/gamemode/settings/sh_settings.lua +++ b/gamemode/settings/sh_settings.lua @@ -34,8 +34,19 @@ Quantum.Models = { } Quantum.Classes = { - Citizen = { - Name = "Downtown Citizen", + Commoner = { -- id + Name = "Commoner", + Desc = "Someone who lives in a city.", Models = Quantum.Models.Player.Citizen + }, + Nobleman = { + Name = "Nobleman", + Desc = "A nobleman is someone who originates from a family of wealth and power and tend to look down upon those who are not 'fit' in their eyes. They often expects everyone to do their bidding without question.", + Models = Quantum.Models.Player.Citizen -- change this to better models + }, + Worker = { + Name = "Worker", + Desc = "A worker is someone who is in the working-class and come from a poor family but has learned the secret of life; how to work hard and earn what you want.", + Models = Quantum.Models.Player.Citizen -- change this to better models } } \ No newline at end of file