54 lines
1.3 KiB
Lua
54 lines
1.3 KiB
Lua
|
include("shared.lua")
|
||
|
|
||
|
function ENT:Draw()
|
||
|
self:DrawModel()
|
||
|
end
|
||
|
|
||
|
net.Receive("AOC:OpenMenu", function()
|
||
|
local ent = net.ReadEntity()
|
||
|
|
||
|
local win_w = 400
|
||
|
local win_h = 300
|
||
|
|
||
|
local margin = 10
|
||
|
local btn_h = 35
|
||
|
local btn_w = (win_w - margin * 3) / 2
|
||
|
|
||
|
local main = vgui.Create("DFrame")
|
||
|
main:SetPos(ScrW() / 2, ScrH() / 2)
|
||
|
main:SetSize(win_w, win_h)
|
||
|
main:SetTitle("Advent of code 2023")
|
||
|
main:SetVisible(true)
|
||
|
main:SetDraggable(true)
|
||
|
main:ShowCloseButton(true)
|
||
|
main:MakePopup()
|
||
|
|
||
|
local input = vgui.Create("DTextEntry", main)
|
||
|
input:SetPos(margin, 25 + margin)
|
||
|
input:SetSize(win_w - margin * 2, win_h - btn_h - margin * 3 - 25)
|
||
|
input:SetEnterAllowed(true)
|
||
|
input:SetMultiline(true)
|
||
|
|
||
|
local part1 = vgui.Create("DButton",main)
|
||
|
part1:SetText("Part 1")
|
||
|
part1:SetPos(margin, win_h - btn_h - margin)
|
||
|
part1:SetSize(btn_w, btn_h)
|
||
|
part1.DoClick = function()
|
||
|
net.Start("AOC:Part1")
|
||
|
net.WriteEntity(self)
|
||
|
net.WriteString(input:GetValue())
|
||
|
net.SendToServer()
|
||
|
end
|
||
|
|
||
|
local part2 = vgui.Create("DButton",main)
|
||
|
part2:SetText("Part 2")
|
||
|
part2:SetPos(btn_w + margin * 2, win_h - btn_h - margin)
|
||
|
part2:SetSize(btn_w, btn_h)
|
||
|
part2.DoClick = function()
|
||
|
net.Start("AOC:Part2")
|
||
|
net.WriteEntity(self)
|
||
|
net.WriteString(input:GetValue())
|
||
|
net.SendToServer()
|
||
|
end
|
||
|
end)
|