From ee5c17056062925524a7527210ea8a17fb825113 Mon Sep 17 00:00:00 2001 From: Linventif Date: Sat, 10 Feb 2024 00:59:17 +0100 Subject: [PATCH] Update font weight and popup size --- lua/gmod_integration/client/cl__color.lua | 23 +++++++++++ lua/gmod_integration/client/cl_font.lua | 2 +- lua/gmod_integration/client/cl_gui_link.lua | 43 ++++++++++++++------- 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 lua/gmod_integration/client/cl__color.lua diff --git a/lua/gmod_integration/client/cl__color.lua b/lua/gmod_integration/client/cl__color.lua new file mode 100644 index 0000000..7115573 --- /dev/null +++ b/lua/gmod_integration/client/cl__color.lua @@ -0,0 +1,23 @@ +local colorTbl = { + ["background"] = Color(41, 44, 54), + ["primary"] = Color(58, 62, 73), + ["primary-active"] = Color(58, 62, 73, 163), -- Adjusted alpha for opacity + ["secondary"] = Color(44, 47, 59), + ["secondary-active"] = Color(31, 33, 40), + ["green"] = Color(78, 151, 53), + ["green-active"] = Color(58, 122, 38), + ["orange"] = Color(204, 145, 62), + ["orange-active"] = Color(168, 122, 43), + ["red"] = Color(201, 59, 59), + ["red-active"] = Color(168, 43, 43), + ["blue"] = Color(67, 197, 214), + ["blue-active"] = Color(41, 152, 167), + ["purple"] = Color(73, 90, 252), + ["purple-active"] = Color(47, 63, 159), + ["font"] = Color(255, 255, 255), + ["font-secondary"] = Color(179, 179, 179) +} + +function gmInte.getColor(name) + return colorTbl[name] +end \ No newline at end of file diff --git a/lua/gmod_integration/client/cl_font.lua b/lua/gmod_integration/client/cl_font.lua index 7655a1c..eba3bea 100644 --- a/lua/gmod_integration/client/cl_font.lua +++ b/lua/gmod_integration/client/cl_font.lua @@ -1,7 +1,7 @@ surface.CreateFont("GmodIntegration_Roboto_16", { font = "Roboto", size = 16, - weight = 500, + weight = 100, antialias = true, shadow = false }) diff --git a/lua/gmod_integration/client/cl_gui_link.lua b/lua/gmod_integration/client/cl_gui_link.lua index c7e0a10..b648066 100644 --- a/lua/gmod_integration/client/cl_gui_link.lua +++ b/lua/gmod_integration/client/cl_gui_link.lua @@ -1,27 +1,26 @@ function gmInte.openVerifPopup() local frame = vgui.Create("DFrame") - frame:SetSize(400, 140) + frame:SetSize(400, 200) frame:Center() frame:SetTitle("Gmod Integration - Verification Required") frame:SetDraggable(false) frame:ShowCloseButton(false) frame:MakePopup() + frame.Paint = function(self, w, h) + draw.RoundedBox(8, 0, 0, w, h, gmInte.getColor("background")) + end - local messagePanel = vgui.Create("DPanel", frame) - messagePanel:Dock(TOP) - messagePanel:SetSize(300, 40) - messagePanel:DockMargin(10, 0, 10, 10) - messagePanel:SetBackgroundColor(Color(0, 0, 0, 0)) - - local messageLabel = vgui.Create("DLabel", messagePanel) + local messageLabel = vgui.Create("DLabel", frame) messageLabel:Dock(FILL) - messageLabel:SetText("Hey! It looks like you haven't linked your Steam account to Discord yet. This is required to play on this server. Please click the button below to link your account. After you've done that, click the refresh button.") + messageLabel:DockMargin(10, 0, 10, 0) + messageLabel:SetText("Hey,\nIt looks like you haven't linked your Steam account to Discord yet. This is required to play on this server. Please click the button below to link your account.\n\nAfter you've done that, click the refresh button.") messageLabel:SetContentAlignment(5) + messageLabel:SetFont("GmodIntegration_Roboto_16") messageLabel:SetWrap(true) local buttonGrid = vgui.Create("DGrid", frame) buttonGrid:Dock(BOTTOM) - buttonGrid:DockMargin(5, 10, 5, 5) + buttonGrid:DockMargin(10, 0, 10, 10) buttonGrid:SetCols(2) buttonGrid:SetColWide(frame:GetWide() / 2 - 10) buttonGrid:SetRowHeight(35) @@ -31,8 +30,16 @@ function gmInte.openVerifPopup() button.DoClick = function() gui.OpenURL("https://verif.gmod-integration.com") end - button:SetSize(buttonGrid:GetColWide(), buttonGrid:GetRowHeight()) + button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight()) buttonGrid:AddItem(button) + button:SetTextColor(Color(255, 255, 255)) + button.Paint = function(self, w, h) + local color = gmInte.getColor("primary") + if self:IsHovered() then + color = gmInte.getColor("primary-active") + end + draw.RoundedBox(8, 0, 0, w, h, color) + end local button = vgui.Create("DButton") button:SetText("Refresh Verification") @@ -45,6 +52,16 @@ function gmInte.openVerifPopup() LocalPlayer():ChatPrint("Failed to refresh verification: " .. err) end) end - button:SetSize(buttonGrid:GetColWide(), buttonGrid:GetRowHeight()) + button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight()) buttonGrid:AddItem(button) -end \ No newline at end of file + button:SetTextColor(Color(255, 255, 255)) + button.Paint = function(self, w, h) + local color = gmInte.getColor("primary") + if self:IsHovered() then + color = gmInte.getColor("primary-active") + end + draw.RoundedBox(8, 0, 0, w, h, color) + end +end + +gmInte.openVerifPopup() \ No newline at end of file