Added menu loading system

master
AlmTech 5 years ago
parent 8f938f83ef
commit 14dd39e06c
  1. 5
      gamemode/cl_init.lua
  2. 2
      gamemode/engine/core/server/sv_player_init.lua
  3. 8
      gamemode/engine/core/sh_player_binds.lua
  4. 14
      gamemode/engine/derma/cl_menu.lua
  5. 8
      gamemode/engine/derma/lib/cl_character.lua
  6. 8
      gamemode/init.lua

@ -41,10 +41,7 @@ if CLIENT then
local function loadAllDermaMenus() local function loadAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/" local fol = GM.FolderName .. "/gamemode/engine/derma/"
local clFiles = file.Find( fol .. "/cl_*.lua", "LUA" ) include( fol .. "/cl_menu.lua" )
for _, file in pairs( clFiles ) do
include( fol .. file )
end
end end
function Quantum.Client.Load() function Quantum.Client.Load()

@ -28,7 +28,7 @@ end
function GM:PlayerSpawn( ply ) function GM:PlayerSpawn( ply )
if( ply.isloaded ) then if( !ply.isloaded ) then
ply:Spectate( OBS_MODE_FIXED ) ply:Spectate( OBS_MODE_FIXED )
else else
setUpPlayer( ply ) setUpPlayer( ply )

@ -11,12 +11,16 @@ if SERVER then
local keyfuncs = { local keyfuncs = {
[IN_USE] = function( pl ) [IN_USE] = function( pl )
Quantum.Debug( tostring( pl ) .. " pressed IN_USE" ) Quantum.Debug( tostring( pl ) .. " pressed IN_USE" )
end,
["openCharMenu"] = function( pl )
end end
} }
function GM:KeyRelease( ply, key ) function GM:KeyRelease( ply, key )
if( keyfuncs[key] ) then keyfuncs[key]( ply ) end if( keyfuncs[key] ) then keyfuncs[key]( ply ) end
end end
else function GM:ShowHelp( ply )
--
end
end end

@ -5,11 +5,9 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local function mainMenu() net.Receive( "quantum_menu_net", function( len, pl )
local sw, sh = ScrW(), ScrH() local menu = net.ReadString()
if( !f ) then local dt = net.ReadTable()
local f = vgui.Create( "DFrame" ) local menu = include( "lib/cl_" .. menu .. ".lua" )
f:SetTitle( "Main Menu" ) menu.open( dt )
f:SetSize( sw, sh ) end)
end
end

@ -5,7 +5,9 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local function char_derma() local menu = {}
function menu.open( dt )
local sw, sh = ScrW(), ScrH() local sw, sh = ScrW(), ScrH()
if( !f ) then if( !f ) then
local f = vgui.Create( "DFrame" ) local f = vgui.Create( "DFrame" )
@ -27,4 +29,6 @@ local function char_derma()
net.SendToServer() net.SendToServer()
end end
end end
end end
return menu

@ -63,11 +63,15 @@ if SERVER then
end end
local function addAllDermaMenus() local function addAllDermaMenus()
AddCSLuaFile( fol .. "/cl_menu.lua" )
local fol = GM.FolderName .. "/gamemode/engine/derma/" local fol = GM.FolderName .. "/gamemode/engine/derma/"
local clFiles = file.Find( fol .. "/cl_*.lua", "LUA" ) local menuFiles = file.Find( fol .. "/lib/menu_*.lua", "LUA" )
for _, file in pairs( clFiles ) do for _, file in pairs( menuFiles ) do
AddCSLuaFile( fol .. "/" .. file ) AddCSLuaFile( fol .. "/" .. file )
end end
end end
function Quantum.Server.Load() function Quantum.Server.Load()

Loading…
Cancel
Save