From 4890d4e08ae8bb5e9ed2d279de2f0f711895a942 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Sun, 22 Dec 2019 17:23:31 +0100 Subject: [PATCH] Added themes & inventory menu stuff --- .../engine/core/server/sv_player_init.lua | 2 +- gamemode/engine/derma/lib/cl_menu_theme.lua | 9 ++++ gamemode/engine/derma/menus/menu_charinfo.lua | 52 +++++++++++++++++-- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index 4a9a49a..4c1055c 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -47,7 +47,7 @@ function GM:PlayerSpawn( ply ) setUpPlayer( ply ) else ply:SetPos( Vector( -8936.411133, 8244.439453, 7744.031250 ) ) - Quantum.Net.OpenMenu( ply, "main", Quantum.Server.Char.GetPlayerChars_cl( ply ) ) -- make the player open the main menu + Quantum.Net.OpenMenu( ply, "main", { chars = Quantum.Server.Char.GetPlayerChars_cl( ply ) } ) -- make the player open the main menu end end \ No newline at end of file diff --git a/gamemode/engine/derma/lib/cl_menu_theme.lua b/gamemode/engine/derma/lib/cl_menu_theme.lua index 0cac9c9..aae26cd 100644 --- a/gamemode/engine/derma/lib/cl_menu_theme.lua +++ b/gamemode/engine/derma/lib/cl_menu_theme.lua @@ -126,4 +126,13 @@ function theme.skipbutton( b, inClr ) surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s ) end +function theme.pagetitle( b ) + local w, h = b:GetSize() + + b:SetTextColor( Color( 205, 205, 205, 255 ) ) + + surface.SetDrawColor( Color( 0, 0, 0, 0 ) ) + surface.DrawRect( 0, 0, w, h ) +end + return theme \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_charinfo.lua b/gamemode/engine/derma/menus/menu_charinfo.lua index 68b5d94..cb68221 100644 --- a/gamemode/engine/derma/menus/menu_charinfo.lua +++ b/gamemode/engine/derma/menus/menu_charinfo.lua @@ -20,12 +20,20 @@ local errorMdl = "models/player.mdl" function menu.open( dt ) local items = dt.cont.items if( !f ) then + Quantum.Client.IsInMenu = true + local f = vgui.Create( "DFrame" ) f:SetSize( sw, sh ) - f:SetTitle("Character Info") + f.w, f.h = f:GetSize() + f:SetTitle( "" ) f:SetDraggable( false ) + f:ShowCloseButton( false ) f:MakePopup() - f.Paint = function() end + f.Paint = function( self, w, h ) + surface.SetDrawColor( 0, 0, 0, 40 ) + surface.DrawRect( 0, 0, w, h ) + theme.renderblur( self, 10, 10 ) + end function f:OnClose() Quantum.Client.IsInMenu = false -- show the hud when closed Quantum.Client.Cam.Stop() @@ -33,7 +41,45 @@ function menu.open( dt ) -- Default is the inventory page -- - --f.inv = page.New( f, {} ) + local bar = vgui.Create( "DPanel", f ) + bar:SetSize( f.w, padding*5 ) + bar.w, bar.h = bar:GetSize() + bar:SetPos( 0, 0 ) + bar.Paint = function( self ) theme.blurpanel( self ) end + bar.DoClick = function( self ) f:Close() end + + f.pages = { + inventory = { title = "Inventory" }, + info = { title = "Character Information" } + } + + -- Inventory button -- + title = vgui.Create( "DLabel", bar ) + title:SetText( "Inventory" ) + title:SetFont( "q_header_s" ) + title:SetTextColor( Color( 255, 255, 255, 255 ) ) + title.Paint = function( self ) + theme.pagetitle( self ) + end + + title:SizeToContents() + title.w, title.h = title:GetSize() + title:SetPos( bar.w/2 - title.w/2, bar.h/2 - title.h/2 ) + + + ---- Character view ---- + local char = vgui.Create( "DModelPanel", f ) + char:SetSize( 500, 500 ) + --char:SetModel( dt.cont.char.model ) ------------FIX THIS + + ---- TEMPORARY: REMOVE WHEN THE MENU IS DONE ---- + local close = vgui.Create( "DButton", f ) + close:SetText( "DEV CLOSE" ) + close:SizeToContents() + close.w, close.h = close:GetSize() + close:SetPos( 0, f.h - close.h ) + close.DoClick = function( self ) f:Close() end + end end