1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-07 13:49:33 -05:00

Pause menu: add restart game button

This commit is contained in:
Jbleezy 2024-06-26 02:16:45 -07:00
parent 0a5799d183
commit 9d39280bfb
4 changed files with 69 additions and 1 deletions

View File

@ -163,6 +163,7 @@
## General
* Removed round cap
* Removed 5 second wait before match start
* Added restart game button when in online solo game
* Disabled depth of field
* Increased level of detail at longer distances
* Announcer audio always plays

View File

@ -109,6 +109,12 @@ LANG_ENGLISH "MELEE WEAPON"
REFERENCE MENU_PLACEABLE_MINE_CAPS
LANG_ENGLISH "PLACEABLE MINE"
REFERENCE MENU_RESTART_LEVEL_CAPS
LANG_ENGLISH "RESTART GAME"
REFERENCE MENU_RESTART_LEVEL_Q
LANG_ENGLISH "Restart Game?"
REFERENCE CGAME_QUAKE_SUICIDE
LANG_ENGLISH ""

View File

@ -61,6 +61,10 @@ CoD.Class.ResumeGameButtonPressed = function(IngameMenuWidget, ClientInstance)
})
end
CoD.Class.RestartGameButtonPressed = function(IngameMenuWidget, ClientInstance)
IngameMenuWidget:openPopup("RestartGamePopup", ClientInstance.controller)
end
CoD.Class.ChooseTeamButtonPressed = function(IngameMenuWidget, ClientInstance)
if CoD.isZombie == true then
local ClientTeamIndex = UIExpression.Team(ClientInstance.controller, "index")
@ -103,8 +107,9 @@ CoD.Class.PrepareClassButtonList = function(LocalClientIndex, IngameMenuWidget)
})
f12_local0:addElement(IngameMenuWidget.buttonList)
if CoD.isZombie == true then
if Engine.CanPauseZombiesGame() and CoD.canLeaveGame(LocalClientIndex) then
if Engine.CanPauseZombiesGame() and CoD.canLeaveGame(LocalClientIndex) and not Engine.GameModeIsMode(CoD.GAMEMODE_PUBLIC_MATCH) then
CoD.Class.AddButton(IngameMenuWidget, Engine.Localize("MENU_RESUMEGAME_CAPS"), "soloResumeGame")
CoD.Class.AddButton(IngameMenuWidget, Engine.Localize("MENU_RESTART_LEVEL_CAPS"), "openRestartGamePopup")
end
else
if UIExpression.Team(LocalClientIndex, "name") ~= "TEAM_SPECTATOR" and CoD.IsWagerMode() == false then
@ -154,6 +159,7 @@ LUI.createMenu.class = function(LocalClientIndex)
IngameMenuWidget:registerEventHandler("open_endGamePopup", CoD.Class.EndGameButtonPressed)
if CoD.isZombie == true then
IngameMenuWidget:registerEventHandler("soloResumeGame", CoD.Class.ResumeGameButtonPressed)
IngameMenuWidget:registerEventHandler("openRestartGamePopup", CoD.Class.RestartGameButtonPressed)
end
local Mapname = UIExpression.TableLookup(LocalClientIndex, UIExpression.GetCurrentMapTableName(), 0, UIExpression.DvarString(nil, "mapname"), 3)
local f13_local10 = CoD.SplitscreenScaler.new(nil, CoD.SplitscreenMultiplier)

View File

@ -0,0 +1,55 @@
require("T6.HUD.InGameMenus")
CoD.RestartGamePopup = {}
CoD.RestartGamePopup.AddButton = function(f1_arg0, f1_arg1, f1_arg2, f1_arg3)
local f1_local0 = f1_arg0.buttonList:addButton(f1_arg1)
f1_local0:setActionEventName(f1_arg2)
if f1_arg3 == true then
f1_local0:disable()
end
return f1_local0
end
CoD.RestartGamePopup.YesButtonPressed = function(f6_arg0, f6_arg1)
Engine.SetDvar("cl_paused", 0)
Engine.ExecNow(f6_arg1.controller, "fast_restart")
end
CoD.RestartGamePopup.NoButtonPressed = function(f7_arg0, f7_arg1)
f7_arg0:goBack(f7_arg1.controller)
end
LUI.createMenu.RestartGamePopup = function(f8_arg0)
local f8_local0 = CoD.Menu.NewSmallPopup("RestartGamePopup")
f8_local0:setOwner(f8_arg0)
f8_local0:registerEventHandler("close_all_ingame_menus", CoD.InGameMenu.CloseAllInGameMenus)
f8_local0:registerEventHandler("restartGamePopup_YesButtonPressed", CoD.RestartGamePopup.YesButtonPressed)
f8_local0:registerEventHandler("restartGamePopup_NoButtonPressed", CoD.RestartGamePopup.NoButtonPressed)
f8_local0:addSelectButton()
f8_local0:addBackButton()
local f8_local1 = 5
local f8_local2 = LUI.UIText.new()
f8_local2:setLeftRight(true, true, 0, 0)
f8_local2:setTopBottom(true, false, f8_local1, f8_local1 + CoD.textSize.Big)
f8_local2:setFont(CoD.fonts.Big)
f8_local2:setAlignment(LUI.Alignment.Left)
f8_local2:setText(Engine.Localize("MENU_RESTART_LEVEL_Q"))
f8_local0.title = f8_local2
f8_local0:addElement(f8_local2)
f8_local0.buttonList = CoD.ButtonList.new({
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
topAnchor = false,
bottomAnchor = true,
top = -CoD.ButtonPrompt.Height - CoD.CoD9Button.Height * 3 + 10,
bottom = 0,
})
f8_local0:addElement(f8_local0.buttonList)
local f8_local4 = CoD.RestartGamePopup.AddButton(f8_local0, Engine.Localize("MENU_YES"), "restartGamePopup_YesButtonPressed")
local f8_local5 = CoD.RestartGamePopup.AddButton(f8_local0, Engine.Localize("MENU_NO"), "restartGamePopup_NoButtonPressed")
f8_local5:processEvent({
name = "gain_focus",
})
return f8_local0
end