mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 17:17:33 +00:00
add: better color menu
This commit is contained in:
parent
40ee52e41b
commit
d2a86b2182
|
@ -20,4 +20,30 @@ local colorTbl = {
|
|||
|
||||
function gmInte.getColor(name)
|
||||
return colorTbl[name]
|
||||
end
|
||||
|
||||
function gmInte.applyPaint(element, id)
|
||||
if (element.DoClick) then
|
||||
element:SetTextColor(gmInte.getColor("font"))
|
||||
|
||||
element.Paint = function(self, w, h)
|
||||
local color = gmInte.getColor("primary")
|
||||
|
||||
if (self:IsHovered()) then
|
||||
color = gmInte.getColor("primary-active")
|
||||
end
|
||||
|
||||
draw.RoundedBox(0, 0, 0, w, h, color)
|
||||
end
|
||||
elseif (element.SetTitle) then
|
||||
element.Paint = function(self, w, h)
|
||||
draw.RoundedBox(0, 0, 0, w, h, gmInte.getColor("background"))
|
||||
// first 20px = title bar = primary
|
||||
draw.RoundedBox(0, 0, 0, w, 22, gmInte.getColor("primary"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function gmInte.getFrameName(name)
|
||||
return "Gmod Integration v" .. gmInte.config.version .. " - " .. name
|
||||
end
|
|
@ -6,9 +6,7 @@ function gmInte.openVerifPopup()
|
|||
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
|
||||
gmInte.applyPaint(frame)
|
||||
|
||||
local messageLabel = vgui.Create("DLabel", frame)
|
||||
messageLabel:Dock(FILL)
|
||||
|
@ -31,15 +29,8 @@ function gmInte.openVerifPopup()
|
|||
gui.OpenURL("https://verif.gmod-integration.com")
|
||||
end
|
||||
button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight())
|
||||
gmInte.applyPaint(button)
|
||||
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")
|
||||
|
@ -48,18 +39,11 @@ function gmInte.openVerifPopup()
|
|||
gmInte.SendNet("verifyMe")
|
||||
frame:Close()
|
||||
end,
|
||||
function(err)
|
||||
LocalPlayer():ChatPrint("Failed to refresh verification: " .. err)
|
||||
function(code, body)
|
||||
LocalPlayer():ChatPrint("Failed to refresh verification: " .. code)
|
||||
end)
|
||||
end
|
||||
button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight())
|
||||
gmInte.applyPaint(button)
|
||||
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
|
||||
end
|
Loading…
Reference in New Issue
Block a user