Подскажите как можно кастомизировать стандартное меню f2
gamemodes/darkrp/gamemode/modules/doorsystem/cl_doorvgui.lua
)local function getDoorOwner(door)
local owner = door:getDoorOwner()
if not IsValid(owner) then return nil end
return owner:Nick()
end
local function createDoorMenu(door, allowed)
local frame = vgui.Create("DFrame")
frame:SetSize(300, 400)
frame:Center()
frame:SetTitle("")
frame:MakePopup()
frame:ShowCloseButton(false)
frame.Paint = function(self, w, h)
draw.RoundedBox(8, 0, 0, w, h, Color(45, 45, 45, 230))
draw.RoundedBox(8, 1, 1, w-2, h-2, Color(35, 35, 35, 230))
draw.SimpleText("Управление дверью", "DermaLarge", w/2, 20, Color(255, 255, 255), TEXT_ALIGN_CENTER)
end
local closeButton = vgui.Create("DButton", frame)
closeButton:SetSize(30, 30)
closeButton:SetPos(frame:GetWide() - 35, 5)
closeButton:SetText("X")
closeButton:SetTextColor(Color(255, 255, 255))
closeButton.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(180, 0, 0))
end
closeButton.DoClick = function()
frame:Close()
end
local infoPanel = vgui.Create("DPanel", frame)
infoPanel:SetSize(280, 80)
infoPanel:SetPos(10, 50)
infoPanel.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(50, 50, 50))
local owner = getDoorOwner(door)
local price = door:getPrice()
draw.SimpleText("Статус: " .. (owner and "Занято" or "Свободно"), "DermaDefault", 10, 15, Color(255, 255, 255))
draw.SimpleText("Владелец: " .. (owner or "Нет"), "DermaDefault", 10, 35, Color(255, 255, 255))
draw.SimpleText("Цена: " .. price .. "₽", "DermaDefault", 10, 55, Color(255, 255, 255))
end
local buttonPanel = vgui.Create("DPanel", frame)
buttonPanel:SetSize(280, 250)
buttonPanel:SetPos(10, 140)
buttonPanel.Paint = function() end
local buttons = {}
local function CreateDoorButton(text, y, color, callback)
local button = vgui.Create("DButton", buttonPanel)
button:SetSize(280, 40)
button:SetPos(0, y)
button:SetText(text)
button:SetTextColor(Color(255, 255, 255))
button.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, color)
if self:IsHovered() then
draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 10))
end
end
button.DoClick = callback
return button
end
if not door:isKeysOwned() then
buttons.buy = CreateDoorButton("Купить", 0, Color(0, 150, 0), function()
RunConsoleCommand("darkrp", "buydoor")
frame:Close()
end)
else
buttons.sell = CreateDoorButton("Продать", 0, Color(200, 0, 0), function()
RunConsoleCommand("darkrp", "selldoor")
frame:Close()
end)
end
if door:isKeysOwned() then
buttons.addOwner = CreateDoorButton("Добавить владельца", 50, Color(0, 100, 150), function()
RunConsoleCommand("darkrp", "addowner")
frame:Close()
end)
end
if door:isKeysOwned() then
buttons.removeOwner = CreateDoorButton("Удалить владельца", 100, Color(150, 0, 150), function()
RunConsoleCommand("darkrp", "removeowner")
frame:Close()
end)
end
if door:isKeysOwned() then
buttons.title = CreateDoorButton("Изменить заголовок", 150, Color(150, 150, 0), function()
Derma_StringRequest(
"Заголовок двери",
"Введите новый заголовок для двери:",
"",
function(text)
RunConsoleCommand("darkrp", "title", text)
frame:Close()
end,
function() end
)
end)
end
if door:isKeysOwned() then
buttons.description = CreateDoorButton("Изменить описание", 200, Color(100, 100, 100), function()
Derma_StringRequest(
"Описание двери",
"Введите новое описание для двери:",
"",
function(text)
RunConsoleCommand("darkrp", "description", text)
frame:Close()
end,
function() end
)
end)
end
end
hook.Add("DarkRP_DoorMenu", "CustomDoorMenu", createDoorMenu)