Added main menu features & fix HUD showing during cinematics

master
AlmTech Software 5 years ago
parent 54aa3ecd25
commit 35a1d28300
  1. 11
      gamemode/engine/core/sh_player_binds.lua
  2. 4
      gamemode/engine/derma/lib/cl_menu_fade.lua
  3. 5
      gamemode/engine/derma/lib/cl_menu_pages.lua
  4. 2
      gamemode/engine/derma/menus/menu_character.lua
  5. 8
      gamemode/engine/derma/menus/menu_charinfo.lua
  6. 2
      gamemode/engine/derma/menus/menu_intro.lua
  7. 49
      gamemode/engine/derma/menus/menu_main.lua
  8. 3
      gamemode/engine/lib/client/cl_cinematic.lua

@ -9,14 +9,11 @@
if SERVER then if SERVER then
local keyfuncs = { local keyfuncs = {
["openCharMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars_cl( pl ) )
end,
["mainMenu"] = function( pl ) ["mainMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "main", Quantum.Server.Char.GetPlayerChars_cl( pl ) ) Quantum.Net.OpenMenu( pl, "main", { chars = Quantum.Server.Char.GetPlayerChars_cl( pl ), resume = true } )
end, end,
["intro"] = function( pl ) ["charinfo"] = function( pl )
Quantum.Net.OpenMenu( pl, "intro", {} ) Quantum.Net.OpenMenu( pl, "charinfo", {} )
end end
} }
@ -24,6 +21,6 @@ if SERVER then
if( keyfuncs[key] ) then keyfuncs[key]( ply ) end if( keyfuncs[key] ) then keyfuncs[key]( ply ) end
end end
function GM:ShowHelp( ply ) keyfuncs["mainMenu"]( ply ) end function GM:ShowHelp( ply ) keyfuncs["mainMenu"]( ply ) end
function GM:ShowSpare2( ply ) keyfuncs["intro"]( ply ) end function GM:ShowSpare2( ply ) keyfuncs["charinfo"]( ply ) end
end end

@ -64,8 +64,6 @@ function fade.transition( parent, dt, start_delay, mid_delay, end_delay, inColor
end end
end end
Quantum.Debug("[Fade] First part done.")
elseif( self.time >= end_delay && !self.fadeIn ) then elseif( self.time >= end_delay && !self.fadeIn ) then
if( !self.runnedEndFunc ) then if( !self.runnedEndFunc ) then
@ -73,8 +71,6 @@ function fade.transition( parent, dt, start_delay, mid_delay, end_delay, inColor
endFunc( dt ) endFunc( dt )
self.runnedEndFunc = true self.runnedEndFunc = true
self:Remove() -- remove the panel when finished self:Remove() -- remove the panel when finished
Quantum.Debug( "[Fade] Finished transition." )
Quantum.Client.IsInMenu = false
end end

@ -37,9 +37,8 @@ function page.New( parent, args )
local close = vgui.Create( "DButton", p ) local close = vgui.Create( "DButton", p )
close:SetText( args.CloseButtonText || "Close" ) close:SetText( args.CloseButtonText || "Close" )
close:SetTextColor( args.CloseButtonTextColor || Color( 0, 0, 0, 255 ) ) close:SetTextColor( args.CloseButtonTextColor || Color( 255, 255, 255, 255 ) )
close:SetFont( args.CloseButtonFont || "q_text" ) close:SetFont( args.CloseButtonFont || "q_text" )
--close:SetSize( args.closeW, args.closeH )
close:SizeToContents() close:SizeToContents()
local closeW, closeH = close:GetSize() local closeW, closeH = close:GetSize()
close:SetSize( closeW + padding*2, closeH ) close:SetSize( closeW + padding*2, closeH )
@ -50,7 +49,7 @@ function page.New( parent, args )
end end
close.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end close.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
close.Paint = args.CloseButtonPaint || function( self, w, h ) close.Paint = args.CloseButtonPaint || function( self, w, h )
theme.sharpbutton( self ) theme.sharpblurrbutton( self )
end end
return p, close return p, close
end end

@ -459,7 +459,7 @@ end
function menu.open( dt ) function menu.open( dt )
Quantum.Client.IsInMenu = true -- hide the hud Quantum.Client.IsInMenu = true -- hide the hud
Quantum.Client.Chars = dt.cont Quantum.Client.Chars = dt.cont.chars
if( !f ) then if( !f ) then
local f = vgui.Create( "DFrame" ) local f = vgui.Create( "DFrame" )
f:SetTitle( "" ) f:SetTitle( "" )

@ -18,6 +18,7 @@ local padding_s = 4 * resScale
local errorMdl = "models/player.mdl" local errorMdl = "models/player.mdl"
function menu.open( dt ) function menu.open( dt )
local items = dt.cont.items
if( !f ) then if( !f ) then
local f = vgui.Create( "DFrame" ) local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh ) f:SetSize( sw, sh )
@ -30,7 +31,10 @@ function menu.open( dt )
Quantum.Client.Cam.Stop() Quantum.Client.Cam.Stop()
end end
-- Create the inventory page -- -- Default is the inventory page --
f.inv = page.New( f, {} )
--f.inv = page.New( f, {} )
end end
end end
return menu

@ -120,7 +120,7 @@ function intro.open()
skip:SetPos( f.w - skip.w - padding, f.h - skip.h - padding ) skip:SetPos( f.w - skip.w - padding, f.h - skip.h - padding )
skip.DoClick = function( self ) skip.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
fade.transition( f, {}, 1, 1, 2, Color( 0, 0, 0, 255 ), true, Quantum.EmptyFunction, Quantum.EmptyFunction ) -- close the intro but smoothly fade.transition( f, {}, 1, 1, 2, Color( 0, 0, 0, 255 ), true, Quantum.EmptyFunction, function() Quantum.Client.IsInMenu = false end ) -- close the intro but smoothly
end end
skip.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end skip.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end

@ -72,7 +72,7 @@ function main.open(dt)
theme.renderblur( self, 2, 7 ) theme.renderblur( self, 2, 7 )
end end
f.OnClose = function( self ) f.OnClose = function( self )
Quantum.Client.Menu.Menus["character"].open( dt ) --Quantum.Client.Menu.Menus["character"].open( dt )
end end
Quantum.Client.Cam.Start( scenes[ game.GetMap() ][math.random( 1, table.Count(scenes[ game.GetMap() ])) ], false ) Quantum.Client.Cam.Start( scenes[ game.GetMap() ][math.random( 1, table.Count(scenes[ game.GetMap() ])) ], false )
@ -106,19 +106,59 @@ function main.open(dt)
---- BUTTONS ---- ---- BUTTONS ----
-- resume button
if( dt.cont.resume ) then
local res = vgui.Create( "DButton", f )
res:SetText( "Resume" )
res:SetFont( buttonFont )
res:SetTextColor( buttonTextColor )
res:SizeToContents()
res.w, res.h = res:GetSize()
res:SetSize( buttonWidth, res.h )
res.w, res.h = res:GetSize()
res:SetPos( sw/2 - res.w/2, sub.y + res.h + padding * 20 )
res.x, res.y = res:GetPos()
res.Paint = function( self )
theme.sharpbutton( self, buttonColor )
end
res.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
f:Close()
Quantum.Client.Cam.Stop()
end
res.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end
-- play button -- play button
local play = vgui.Create( "DButton", f ) local play = vgui.Create( "DButton", f )
play:SetText( "Play" ) play:SetText( "Play" )
play:SetFont( buttonFont ) play:SetFont( buttonFont )
play:SetTextColor( buttonTextColor )
play:SizeToContents() play:SizeToContents()
play.w, play.h = play:GetSize() play.w, play.h = play:GetSize()
play:SetSize( buttonWidth, play.h ) play:SetSize( buttonWidth, play.h )
play.w, play.h = play:GetSize() play.w, play.h = play:GetSize()
play:SetPos( sw/2 - play.w/2, sub.y + play.h + padding*20 ) play.x, play.y = sw/2 - play.w/2, sub.y + play.h + padding*20
play.x, play.y = play:GetPos() if( dt.cont.resume ) then
play:SetText( "Change Character" )
play:SizeToContents()
play.w, play.h = play:GetSize()
play:SetSize( buttonWidth, play.h )
play.w, play.h = play:GetSize()
play.y = play.y + play.h + padding*2
print( play.y )
end
play:SetTextColor( buttonTextColor )
play:SetPos( play.x, play.y )
play.Paint = function( self ) play.Paint = function( self )
theme.sharpbutton( self, buttonColor ) theme.sharpbutton( self, buttonColor )
@ -127,6 +167,7 @@ function main.open(dt)
play.DoClick = function( self ) play.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
f:Close() f:Close()
Quantum.Client.Menu.Menus["character"].open( dt )
end end
play.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end play.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end

@ -11,8 +11,7 @@ function Quantum.Client.Cam.InvertAngle( ang ) return Angle( -ang.x, ang.y, -ang
function Quantum.Client.Cam.Stop() function Quantum.Client.Cam.Stop()
hook.Remove( "CalcView", "Quantum_Cinematic" ) hook.Remove( "CalcView", "Quantum_Cinematic" )
Quantum.Client.Cam.Temp.scene_index = nil -- remove the var becuase it is unneeded Quantum.Client.Cam.Temp = nil -- remove the var becuase it is unneeded
Quantum.Debug( "Stopped cinematic." )
end end
function Quantum.Client.Cam.Start( scene, loop ) function Quantum.Client.Cam.Start( scene, loop )

Loading…
Cancel
Save