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
include( "shared.lua" )
--local gmfolder = GAMEMODE.FolderName || GM.FolderName
Quantum.Client = {}
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 fol = GM.FolderName .. "/gamemode/engine/core/"

@ -27,7 +27,7 @@ end
function theme.panel( p, color )
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 )
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
@ -36,7 +36,7 @@ end
function theme.blurpanel( p, color )
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 )
renderBlur( p, 2, 7 )

@ -37,27 +37,95 @@ local pages = {
p:Remove()
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
ip:SetSize( 400 * resScale, p.h * 0.9 )
ip.w, ip.h = ip:GetSize()
ip:SetPos( padding*4, p.h/2 - ip.h/2 )
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 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 --
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:SetText( "M" )
gbuttons.male:SetText( "Male" )
gbuttons.male:SetTextColor( Color( 0, 0, 0, 255 ) )
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: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 )
theme.sharpbutton( self )
@ -67,30 +135,22 @@ local pages = {
end
end
gbuttons.male.DoClick = function( self )
selectedGenderButton = self
surface.PlaySound( "UI/buttonclick.wav" )
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
surface.PlaySound( "UI/buttonclick.wav" )
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
end
}
@ -126,7 +186,7 @@ function menu.open( dt )
clist:SetPos( (sw - clist.w) - padding*2, padding*6 )
clist.x, clist.y = clist:GetPos()
clist.Paint = function( self, w, h )
theme.blurpanel( self, Color( 0, 0, 0, 200 ) )
theme.blurpanel( self )
end
local sbar = clist:GetVBar()

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

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