Dialogue stuff

master
E. Almqvist 5 years ago
parent 56ed89173c
commit 903982e57a
  1. 37
      gamemode/engine/derma/lib/cl_menu_dialogueBox.lua
  2. 1
      gamemode/engine/derma/lib/cl_menu_theme.lua
  3. 13
      gamemode/engine/derma/menus/menu_dialogue.lua

@ -14,6 +14,43 @@ local padding_s = 4 * scale
local theme = Quantum.Client.Menu.GetAPI( "theme" ) local theme = Quantum.Client.Menu.GetAPI( "theme" )
function log.createDialogueBox( logdata, parent )
cinematic = cinematic || true
local fw, fh = parent:GetSize()
local logtext = logdata["init"].question
local box = vgui.Create( "DPanel", parent )
box:SetSize( 775 * scale, 80 * scale )
box.Paint = theme.sharpblurpanel( self )
box.w, box.h = box:GetSize()
box:SetPos( fw/2 - box.w/2, fh*0.7 - box.h/2 )
box.x, box.y = box:GetPos()
local scroll = vgui.Create( "DScrollPanel", box )
scroll:SetSize( box:GetSize() )
scroll.Paint = function( self ) end
local sb = scroll:GetVBar()
sb.Paint = function( self ) end
function sb.btnGrip:Paint()
theme.button( self, Color( 0, 0, 0, 0 ) )
end
sb.btnUp: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_dialogue_question" )
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 )
return box
end
function log.createinfobox( logdata, parent, cinematic ) function log.createinfobox( logdata, parent, cinematic )
cinematic = cinematic || true cinematic = cinematic || true
local fw, fh = parent:GetSize() local fw, fh = parent:GetSize()

@ -260,6 +260,7 @@ function theme.fadebutton( b, dir, inColor, font, txtColor )
end end
---- Color Manipulation ---- ---- Color Manipulation ----
theme.color = {} theme.color = {}

@ -10,6 +10,7 @@ local menu = {}
local snm = Quantum.Client.Menu.GetAPI( "net" ) local snm = Quantum.Client.Menu.GetAPI( "net" )
local theme = Quantum.Client.Menu.GetAPI( "theme" ) local theme = Quantum.Client.Menu.GetAPI( "theme" )
local fade = Quantum.Client.Menu.GetAPI( "fade" ) local fade = Quantum.Client.Menu.GetAPI( "fade" )
local log = Quantum.Client.Menu.GetAPI( "dialogue" )
local resScale = Quantum.Client.ResolutionScale local resScale = Quantum.Client.ResolutionScale
local sw, sh = ScrW(), ScrH() local sw, sh = ScrW(), ScrH()
@ -54,9 +55,11 @@ function menu.open( dt )
f:ShowCloseButton( false ) f:ShowCloseButton( false )
local borderHeight = 90 * resScale local borderHeight = 90 * resScale
f.Paint = function( self, w, h ) f.Paint = function( self, w, h )
--[[
surface.SetDrawColor( Color( 20, 20, 20, 255 ) ) surface.SetDrawColor( Color( 20, 20, 20, 255 ) )
surface.DrawRect( 0, 0, w, borderHeight ) surface.DrawRect( 0, 0, w, borderHeight )
surface.DrawRect( 0, h - borderHeight, w, borderHeight ) surface.DrawRect( 0, h - borderHeight, w, borderHeight )
--]]
end end
f:SetDraggable( false ) f:SetDraggable( false )
f:MakePopup() f:MakePopup()
@ -78,7 +81,7 @@ function menu.open( dt )
f.w, f.h = f:GetSize() f.w, f.h = f:GetSize()
f.dialogue = {} f.dialogue = {}
local textColor = Color(255, 255, 255, 120) local textColor = Color(255, 255, 255, 220)
-- Title is static, can't be changed mid dialogue. -- Title is static, can't be changed mid dialogue.
local title = vgui.Create( "DLabel", f ) -- dialogue title, useally the npcs name or something local title = vgui.Create( "DLabel", f ) -- dialogue title, useally the npcs name or something
@ -90,13 +93,7 @@ function menu.open( dt )
title:SetPos(padding*2, borderHeight/2 - title.h/2) title:SetPos(padding*2, borderHeight/2 - title.h/2)
-- Dialogue question -- Dialogue question
f.dialogue.q = vgui.Create("DLabel", f) f.dialogue.q = log.createDialogueBox( dialogue, f )
f.dialogue.q:SetText(dialogue["init"].question)
f.dialogue.q:SetFont("q_dialogue_question")
f.dialogue.q:SetTextColor(textColor)
f.dialogue.q:SizeToContents()
f.dialogue.q.w, f.dialogue.q.h = f.dialogue.q:GetSize()
f.dialogue.q:SetPos(padding*2, sh - borderHeight/2 - f.dialogue.q.h)
return f return f
end end

Loading…
Cancel
Save