Added new button & panel themes (fade)

master
AlmTech Software 5 years ago
parent 8a3ff8bdf5
commit 1c06462838
  1. 33
      entities/entities/q_crafting_station/cl_init.lua
  2. 2
      gamemode/engine/core/client/cl_hud.lua
  3. 65
      gamemode/engine/derma/lib/cl_menu_theme.lua
  4. 36
      gamemode/engine/derma/menus/menu_main.lua
  5. 2
      gamemode/engine/lib/sh_station.lua
  6. 9
      gamemode/settings/sh_crafting_stations.lua
  7. 2
      gamemode/settings/sv_crafting_stations_locations.lua

@ -12,21 +12,50 @@ local ang
local mdlHeight local mdlHeight
local p, q local p, q
local txtW, txtH
local stationTbl
local stationName
local barW, barH
local scale = Quantum.Client.ResolutionScale
local padding = 10 * scale
function ENT:Draw() function ENT:Draw()
if( !stationTbl ) then
stationTbl = Quantum.Station.Get( self:GetNWInt( "q_station_id" ) )
stationName = stationTbl.name
end
self:DrawModel() self:DrawModel()
if( stationTbl.showname == true ) then
pos, ang = self:GetPos(), self:GetAngles() pos, ang = self:GetPos(), self:GetAngles()
p, q = self:GetRenderBounds() p, q = self:GetRenderBounds()
mdlHeight = q.z - p.z mdlHeight = q.z - p.z
pos = pos + ang:Up() * (mdlHeight + 10) pos = pos + ang:Up() * (mdlHeight + 20)
-- rotate around axis -- rotate around axis
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )
ang.y = LocalPlayer():EyeAngles().y - 90
cam.Start3D2D( pos, ang, 0.15 ) cam.Start3D2D( pos, ang, 0.15 )
surface.SetTextColor( Color( 255, 255, 255 ) ) surface.SetTextColor( Color( 255, 255, 255 ) )
surface.SetFont( "q_title" ) surface.SetFont( "q_title" )
surface.DrawText( "aihofhsdifhiosdfh" ) txtW, txtH = surface.GetTextSize( stationName )
barW, barH = txtW + padding, txtH + padding
surface.SetDrawColor( 0, 0, 0, 150 )
surface.DrawRect( -barW/2, -padding/2, barW, barH )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawOutlinedRect( -barW/2, -padding/2, barW, barH )
surface.SetTextPos( -txtW/2, 0 )
surface.DrawText( stationName )
cam.End3D2D() cam.End3D2D()
end end
end

@ -113,7 +113,7 @@ local function createCraftPanel()
craft.Paint = function( self, w, h ) craft.Paint = function( self, w, h )
surface.SetDrawColor( Color( 0, 0, 0, 180 ) ) surface.SetDrawColor( Color( 0, 0, 0, 180 ) )
surface.DrawOutlinedRect( 0, 0, w, h ) surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( Color( 255, 255, 255, 50 ) ) surface.SetDrawColor( Color( 255, 255, 255, 50 ) )
surface.DrawOutlinedRect( 0, 0, w, h ) surface.DrawOutlinedRect( 0, 0, w, h )

@ -187,6 +187,71 @@ function theme.titleframe( p )
surface.DrawOutlinedRect( -scale*2, 0, w + 4 * scale, h ) surface.DrawOutlinedRect( -scale*2, 0, w + 4 * scale, h )
end end
function theme.fadepanel( p, dir, color, startalpha, intervall )
local w, h = p:GetSize()
color = color || Color( 0, 0, 0 )
local alpha = startalpha || 200
dir = dir || 1
intervall = intervall || 2
surface.SetDrawColor( color )
surface.SetAlphaMultiplier( 1 )
if( dir == 1 ) then
for iw=1, w, intervall do
surface.SetDrawColor( Color( color.r, color.g, color.b, alpha * math.Clamp( (w-(iw-1)) / w, 0, 1 ) ) )
surface.DrawRect( iw - 1, 0, intervall, h )
end
elseif( dir == 2 ) then
for iw=1, w, intervall do
surface.SetDrawColor( Color( color.r, color.g, color.b, alpha * math.Clamp( (w-(iw-1)) / w, 0, 1 ) ) )
surface.DrawRect( w - (iw - 1), 0, intervall, h )
end
end
end
function theme.fadepanelborder( p, dir, color, color2, startalpha, intervall )
local w, h = p:GetSize()
color = color || Color( 0, 0, 0 )
color2 = color2 || Color( 0, 0, 0 )
local alpha = startalpha || 200
dir = dir || 1
intervall = intervall || 1
local ih = 2*scale
theme.fadepanel( p, dir, color, startalpha, intervall )
-- border
if( dir == 1 ) then
for iw=1, w, intervall do
surface.SetDrawColor( Color( color2.r, color2.g, color2.b, alpha * math.Clamp( (w-(iw-1)) / w, 0, 1 ) ) )
surface.DrawRect( iw - 1, 0, intervall, ih )
surface.DrawRect( iw - 1, h - ih/2, intervall, ih )
end
elseif( dir == 2 ) then
for iw=1, w, intervall do ------------------- NOT DONE
surface.SetDrawColor( Color( color2.r, color2.g, color2.b, alpha * math.Clamp( (w-(iw-1)) / w, 0, 1 ) ) )
surface.DrawRect( w - (iw - 1), 0, intervall, 2 )
end
end
end
function theme.fadebutton( b, dir, inColor )
local w, h = b:GetSize()
local brdColor = Color( 0, 0, 0 )
inColor = inColor || Color( 0, 0, 0, 100 )
if( !b:IsHovered() ) then
brdColor = Color( 0, 0, 0 )
else
brdColor = Color( 116, 185, 255 )
end
theme.fadepanelborder( b, dir, Color( brdColor.r * 0.4, brdColor.g * 0.4, brdColor.b * 0.4 ) , brdColor )
end
---- Color Manipulation ---- ---- Color Manipulation ----
theme.color = {} theme.color = {}

@ -49,14 +49,6 @@ local scenes = {
["rp_dunwood_eu"] = { ["rp_dunwood_eu"] = {
[1] = { [1] = {
[1] = {
fov = 60,
velocity = 1,
pos1 = Vector( -8481.490234375, 10434.901367188, 161.60014343262 ),
ang1 = Angle( 13.865054130554, 112.71305084229, 0 )
}
},
[2] = {
[1] = { [1] = {
fov = 80, fov = 80,
velocity = 1, velocity = 1,
@ -79,7 +71,7 @@ function main.open(dt)
local padding = 10 * resScale local padding = 10 * resScale
local padding_s = 4 * resScale local padding_s = 4 * resScale
local buttonWidth = 255 * resScale local buttonWidth = 400 * resScale
local buttonColor = Color( 20, 20, 20, 180 ) local buttonColor = Color( 20, 20, 20, 180 )
local buttonTextColor = Color( 255, 255, 255, 255 ) local buttonTextColor = Color( 255, 255, 255, 255 )
local buttonFont = "q_button2" local buttonFont = "q_button2"
@ -145,9 +137,12 @@ function main.open(dt)
---- BUTTONS ---- ---- BUTTONS ----
local xbasepos = padding*6 local xbasepos = 0 --padding*6
local ybasepos = sh*0.85 - padding*20 local ybasepos = sh*0.775 - padding*20
local ypos = ybasepos local ypos = ybasepos
local contBtnAlign = 5
-- resume button -- resume button
if( dt.cont.resume ) then if( dt.cont.resume ) then
@ -166,6 +161,8 @@ function main.open(dt)
res.Paint = function( self ) res.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
-- theme.fadebutton( self, 1, Color( 90, 90, 240 ) )
theme.fadebutton( self, 1 )
end end
res.DoClick = function( self ) res.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -174,7 +171,7 @@ function main.open(dt)
Quantum.Client.IsInMenu = false Quantum.Client.IsInMenu = false
end end
res.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end res.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
res:SetContentAlignment( 4 ) res:SetContentAlignment( contBtnAlign )
ypos = ypos + res.h + padding * 1.5 ypos = ypos + res.h + padding * 1.5
end end
@ -204,6 +201,7 @@ function main.open(dt)
play.Paint = function( self ) play.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 )
end end
play.DoClick = function( self ) play.DoClick = function( self )
@ -212,7 +210,7 @@ function main.open(dt)
Quantum.Client.Menu.Menus["character"].open( dt ) 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
play:SetContentAlignment( 4 ) play:SetContentAlignment( contBtnAlign )
ypos = ypos + play.h + padding * 1.5 ypos = ypos + play.h + padding * 1.5
@ -232,12 +230,13 @@ function main.open(dt)
settings.Paint = function( self ) settings.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 )
end end
settings.DoClick = function( self ) settings.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
end end
settings.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end settings.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
settings:SetContentAlignment( 4 ) settings:SetContentAlignment( contBtnAlign )
ypos = ypos + settings.h + padding * 1.5 ypos = ypos + settings.h + padding * 1.5
@ -257,13 +256,14 @@ function main.open(dt)
ws.Paint = function( self ) ws.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 )
end end
ws.DoClick = function( self ) ws.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
gui.OpenURL( Quantum.WorkshopLink ) gui.OpenURL( Quantum.WorkshopLink )
end end
ws.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end ws.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
ws:SetContentAlignment( 4 ) ws:SetContentAlignment( contBtnAlign )
ypos = ypos + ws.h + padding * 1.5 ypos = ypos + ws.h + padding * 1.5
@ -283,13 +283,14 @@ function main.open(dt)
inv.Paint = function( self ) inv.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 )
end end
inv.DoClick = function( self ) inv.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
gui.OpenURL( Quantum.DiscordInvite ) gui.OpenURL( Quantum.DiscordInvite )
end end
inv.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end inv.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
inv:SetContentAlignment( 4 ) inv:SetContentAlignment( contBtnAlign )
ypos = ypos + inv.h + padding * 1.5 ypos = ypos + inv.h + padding * 1.5
@ -309,6 +310,7 @@ function main.open(dt)
quit.Paint = function( self ) quit.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 )
end end
quit.DoClick = function( self ) quit.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -317,7 +319,7 @@ function main.open(dt)
end) end)
end end
quit.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end quit.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
quit:SetContentAlignment( 4 ) quit:SetContentAlignment( contBtnAlign )
end end
end end

@ -15,6 +15,7 @@ function Quantum.Station.Add( id, tbl )
stationid = id, stationid = id,
name = tbl.name || "Crafting Station", -- name of the station name = tbl.name || "Crafting Station", -- name of the station
model = tbl.model || "models/props_phx/facepunch_barrel.mdl", model = tbl.model || "models/props_phx/facepunch_barrel.mdl",
showname = tbl.showname,
recipes = tbl.recipes recipes = tbl.recipes
} }
@ -24,7 +25,6 @@ function Quantum.Station.Add( id, tbl )
end end
function Quantum.Station.Get( id ) function Quantum.Station.Get( id )
if( isnumber(id) ) then return nil end
return Quantum.Stations[id] return Quantum.Stations[id]
end end

@ -8,5 +8,12 @@
-- Add all of the station "categories" here -- -- Add all of the station "categories" here --
Quantum.Station.Add( "barrel", { Quantum.Station.Add( "barrel", {
name = "Crafting Barrel", name = "Crafting Barrel",
model = "models/props_phx/facepunch_barrel.mdl" model = "models/props_phx/facepunch_barrel.mdl",
showname = true
})
Quantum.Station.Add( "barrel2", {
name = "Test Barrel 2",
model = "models/props_phx/facepunch_barrel.mdl",
showname = false
}) })

@ -6,4 +6,4 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Station.Register( "barrel", Vector( 747.13494873047, 10483.685546875, 7168.0317382813 ), Angle( 0, -118.23150634766, 0 ) ) Quantum.Server.Station.Register( "barrel", Vector( 747.13494873047, 10483.685546875, 7168.0317382813 ), Angle( 0, -118.23150634766, 0 ) )
Quantum.Server.Station.Register( "barrel", Vector( 885.861328125, 10542.946289063, 7168.03125 ), Angle( 0, -118.23150634766, 0 ) ) Quantum.Server.Station.Register( "barrel2", Vector( 885.861328125, 10542.946289063, 7168.03125 ), Angle( 0, -118.23150634766, 0 ) )
Loading…
Cancel
Save