From 534ce8e8612da3ba6d610a782eeaf10c9135b947 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 22 Apr 2016 18:30:55 -0400 Subject: Started split to expidition --- gamemode/client/cl_inventory.lua | 43 ++++++++++++++++++++++++++++++++++++++++ gamemode/client/cl_quickmenu.lua | 19 ++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 gamemode/client/cl_inventory.lua create mode 100644 gamemode/client/cl_quickmenu.lua (limited to 'gamemode/client') diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua new file mode 100644 index 0000000..9e18040 --- /dev/null +++ b/gamemode/client/cl_inventory.lua @@ -0,0 +1,43 @@ +print("Custom inventory loaded") + +local function createPanel() + local frame = vgui.Create( "DFrame" ) + frame:SetSize( 300, 300 ) + frame:SetTitle( "Inventory" ) + frame:MakePopup() + frame:Center() + + local layout = vgui.Create( "DTileLayout", frame ) + layout:SetBaseSize( 32 ) -- Tile size + layout:Dock( FILL ) + + //Draw a background so we can see what it's doing + --layout:SetDrawBackground( true ) + --layout:SetBackgroundColor( Color( 0, 100, 100 ) ) + + layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children + for k, v in SortedPairs( Resources ) do + layout:Add( Label( v .. k) ) + end + /* + for i = 1, 32 do + layout:Add( Label( " Label " .. i ) ) + end + */ +end + +local invpanel = nil +function GM:OnSpawnMenuOpen() + print("Spawn menu hooked correctly") + if(invpanel == nil) then + invpanel = createPanel() + end +end + +function GM:OnSpawnMenuClose() + +end + +function GM:SpawnMenuEnabled() + return false +end diff --git a/gamemode/client/cl_quickmenu.lua b/gamemode/client/cl_quickmenu.lua new file mode 100644 index 0000000..2ce0bbb --- /dev/null +++ b/gamemode/client/cl_quickmenu.lua @@ -0,0 +1,19 @@ +function GM:OnContextMenuOpen() + print("Context menu hooked correctly") + local Menu = DermaMenu() -- Is the same as vgui.Create( "DMenu" ) + Menu:AddOption( "Simple option" ) -- Add a simple option. + + local btnWithIcon = Menu:AddOption( "Option with icon" ) -- Simple option, but we're going to add an icon + btnWithIcon:SetIcon( "icon16/bug.png" ) -- Icons are in materials/icon16 folder + + Menu:AddSpacer() -- Adds a simple line spacer + + local SubMenu = Menu:AddSubMenu( "A Sub Menu" ) -- Add a submenu + SubMenu:AddOption( "Sub Option #1" ):SetIcon( "icon16/group.png" ) -- SetIcon possible like this + + Menu:Open() +end + +function GM:OnContextMenuClose() + +end -- cgit v1.2.3-70-g09d2