Character creation UI stuff

master
AlmTech 5 years ago
parent 2705f3d343
commit f6e1f9b9c2
  1. 3
      gamemode/cl_init.lua
  2. 4
      gamemode/engine/derma/lib/cl_menu_theme.lua
  3. 114
      gamemode/engine/derma/menus/menu_character.lua
  4. 2
      gamemode/init.lua
  5. 0
      gamemode/settings/sh_settings.lua
  6. 2
      gamemode/shared.lua

@ -7,9 +7,10 @@
if CLIENT then if CLIENT then
include( "shared.lua" ) include( "shared.lua" )
--local gmfolder = GAMEMODE.FolderName || GM.FolderName
Quantum.Client = {} Quantum.Client = {}
Quantum.Client.ResolutionScale = ScrH() / 1080 Quantum.Client.ResolutionScale = ScrH() / 1080
Quantum.Client.ServerBannerPath = "gamemodes/" .. GAMEMODE.FolderName .. "/gamemode/content/materials/quantum/server_banner.png" Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png"
local function loadCoreFiles() local function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/" local fol = GM.FolderName .. "/gamemode/engine/core/"

@ -27,7 +27,7 @@ end
function theme.panel( p, color ) function theme.panel( p, color )
local w, h = p:GetSize() local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 100 ) local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 ) local bclr = Color( 50, 50, 50, 105 )
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
@ -36,7 +36,7 @@ end
function theme.blurpanel( p, color ) function theme.blurpanel( p, color )
local w, h = p:GetSize() local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 100 ) local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 ) local bclr = Color( 50, 50, 50, 105 )
renderBlur( p, 2, 7 ) renderBlur( p, 2, 7 )

@ -37,27 +37,95 @@ local pages = {
p:Remove() p:Remove()
end end
local banner = vgui.Create( "DImage", p )
banner:SetImage( Quantum.Client.ServerBannerPath )
banner:SizeToContents()
banner.w, banner.h = banner:GetSize()
banner:SetSize( (banner.w * resScale)/2.8, (banner.h * resScale)/2.8 )
banner.w, banner.h = banner:GetSize()
banner:SetPos( (p.w - banner.w) + padding*2, 0 )
local ip = vgui.Create( "DPanel", p ) -- input panel local ip = vgui.Create( "DPanel", p ) -- input panel
ip:SetSize( 400 * resScale, p.h * 0.9 ) ip:SetSize( 400 * resScale, p.h * 0.9 )
ip.w, ip.h = ip:GetSize() ip.w, ip.h = ip:GetSize()
ip:SetPos( padding*4, p.h/2 - ip.h/2 ) ip:SetPos( padding*4, p.h/2 - ip.h/2 )
ip.Paint = function( self ) theme.blurpanel(self) end ip.Paint = function( self ) theme.blurpanel(self) end
ip.x, ip.y = ip:GetPos()
local header = vgui.Create( "DLabel", p )
header:SetText( "Character Creation" )
header:SetFont( "q_header" )
header:SetTextColor( Color( 255, 255, 255, 255 ) )
header:SizeToContents()
header.w, header.h = header:GetSize()
header:SetPos( (ip.x + ip.w/2) - header.w/2, header.h/2 )
-- character model panel
local mdl = vgui.Create( "DModelPanel", p )
mdl:SetSize( 600 * resScale, 1000 * resScale )
mdl.w, mdl.h = mdl:GetSize()
mdl:SetPos( p.w/2 - mdl.w/2, p.h/2 - mdl.h/2 )
mdl:SetFOV( 55 )
function mdl:LayoutEntity( ent ) return end
local inputs = {} local inputs = {}
local name = vgui.Create( "DTextEntry", p )
name:SetText( "" )
name:SetFont( "q_button2" )
name:SetTextColor( Color( 255, 255, 255, 255 ) )
name:SetSize( 300 * resScale, 40 * resScale )
name.w, name.h = name:GetSize()
name:SetPos( p.w/2 - name.w/2, p.h*0.85 - name.h/2 )
name.Paint = function( self )
theme.blurpanel( self )
self:DrawTextEntryText( Color( 255, 255, 255, 255 ), Color( 150, 150, 150, 255 ), Color( 100, 100, 100, 255 ) )
end
--function name:OnChange() inputs.name = self:GetValue() end
-- input panel contens -- -- input panel contens --
local gbuttons = {}
local rheader = vgui.Create( "DLabel", ip )
rheader:SetText("Select Race")
rheader:SetFont( "q_button2" )
rheader:SetTextColor( Color( 255, 255, 255, 255 ) )
rheader:SizeToContents()
rheader.w, rheader.h = rheader:GetSize()
rheader:SetPos( ip.w/2 - rheader.w/2, rheader.h )
rheader.x, rheader.y = rheader:GetPos()
local gbuttons = {}
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:SetFont( "q_button2" )
gbuttons.female.Paint = function( self, w, h )
theme.sharpbutton( self )
if( selectedGenderButton == self ) then
surface.SetDrawColor( 100, 100, 100, 100 )
surface.DrawRect( 0, 0, w, h )
end
end
gbuttons.female:SizeToContents()
gbuttons.female.w, gbuttons.female.h = gbuttons.female:GetSize()
gbuttons.female:SetPos( padding, rheader.y + gbuttons.female.h + padding )
gbuttons.female.x, gbuttons.female.y = gbuttons.female:GetPos()
gbuttons.female.DoClick = function( self )
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
surface.PlaySound( "UI/buttonclick.wav" )
end
end
gbuttons.male = vgui.Create( "DButton", ip ) gbuttons.male = vgui.Create( "DButton", ip )
gbuttons.male:SetText( "M" ) gbuttons.male:SetText( "Male" )
gbuttons.male:SetTextColor( Color( 0, 0, 0, 255 ) ) gbuttons.male:SetTextColor( Color( 0, 0, 0, 255 ) )
gbuttons.male:SetFont( "q_button2" ) gbuttons.male:SetFont( "q_button2" )
gbuttons.male:SizeToContents() gbuttons.male:SetSize( gbuttons.female:GetSize() )
gbuttons.male.w, gbuttons.male.h = gbuttons.male:GetSize() gbuttons.male.w, gbuttons.male.h = gbuttons.male:GetSize()
gbuttons.male:SetPos( (ip.w/2 - padding) - gbuttons.male.w/2, ip.h/2 - gbuttons.male.h/2 ) gbuttons.male:SetPos( (ip.w/2 - padding) - gbuttons.male.w/2, ip.h/2 - gbuttons.male.h/2 )
gbuttons.male.x, gbuttons.male.y = gbuttons.male:GetPos()
local selectedGenderButton = gbuttons.male -- select itself
gbuttons.male.Paint = function( self, w, h ) gbuttons.male.Paint = function( self, w, h )
theme.sharpbutton( self ) theme.sharpbutton( self )
@ -67,29 +135,21 @@ local pages = {
end end
end end
gbuttons.male.DoClick = function( self ) gbuttons.male.DoClick = function( self )
selectedGenderButton = self if( selectedGenderButton ~= self ) then
surface.PlaySound( "UI/buttonclick.wav" ) selectedGenderButton = self
surface.PlaySound( "UI/buttonclick.wav" )
end
end end
gbuttons.female = vgui.Create( "DButton", ip )
gbuttons.female:SetText( "F" )
gbuttons.female:SetTextColor( Color( 0, 0, 0, 255 ) )
gbuttons.female:SetFont( "q_button2" )
gbuttons.female.Paint = function( self, w, h )
theme.sharpbutton( self )
if( selectedGenderButton == self ) then
surface.SetDrawColor( 100, 100, 100, 100 )
surface.DrawRect( 0, 0, w, h )
end
end
gbuttons.female:SetSize( gbuttons.male:GetSize() )
gbuttons.female.w, gbuttons.female.h = gbuttons.female:GetSize()
gbuttons.female:SetPos( (ip.w/2 + padding) + gbuttons.female.w/2, gbuttons.male.y )
gbuttons.female.DoClick = function( self )
selectedGenderButton = self
surface.PlaySound( "UI/buttonclick.wav" )
end
--- set the model
mdl:SetModel( Quantum.Models.Player.Male[1] ) -- set the char model
local minv, maxv = mdl.Entity:GetRenderBounds()
local eyepos = mdl.Entity:GetBonePosition( mdl.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 40, 0, -15 ) )
mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) )
mdl:SetLookAt( eyepos )
return p, c return p, c
end end
@ -126,7 +186,7 @@ function menu.open( dt )
clist:SetPos( (sw - clist.w) - padding*2, padding*6 ) clist:SetPos( (sw - clist.w) - padding*2, padding*6 )
clist.x, clist.y = clist:GetPos() clist.x, clist.y = clist:GetPos()
clist.Paint = function( self, w, h ) clist.Paint = function( self, w, h )
theme.blurpanel( self, Color( 0, 0, 0, 200 ) ) theme.blurpanel( self )
end end
local sbar = clist:GetVBar() local sbar = clist:GetVBar()

@ -7,7 +7,7 @@
if SERVER then if SERVER then
AddCSLuaFile( "engine/sh_debug.lua" ) AddCSLuaFile( "engine/sh_debug.lua" )
AddCSLuaFile( "settings/sh_models.lua" ) AddCSLuaFile( "settings/sh_settings.lua" )
AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "shared.lua" )

@ -14,4 +14,4 @@ Quantum = {}
include( "engine/sh_debug.lua" ) -- add the debug functions and stuff include( "engine/sh_debug.lua" ) -- add the debug functions and stuff
include( "settings/sh_models.lua" ) include( "settings/sh_settings.lua" )
Loading…
Cancel
Save