From d13c358f7cd344c4d243af3902380e7c6e183977 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 24 Jul 2023 00:11:42 +0500 Subject: [PATCH] Add Build Mode button in Course Menu --- .../beatrun/gamemode/cl/BuildModeHUD.lua | 2 +- .../beatrun/gamemode/cl/Menu_Course.lua | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/BuildModeHUD.lua b/beatrun/gamemodes/beatrun/gamemode/cl/BuildModeHUD.lua index 2c0e16e..4f854d0 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/BuildModeHUD.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/BuildModeHUD.lua @@ -83,7 +83,7 @@ end local b = AEUI:AddButton(bmbuttons, "Drag (G)", BuildModeHUDButton, "AEUIDefault", 2, 0, false) b.key = KEY_G 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.greyed = GreyButtons local b = AEUI:AddButton(bmbuttons, "Delete (DEL/BCKSPC)", BuildModeHUDButton, "AEUIDefault", 2, 50, false) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua index 919a1a9..6ce80e1 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua @@ -1,17 +1,17 @@ local coursepanel = { - w = 1200, + w = 900, h = 650 } -coursepanel.x = 960 - coursepanel.w * 0.5 -coursepanel.y = 540 - coursepanel.h * 0.5 +coursepanel.x = 950 - coursepanel.w * 0.5 +coursepanel.y = 550 - coursepanel.h * 0.5 coursepanel.bgcolor = Color(32, 32, 32) coursepanel.outlinecolor = Color(54, 55, 56) coursepanel.alpha = 0.9 coursepanel.elements = {} -local function closebutton() - AEUI:Clear() +local function sacheck() + return not LocalPlayer():IsSuperAdmin() end local function stopbutton() @@ -19,20 +19,24 @@ local function stopbutton() net.SendToServer() end -local function sacheck() - return not LocalPlayer():IsSuperAdmin() +local function buildmodebutton() + AEUI:Clear() + + LocalPlayer():ConCommand("buildmode") end 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 local courselist = { w = 800, h = 450, - x = 979.2 - coursepanel.w * 0.5, + x = 1000 - coursepanel.w * 0.5, y = 648 - coursepanel.h * 0.5, bgcolor = Color(32, 32, 32), outlinecolor = Color(54, 55, 56), @@ -40,6 +44,13 @@ local courselist = { elements = {} } +local function closebutton() + AEUI:RemovePanel(courselist) + AEUI:RemovePanel(coursepanel) +end + +AEUI:AddButton(coursepanel, " X ", closebutton, "AEUILarge", coursepanel.w - 47, 0) + function OpenCourseMenu() AEUI:AddPanel(coursepanel) AEUI:AddPanel(courselist)