Add Build Mode button in Course Menu

This commit is contained in:
Jonny_Bro (Nikita) 2023-07-24 00:11:42 +05:00
parent 1d96e5fbfa
commit d13c358f7c
2 changed files with 22 additions and 11 deletions

View file

@ -83,7 +83,7 @@ end
local b = AEUI:AddButton(bmbuttons, "Drag (G)", BuildModeHUDButton, "AEUIDefault", 2, 0, false) local b = AEUI:AddButton(bmbuttons, "Drag (G)", BuildModeHUDButton, "AEUIDefault", 2, 0, false)
b.key = KEY_G b.key = KEY_G
b.greyed = GreyButtons b.greyed = GreyButtons
local b = AEUI:AddButton(bmbuttons, "Dupe (SHIFT+D)", BuildModeHUDButton, "AEUIDefault", 2, 25, false) local b = AEUI:AddButton(bmbuttons, "Copy (SHIFT+D)", BuildModeHUDButton, "AEUIDefault", 2, 25, false)
b.key = KEY_D b.key = KEY_D
b.greyed = GreyButtons b.greyed = GreyButtons
local b = AEUI:AddButton(bmbuttons, "Delete (DEL/BCKSPC)", BuildModeHUDButton, "AEUIDefault", 2, 50, false) local b = AEUI:AddButton(bmbuttons, "Delete (DEL/BCKSPC)", BuildModeHUDButton, "AEUIDefault", 2, 50, false)

View file

@ -1,17 +1,17 @@
local coursepanel = { local coursepanel = {
w = 1200, w = 900,
h = 650 h = 650
} }
coursepanel.x = 960 - coursepanel.w * 0.5 coursepanel.x = 950 - coursepanel.w * 0.5
coursepanel.y = 540 - coursepanel.h * 0.5 coursepanel.y = 550 - coursepanel.h * 0.5
coursepanel.bgcolor = Color(32, 32, 32) coursepanel.bgcolor = Color(32, 32, 32)
coursepanel.outlinecolor = Color(54, 55, 56) coursepanel.outlinecolor = Color(54, 55, 56)
coursepanel.alpha = 0.9 coursepanel.alpha = 0.9
coursepanel.elements = {} coursepanel.elements = {}
local function closebutton() local function sacheck()
AEUI:Clear() return not LocalPlayer():IsSuperAdmin()
end end
local function stopbutton() local function stopbutton()
@ -19,20 +19,24 @@ local function stopbutton()
net.SendToServer() net.SendToServer()
end end
local function sacheck() local function buildmodebutton()
return not LocalPlayer():IsSuperAdmin() AEUI:Clear()
LocalPlayer():ConCommand("buildmode")
end end
AEUI:AddText(coursepanel, "Time Trials - " .. game.GetMap(), "AEUIVeryLarge", 20, 30) AEUI:AddText(coursepanel, "Time Trials - " .. game.GetMap(), "AEUIVeryLarge", 20, 30)
AEUI:AddButton(coursepanel, " X ", closebutton, "AEUILarge", coursepanel.w - 47, 0)
local stopbutton = AEUI:AddButton(coursepanel, "Return to Freeplay", stopbutton, "AEUILarge", coursepanel.w - 295, coursepanel.h - 50) local buildmodebutton = AEUI:AddButton(coursepanel, "Build Mode Toggle", buildmodebutton, "AEUILarge", coursepanel.w - 400, coursepanel.h - 50)
buildmodebutton.greyed = sacheck
local stopbutton = AEUI:AddButton(coursepanel, "Return to Freeplay", stopbutton, "AEUILarge", coursepanel.w - 750, coursepanel.h - 50)
stopbutton.greyed = sacheck stopbutton.greyed = sacheck
local courselist = { local courselist = {
w = 800, w = 800,
h = 450, h = 450,
x = 979.2 - coursepanel.w * 0.5, x = 1000 - coursepanel.w * 0.5,
y = 648 - coursepanel.h * 0.5, y = 648 - coursepanel.h * 0.5,
bgcolor = Color(32, 32, 32), bgcolor = Color(32, 32, 32),
outlinecolor = Color(54, 55, 56), outlinecolor = Color(54, 55, 56),
@ -40,6 +44,13 @@ local courselist = {
elements = {} elements = {}
} }
local function closebutton()
AEUI:RemovePanel(courselist)
AEUI:RemovePanel(coursepanel)
end
AEUI:AddButton(coursepanel, " X ", closebutton, "AEUILarge", coursepanel.w - 47, 0)
function OpenCourseMenu() function OpenCourseMenu()
AEUI:AddPanel(coursepanel) AEUI:AddPanel(coursepanel)
AEUI:AddPanel(courselist) AEUI:AddPanel(courselist)