Finished cinematic API & Dialogue box API

master
AlmTech 5 years ago
parent e021269bdd
commit c4d8ed40c2
  1. 39
      gamemode/engine/derma/lib/cl_menu_dialogueBox.lua
  2. 25
      gamemode/engine/derma/lib/cl_menu_theme.lua
  3. 26
      gamemode/engine/derma/menus/menu_intro.lua

@ -12,22 +12,38 @@ local padding_s = 4 * scale
local theme = Quantum.Client.Menu.GetAPI( "theme" ) local theme = Quantum.Client.Menu.GetAPI( "theme" )
function log.createinfobox( title, text, parent ) function log.createinfobox( logdata, parent )
local fw, fh = parent:GetSize() local fw, fh = parent:GetSize()
local logtitle = logdata[1].title
local logtext = logdata[1].text
local box = vgui.Create( "DPanel", parent ) local box = vgui.Create( "DPanel", parent )
box:SetSize( 775 * scale, 200 * scale ) box:SetSize( 775 * scale, 200 * scale )
box.Paint = function( self ) theme.blurpanel( self, Color( 0, 0, 0, 0 ) ) end box.Paint = function( self ) theme.sharpblurpanel( self ) end
box.w, box.h = box:GetSize() box.w, box.h = box:GetSize()
box:SetPos( fw/2 - box.w/2, fh*0.8 - box.h/2 ) box:SetPos( fw/2 - box.w/2, fh*0.8 - box.h/2 )
box.x, box.y = box:GetPos() box.x, box.y = box:GetPos()
local header = vgui.Create( "DLabel", parent ) local header = vgui.Create( "DLabel", parent )
header:SetText( title )
header:SetFont( "q_header_s" ) header:SetFont( "q_header_s" )
header:SetTextColor( Color( 255, 255, 255, 220 ) ) header:SetTextColor( Color( 255, 255, 255, 220 ) )
header:SizeToContents() header:SizeToContents()
header.w, header.h = header:GetSize() header.w, header.h = header:GetSize()
header:SetPos( box.x - box.w/2 + header.w/2, box.y ) header:SetPos( box.x, ( box.y - header.h ) - padding/2 )
header.Think = function( self )
if( logdata[Quantum.Client.Cam.Temp.scene_index].title ~= nil ) then
PrintTable( logdata[Quantum.Client.Cam.Temp.scene_index] )
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
header.Paint = function( self )
theme.sharpblurpanel( self )
end
header:SetContentAlignment( 5 )
local scroll = vgui.Create( "DScrollPanel", box ) local scroll = vgui.Create( "DScrollPanel", box )
scroll:SetSize( box:GetSize() ) scroll:SetSize( box:GetSize() )
@ -35,11 +51,24 @@ function log.createinfobox( title, text, parent )
local sb = scroll:GetVBar() local sb = scroll:GetVBar()
sb.Paint = function( self ) end sb.Paint = function( self ) end
function sb.btnGrip:Paint() function sb.btnGrip:Paint()
theme.button( self, Color( 0, 0, 0, 80 ) ) theme.button( self, Color( 0, 0, 0, 0 ) )
end end
sb.btnUp:SetSize(0,0) sb.btnUp:SetSize(0,0)
sb.btnDown:SetSize(0,0) sb.btnDown:SetSize(0,0)
scroll.w, scroll.h = scroll:GetSize()
local text = vgui.Create( "DLabel", scroll )
text:SetText( logtext )
text:SetFont( "q_info" )
text:SetTextColor( Color( 240, 240, 240, 255 ) )
text:SetSize( scroll.w * 0.95, scroll.h * 0.95 )
text:SetWrap( true )
text.w, text.h = text:GetSize()
text:SetPos( scroll.w/2 - text.w/2, 0 )
text.Think = function( self ) self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].text ) end
return box return box
end end

@ -52,6 +52,15 @@ function theme.blurpanel( p, color )
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end end
function theme.sharpblurpanel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
surface.SetDrawColor( clr )
surface.DrawRect( 0, 0, w, h )
renderBlur( p, 2, 7 )
theme.borderpanel( p, Color( 255, 255, 255, 255 ) )
end
function theme.button( b, color ) function theme.button( b, color )
local w, h = b:GetSize() local w, h = b:GetSize()
local clr = color || Color( 235, 64, 52, 255 ) local clr = color || Color( 235, 64, 52, 255 )
@ -82,4 +91,20 @@ function theme.sharpbutton( b, inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s ) surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
end end
function theme.skipbutton( b, inClr )
local w, h = b:GetSize()
inClr = inClr || Color( 235, 64, 52, 255 )
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 255 )
else
surface.SetDrawColor( 120, 120, 120, 255 )
end
surface.DrawOutlinedRect( 0, 0, w, h )
surface.SetDrawColor( inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
end
return theme return theme

@ -8,6 +8,7 @@
local intro = {} local intro = {}
local log = Quantum.Client.Menu.GetAPI( "dialogue" ) local log = Quantum.Client.Menu.GetAPI( "dialogue" )
local theme = local log = Quantum.Client.Menu.GetAPI( "themes" )
local scenes = { local scenes = {
["rp_truenorth_v1a_livin"] = { ["rp_truenorth_v1a_livin"] = {
@ -57,8 +58,31 @@ function intro.open( dt )
Quantum.Client.Cam.Stop() -- stop the cinematic Quantum.Client.Cam.Stop() -- stop the cinematic
end end
local skip = vgui.Create( "DButton", f )
skip:SetText( "Skip Intro" )
skip:SetFont( "q_button_m" )
skip:SetTextColor( Color( 255, 255, 255, 255 ) )
skip:SizeToContents()
skip.Paint = function( self ) theme.skipbutton( self ) end
Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic
local box = log.createinfobox( "Sample Title", "TEST", f )
local logdata = {
[1] = {
title = "Welcome!",
text = "Welcome to the server! This server is running the Quantum framework which was developed by AlmTech.\n\nDuring this awesome cinematic you will be shown what you can do on the server. Starting with the basics."
},
[2] = {
title = "Classes & Professions",
text = "You can learn a profession at any teacher NPC. Professions unlocks certian abilities to craft, cook and gather certain resources."
},
[3] = {
title = "Classes & Professions",
text = "Some character classes are better at certain things but worse at other things."
}
}
local box = log.createinfobox( logdata, f )
end end
end end

Loading…
Cancel
Save