From d81ade4c6460ac69f8d3611a8e98387e4504c952 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Wed, 22 Jan 2020 17:21:12 +0100 Subject: [PATCH] Bug fixes & improvements & added scenes to menus --- .../engine/derma/lib/cl_menu_dialogueBox.lua | 22 +++++++++++-------- gamemode/engine/derma/lib/cl_menu_fade.lua | 7 +++++- .../engine/derma/menus/menu_character.lua | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua index 46aea99..b116122 100644 --- a/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua +++ b/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua @@ -31,13 +31,15 @@ function log.createinfobox( logdata, parent ) header.w, header.h = header:GetSize() header:SetPos( box.x, ( box.y - header.h ) - padding/2 ) header.Think = function( self ) - if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then - if( logdata[Quantum.Client.Cam.Temp.scene_index].title ~= nil ) then - self:SetVisible( true ) - self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].title ) - surface.SetFont( self:GetFont() ) - local tw, th = surface.GetTextSize( self:GetText() ) - self:SetSize( tw * 1.1, th * 1.1 ) + if( Quantum.Client.Cam.Temp != nil ) then + if( logdata[Quantum.Client.Cam.Temp.scene_index] != nil ) then + if( logdata[Quantum.Client.Cam.Temp.scene_index].title != nil ) then + self:SetVisible( true ) + self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].title ) + surface.SetFont( self:GetFont() ) + local tw, th = surface.GetTextSize( self:GetText() ) + self:SetSize( tw * 1.1, th * 1.1 ) + end end end end @@ -70,8 +72,10 @@ function log.createinfobox( logdata, parent ) text:SetPos( scroll.w/2 - text.w/2, 0 ) text.Think = function( self ) - if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then - self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].text ) + if( Quantum.Client.Cam.Temp != nil ) then + if( logdata[Quantum.Client.Cam.Temp.scene_index] != nil ) then + self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].text ) + end end end diff --git a/gamemode/engine/derma/lib/cl_menu_fade.lua b/gamemode/engine/derma/lib/cl_menu_fade.lua index c227b9d..e9c8213 100644 --- a/gamemode/engine/derma/lib/cl_menu_fade.lua +++ b/gamemode/engine/derma/lib/cl_menu_fade.lua @@ -19,7 +19,7 @@ local function changeAlpha( clr, alpha ) return Color( clr.r, clr.g, clr.b, alpha ) end -function fade.transition( parent, dt, start_delay, mid_delay, end_delay, inColor, isBlur, startFunc, endFunc ) +function fade.transition( parent, dt, start_delay, mid_delay, end_delay, inColor, isBlur, startFunc, endFunc, showHUDonEnd ) local color = inColor || Color( 0, 0, 0, 255 ) local p = vgui.Create( "DPanel" ) @@ -37,6 +37,11 @@ function fade.transition( parent, dt, start_delay, mid_delay, end_delay, inColor surface.DrawRect( 0, 0, w, h ) end + p.OnRemove = function() + if( showHUDonEnd ) then + Quantum.Client.IsInMenu = false + end + end p.Think = function( self ) self.time = CurTime() - self.starttime diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 7d4e60a..d623b63 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -665,7 +665,7 @@ function menu.open( dt ) local dt = { index = Quantum.Client.selectedChar.index } snm.RunNetworkedFunc( "enterWorldChar", dt ) if( !isFirstTime( Quantum.Client.selectedChar.char ) ) then - fade.transition( f, {}, 1, 2, 1, Color( 0, 0, 0, 255 ), true, Quantum.EmptyFunction, Quantum.EmptyFunction ) -- close the frame + fade.transition( f, {}, 1, 2, 1, Color( 0, 0, 0, 255 ), true, Quantum.EmptyFunction, Quantum.EmptyFunction, true ) -- close the frame end -- Open the intro cinematic