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 fol = GM.FolderName .. "/gamemode/engine/derma/"
local clFiles = file.Find( fol .. "/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
include( fol .. file )
end
include( fol .. "/cl_menu.lua" )
end
function Quantum.Client.Load()

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

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

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

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

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

Loading…
Cancel
Save