From b28192f549cc0cb8562abc1e5c5bb60b8d50b37d Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Fri, 29 Nov 2019 20:20:52 +0100 Subject: [PATCH] Fixed linking to other menus --- gamemode/engine/derma/menus/menu_character.lua | 18 ++++++++++-------- gamemode/engine/derma/menus/menu_main.lua | 4 +--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index add920c..20d143e 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -11,8 +11,6 @@ local snm = Quantum.Client.Menu.GetAPI( "net" ) local page = Quantum.Client.Menu.GetAPI( "page" ) local theme = Quantum.Client.Menu.GetAPI( "theme" ) ---local mainmenu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_main.lua" ) - local resScale = Quantum.Client.ResolutionScale local sw, sh = ScrW(), ScrH() local padding = 10 * resScale @@ -84,7 +82,7 @@ local pages = { p:Remove() end - local scene = { + p.scene = { ["rp_truenorth_v1a_livin"] = { [1] = { fov = 75, @@ -94,7 +92,11 @@ local pages = { } } } - Quantum.Client.Cam.Start( scene[game.GetMap()], true ) + Quantum.Client.Cam.Start( p.scene[game.GetMap()], true ) + + p.OnRemove = function( self ) + Quantum.Client.Cam.Start( parent.scene[game.GetMap()], true ) -- switch back to the parents scene + end local banner = vgui.Create( "DImage", p ) banner:SetImage( Quantum.Client.ServerBannerPath ) @@ -448,7 +450,7 @@ function menu.open( dt ) Quantum.Client.Cam.Stop() end - local scene = { + f.scene = { ["rp_truenorth_v1a_livin"] = { [1] = { fov = 70, @@ -458,10 +460,10 @@ function menu.open( dt ) } } } - Quantum.Client.Cam.Start( scene[game.GetMap()], true ) + Quantum.Client.Cam.Start( f.scene[game.GetMap()], true ) local args = { - CloseButtonText = "Main Menu", + CloseButtonText = "Return", CloseButtonFont = "q_text" } local p, c = page.New( f, args ) @@ -487,7 +489,7 @@ function menu.open( dt ) c.DoClick = function() surface.PlaySound( "UI/buttonclick.wav" ) f:Close() - mainmenu.open(dt) + Quantum.Client.Menu.Menus["main"].open(dt) end --- diff --git a/gamemode/engine/derma/menus/menu_main.lua b/gamemode/engine/derma/menus/menu_main.lua index b9df782..181ea94 100644 --- a/gamemode/engine/derma/menus/menu_main.lua +++ b/gamemode/engine/derma/menus/menu_main.lua @@ -47,8 +47,6 @@ local scenes = { } } -local charmenu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_character.lua" ) - function main.open(dt) if( !f ) then @@ -76,7 +74,7 @@ function main.open(dt) f.OnClose = function( self ) --Quantum.Client.IsInMenu = false --Quantum.Client.Cam.Stop() - charmenu.open( dt ) + Quantum.Client.Menu.Menus["character"].open( dt ) end Quantum.Client.Cam.Start( scenes[ game.GetMap() ][math.random( 1, table.Count(scenes[ game.GetMap() ])) ], false )