From ab388b71864ed45033b50d52e01a528548e39d86 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Tue, 19 Dec 2023 01:41:41 -0800 Subject: [PATCH] Add game mode and map list select menu --- .gitignore | 7 +- english/localizedstrings/reimagined.str | 17 + ui/t6/mainlobby.lua | 839 ++++++++++++++++++++ ui/t6/maps.lua | 321 ++++++++ ui_mp/t6/menus/privategamelobby_project.lua | 666 ++++++++++++++++ zone_source/mod.zone | 5 + 6 files changed, 1853 insertions(+), 2 deletions(-) create mode 100644 english/localizedstrings/reimagined.str create mode 100644 ui/t6/mainlobby.lua create mode 100644 ui/t6/maps.lua create mode 100644 ui_mp/t6/menus/privategamelobby_project.lua create mode 100644 zone_source/mod.zone diff --git a/.gitignore b/.gitignore index ea6aef9e..196f6303 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ /.vscode -TODO.md +*.ff +*.iwd +build.bat _zm_test.gsc games_mp.log -zmStats \ No newline at end of file +zmStats +TODO.md \ No newline at end of file diff --git a/english/localizedstrings/reimagined.str b/english/localizedstrings/reimagined.str new file mode 100644 index 00000000..2259cd2a --- /dev/null +++ b/english/localizedstrings/reimagined.str @@ -0,0 +1,17 @@ +VERSION "1" +CONFIG "C:/projects/cod/t6/bin/StringEd.cfg" +FILENOTES "" + +REFERENCE ZMUI_CLASSIC_GAMEMODE_CAPS +LANG_ENGLISH "CLASSIC" + +REFERENCE ZMUI_SNR_CAPS +LANG_ENGLISH "SEARCH & REZURRECT" + +REFERENCE ZMUI_DOCKS_CAPS +LANG_ENGLISH "DOCKS" + +REFERENCE ZMUI_MAZE_CAPS +LANG_ENGLISH "MAZE" + +ENDMARKER \ No newline at end of file diff --git a/ui/t6/mainlobby.lua b/ui/t6/mainlobby.lua new file mode 100644 index 00000000..6315e6cd --- /dev/null +++ b/ui/t6/mainlobby.lua @@ -0,0 +1,839 @@ +require("T6.CoDBase") +require("T6.Lobby") +require("T6.EdgeShadow") +require("T6.Menus.Playercard") +require("T6.JoinableList") +require("T6.Error") +require("T6.Menus.CODTv") +require("T6.Menus.SignOutPopup") +require("T6.Menus.RejoinSessionPopup") +require("T6.Mods") +require("T6.Maps") +if CoD.isWIIU then + require("T6.WiiUControllerSettings") +end +if CoD.isZombie == false and (CoD.isXBOX or CoD.isPS3) then + require("T6.Menus.EliteAppPopup") +end +CoD.MainLobby = {} +CoD.MainLobby.ShouldPreventCreateLobby = function () + if UIExpression.AcceptingInvite() == 1 or Engine.IsJoiningAnotherParty() == 1 or UIExpression.PrivatePartyHost() == 0 or Engine.IsGameLobbyRunning() then + return true + else + return false + end +end + +CoD.MainLobby.OnlinePlayAvailable = function (MainLobbyWidget, ClientInstance, Boolean) + if Boolean == nil then + Boolean = false + end + if CoD.isPC and Engine.IsVacBanned() then + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("PLATFORM_VACBANNED")) + ErrorPopup.anyControllerAllowed = true + ErrorPopup.callingMenu = MainLobbyWidget + return 0 + elseif CoD.isWIIU and Engine.IsSignedInToDemonware(ClientInstance.controller) == false then + if UIExpression.IsPrimaryLocalClient(ClientInstance.controller) == 1 then + Engine.Exec(ClientInstance.controller, "xsigninlive") + end + return 0 + elseif UIExpression.IsGuest(ClientInstance.controller) == 1 then + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("XBOXLIVE_NOGUESTACCOUNTS")) + ErrorPopup.anyControllerAllowed = true + elseif UIExpression.DvarBool(ClientInstance.controller, "live_betaexpired") == 1 then + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("MP_BETACLOSED")) + elseif UIExpression.IsSignedInToLive(ClientInstance.controller) == 0 then + if CoD.isPS3 or CoD.isWIIU then + if UIExpression.IsPrimaryLocalClient(ClientInstance.controller) == 1 then + Engine.Exec(ClientInstance.controller, "xsigninlive") + else + Engine.Exec(ClientInstance.controller, "signclientin") + end + elseif CoD.isPC then + if 0 == UIExpression.GetUsedControllerCount() then + Engine.Exec(ClientInstance.controller, "xsigninlivenoguests") + else + Engine.Exec(ClientInstance.controller, "xsigninlive") + end + elseif 0 == UIExpression.GetUsedControllerCount() then + Engine.Exec(ClientInstance.controller, "xsigninlivenoguests") + elseif UIExpression.IsSignedIn(ClientInstance.controller) == 1 then + MainLobbyWidget:openPopup("popup_signintolive", ClientInstance.controller) + else + Engine.Exec(ClientInstance.controller, "xsigninlive") + end + elseif (UIExpression.IsContentRatingAllowed(ClientInstance.controller) == 0 or UIExpression.IsAnyControllerMPRestricted() == 1) and not Boolean then + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("XBOXLIVE_MPNOTALLOWED")) + ErrorPopup.anyControllerAllowed = true + elseif UIExpression.IsDemonwareFetchingDone(ClientInstance.controller) == 1 then + local PlayerStatTable1 = Engine.GetPlayerStats(ClientInstance.controller) + local PlayerStatTable2 = Engine.GetPlayerStats(ClientInstance.controller) + if PlayerStatTable1.cacLoadouts.resetWarningDisplayed:get() == 0 then + PlayerStatTable1.cacLoadouts.resetWarningDisplayed:set(1) + if PlayerStatTable2.cacLoadouts.classWarningDisplayed ~= nil then + PlayerStatTable2.cacLoadouts.classWarningDisplayed:set(1) + end + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("MENU_STATS_RESET")) + ErrorPopup.anyControllerAllowed = true + elseif CoD.isZombie == false and PlayerStatTable2.cacLoadouts.classWarningDisplayed:get() == 0 then + PlayerStatTable2.cacLoadouts.classWarningDisplayed:set(1) + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("MENU_RESETCUSTOMCLASSES")) + ErrorPopup.anyControllerAllowed = true + else + return 1 + end + else + Engine.ExecNow(nil, "initiatedemonwareconnect") + local ConnectingDemonwarePopup = MainLobbyWidget:openPopup("popup_connectingdw", ClientInstance.controller) + ConnectingDemonwarePopup.openingStore = Boolean + ConnectingDemonwarePopup.callingMenu = MainLobbyWidget + end + return 0 +end + +CoD.MainLobby.IsControllerCountValid = function (MainLobbyWidget, LocalClientIndex, MaxLocalPlayers) + if MaxLocalPlayers < UIExpression.GetUsedControllerCount() then + local ErrorPopup = MainLobbyWidget:openPopup("Error", LocalClientIndex) + ErrorPopup:setMessage(Engine.Localize("XBOXLIVE_TOOMANYCONTROLLERS")) + ErrorPopup.anyControllerAllowed = true + return 0 + else + return 1 + end +end + +CoD.MainLobby.OpenPlayerMatchPartyLobby = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then + Engine.ProbationCheckForDashboardWarning(CoD.GAMEMODE_PUBLIC_MATCH) + local InProbation, LocalClientIndexInProbation = Engine.ProbationCheckInProbation(CoD.GAMEMODE_PUBLIC_MATCH) + if InProbation == true then + MainLobbyWidget:openPopup("popup_public_inprobation", LocalClientIndexInProbation) + return + end + local GivenProbation, LocalClientIndexGivenProbation = Engine.ProbationCheckForProbation(CoD.GAMEMODE_PUBLIC_MATCH) + if GivenProbation == true then + MainLobbyWidget:openPopup("popup_public_givenprobation", LocalClientIndexGivenProbation) + return + elseif Engine.ProbationCheckParty(CoD.GAMEMODE_PUBLIC_MATCH, ClientInstance.controller) == true then + MainLobbyWidget:openPopup("popup_public_partyprobation", ClientInstance.controller) + return + end + local MaxLocalPlayers = UIExpression.DvarInt(LocalClientIndexGivenProbation, "party_maxlocalplayers_playermatch") + if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, MaxLocalPlayers) == 1 then + MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = MaxLocalPlayers + CoD.SwitchToPlayerMatchLobby(ClientInstance.controller) + if CoD.isZombie == true then + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST) + CoD.PlaylistCategoryFilter = "playermatch" + Engine.SetDvar("ui_game_lobby_open", 0) + MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller) + CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller) + else + MainLobbyWidget:openMenu("PlayerMatchPartyLobby", ClientInstance.controller) + end + MainLobbyWidget:close() + end + end +end + +CoD.MainLobby.OpenLeagueSelectionPopup = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then + Engine.ProbationCheckForDashboardWarning(CoD.GAMEMODE_PUBLIC_MATCH) + local InProbation, LocalClientIndexInProbation = Engine.ProbationCheckInProbation(CoD.GAMEMODE_LEAGUE_MATCH) + if InProbation == true then + MainLobbyWidget:openPopup("popup_league_inprobation", LocalClientIndexInProbation) + return + end + local GivenProbation, LocalClientIndexGivenProbation = Engine.ProbationCheckForProbation(CoD.GAMEMODE_LEAGUE_MATCH) + if GivenProbation == true then + MainLobbyWidget:openPopup("popup_league_givenprobation", LocalClientIndexGivenProbation) + return + elseif Engine.ProbationCheckParty(CoD.GAMEMODE_LEAGUE_MATCH, ClientInstance.controller) == true then + MainLobbyWidget:openPopup("popup_league_partyprobation", ClientInstance.controller) + return + end + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST) + CoD.PlaylistCategoryFilter = "leaguematch" + PlaylistPopup = MainLobbyWidget:openPopup("PlaylistSelection", ClientInstance.controller) + PlaylistPopup:addCategoryButtons(ClientInstance.controller) + Engine.PlaySound("cac_screen_fade") + end +end + +CoD.MainLobby.OpenLeaguePlayPartyLobby = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then + local MaxLocalPlayers = UIExpression.DvarInt(ClientInstance.controller, "party_maxlocalplayers_playermatch") + if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, MaxLocalPlayers) == 1 then + MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = MaxLocalPlayers + CoD.SwitchToLeagueMatchLobby(ClientInstance.controller) + MainLobbyWidget:openMenu("LeaguePlayPartyLobby", ClientInstance.controller) + MainLobbyWidget:close() + end + end +end + +CoD.MainLobby.OpenCustomGamesLobby = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 and CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, UIExpression.DvarInt(ClientInstance.controller, "party_maxlocalplayers_privatematch")) == 1 then + -- CoD.SwitchToPrivateLobby(ClientInstance.controller) + if CoD.isZombie == true then + Engine.SetDvar("ui_zm_mapstartlocation", "") + Engine.SetDvar("ui_game_lobby_open", 0) + MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller) + -- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller) + else + local PrivateOnlineLobbyMenu = MainLobbyWidget:openMenu("PrivateOnlineGameLobby", ClientInstance.controller) + end + MainLobbyWidget:close() + end +end + +CoD.MainLobby.OpenSoloLobby_Zombie = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then + if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, 1) == 1 then + MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1 + CoD.SwitchToPlayerMatchLobby(ClientInstance.controller) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST) + Dvar.party_maxplayers:set(1) + CoD.PlaylistCategoryFilter = CoD.Zombie.PLAYLIST_CATEGORY_FILTER_SOLOMATCH + Engine.SetDvar("ui_game_lobby_open", 0) + MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller) + -- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller) + MainLobbyWidget:close() + end + end +end + +CoD.MainLobby.OpenTheaterLobby = function (MainLobbyWidget, ClientInstance) + if CoD.MainLobby.ShouldPreventCreateLobby() then + return + elseif UIExpression.CanSwitchToLobby(ClientInstance.controller, Dvar.party_maxplayers_theater:get(), Dvar.party_maxlocalplayers_theater:get()) == 0 then + Dvar.ui_errorTitle:set(Engine.Localize("MENU_NOTICE_CAPS")) + Dvar.ui_errorMessage:set(Engine.Localize("MENU_FILESHARE_MAX_LOCAL_PLAYERS")) + CoD.Menu.OpenErrorPopup(MainLobbyWidget, { + controller = ClientInstance.controller + }) + return + elseif Engine.CanViewContent() == false then + MainLobbyWidget:openPopup("popup_contentrestricted", ClientInstance.controller) + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 and CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, UIExpression.DvarInt(ClientInstance.controller, "party_maxlocalplayers_theater")) == 1 then + CoD.SwitchToTheaterLobby(ClientInstance.controller) + local TheaterLobbyMenu = MainLobbyWidget:openMenu("TheaterLobby", ClientInstance.controller, { + parent = "MainLobby" + }) + MainLobbyWidget:close() + end +end + +CoD.MainLobby.OpenCODTV = function (MainLobbyWidget, ClientInstance) + if Engine.CanViewContent() == false then + MainLobbyWidget:openPopup("popup_contentrestricted", ClientInstance.controller) + return + elseif Engine.IsLivestreamEnabled() then + MainLobbyWidget:openPopup("CODTv_Error", ClientInstance.controller) + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 and Engine.IsCodtvContentLoaded() == true then + CoD.perController[ClientInstance.controller].codtvRoot = "community" + MainLobbyWidget:openPopup("CODTv", ClientInstance.controller) + end +end + +CoD.MainLobby.OpenBarracks = function (MainLobbyWidget, ClientInstance) + if UIExpression.IsGuest(ClientInstance.controller) == 1 then + MainLobbyWidget:openPopup("popup_guest_contentrestricted", ClientInstance.controller) + return + elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then + if CoD.isZombie == true then + Engine.Exec(ClientInstance.controller, "party_setHostUIString ZMUI_VIEWING_LEADERBOARD") + MainLobbyWidget:openPopup("LeaderboardCarouselZM", ClientInstance.controller) + else + Engine.Exec(ClientInstance.controller, "party_setHostUIString MENU_VIEWING_PLAYERCARD") + MainLobbyWidget:openPopup("Barracks", ClientInstance.controller) + end + end +end + +CoD.MainLobby.OpenStore = function (MainLobbyWidget, ClientInstance) + if MainLobbyWidget.occludedBy then + return + end + Engine.SetDvar("ui_openStoreForMTX", 0) + if Engine.CheckNetConnection() == false then + local NetConnectionCheckPopup = MainLobbyWidget:openPopup("popup_net_connection_store", ClientInstance.controller) + NetConnectionCheckPopup.callingMenu = MainLobbyWidget + return + end + Engine.Exec(ClientInstance.controller, "setclientbeingusedandprimary") + if CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance, true) == 1 then + if not CoD.isPS3 or UIExpression.IsSubUser(ClientInstance.controller) ~= 1 then + Dvar.ui_storeButtonPressed:set(true) + CoD.perController[ClientInstance.controller].codtvRoot = "ingamestore" + if CoD.isPC then + Engine.ShowMarketplaceUI(ClientInstance.controller) + else + MainLobbyWidget:openPopup("CODTv", ClientInstance.controller) + end + else + local ErrorPopup = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + ErrorPopup:setMessage(Engine.Localize("MENU_SUBUSERS_NOTALLOWED")) + ErrorPopup.anyControllerAllowed = true + end + end +end + +CoD.MainLobby.OpenControlsMenu = function (MainLobbyWidget, ClientInstance) + MainLobbyWidget:openPopup("WiiUControllerSettings", ClientInstance.controller, true) +end + +CoD.MainLobby.OpenOptionsMenu = function (MainLobbyWidget, ClientInstance) + MainLobbyWidget:openPopup("OptionsMenu", ClientInstance.controller) +end + +CoD.MainLobby.UpdateButtonPaneButtonVisibilty_Multiplayer = function (MainLobbyButtonPane) + if CoD.isPartyHost() then + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.matchmakingButton) + --MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.leaguePlayButton) + if not Engine.IsBetaBuild() then + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.customGamesButton) + end + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.theaterButton) + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.postTheaterSpacer) + else + MainLobbyButtonPane.body.matchmakingButton:closeAndRefocus(MainLobbyButtonPane.body.barracksButton) + --MainLobbyButtonPane.body.leaguePlayButton:closeAndRefocus(MainLobbyButtonPane.body.barracksButton) + if not Engine.IsBetaBuild() then + MainLobbyButtonPane.body.customGamesButton:closeAndRefocus(MainLobbyButtonPane.body.barracksButton) + end + MainLobbyButtonPane.body.theaterButton:closeAndRefocus(MainLobbyButtonPane.body.barracksButton) + MainLobbyButtonPane.body.postTheaterSpacer:closeAndRefocus(MainLobbyButtonPane.body.barracksButton) + MainLobbyButtonPane.body.serverBrowserButton:closeAndRefocus(MainLobbyButtonPane.body.serverBrowserButton) + end +end + +CoD.MainLobby.UpdateButtonPaneButtonVisibilty_Zombie = function (MainLobbyButtonPane) + if CoD.isPartyHost() then + -- MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.matchmakingButton) + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.customSpacer) + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.customGamesButton) + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.theaterSpacer) + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.theaterButton) + if UIExpression.DvarInt(nil, "party_playerCount") <= 1 then + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.soloPlayButton) + else + MainLobbyButtonPane.body.soloPlayButton:closeAndRefocus(MainLobbyButtonPane.body.theaterButton) + end + MainLobbyButtonPane.body.buttonList:addElement(MainLobbyButtonPane.body.optionSpacer) + else + -- MainLobbyButtonPane.body.matchmakingButton:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.soloPlayButton:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.customSpacer:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.customGamesButton:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.theaterButton:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.theaterSpacer:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.optionSpacer:closeAndRefocus(MainLobbyButtonPane.body.optionsButton) + MainLobbyButtonPane.body.serverBrowserButton:closeAndRefocus(MainLobbyButtonPane.body.serverBrowserButton) + end +end + +CoD.MainLobby.UpdateButtonPaneButtonVisibilty = function (MainLobbyButtonPane) + if MainLobbyButtonPane == nil or MainLobbyButtonPane.body == nil then + return + elseif CoD.isZombie == true then + CoD.MainLobby.UpdateButtonPaneButtonVisibilty_Zombie(MainLobbyButtonPane) + else + CoD.MainLobby.UpdateButtonPaneButtonVisibilty_Multiplayer(MainLobbyButtonPane) + end + MainLobbyButtonPane:setLayoutCached(false) +end + +CoD.MainLobby.UpdateButtonPromptVisibility = function (MainLobbyWidget) + if MainLobbyWidget == nil then + return + end + MainLobbyWidget:removeBackButton() + local ShouldAddJoinButton = false + if MainLobbyWidget.joinButton ~= nil then + MainLobbyWidget.joinButton:close() + ShouldAddJoinButton = true + end + MainLobbyWidget.friendsButton:close() + if MainLobbyWidget.partyPrivacyButton ~= nil then + MainLobbyWidget.partyPrivacyButton:close() + end + MainLobbyWidget:addBackButton() + MainLobbyWidget:addFriendsButton() + if ShouldAddJoinButton then + MainLobbyWidget:addJoinButton() + end + if MainLobbyWidget.panelManager.slidingEnabled ~= true then + MainLobbyWidget.friendsButton:disable() + end + if MainLobbyWidget.panelManager:isPanelOnscreen("buttonPane") then + MainLobbyWidget:addPartyPrivacyButton() + end + MainLobbyWidget:addNATType() +end + +CoD.MainLobby.PopulateButtons_Multiplayer = function (MainLobbyButtonPane) + MainLobbyButtonPane.body.serverBrowserButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("SERVER BROWSER"), nil, 1) + MainLobbyButtonPane.body.serverBrowserButton.hintText = Engine.Localize(CoD.MPZM("MPUI_PLAYER_MATCH_DESC", "ZMUI_PLAYER_MATCH_DESC")) + MainLobbyButtonPane.body.serverBrowserButton:setActionEventName("open_server_browser_mainlobby") + CoD.SetupMatchmakingLock(MainLobbyButtonPane.body.serverBrowserButton) + if Engine.IsBetaBuild() then + MainLobbyButtonPane.body.matchmakingButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_MATCHMAKING_CAPS"), nil, 3) + --MainLobbyButtonPane.body.leaguePlayButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_LEAGUE_PLAY_CAPS"), nil, 2) + else + MainLobbyButtonPane.body.matchmakingButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_MATCHMAKING_CAPS"), nil, 2) + --MainLobbyButtonPane.body.leaguePlayButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_LEAGUE_PLAY_CAPS"), nil, 3) + end + MainLobbyButtonPane.body.matchmakingButton.hintText = Engine.Localize(CoD.MPZM("MPUI_PLAYER_MATCH_DESC", "ZMUI_PLAYER_MATCH_DESC")) + MainLobbyButtonPane.body.matchmakingButton:setActionEventName("open_player_match_party_lobby") + CoD.SetupMatchmakingLock(MainLobbyButtonPane.body.matchmakingButton) + --MainLobbyButtonPane.body.leaguePlayButton.hintText = Engine.Localize("MPUI_LEAGUE_PLAY_DESC") + --MainLobbyButtonPane.body.leaguePlayButton:setActionEventName("open_league_play_party_lobby") + if not Engine.IsBetaBuild() then + MainLobbyButtonPane.body.customGamesButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_CUSTOMGAMES_CAPS"), nil, 4) + MainLobbyButtonPane.body.customGamesButton.hintText = Engine.Localize(CoD.MPZM("MPUI_CUSTOM_MATCH_DESC", "ZMUI_CUSTOM_MATCH_DESC")) + MainLobbyButtonPane.body.customGamesButton:setActionEventName("open_custom_games_lobby") + CoD.SetupCustomGamesLock(MainLobbyButtonPane.body.customGamesButton) + end + MainLobbyButtonPane.body.theaterButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_THEATER_CAPS"), nil, 5) + MainLobbyButtonPane.body.theaterButton:setActionEventName("open_theater_lobby") + MainLobbyButtonPane.body.theaterButton.hintText = Engine.Localize(CoD.MPZM("MPUI_THEATER_DESC", "ZMUI_THEATER_DESC")) + MainLobbyButtonPane.body.postTheaterSpacer = MainLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2, 6) + if not Engine.IsBetaBuild() then + MainLobbyButtonPane.body.barracksButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_BARRACKS_CAPS"), nil, 7) + MainLobbyButtonPane.body.barracksButton.id = "CoD9Button" .. "." .. "MainLobby" .. "." .. Engine.Localize("MENU_BARRACKS_CAPS") + CoD.SetupBarracksLock(MainLobbyButtonPane.body.barracksButton) + CoD.SetupBarracksNew(MainLobbyButtonPane.body.barracksButton) + MainLobbyButtonPane.body.barracksButton:setActionEventName("open_barracks") + end + if CoD.isZombie == false and not Engine.IsBetaBuild() and (CoD.isXBOX or CoD.isPS3) and Engine.IsEliteAvailable() and Engine.IsEliteButtonAvailable() then + MainLobbyButtonPane.body.eliteAppButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_ELITE_CAPS"), nil, 8) + MainLobbyButtonPane.body.eliteAppButton.hintText = Engine.Localize("MENU_ELITE_DESC") + MainLobbyButtonPane.body.eliteAppButton:setActionEventName("open_eliteapp_popup") + end + MainLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2, 9) + MainLobbyButtonPane.body.optionsButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_OPTIONS_CAPS"), nil, 11) + MainLobbyButtonPane.body.optionsButton.hintText = Engine.Localize("MPUI_OPTIONS_DESC") + MainLobbyButtonPane.body.optionsButton:setActionEventName("open_options_menu") + MainLobbyButtonPane.body.modsButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MODS"), nil, 12) + MainLobbyButtonPane.body.modsButton:setActionEventName("open_mods_menu") +end + +CoD.MainLobby.PopulateButtons_Zombie = function (MainLobbyButtonPane) + MainLobbyButtonPane.body.serverBrowserButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("SERVER BROWSER"), nil, 1) + MainLobbyButtonPane.body.serverBrowserButton.hintText = Engine.Localize(CoD.MPZM("MPUI_PLAYER_MATCH_DESC", "ZMUI_PLAYER_MATCH_DESC")) + MainLobbyButtonPane.body.serverBrowserButton:setActionEventName("open_server_browser_mainlobby") + CoD.SetupMatchmakingLock(MainLobbyButtonPane.body.serverBrowserButton) + -- MainLobbyButtonPane.body.matchmakingButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_MATCHMAKING_CAPS"), nil, 2) + -- MainLobbyButtonPane.body.matchmakingButton.hintText = Engine.Localize(CoD.MPZM("MPUI_PLAYER_MATCH_DESC", "ZMUI_PLAYER_MATCH_DESC")) + -- MainLobbyButtonPane.body.matchmakingButton:setActionEventName("open_player_match_party_lobby") + -- CoD.SetupMatchmakingLock(MainLobbyButtonPane.body.matchmakingButton) + MainLobbyButtonPane.body.soloPlayButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("ZMUI_SOLO_PLAY_CAPS"), nil, 3) + MainLobbyButtonPane.body.soloPlayButton.hintText = Engine.Localize("ZMUI_SOLO_PLAY_DESC") + MainLobbyButtonPane.body.soloPlayButton:setActionEventName("open_solo_lobby_zombie") + MainLobbyButtonPane.body.customSpacer = MainLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2, 3) + MainLobbyButtonPane.body.customGamesButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_CUSTOMGAMES_CAPS"), nil, 4) + MainLobbyButtonPane.body.customGamesButton.hintText = Engine.Localize(CoD.MPZM("MPUI_CUSTOM_MATCH_DESC", "ZMUI_CUSTOM_MATCH_DESC")) + MainLobbyButtonPane.body.customGamesButton:setActionEventName("open_custom_games_lobby") + CoD.SetupCustomGamesLock(MainLobbyButtonPane.body.customGamesButton) + MainLobbyButtonPane.body.theaterButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_THEATER_CAPS"), nil, 5) + MainLobbyButtonPane.body.theaterButton:setActionEventName("open_theater_lobby") + MainLobbyButtonPane.body.theaterButton.hintText = Engine.Localize(CoD.MPZM("MPUI_THEATER_DESC", "ZMUI_THEATER_DESC")) + MainLobbyButtonPane.body.theaterSpacer = MainLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2, 6) + MainLobbyButtonPane.body.barracksButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MPUI_LEADERBOARDS_CAPS"), nil, 7) + CoD.SetupBarracksLock(MainLobbyButtonPane.body.barracksButton) + MainLobbyButtonPane.body.barracksButton:setActionEventName("open_barracks") + MainLobbyButtonPane.body.optionSpacer = MainLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2, 8) + MainLobbyButtonPane.body.optionsButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_OPTIONS_CAPS"), nil, 9) + MainLobbyButtonPane.body.optionsButton.hintText = Engine.Localize("MPUI_OPTIONS_DESC") + MainLobbyButtonPane.body.optionsButton:setActionEventName("open_options_menu") + MainLobbyButtonPane.body.modsButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MODS"), nil, 10) + MainLobbyButtonPane.body.modsButton:setActionEventName("open_mods_menu") +end + +CoD.MainLobby.PopulateButtons = function (MainLobbyButtonPane) + if CoD.isZombie == true then + CoD.MainLobby.PopulateButtons_Zombie(MainLobbyButtonPane) + else + CoD.MainLobby.PopulateButtons_Multiplayer(MainLobbyButtonPane) + end + if CoD.isWIIU then + MainLobbyButtonPane.body.controlsButton = MainLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_CONTROLLER_SETTINGS_CAPS"), nil, 9) + MainLobbyButtonPane.body.controlsButton.hintText = Engine.Localize("MENU_CONTROLLER_SETTINGS_DESC") + MainLobbyButtonPane.body.controlsButton:setActionEventName("open_controls_menu") + end + if CoD.isOnlineGame() then + if MainLobbyButtonPane.playerCountLabel == nil then + MainLobbyButtonPane.playerCountLabel = LUI.UIText.new() + MainLobbyButtonPane:addElement(MainLobbyButtonPane.playerCountLabel) + end + MainLobbyButtonPane.playerCountLabel:setLeftRight(true, false, 0, 0) + MainLobbyButtonPane.playerCountLabel:setTopBottom(false, true, -30 - CoD.textSize.Big, -30) + MainLobbyButtonPane.playerCountLabel:setFont(CoD.fonts.Big) + MainLobbyButtonPane.playerCountLabel:setRGB(CoD.offWhite.r, CoD.offWhite.g, CoD.offWhite.b) + local PlayerCountText = CoD.Menu.GetOnlinePlayerCountText() + local PlayerCountUpdateTimer = nil + if PlayerCountText ~= "" then + MainLobbyButtonPane.playerCountLabel:setText(PlayerCountText) + PlayerCountUpdateTimer = LUI.UITimer.new(60000, "update_online_player_count", false, MainLobbyButtonPane.playerCountLabel) + else + PlayerCountUpdateTimer = LUI.UITimer.new(1000, "update_online_player_count", false, MainLobbyButtonPane.playerCountLabel) + end + MainLobbyButtonPane.playerCountLabel:registerEventHandler("update_online_player_count", CoD.MainLobby.UpdateOnlinePlayerCount) + MainLobbyButtonPane.playerCountLabel.timer = PlayerCountUpdateTimer + MainLobbyButtonPane:addElement(PlayerCountUpdateTimer) + end +end + +CoD.MainLobby.UpdateOnlinePlayerCount = function (PlayerCountLabel) + if CoD.isOnlineGame() then + local PlayerCountText = CoD.Menu.GetOnlinePlayerCountText() + if PlayerCountText ~= "" then + PlayerCountLabel:setText(PlayerCountText) + PlayerCountLabel.timer.interval = 60000 + PlayerCountLabel.timer:reset() + end + end +end + +CoD.MainLobby.FirstSignedInToLive = function (MainLobbyWidget) + if MainLobbyWidget ~= nil then + if CoD.isXBOX then + MainLobbyWidget.anyControllerAllowed = false + end + if MainLobbyWidget.friendsButton == nil then + MainLobbyWidget:addFriendsButton() + end + end +end + +CoD.MainLobby.LastSignedOutOfLive = function (MainLobbyWidget) + if MainLobbyWidget ~= nil and CoD.isXBOX then + MainLobbyWidget.anyControllerAllowed = true + end +end + +CoD.MainLobby.PlayerSelected = function (MainLobbyWidget, PlayerSelectedEvent) + if MainLobbyWidget.joinable ~= nil and CoD.canJoinSession(UIExpression.GetPrimaryController(), PlayerSelectedEvent.playerXuid) then + if MainLobbyWidget.joinButton == nil and not MainLobbyWidget.m_blockJoinButton then + MainLobbyWidget:addJoinButton() + MainLobbyWidget:addNATType() + end + elseif MainLobbyWidget.joinButton ~= nil then + MainLobbyWidget.joinButton:close() + MainLobbyWidget.joinButton = nil + end + MainLobbyWidget:dispatchEventToChildren(PlayerSelectedEvent) +end + +CoD.MainLobby.PlayerDeselected = function (MainLobbyWidget, PlayerDeselectedEvent) + if MainLobbyWidget.joinButton ~= nil then + MainLobbyWidget.joinButton:close() + MainLobbyWidget.joinButton = nil + end + MainLobbyWidget:dispatchEventToChildren(PlayerDeselectedEvent) +end + +CoD.MainLobby.CurrentPanelChanged = function (MainLobbyWidget, f27_arg1) + if CoD.isPC then + MainLobbyWidget.m_blockJoinButton = f27_arg1.id ~= "PanelManager.lobbyPane" + end +end + +--Unused skipped +CoD.MainLobby.BusyList_Update = function (f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4) + CoD.PlayerList.Update(f28_arg0, Engine.GetBusyFriendsOfAllLocalPlayers(f28_arg0.maxRows - f28_arg2), f28_arg2, f28_arg3, f28_arg4) +end + +CoD.MainLobby.Update = function (MainLobbyWidget, ClientInstance) + if MainLobbyWidget == nil then + return + elseif UIExpression.IsDemonwareFetchingDone(ClientInstance.controller) == 1 == true then + MainLobbyWidget.panelManager:processEvent({ + name = "fetching_done" + }) + end + CoD.MainLobby.UpdateButtonPaneButtonVisibilty(MainLobbyWidget.buttonPane) + CoD.MainLobby.UpdateButtonPromptVisibility(MainLobbyWidget) + MainLobbyWidget:dispatchEventToChildren(ClientInstance) +end + +CoD.MainLobby.ClientLeave = function (MainLobbyWidget, ClientInstance) + Engine.ExecNow(ClientInstance.controller, "leaveAllParties") + Engine.PartyHostClearUIState() + CoD.StartMainLobby(ClientInstance.controller) + CoD.MainLobby.UpdateButtonPaneButtonVisibilty(MainLobbyWidget.buttonPane) + CoD.MainLobby.UpdateButtonPromptVisibility() +end + +CoD.MainLobby.GoBack = function (MainLobbyWidget, ClientInstance) + Engine.SessionModeResetModes() + Engine.Exec(ClientInstance.controller, "xstopprivateparty") + if CoD.isPS3 then + Engine.Exec(ClientInstance.controller, "signoutSubUsers") + end + MainLobbyWidget:setPreviousMenu("MainMenu") + CoD.Menu.goBack(MainLobbyWidget, ClientInstance.controller) +end + +CoD.MainLobby.Back = function (MainLobbyWidget, ClientInstance) + if CoD.Lobby.OpenSignOutPopup(MainLobbyWidget, ClientInstance) == true then + return + elseif UIExpression.IsPrimaryLocalClient(ClientInstance.controller) == 0 then + Engine.Exec(ClientInstance.controller, "signclientout") + MainLobbyWidget:processEvent({ + name = "controller_backed_out" + }) + return + elseif UIExpression.AloneInPartyIgnoreSplitscreen(ClientInstance.controller, 1) == 0 then + local CustomLeaveMessage = { + params = {} + } + if not CoD.isPartyHost() then + CustomLeaveMessage.titleText = Engine.Localize("MENU_LEAVE_LOBBY_TITLE") + CustomLeaveMessage.messageText = Engine.Localize("MENU_LEAVE_LOBBY_CLIENT_WARNING") + table.insert(CustomLeaveMessage.params, { + leaveHandler = CoD.MainLobby.ClientLeave, + leaveEvent = "client_leave", + leaveText = Engine.Localize("MENU_LEAVE_LOBBY_AND_PARTY"), + debugHelper = "You're a client of a private party, remove you from the party" + }) + else + CustomLeaveMessage.titleText = Engine.Localize("MENU_DISBAND_PARTY_TITLE") + CustomLeaveMessage.messageText = Engine.Localize("MENU_DISBAND_PARTY_HOST_WARNING") + table.insert(CustomLeaveMessage.params, { + leaveHandler = CoD.MainLobby.GoBack, + leaveEvent = "host_leave", + leaveText = Engine.Localize("MENU_LEAVE_AND_DISBAND_PARTY"), + debugHelper = "You're the leader of a private party, choosing this will disband your party" + }) + end + CoD.Lobby.ConfirmLeave(MainLobbyWidget, ClientInstance.controller, nil, nil, CustomLeaveMessage) + else + CoD.MainLobby.GoBack(MainLobbyWidget, ClientInstance) + end +end + +CoD.MainLobby.AddLobbyPaneElements = function (LobbyPane, MenuParty) + CoD.LobbyPanes.addLobbyPaneElements(LobbyPane, MenuParty, UIExpression.DvarInt(nil, "party_maxlocalplayers_mainlobby")) + LobbyPane.body.lobbyList.joinableList = CoD.JoinableList.New({ + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = 0 + }, false, "", "joinableList", LobbyPane.id) + LobbyPane.body.lobbyList.joinableList.pane = LobbyPane + LobbyPane.body.lobbyList.joinableList.maxRows = CoD.MaxPlayerListRows - 2 + LobbyPane.body.lobbyList.joinableList.statusText = Engine.Localize("MENU_PLAYERLIST_FRIENDS_PLAYING") + LobbyPane.body.lobbyList:addElement(LobbyPane.body.lobbyList.joinableList) +end + +CoD.MainLobby.ButtonListButtonGainFocus = function (f34_arg0, ClientInstance) + f34_arg0:dispatchEventToParent({ + name = "add_party_privacy_button" + }) + CoD.Lobby.ButtonListButtonGainFocus(f34_arg0, ClientInstance) +end + +CoD.MainLobby.ButtonListAddButton = function (f35_arg0, f35_arg1, f35_arg2, f35_arg3) + local f35_local0 = CoD.Lobby.ButtonListAddButton(f35_arg0, f35_arg1, f35_arg2, f35_arg3) + f35_local0:registerEventHandler("gain_focus", CoD.MainLobby.ButtonListButtonGainFocus) + return f35_local0 +end + +CoD.MainLobby.AddButtonPaneElements = function (f36_arg0) + CoD.LobbyPanes.addButtonPaneElements(f36_arg0) + f36_arg0.body.buttonList.addButton = CoD.MainLobby.ButtonListAddButton +end + +CoD.MainLobby.PopulateButtonPaneElements = function (MainLobbyButtonPane) + CoD.MainLobby.PopulateButtons(MainLobbyButtonPane) + CoD.MainLobby.UpdateButtonPaneButtonVisibilty(MainLobbyButtonPane) +end + +CoD.MainLobby.GoToFindingGames_Zombie = function (MainLobbyWidget, ClientInstance) + Engine.Exec(ClientInstance.controller, "xstartparty") + Engine.Exec(ClientInstance.controller, "updategamerprofile") + local PublicGameLobbyMenu = MainLobbyWidget:openMenu("PublicGameLobby", ClientInstance.controller) + PublicGameLobbyMenu:setPreviousMenu("MainLobby") + PublicGameLobbyMenu:registerAnimationState("hide", { + alpha = 0 + }) + PublicGameLobbyMenu:animateToState("hide") + PublicGameLobbyMenu:registerAnimationState("show", { + alpha = 1 + }) + PublicGameLobbyMenu:animateToState("show", 500) + MainLobbyWidget:close() +end + +CoD.MainLobby.ButtonPromptJoin = function (MainLobbyWidget, ClientInstance) + if UIExpression.IsGuest(ClientInstance.controller) == 1 then + local f39_local0 = MainLobbyWidget:openPopup("Error", ClientInstance.controller) + f39_local0:setMessage(Engine.Localize("XBOXLIVE_NOGUESTACCOUNTS")) + f39_local0.anyControllerAllowed = true + return + end + if MainLobbyWidget.lobbyPane.body.lobbyList.selectedPlayerXuid ~= nil then + Engine.SetDvar("selectedPlayerXuid", MainLobbyWidget.lobbyPane.body.lobbyList.selectedPlayerXuid) + CoD.joinPlayer(ClientInstance.controller, MainLobbyWidget.lobbyPane.body.lobbyList.selectedPlayerXuid) + end +end + +LUI.createMenu.MainLobby = function (LocalClientIndex) + local MainLobbyName = Engine.Localize(CoD.MPZM("MENU_MULTIPLAYER_CAPS", "MENU_ZOMBIES_CAPS")) + local MainLobbyWidget = CoD.Lobby.New("MainLobby", LocalClientIndex, nil, MainLobbyName) + MainLobbyWidget.controller = LocalClientIndex + MainLobbyWidget.anyControllerAllowed = true + MainLobbyWidget:setPreviousMenu("MainMenu") + if CoD.isPC then + MainLobbyWidget.m_blockJoinButton = true + end + if CoD.isZombie == true then + Engine.Exec(LocalClientIndex, "xsessionupdate") + MainLobbyWidget:registerEventHandler("open_solo_lobby_zombie", CoD.MainLobby.OpenSoloLobby_Zombie) + MainLobbyWidget:registerEventHandler("restartMatchmaking", CoD.MainLobby.GoToFindingGames_Zombie) + Engine.SetDvar("party_readyPercentRequired", 0) + elseif (CoD.isXBOX or CoD.isPS3) and Engine.IsEliteAvailable() and Engine.IsEliteButtonAvailable() then + MainLobbyWidget:registerEventHandler("open_eliteapp_popup", CoD.MainLobby.OpenEliteAppPopup) + MainLobbyWidget:registerEventHandler("elite_registration_ended", CoD.MainLobby.elite_registration_ended) + end + MainLobbyWidget:addTitle(MainLobbyName) + MainLobbyWidget.addButtonPaneElements = CoD.MainLobby.AddButtonPaneElements + MainLobbyWidget.populateButtonPaneElements = CoD.MainLobby.PopulateButtonPaneElements + MainLobbyWidget.addLobbyPaneElements = CoD.MainLobby.AddLobbyPaneElements + MainLobbyWidget:updatePanelFunctions() + MainLobbyWidget:registerEventHandler("partylobby_update", CoD.MainLobby.Update) + MainLobbyWidget:registerEventHandler("button_prompt_back", CoD.MainLobby.Back) + MainLobbyWidget:registerEventHandler("first_signed_in", CoD.MainLobby.FirstSignedInToLive) + MainLobbyWidget:registerEventHandler("last_signed_out", CoD.MainLobby.LastSignedOutOfLive) + MainLobbyWidget:registerEventHandler("player_selected", CoD.MainLobby.PlayerSelected) + MainLobbyWidget:registerEventHandler("player_deselected", CoD.MainLobby.PlayerDeselected) + MainLobbyWidget:registerEventHandler("current_panel_changed", CoD.MainLobby.CurrentPanelChanged) + MainLobbyWidget:registerEventHandler("open_player_match_party_lobby", CoD.MainLobby.OpenPlayerMatchPartyLobby) + MainLobbyWidget:registerEventHandler("open_league_play_party_lobby", CoD.MainLobby.OpenLeagueSelectionPopup) + MainLobbyWidget:registerEventHandler("playlist_selected", CoD.MainLobby.OpenLeaguePlayPartyLobby) + MainLobbyWidget:registerEventHandler("open_custom_games_lobby", CoD.MainLobby.OpenCustomGamesLobby) + MainLobbyWidget:registerEventHandler("open_theater_lobby", CoD.MainLobby.OpenTheaterLobby) + MainLobbyWidget:registerEventHandler("open_cod_tv", CoD.MainLobby.OpenCODTV) + MainLobbyWidget:registerEventHandler("open_barracks", CoD.MainLobby.OpenBarracks) + if CoD.isWIIU then + MainLobbyWidget:registerEventHandler("open_controls_menu", CoD.MainLobby.OpenControlsMenu) + end + MainLobbyWidget:registerEventHandler("open_options_menu", CoD.MainLobby.OpenOptionsMenu) + MainLobbyWidget:registerEventHandler("open_session_rejoin_popup", CoD.MainLobby.OpenSessionRejoinPopup) + MainLobbyWidget:registerEventHandler("button_prompt_join", CoD.MainLobby.ButtonPromptJoin) + MainLobbyWidget:registerEventHandler("open_store", CoD.MainLobby.OpenStore) + MainLobbyWidget:registerEventHandler("open_server_browser_mainlobby", CoD.MainLobby.OpenIMGUIServerBrowser) + MainLobbyWidget:registerEventHandler("open_mods_menu", CoD.MainLobby.OpenModsList) + MainLobbyWidget.lobbyPane.body.lobbyList:setSplitscreenSignInAllowed(true) + CoD.MainLobby.PopulateButtons(MainLobbyWidget.buttonPane) + CoD.MainLobby.UpdateButtonPaneButtonVisibilty(MainLobbyWidget.buttonPane) + CoD.MainLobby.UpdateButtonPromptVisibility(MainLobbyWidget) + if CoD.useController then + if CoD.isZombie then + MainLobbyWidget.buttonPane.body.buttonList:selectElementIndex(1) + elseif not MainLobbyWidget.buttonPane.body.buttonList:restoreState() then + if CoD.isPartyHost() then + if Engine.IsBetaBuild() then + -- MainLobbyWidget.buttonPane.body.leaguePlayButton:processEvent({ + -- name = "gain_focus" + -- }) + else + -- MainLobbyWidget.buttonPane.body.matchmakingButton:processEvent({ + -- name = "gain_focus" + -- }) + end + else + MainLobbyWidget.buttonPane.body.theaterButton:processEvent({ + name = "gain_focus" + }) + end + end + end + MainLobbyWidget.categoryInfo = CoD.Lobby.CreateInfoPane() + MainLobbyWidget.playlistInfo = CoD.Lobby.CreateInfoPane() + MainLobbyWidget.lobbyPane.body:close() + MainLobbyWidget.lobbyPane.body = nil + CoD.MainLobby.AddLobbyPaneElements(MainLobbyWidget.lobbyPane, Engine.Localize("MENU_PARTY_CAPS")) + if UIExpression.AnySignedInToLive() == 1 then + CoD.MainLobby.FirstSignedInToLive(MainLobbyWidget) + else + CoD.MainLobby.LastSignedOutOfLive(MainLobbyWidget) + end + Engine.SystemNeedsUpdate(nil, "party") + if CoD.isPS3 then + MainLobbyWidget.anyControllerAllowed = false + end + if not CoD.isZombie then + CoD.CheckClasses.CheckClasses() + end + Engine.SessionModeSetOnlineGame(true) + return MainLobbyWidget +end + +CoD.MainLobby.OpenSessionRejoinPopup = function (MainLobbyWidget, ClientInstance) + MainLobbyWidget:openPopup("RejoinSessionPopup", ClientInstance.controller) +end + +CoD.MainLobby.elite_registration_ended = function (MainLobbyWidget, ClientInstance) + if UIExpression.IsGuest(ClientInstance.controller) == 1 then + MainLobbyWidget:openPopup("popup_guest_contentrestricted", ClientInstance.controller) + return + elseif Engine.IsPlayerEliteRegistered(ClientInstance.controller) then + if Engine.ELaunchAppSearch(ClientInstance.controller) then + local f42_local0 = MainLobbyWidget:openPopup("EliteAppLaunchExecPopup", ClientInstance.controller) + else + local f42_local0 = MainLobbyWidget:openPopup("EliteAppDownloadPopup", ClientInstance.controller) + end + end +end + +CoD.MainLobby.OpenEliteAppPopup = function (MainLobbyWidget, ClientInstance) + if UIExpression.IsGuest(ClientInstance.controller) == 1 then + MainLobbyWidget:openPopup("popup_guest_contentrestricted", ClientInstance.controller) + return + elseif Engine.IsPlayerEliteRegistered(ClientInstance.controller) then + if Engine.ELaunchAppSearch(ClientInstance.controller) then + local f43_local0 = MainLobbyWidget:openPopup("EliteAppLaunchExecPopup", ClientInstance.controller) + else + local f43_local0 = MainLobbyWidget:openPopup("EliteAppDownloadPopup", ClientInstance.controller) + end + else + local f43_local0 = MainLobbyWidget:openPopup("EliteRegistrationPopup", ClientInstance.controller) + end +end + +CoD.MainLobby.OpenIMGUIServerBrowser = function(MainLobbyWidget, ClientInstance) + Engine.Exec(ClientInstance.controller, "plutoniumServers") +end + +CoD.MainLobby.OpenModsList = function(MainLobbyWidget, ClientInstance) + MainLobbyWidget:openMenu("Mods", ClientInstance.controller, { + parent = "MainLobby" + }) + MainLobbyWidget:close() +end \ No newline at end of file diff --git a/ui/t6/maps.lua b/ui/t6/maps.lua new file mode 100644 index 00000000..e153a819 --- /dev/null +++ b/ui/t6/maps.lua @@ -0,0 +1,321 @@ +require( "T6.Lobby" ) +require( "T6.Menus.PopupMenus" ) +require( "T6.ListBox" ) + +local GameModes = { + "ZMUI_CLASSIC_GAMEMODE_CAPS", + "ZMUI_STANDARD_CAPS", + "ZMUI_GRIEF_CAPS", + "ZMUI_SNR_CAPS", + "ZMUI_RACE_CAPS", + "ZMUI_CONTAINMENT_CAPS", + "ZMUI_MEAT_CAPS", + -- "ZMUI_CLEANSED_CAPS", -- TODO: uncomment when game mode is added +} +local Maps = { + "ZMUI_CLASSIC_CAPS", + "ZMUI_CLASSIC_ZM_HIGHRISE_CAPS", + "ZMUI_CLASSIC_ZM_PRISON_CAPS", + "ZMUI_CLASSIC_ZM_BURIED_CAPS", + "ZMUI_CLASSIC_ZM_TOMB_CAPS", +} +local Locations = { + "ZMUI_TRANSIT_STARTLOC_CAPS", + "ZMUI_DINER_CAPS", + "ZMUI_FARM_CAPS", + "ZMUI_POWER_CAPS", + "ZMUI_TOWN_CAPS", + "ZMUI_TUNNEL_CAPS", + "ZMUI_CORNFIELD_CAPS", + "ZMUI_NUKED_STARTLOC_CAPS", + -- "ZMUI_GREEN_ROOFTOP_CAPS", -- TODO: add localized string, uncomment when location is added + -- "ZMUI_BLUE_ROOFTOP_CAPS", -- TODO: add localized string, uncomment when location is added + -- "ZMUI_BLUE_HIGHRISE_CAPS", -- TODO: add localized string, uncomment when location is added + "ZMUI_CELLBLOCK_CAPS", + "ZMUI_DOCKS_CAPS", + "ZMUI_STREET_LOC_CAPS", + "ZMUI_MAZE_CAPS", + -- "ZMUI_BUNKERS_CAPS", -- TODO: add localized string, uncomment when location is added + -- "ZMUI_EXCAVATION_SITE_CAPS", -- TODO: add localized string, uncomment when location is added + -- "ZMUI_CHURCH_CAPS", -- TODO: add localized string, uncomment when location is added + -- "ZMUI_CRAZY_PLACE_CAPS", -- TODO: add localized string, uncomment when location is added +} + +local function gameModeListFocusChangedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() +end + +local function gameModeListSelectionClickedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() + + local gameMode = GameModes[focusedIndex] + + if gameMode == "ZMUI_CLASSIC_GAMEMODE_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zclassic") + Engine.SetDvar("ui_gametype", "zclassic") + elseif gameMode == "ZMUI_STANDARD_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zsurvival") + Engine.SetDvar("ui_gametype", "zstandard") + elseif gameMode == "ZMUI_GRIEF_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zencounter") + Engine.SetDvar("ui_gametype", "zgrief") + Engine.SetDvar("ui_gametype_obj", "zgrief") + elseif gameMode == "ZMUI_SNR_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zencounter") + Engine.SetDvar("ui_gametype", "zgrief") + Engine.SetDvar("ui_gametype_obj", "zsnr") + elseif gameMode == "ZMUI_RACE_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zencounter") + Engine.SetDvar("ui_gametype", "zgrief") + Engine.SetDvar("ui_gametype_obj", "zrace") + elseif gameMode == "ZMUI_CONTAINMENT_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zencounter") + Engine.SetDvar("ui_gametype", "zgrief") + Engine.SetDvar("ui_gametype_obj", "zcontainment") + elseif gameMode == "ZMUI_MEAT_CAPS" then + Engine.SetDvar("ui_zm_gamemodegroup", "zencounter") + Engine.SetDvar("ui_gametype", "zgrief") + Engine.SetDvar("ui_gametype_obj", "zmeat") + elseif gameMode == "ZMUI_CLEANSED_CAPS" then + -- TODO: set dvars when game mode is added + end + + if gameMode == "ZMUI_CLASSIC_GAMEMODE_CAPS" then + self:openMenu("SelectMapListZM", self.controller) + else + self:openMenu("SelectLocationListZM", self.controller) + end + + self:close() +end + +local function gameModeListBackEventHandler( self, event ) + CoD.Menu.ButtonPromptBack( self, event ) +end + +local function gameModeListCreateButtonMutables( controller, mutables ) + local text = LUI.UIText.new() + text:setLeftRight( true, false, 0, 0 ) + text:setTopBottom( true, true, 0, 0 ) + text:setRGB( 1, 1, 1 ) + text:setAlpha( 1 ) + mutables:addElement( text ) + mutables.text = text +end + +local function gameModeListGetButtonData( controller, index, mutables, self ) + local gameMode = GameModes[index] + mutables.text:setText( Engine.Localize(gameMode) ) +end + +function LUI.createMenu.SelectGameModeListZM( controller ) + local self = CoD.Menu.New( "SelectGameModeListZM" ) + self.controller = controller + + if UIExpression.DvarBool(nil, "ui_game_lobby_open") == 1 then + self:setPreviousMenu( "PrivateOnlineGameLobby" ) + else + self:setPreviousMenu( "MainLobby" ) + end + + self:registerEventHandler( "open_menu", CoD.Lobby.OpenMenu ) + self:addSelectButton() + self:addBackButton() + + self:addTitle( Engine.Localize("MPUI_GAMEMODE_CAPS") ) + + local listBox = CoD.ListBox.new( nil, controller, 15, CoD.CoD9Button.Height, 250, gameModeListCreateButtonMutables, gameModeListGetButtonData, 0, 0 ) + listBox:setLeftRight( true, false, 0, 250 ) + listBox:setTopBottom( true, false, 75, 75 + 530 ) + listBox:addScrollBar( 530 + (8 * 12), 2 ) + listBox:setTotalItems( #GameModes ) + self:addElement( listBox ) + self.listBox = listBox + + self:registerEventHandler( "button_prompt_back", gameModeListBackEventHandler ) + self:registerEventHandler( "listbox_focus_changed", gameModeListFocusChangedEventHandler ) + self:registerEventHandler( "listbox_clicked", gameModeListSelectionClickedEventHandler ) + + return self +end + +local function mapListFocusChangedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() +end + +local function mapListSelectionClickedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() + + local map = Maps[focusedIndex] + + if map == "ZMUI_CLASSIC_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "transit") + elseif map == "ZMUI_CLASSIC_ZM_HIGHRISE_CAPS" then + Engine.SetDvar("ui_mapname", "zm_highrise") + Engine.SetDvar("ui_zm_mapstartlocation", "rooftop") + elseif map == "ZMUI_CLASSIC_ZM_PRISON_CAPS" then + Engine.SetDvar("ui_mapname", "zm_prison") + Engine.SetDvar("ui_zm_mapstartlocation", "prison") + elseif map == "ZMUI_CLASSIC_ZM_BURIED_CAPS" then + Engine.SetDvar("ui_mapname", "zm_buried") + Engine.SetDvar("ui_zm_mapstartlocation", "processing") + elseif map == "ZMUI_CLASSIC_ZM_TOMB_CAPS" then + Engine.SetDvar("ui_mapname", "zm_tomb") + Engine.SetDvar("ui_zm_mapstartlocation", "tomb") + end + + self:openMenu("PrivateOnlineGameLobby", self.controller) + + self:close() +end + +local function mapListCreateButtonMutables( controller, mutables ) + local text = LUI.UIText.new() + text:setLeftRight( true, false, 0, 0 ) + text:setTopBottom( true, true, 0, 0 ) + text:setRGB( 1, 1, 1 ) + text:setAlpha( 1 ) + mutables:addElement( text ) + mutables.text = text +end + +local function mapListGetButtonData( controller, index, mutables, self ) + local map = Maps[index] + mutables.text:setText( Engine.Localize(map) ) +end + +function LUI.createMenu.SelectMapListZM( controller ) + local self = CoD.Menu.New( "SelectMapListZM" ) + self.controller = controller + + self:setPreviousMenu( "SelectGameModeListZM" ) + self:registerEventHandler( "open_menu", CoD.Lobby.OpenMenu ) + self:addSelectButton() + self:addBackButton() + + self:addTitle( Engine.Localize("MPUI_MAPS_CAPS") ) + + local listBox = CoD.ListBox.new( nil, controller, 15, CoD.CoD9Button.Height, 250, mapListCreateButtonMutables, mapListGetButtonData, 0, 0 ) + listBox:setLeftRight( true, false, 0, 250 ) + listBox:setTopBottom( true, false, 75, 75 + 530 ) + listBox:addScrollBar( 530 + (8 * 12), 2 ) + listBox:setTotalItems( #Maps ) + self:addElement( listBox ) + self.listBox = listBox + + self:registerEventHandler( "listbox_focus_changed", mapListFocusChangedEventHandler ) + self:registerEventHandler( "listbox_clicked", mapListSelectionClickedEventHandler ) + + return self +end + +local function locationListFocusChangedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() +end + +local function locationListSelectionClickedEventHandler( self, event ) + local focusedIndex = self.listBox:getFocussedIndex() + + local location = Locations[focusedIndex] + + if location == "ZMUI_TRANSIT_STARTLOC_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "transit") + elseif location == "ZMUI_DINER_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "diner") + elseif location == "ZMUI_FARM_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "farm") + elseif location == "ZMUI_POWER_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "power") + elseif location == "ZMUI_TOWN_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "town") + elseif location == "ZMUI_TUNNEL_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "tunnel") + elseif location == "ZMUI_CORNFIELD_CAPS" then + Engine.SetDvar("ui_mapname", "zm_transit") + Engine.SetDvar("ui_zm_mapstartlocation", "cornfield") + elseif location == "ZMUI_NUKED_STARTLOC_CAPS" then + Engine.SetDvar("ui_mapname", "zm_nuked") + Engine.SetDvar("ui_zm_mapstartlocation", "nuked") + elseif location == "ZMUI_GREEN_ROOFTOP_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_BLUE_ROOFTOP_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_BLUE_HIGHRISE_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_CELLBLOCK_CAPS" then + Engine.SetDvar("ui_mapname", "zm_prison") + Engine.SetDvar("ui_zm_mapstartlocation", "cellblock") + Engine.SetDvar("ui_zm_mapstartlocation_fake", "") + elseif location == "ZMUI_DOCKS_CAPS" then + Engine.SetDvar("ui_mapname", "zm_prison") + Engine.SetDvar("ui_zm_mapstartlocation", "cellblock") + Engine.SetDvar("ui_zm_mapstartlocation_fake", "docks") + elseif location == "ZMUI_STREET_LOC_CAPS" then + Engine.SetDvar("ui_mapname", "zm_buried") + Engine.SetDvar("ui_zm_mapstartlocation", "street") + Engine.SetDvar("ui_zm_mapstartlocation_fake", "") + elseif location == "ZMUI_MAZE_CAPS" then + Engine.SetDvar("ui_mapname", "zm_buried") + Engine.SetDvar("ui_zm_mapstartlocation", "street") + Engine.SetDvar("ui_zm_mapstartlocation_fake", "maze") + elseif location == "ZMUI_BUNKERS_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_EXCAVATION_SITE_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_CHURCH_CAPS" then + -- TODO: set dvars when location is added + elseif location == "ZMUI_CRAZY_PLACE_CAPS" then + -- TODO: set dvars when location is added + end + + self:openMenu("PrivateOnlineGameLobby", self.controller) + + self:close() +end + +local function locationListCreateButtonMutables( controller, mutables ) + local text = LUI.UIText.new() + text:setLeftRight( true, false, 0, 0 ) + text:setTopBottom( true, true, 0, 0 ) + text:setRGB( 1, 1, 1 ) + text:setAlpha( 1 ) + mutables:addElement( text ) + mutables.text = text +end + +local function locationListGetButtonData( controller, index, mutables, self ) + local location = Locations[index] + mutables.text:setText( Engine.Localize(location) ) +end + +function LUI.createMenu.SelectLocationListZM( controller ) + local self = CoD.Menu.New( "SelectLocationListZM" ) + self.controller = controller + + self:setPreviousMenu( "SelectGameModeListZM" ) + self:registerEventHandler( "open_menu", CoD.Lobby.OpenMenu ) + self:addSelectButton() + self:addBackButton() + + self:addTitle( Engine.Localize("MPUI_MAPS_CAPS") ) + + local listBox = CoD.ListBox.new( nil, controller, 15, CoD.CoD9Button.Height, 250, locationListCreateButtonMutables, locationListGetButtonData, 0, 0 ) + listBox:setLeftRight( true, false, 0, 250 ) + listBox:setTopBottom( true, false, 75, 75 + 530 ) + listBox:addScrollBar( 530 + (8 * 12), 2 ) + listBox:setTotalItems( #Locations ) + self:addElement( listBox ) + self.listBox = listBox + + self:registerEventHandler( "listbox_focus_changed", locationListFocusChangedEventHandler ) + self:registerEventHandler( "listbox_clicked", locationListSelectionClickedEventHandler ) + + return self +end \ No newline at end of file diff --git a/ui_mp/t6/menus/privategamelobby_project.lua b/ui_mp/t6/menus/privategamelobby_project.lua new file mode 100644 index 00000000..d3ff207c --- /dev/null +++ b/ui_mp/t6/menus/privategamelobby_project.lua @@ -0,0 +1,666 @@ +CoD.PrivateGameLobby.GameTypeSettings = {} +CoD.PrivateGameLobby.GameTypeSettings[1] = {} +CoD.PrivateGameLobby.GameTypeSettings[1].id = "zmDifficulty" +CoD.PrivateGameLobby.GameTypeSettings[1].name = "ZMUI_DIFFICULTY_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[1].hintText = "ZMUI_DIFFICULTY_DESC" +CoD.PrivateGameLobby.GameTypeSettings[1].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[1].labels[1] = "ZMUI_DIFFICULTY_EASY_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[1].labels[2] = "ZMUI_DIFFICULTY_NORMAL_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[1].values = {} +CoD.PrivateGameLobby.GameTypeSettings[1].values[1] = 0 +CoD.PrivateGameLobby.GameTypeSettings[1].values[2] = 1 +CoD.PrivateGameLobby.GameTypeSettings[1].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[1].gameTypes[1] = "zclassic" +CoD.PrivateGameLobby.GameTypeSettings[1].gameTypes[2] = "zstandard" +CoD.PrivateGameLobby.GameTypeSettings[1].gameTypes[3] = "zgrief" +CoD.PrivateGameLobby.GameTypeSettings[2] = {} +CoD.PrivateGameLobby.GameTypeSettings[2].id = "startRound" +CoD.PrivateGameLobby.GameTypeSettings[2].name = "ZMUI_STARTING_ROUND_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[2].hintText = "ZMUI_STARTING_ROUND_DESC" +CoD.PrivateGameLobby.GameTypeSettings[2].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[2].labels[1] = "1" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[2] = "5" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[3] = "10" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[4] = "15" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[5] = "20" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[6] = "25" +CoD.PrivateGameLobby.GameTypeSettings[2].labels[7] = "30" +CoD.PrivateGameLobby.GameTypeSettings[2].values = {} +CoD.PrivateGameLobby.GameTypeSettings[2].values[1] = 1 +CoD.PrivateGameLobby.GameTypeSettings[2].values[2] = 5 +CoD.PrivateGameLobby.GameTypeSettings[2].values[3] = 10 +CoD.PrivateGameLobby.GameTypeSettings[2].values[4] = 15 +CoD.PrivateGameLobby.GameTypeSettings[2].values[5] = 20 +CoD.PrivateGameLobby.GameTypeSettings[2].values[6] = 25 +CoD.PrivateGameLobby.GameTypeSettings[2].values[7] = 30 +CoD.PrivateGameLobby.GameTypeSettings[2].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[2].gameTypes[1] = "zclassic" +CoD.PrivateGameLobby.GameTypeSettings[2].gameTypes[2] = "zstandard" +CoD.PrivateGameLobby.GameTypeSettings[2].gameTypes[3] = "zgrief" +CoD.PrivateGameLobby.GameTypeSettings[3] = {} +CoD.PrivateGameLobby.GameTypeSettings[3].id = "magic" +CoD.PrivateGameLobby.GameTypeSettings[3].name = "ZMUI_MAGIC_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[3].hintText = "ZMUI_MAGIC_DESC" +CoD.PrivateGameLobby.GameTypeSettings[3].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[3].labels[1] = "MENU_ENABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[3].labels[2] = "MENU_DISABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[3].values = {} +CoD.PrivateGameLobby.GameTypeSettings[3].values[1] = 1 +CoD.PrivateGameLobby.GameTypeSettings[3].values[2] = 0 +CoD.PrivateGameLobby.GameTypeSettings[3].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[3].gameTypes[1] = "zstandard" +CoD.PrivateGameLobby.GameTypeSettings[3].gameTypes[2] = "zgrief" +CoD.PrivateGameLobby.GameTypeSettings[4] = {} +CoD.PrivateGameLobby.GameTypeSettings[4].id = "headshotsonly" +CoD.PrivateGameLobby.GameTypeSettings[4].name = "ZMUI_HEADSHOTS_ONLY_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[4].hintText = "ZMUI_HEADSHOTS_ONLY_DESC" +CoD.PrivateGameLobby.GameTypeSettings[4].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[4].labels[1] = "MENU_DISABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[4].labels[2] = "MENU_ENABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[4].values = {} +CoD.PrivateGameLobby.GameTypeSettings[4].values[1] = 0 +CoD.PrivateGameLobby.GameTypeSettings[4].values[2] = 1 +CoD.PrivateGameLobby.GameTypeSettings[4].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[4].gameTypes[1] = "zclassic" +CoD.PrivateGameLobby.GameTypeSettings[4].gameTypes[2] = "zstandard" +CoD.PrivateGameLobby.GameTypeSettings[4].gameTypes[3] = "zgrief" +CoD.PrivateGameLobby.GameTypeSettings[5] = {} +CoD.PrivateGameLobby.GameTypeSettings[5].id = "allowdogs" +CoD.PrivateGameLobby.GameTypeSettings[5].name = "ZMUI_DOGS_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[5].hintText = "ZMUI_DOGS_DESC" +CoD.PrivateGameLobby.GameTypeSettings[5].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[5].labels[1] = "MENU_DISABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[5].labels[2] = "MENU_ENABLED_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[5].values = {} +CoD.PrivateGameLobby.GameTypeSettings[5].values[1] = 0 +CoD.PrivateGameLobby.GameTypeSettings[5].values[2] = 1 +CoD.PrivateGameLobby.GameTypeSettings[5].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[5].gameTypes[1] = "zstandard" +CoD.PrivateGameLobby.GameTypeSettings[5].maps = {} +CoD.PrivateGameLobby.GameTypeSettings[5].maps[1] = "zm_transit" +CoD.PrivateGameLobby.GameTypeSettings[6] = {} +CoD.PrivateGameLobby.GameTypeSettings[6].id = "cleansedLoadout" +CoD.PrivateGameLobby.GameTypeSettings[6].name = "ZMUI_CLEANSED_LOADOUT_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[6].hintText = "ZMUI_CLEANSED_LOADOUT_DESC" +CoD.PrivateGameLobby.GameTypeSettings[6].labels = {} +CoD.PrivateGameLobby.GameTypeSettings[6].labels[1] = "ZMUI_CLEANSED_LOADOUT_SHOTGUN_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[6].labels[2] = "ZMUI_CLEANSED_LOADOUT_GUN_GAME_CAPS" +CoD.PrivateGameLobby.GameTypeSettings[6].values = {} +CoD.PrivateGameLobby.GameTypeSettings[6].values[1] = 0 +CoD.PrivateGameLobby.GameTypeSettings[6].values[2] = 1 +CoD.PrivateGameLobby.GameTypeSettings[6].gameTypes = {} +CoD.PrivateGameLobby.GameTypeSettings[6].gameTypes[1] = "zcleansed" +CoD.PrivateGameLobby.DvarDefaults = {} +CoD.PrivateGameLobby.DvarDefaults["sv_cheats"] = 0 +-- CoD.PrivateGameLobby.DvarDefaults["zombies_minplayers"] = 1 +-- CoD.PrivateGameLobby.Dvars = {} +-- CoD.PrivateGameLobby.Dvars[1] = {} +-- CoD.PrivateGameLobby.Dvars[1].id = "zombies_minplayers" +-- CoD.PrivateGameLobby.Dvars[1].name = "MIN PLAYERS" +-- CoD.PrivateGameLobby.Dvars[1].hintText = "The game will wait at the loadscreen until the amount of players ingame is reached." +-- CoD.PrivateGameLobby.Dvars[1].labels = {} +-- CoD.PrivateGameLobby.Dvars[1].labels[1] = "1" +-- CoD.PrivateGameLobby.Dvars[1].labels[2] = "2" +-- CoD.PrivateGameLobby.Dvars[1].labels[3] = "3" +-- CoD.PrivateGameLobby.Dvars[1].labels[4] = "4" +-- CoD.PrivateGameLobby.Dvars[1].labels[5] = "5" +-- CoD.PrivateGameLobby.Dvars[1].labels[6] = "6" +-- CoD.PrivateGameLobby.Dvars[1].labels[7] = "7" +-- CoD.PrivateGameLobby.Dvars[1].labels[8] = "8" +-- CoD.PrivateGameLobby.Dvars[1].values = {} +-- CoD.PrivateGameLobby.Dvars[1].values[1] = 1 +-- CoD.PrivateGameLobby.Dvars[1].values[2] = 2 +-- CoD.PrivateGameLobby.Dvars[1].values[3] = 3 +-- CoD.PrivateGameLobby.Dvars[1].values[4] = 4 +-- CoD.PrivateGameLobby.Dvars[1].values[5] = 5 +-- CoD.PrivateGameLobby.Dvars[1].values[6] = 6 +-- CoD.PrivateGameLobby.Dvars[1].values[7] = 7 +-- CoD.PrivateGameLobby.Dvars[1].values[8] = 8 +CoD.PrivateGameLobby.DvarDefaults["sv_allowAimAssist"] = 1 +CoD.PrivateGameLobby.Dvars = {} +CoD.PrivateGameLobby.Dvars[1] = {} +CoD.PrivateGameLobby.Dvars[1].id = "sv_allowAimAssist" +CoD.PrivateGameLobby.Dvars[1].name = Engine.Localize("MENU_TARGET_ASSIST_CAPS") +CoD.PrivateGameLobby.Dvars[1].hintText = "Allow aim assist option for all controller players." +CoD.PrivateGameLobby.Dvars[1].labels = {} +CoD.PrivateGameLobby.Dvars[1].labels[1] = "MENU_DISABLED_CAPS" +CoD.PrivateGameLobby.Dvars[1].labels[2] = "MENU_ENABLED_CAPS" +CoD.PrivateGameLobby.Dvars[1].values = {} +CoD.PrivateGameLobby.Dvars[1].values[1] = 0 +CoD.PrivateGameLobby.Dvars[1].values[2] = 1 +CoD.PrivateGameLobby.Dvars[2] = {} +CoD.PrivateGameLobby.Dvars[2].id = "sv_cheats" +CoD.PrivateGameLobby.Dvars[2].name = "CHEATS" +CoD.PrivateGameLobby.Dvars[2].hintText = "Enable cheats on server." +CoD.PrivateGameLobby.Dvars[2].labels = {} +CoD.PrivateGameLobby.Dvars[2].labels[1] = "MENU_DISABLED_CAPS" +CoD.PrivateGameLobby.Dvars[2].labels[2] = "MENU_ENABLED_CAPS" +CoD.PrivateGameLobby.Dvars[2].values = {} +CoD.PrivateGameLobby.Dvars[2].values[1] = 0 +CoD.PrivateGameLobby.Dvars[2].values[2] = 1 +CoD.PrivateGameLobby.ButtonPrompt_TeamPrev = function (f1_arg0, ClientInstance) + if Engine.PartyHostIsReadyToStart() == true then + return + else + Engine.LocalPlayerPartyPrevTeam(ClientInstance.controller) + Engine.PlaySound("cac_loadout_edit_submenu") + end +end + +CoD.PrivateGameLobby.ButtonPrompt_TeamNext = function (f2_arg0, ClientInstance) + if Engine.PartyHostIsReadyToStart() == true then + return + else + Engine.LocalPlayerPartyNextTeam(ClientInstance.controller) + Engine.PlaySound("cac_loadout_edit_submenu") + end +end + +CoD.PrivateGameLobby.ShouldEnableTeamCycling = function (PrivateGameLobbyWidget) + if PrivateGameLobbyWidget.panelManager == nil then + return false + elseif not PrivateGameLobbyWidget.panelManager:isPanelOnscreen("lobbyPane") then + return false + elseif Engine.PartyIsReadyToStart() == true then + return false + elseif Engine.PartyHostIsReadyToStart() == true then + return false + elseif Engine.GetGametypeSetting("autoTeamBalance") == 1 and Engine.GetGametypeSetting("allowspectating") ~= 1 then + return false + else + return true + end +end + +CoD.PrivateGameLobby.SetupTeamCycling = function (PrivateGameLobbyWidget) + if CoD.PrivateGameLobby.ShouldEnableTeamCycling(PrivateGameLobbyWidget) then + PrivateGameLobbyWidget.cycleTeamButtonPrompt:enable() + else + PrivateGameLobbyWidget.cycleTeamButtonPrompt:disable() + end +end + +CoD.PrivateGameLobby.CurrentPanelChanged = function (PrivateGameLobbyWidget, f5_arg1) + CoD.Lobby.CurrentPanelChanged(PrivateGameLobbyWidget, f5_arg1) + CoD.PrivateGameLobby.SetupTeamCycling(PrivateGameLobbyWidget) +end + +CoD.PrivateGameLobby.ButtonPrompt_PartyUpdateStatus = function (PrivateGameLobbyWidget, f6_arg1) + CoD.GameLobby.UpdateStatusText(PrivateGameLobbyWidget, f6_arg1) + CoD.PrivateGameLobby.SetupTeamCycling(PrivateGameLobbyWidget) + PrivateGameLobbyWidget:dispatchEventToChildren(f6_arg1) +end + +CoD.PrivateGameLobby.DoesGametypeSupportBots = function (Gametype) + return true +end + +CoD.PrivateGameLobby.BotButton_Update = function (BotsButton) + local Gametype = UIExpression.DvarString(nil, "ui_gameType") + local EnemyBots = UIExpression.DvarInt(nil, "bot_enemies") + BotsButton.starImage:setAlpha(0) + if not CoD.IsGametypeTeamBased() then + Engine.SetDvar("bot_friends", 0) + end + if CoD.IsGametypeTeamBased() and EnemyBots > 9 then + Engine.SetDvar("bot_enemies", 9) + end + if CoD.PrivateGameLobby.DoesGametypeSupportBots(Gametype) then + BotsButton.hintText = Engine.Localize("MENU_BOTS_HINT") + BotsButton:enable() + if UIExpression.DvarInt(nil, "bot_friends") ~= 0 or EnemyBots ~= 0 then + BotsButton.starImage:setAlpha(1) + end + else + BotsButton.hintText = Engine.Localize("MENU_BOTS_NOT_SUPPORTED_" .. Gametype) + BotsButton:disable() + end +end + +CoD.PrivateGameLobby.PopulateButtons_Project_Multiplayer = function (PrivateGameLobbyButtonPane, IsHost) + if IsHost == true then + local SetupGameText = Engine.Localize("MPUI_SETUP_GAME_CAPS") + local f9_local1_1, f9_local1_2, f9_local1_3, f9_local1_4 = GetTextDimensions(SetupGameText, CoD.CoD9Button.Font, CoD.CoD9Button.TextHeight) + PrivateGameLobbyButtonPane.body.setupGameButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(SetupGameText) + PrivateGameLobbyButtonPane.body.setupGameButton.hintText = Engine.Localize("MPUI_SETUP_GAME_DESC") + PrivateGameLobbyButtonPane.body.setupGameButton:setActionEventName("open_setup_game_flyout") + PrivateGameLobbyButtonPane.body.setupGameButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) + if PrivateGameLobbyButtonPane.body.widestButtonTextWidth < f9_local1_3 then + PrivateGameLobbyButtonPane.body.widestButtonTextWidth = f9_local1_3 + end + local SetupBotsText = Engine.Localize("MENU_SETUP_BOTS_CAPS") + local f9_local2_1, f9_local2_2, f9_local2_3, f9_local2_4 = GetTextDimensions(SetupBotsText, CoD.CoD9Button.Font, CoD.CoD9Button.TextHeight) + PrivateGameLobbyButtonPane.body.botsButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(SetupBotsText) + PrivateGameLobbyButtonPane.body.botsButton:setActionEventName("open_bots_menu") + PrivateGameLobbyButtonPane.body.botsButton:registerEventHandler("gamelobby_update", CoD.PrivateGameLobby.BotButton_Update) + if PrivateGameLobbyButtonPane.body.widestButtonTextWidth < f9_local2_3 then + PrivateGameLobbyButtonPane.body.widestButtonTextWidth = f9_local2_3 + end + local recImage = LUI.UIImage.new() + recImage:setLeftRight(true, false, f9_local2_3 + 5, f9_local2_3 + 5 + 30) + recImage:setTopBottom(false, false, -15, 15) + recImage:setAlpha(0) + recImage:setImage(RegisterMaterial(CoD.MPZM("ui_host", "ui_host_zm"))) + PrivateGameLobbyButtonPane.body.botsButton:addElement(recImage) + PrivateGameLobbyButtonPane.body.botsButton.starImage = recImage + CoD.PrivateGameLobby.BotButton_Update(PrivateGameLobbyButtonPane.body.botsButton) + PrivateGameLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2) + end + local CreateAClassText = Engine.Localize("MENU_CREATE_A_CLASS_CAPS") + local f9_local3_1, f9_local3_2, f9_local3_3, f9_local3_4 = GetTextDimensions(CreateAClassText, CoD.CoD9Button.Font, CoD.CoD9Button.TextHeight) + PrivateGameLobbyButtonPane.body.createAClassButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(CreateAClassText) + PrivateGameLobbyButtonPane.body.createAClassButton.id = "CoD9Button." .. "PrivateGameLobby." .. Engine.Localize("MENU_CREATE_A_CLASS_CAPS") + CoD.CACUtility.SetupCACLock(PrivateGameLobbyButtonPane.body.createAClassButton) + PrivateGameLobbyButtonPane.body.createAClassButton:registerEventHandler("button_action", CoD.GameLobby.Button_CAC) + if PrivateGameLobbyButtonPane.body.widestButtonTextWidth < f9_local3_3 then + PrivateGameLobbyButtonPane.body.widestButtonTextWidth = f9_local3_3 + end + local ScorestreakText = Engine.Localize("MENU_SCORE_STREAKS_CAPS") + local f9_local4_1, f9_local4_2, f9_local4_3, f9_local4_4 = GetTextDimensions(ScorestreakText, CoD.CoD9Button.Font, CoD.CoD9Button.TextHeight) + PrivateGameLobbyButtonPane.body.rewardsButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(ScorestreakText) + PrivateGameLobbyButtonPane.body.rewardsButton.id = "CoD9Button." .. "PrivateGameLobby." .. Engine.Localize("MENU_SCORE_STREAKS_CAPS") + PrivateGameLobbyButtonPane.body.rewardsButton.hintText = Engine.Localize("FEATURE_KILLSTREAKS_DESC") + CoD.SetupButtonLock(PrivateGameLobbyButtonPane.body.rewardsButton, nil, "FEATURE_KILLSTREAKS", "FEATURE_KILLSTREAKS_DESC") + PrivateGameLobbyButtonPane.body.rewardsButton:registerEventHandler("button_action", CoD.GameLobby.Button_Rewards) + if PrivateGameLobbyButtonPane.body.widestButtonTextWidth < f9_local4_3 then + PrivateGameLobbyButtonPane.body.widestButtonTextWidth = f9_local4_3 + end + PrivateGameLobbyButtonPane.body.barracksButtonSpacer = PrivateGameLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 2) + PrivateGameLobbyButtonPane.body.barracksButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(Engine.Localize("MENU_BARRACKS_CAPS")) + PrivateGameLobbyButtonPane.body.barracksButton.id = "CoD9Button." .. "PrivateGameLobby." .. Engine.Localize("MENU_BARRACKS_CAPS") + CoD.SetupBarracksLock(PrivateGameLobbyButtonPane.body.barracksButton) + PrivateGameLobbyButtonPane.body.barracksButton:setActionEventName("open_barracks") + PrivateGameLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height / 4, 200) + if IsHost and UIExpression.SessionMode_IsOnlineGame() == 1 then + local ToggleDemoRecording = PrivateGameLobbyButtonPane.body.buttonList:addButton(Engine.Localize("CUSTOM_GAME_RECORDING_CAPS")) + ToggleDemoRecording.hintText = Engine.Localize("CUSTOM_GAME_RECORDING_DESC") + ToggleDemoRecording:registerEventHandler("button_action", CoD.PrivateGameLobby.DemoRecordingButton_ToggleDemoRecording) + + local recImage = LUI.UIImage.new() + recImage:setLeftRight(false, true, -130, -100) + recImage:setTopBottom(false, false, -15, 15) + recImage:setAlpha(1) + recImage:setImage(RegisterMaterial("codtv_recording")) + + local recText = LUI.UIText.new({ + leftAnchor = false, + rightAnchor = true, + left = -100, + right = -40, + topAnchor = false, + bottomAnchor = false, + top = -CoD.textSize.Condensed / 2, + bottom = CoD.textSize.Condensed / 2, + font = CoD.fonts.Condensed, + alignment = LUI.Alignment.Left + }) + ToggleDemoRecording:addElement(recImage) + ToggleDemoRecording.recImage = recImage + + ToggleDemoRecording:addElement(recText) + ToggleDemoRecording.recText = recText + + CoD.PrivateGameLobby.UpdateDemoRecordingButton(ToggleDemoRecording) + end + if Engine.SessionModeIsMode(CoD.SESSIONMODE_SYSTEMLINK) == false and UIExpression.DvarBool(nil, "webm_encUiEnabledCustom") == 1 then + CoD.Lobby.AddLivestreamButton(PrivateGameLobbyButtonPane, 10, IsHost) + end +end + +CoD.PrivateGameLobby.UpdateDemoRecordingButton = function (ToggleDemoRecording) + if Dvar.demo_recordPrivateMatch:get() then + ToggleDemoRecording.recImage:setRGB(1, 0, 0) + ToggleDemoRecording.recText:setText(Engine.Localize("MENU_ON_CAPS")) + else + ToggleDemoRecording.recImage:setRGB(0.3, 0.3, 0.3) + ToggleDemoRecording.recText:setText(Engine.Localize("MENU_OFF_CAPS")) + end +end + +CoD.PrivateGameLobby.DemoRecordingButton_ToggleDemoRecording = function (ToggleDemoRecording, f11_arg1) + Dvar.demo_recordPrivateMatch:set(not Dvar.demo_recordPrivateMatch:get()) + CoD.PrivateGameLobby.UpdateDemoRecordingButton(ToggleDemoRecording) +end + +CoD.PrivateGameLobby.PopulateFlyoutButtons_Project_Multiplayer = function (PrivateGameLobbyButtonPane) + if not CoD.isZombie then + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeMapButton = PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.buttonList:addButton(Engine.Localize("MPUI_CHANGE_MAP_CAPS")) + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeMapButton.hintText = Engine.Localize("MPUI_CHANGE_MAP_DESC") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeMapButton:setActionEventName("open_change_map") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeMapButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeGameModeButton = PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.buttonList:addButton(Engine.Localize("MPUI_CHANGE_GAME_MODE_CAPS")) + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeGameModeButton.hintText = Engine.Localize("MPUI_CHANGE_GAME_MODE_DESC") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeGameModeButton:setActionEventName("open_change_game_mode") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.changeGameModeButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) + end + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.editGameOptionsButton = PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.buttonList:addButton(Engine.Localize("MPUI_EDIT_GAME_RULES_CAPS")) + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.editGameOptionsButton.hintText = Engine.Localize("MPUI_EDIT_GAME_RULES_DESC") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.editGameOptionsButton:setActionEventName("open_editGameOptions_menu") + PrivateGameLobbyButtonPane.body.setupGameFlyoutContainer.editGameOptionsButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) +end + +local AddGameOptionsButtons = function (PrivateGameLobbyButtonPane, GameOptions, GameOptionsType) + local Gametype = UIExpression.DvarString(nil, "ui_gameType") + local f13_local1 = 220 + if Gametype == "zcleansed" then + f13_local1 = 170 + end + local Mapname = UIExpression.DvarString(nil, "ui_mapname") + local GametypeIsValid = false + local MapIsValid = false + for GameOptionsIndex = 1, #GameOptions, 1 do + GametypeIsValid = false + if GameOptions[GameOptionsIndex].gameTypes ~= nil then + for GametypeIndex = 1, #GameOptions[GameOptionsIndex].gameTypes, 1 do + if GameOptions[GameOptionsIndex].gameTypes[GametypeIndex] == Gametype then + GametypeIsValid = true + end + end + else + GametypeIsValid = true + end + if GameOptions[GameOptionsIndex].maps ~= nil then + for MapIndex = 1, #GameOptions[GameOptionsIndex].maps, 1 do + if GameOptions[GameOptionsIndex].maps[MapIndex] == Mapname then + MapIsValid = true + break + end + end + if not MapIsValid then + GametypeIsValid = false + end + end + if GametypeIsValid then + local GameOptionsButton = nil + if GameOptionsType == "gts" then + GameOptionsButton = PrivateGameLobbyButtonPane.body.buttonList:addGametypeSettingLeftRightSelector(PrivateGameLobbyButtonPane.panelManager.m_ownerController, Engine.Localize(GameOptions[GameOptionsIndex].name), GameOptions[GameOptionsIndex].id, Engine.Localize(GameOptions[GameOptionsIndex].hintText), f13_local1) + elseif GameOptionsType == "dvar" then + GameOptionsButton = PrivateGameLobbyButtonPane.body.buttonList:addDvarLeftRightSelector(PrivateGameLobbyButtonPane.panelManager.m_ownerController, Engine.Localize(GameOptions[GameOptionsIndex].name), GameOptions[GameOptionsIndex].id, Engine.Localize(GameOptions[GameOptionsIndex].hintText), f13_local1) + end + for LabelIndex = 1, #GameOptions[GameOptionsIndex].labels, 1 do + GameOptionsButton:addChoice(PrivateGameLobbyButtonPane.panelManager.m_ownerController, Engine.Localize(GameOptions[GameOptionsIndex].labels[LabelIndex]), GameOptions[GameOptionsIndex].values[LabelIndex]) + end + GameOptionsButton:registerEventHandler("gain_focus", CoD.PrivateGameLobby.ButtonGainFocusZombie) + GameOptionsButton:registerEventHandler("lose_focus", CoD.PrivateGameLobby.ButtonLoseFocusZombie) + GameOptionsButton:registerEventHandler("start_game", GameOptionsButton.disable) + GameOptionsButton:registerEventHandler("cancel_start_game", GameOptionsButton.enable) + GameOptionsButton:registerEventHandler("gamelobby_update", CoD.PrivateGameLobby.ButtonGameLobbyUpdate_Zombie) + end + end +end + +CoD.PrivateGameLobby.PopulateButtons_Project_Zombie = function (PrivateGameLobbyButtonPane, IsHost) + if IsHost == true then + PrivateGameLobbyButtonPane.body.changeMapButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(Engine.Localize("ZMUI_MAP_CAPS")) + PrivateGameLobbyButtonPane.body.changeMapButton.hintText = Engine.Localize("ZMUI_MAP_SELECTION_DESC") + PrivateGameLobbyButtonPane.body.changeMapButton:setActionEventName("open_change_startLoc") + PrivateGameLobbyButtonPane.body.changeMapButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) + PrivateGameLobbyButtonPane.body.buttonList:addSpacer(CoD.CoD9Button.Height * 1) + -- local SetupGameText = Engine.Localize("MPUI_SETUP_GAME_CAPS") + -- local f9_local1_1, f9_local1_2, f9_local1_3, f9_local1_4 = GetTextDimensions(SetupGameText, CoD.CoD9Button.Font, CoD.CoD9Button.TextHeight) + -- PrivateGameLobbyButtonPane.body.setupGameButton = PrivateGameLobbyButtonPane.body.buttonList:addButton(SetupGameText) + -- PrivateGameLobbyButtonPane.body.setupGameButton.hintText = Engine.Localize("MPUI_SETUP_GAME_DESC") + -- PrivateGameLobbyButtonPane.body.setupGameButton:setActionEventName("open_setup_game_flyout") + -- PrivateGameLobbyButtonPane.body.setupGameButton:registerEventHandler("button_update", CoD.PrivateGameLobby.Button_UpdateHostButton) + -- if PrivateGameLobbyButtonPane.body.widestButtonTextWidth < f9_local1_3 then + -- PrivateGameLobbyButtonPane.body.widestButtonTextWidth = f9_local1_3 + -- end + AddGameOptionsButtons(PrivateGameLobbyButtonPane, CoD.PrivateGameLobby.GameTypeSettings, "gts") + AddGameOptionsButtons(PrivateGameLobbyButtonPane, CoD.PrivateGameLobby.Dvars, "dvar") + PrivateGameLobbyButtonPane:registerEventHandler("enable_sliding_zm", CoD.PrivateGameLobby.EnableSlidingZombie) + PrivateGameLobbyButtonPane.defaultFocusButton = PrivateGameLobbyButtonPane.body.startMatchButton + PrivateGameLobbyButtonPane.body.buttonList.hintText:setAlpha(1) + if CoD.useController == true and not PrivateGameLobbyButtonPane:restoreState() then + PrivateGameLobbyButtonPane.body.buttonList:selectElementIndex(1) + end + -- local ToggleDemoRecording = PrivateGameLobbyButtonPane.body.buttonList:addButton(Engine.Localize("CUSTOM_GAME_RECORDING_CAPS")) + -- ToggleDemoRecording.hintText = Engine.Localize("CUSTOM_GAME_RECORDING_DESC") + -- ToggleDemoRecording:registerEventHandler("button_action", CoD.PrivateGameLobby.DemoRecordingButton_ToggleDemoRecording) + -- local recImage = LUI.UIImage.new() + -- recImage:setLeftRight(false, true, -130, -100) + -- recImage:setTopBottom(false, false, -15, 15) + -- recImage:setAlpha(1) + -- recImage:setImage(RegisterMaterial("codtv_recording")) + -- local recText = LUI.UIText.new({ + -- leftAnchor = false, + -- rightAnchor = true, + -- left = -100, + -- right = -40, + -- topAnchor = false, + -- bottomAnchor = false, + -- top = -CoD.textSize.Condensed / 2, + -- bottom = CoD.textSize.Condensed / 2, + -- font = CoD.fonts.Condensed, + -- alignment = LUI.Alignment.Left + -- }) + -- ToggleDemoRecording:addElement(recImage) + -- ToggleDemoRecording.recImage = recImage + -- ToggleDemoRecording:addElement(recText) + -- ToggleDemoRecording.recText = recText + -- CoD.PrivateGameLobby.UpdateDemoRecordingButton(ToggleDemoRecording) + else + PrivateGameLobbyButtonPane.defaultFocusButton = nil + PrivateGameLobbyButtonPane.body.buttonList.hintText:setAlpha(0) + end + if PrivateGameLobbyButtonPane.menuName ~= "TheaterLobby" then + CoD.GameGlobeZombie.MoveToUpDirectly() + end +end + +CoD.PrivateGameLobby.ButtonGameLobbyUpdate_Zombie = function (GametypeSettingButton, f14_arg1) + GametypeSettingButton:refreshChoice() + GametypeSettingButton:dispatchEventToChildren(f14_arg1) +end + +CoD.PrivateGameLobby.ButtonGainFocusZombie = function (GametypeSettingButton, ClientInstance) + CoD.CoD9Button.GainFocus(GametypeSettingButton, ClientInstance) + GametypeSettingButton:dispatchEventToParent({ + name = "enable_sliding_zm", + enableSliding = false, + controller = ClientInstance.controller + }) +end + +CoD.PrivateGameLobby.ButtonLoseFocusZombie = function (GametypeSettingButton, ClientInstance) + CoD.CoD9Button.LoseFocus(GametypeSettingButton, ClientInstance) + GametypeSettingButton:dispatchEventToParent({ + name = "enable_sliding_zm", + enableSliding = true, + controller = ClientInstance.controller + }) +end + +CoD.PrivateGameLobby.EnableSlidingZombie = function (f17_arg0, f17_arg1) + f17_arg0.panelManager.slidingEnabled = f17_arg1.enableSliding +end + +CoD.PrivateGameLobby.PopulateButtons_Project = function (PrivateGameLobbyButtonPane, IsHost) + if CoD.isZombie == true then + CoD.PrivateGameLobby.PopulateButtons_Project_Zombie(PrivateGameLobbyButtonPane, IsHost) + else + CoD.PrivateGameLobby.PopulateButtons_Project_Multiplayer(PrivateGameLobbyButtonPane, IsHost) + end +end + +local LobbyTeamChangeAllowed = function () + if Engine.GetGametypeSetting("allowSpectating") == 1 then + return true + elseif Engine.GetGametypeSetting("autoTeamBalance") == 1 then + return false + elseif CoD.IsGametypeTeamBased() == true then + if CoD.isZombie == true and Engine.GetGametypeSetting("teamCount") == 1 then + return false + else + return true + end + else + return false + end +end + +CoD.PrivateGameLobby.PopulateButtonPrompts_Project = function (PrivateGameLobbyWidget) + if PrivateGameLobbyWidget.cycleTeamButtonPrompt ~= nil then + PrivateGameLobbyWidget.cycleTeamButtonPrompt:close() + end + if LobbyTeamChangeAllowed() then + PrivateGameLobbyWidget.cycleTeamButtonPrompt = CoD.DualButtonPrompt.new("shoulderl", Engine.Localize("MPUI_CHANGE_ROLE"), "shoulderr", PrivateGameLobbyWidget, "button_prompt_team_prev", "button_prompt_team_next", false, nil, nil, nil, nil, "A", "D") + CoD.PrivateGameLobby.SetupTeamCycling(PrivateGameLobbyWidget) + PrivateGameLobbyWidget:addRightButtonPrompt(PrivateGameLobbyWidget.cycleTeamButtonPrompt) + PrivateGameLobbyWidget:registerEventHandler("button_prompt_team_prev", CoD.PrivateGameLobby.ButtonPrompt_TeamPrev) + PrivateGameLobbyWidget:registerEventHandler("button_prompt_team_next", CoD.PrivateGameLobby.ButtonPrompt_TeamNext) + PrivateGameLobbyWidget:registerEventHandler("current_panel_changed", CoD.PrivateGameLobby.CurrentPanelChanged) + PrivateGameLobbyWidget:registerEventHandler("party_update_status", CoD.PrivateGameLobby.ButtonPrompt_PartyUpdateStatus) + else + PrivateGameLobbyWidget:registerEventHandler("party_update_status", CoD.GameLobby.UpdateStatusText) + end +end + +CoD.PrivateGameLobby.LeaveLobby_Project_Multiplayer = function (PrivateGameLobbyWidget, ClientInstance) + Engine.SetDvar("invite_visible", 1) + Engine.SetGametype(Dvar.ui_gametype:get()) + if Engine.SessionModeIsMode(CoD.SESSIONMODE_OFFLINE) == true or Engine.SessionModeIsMode(CoD.SESSIONMODE_SYSTEMLINK) == true then + Engine.ExecNow(ClientInstance.controller, "xstopallparties") + CoD.resetGameModes() + elseif Engine.SessionModeIsMode(CoD.SESSIONMODE_PRIVATE) == true then + if UIExpression.PrivatePartyHost(ClientInstance.controller) == 0 or ClientInstance.name ~= nil and ClientInstance.name == "confirm_leave_alone" then + Engine.ExecNow(ClientInstance.controller, "xstopallparties") + else + Engine.ExecNow(ClientInstance.controller, "xstoppartykeeptogether") + end + CoD.resetGameModes() + CoD.StartMainLobby(ClientInstance.controller) + elseif Engine.IsSignedInToDemonware(ClientInstance.controller) == true and Engine.HasMPPrivileges(ClientInstance.controller) == true then + Engine.ExecNow(ClientInstance.controller, "xstoppartykeeptogether") + CoD.resetGameModes() + CoD.StartMainLobby(ClientInstance.controller) + else + Engine.ExecNow(ClientInstance.controller, "xstopprivateparty") + CoD.resetGameModes() + end + Engine.SessionModeSetPrivate(false) + PrivateGameLobbyWidget:processEvent({ + name = "lose_host" + }) + PrivateGameLobbyWidget:goBack(ClientInstance) +end + +CoD.PrivateGameLobby.LeaveLobby_Project_Zombie_After_Animation = function (PrivateGameLobbyWidget, ClientInstance) + CoD.PrivateGameLobby.LeaveLobby_Project_Multiplayer(PrivateGameLobbyWidget, { + name = PrivateGameLobbyWidget.leaveType, + controller = ClientInstance.controller + }) + PrivateGameLobbyWidget.leaveType = nil +end + +CoD.PrivateGameLobby.LeaveLobby_Project_Zombie = function (PrivateGameLobbyWidget, ClientInstance) + PrivateGameLobbyWidget.leaveType = ClientInstance.name + CoD.GameGlobeZombie.gameGlobe.currentMenu = PrivateGameLobbyWidget + if PrivateGameLobbyWidget.menuName == "TheaterLobby" then + CoD.GameGlobeZombie.MoveToCornerFromUp(ClientInstance.controller, false) + else + CoD.GameGlobeZombie.MoveToCornerFromUp(ClientInstance.controller) + end + CoD.PrivateGameLobby.LeaveLobby_Project_Zombie_After_Animation(PrivateGameLobbyWidget, ClientInstance) +end + +CoD.PrivateGameLobby.LeaveLobby_Project = function (PrivateGameLobbyWidget, ClientInstance) + if CoD.isZombie == true then + CoD.PrivateGameLobby.LeaveLobby_Project_Zombie(PrivateGameLobbyWidget, ClientInstance) + else + CoD.PrivateGameLobby.LeaveLobby_Project_Multiplayer(PrivateGameLobbyWidget, ClientInstance) + end +end + +CoD.PrivateGameLobby.OpenChangeStartLoc = function (PrivateGameLobbyWidget, ClientInstance) + -- Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE) + Engine.SetDvar("ui_game_lobby_open", 1) + if UIExpression.DvarString(nil, "ui_gameType") == "zclassic" then + local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectMapListZM", ClientInstance.controller) + f27_local0:setPreviousMenu("SelectGameModeListZM") + else + local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectLocationListZM", ClientInstance.controller) + f27_local0:setPreviousMenu("SelectGameModeListZM") + end + -- local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectStartLocZM", ClientInstance.controller) + -- f27_local0:setPreviousMenu("SelectMapZM") + -- CoD.SelectStartLocZombie.GoToPreChoices(f27_local0, ClientInstance) + PrivateGameLobbyWidget:close() +end + +CoD.PrivateGameLobby.OpenSetupGameFlyout = function (PrivateGameLobbyWidget, f28_arg1) + if PrivateGameLobbyWidget.buttonPane ~= nil and PrivateGameLobbyWidget.buttonPane.body ~= nil then + CoD.PrivateGameLobby.RemoveSetupGameFlyout(PrivateGameLobbyWidget.buttonPane) + CoD.PrivateGameLobby.AddSetupGameFlyout(PrivateGameLobbyWidget.buttonPane) + PrivateGameLobbyWidget.panelManager.slidingEnabled = false + CoD.ButtonList.DisableInput(PrivateGameLobbyWidget.buttonPane.body.buttonList) + PrivateGameLobbyWidget.buttonPane.body.buttonList:animateToState("disabled") + PrivateGameLobbyWidget.buttonPane.body.setupGameFlyoutContainer:processEvent({ + name = "gain_focus" + }) + PrivateGameLobbyWidget:registerEventHandler("button_prompt_back", CoD.PrivateGameLobby.CloseSetupGameFlyout) + end +end + +CoD.PrivateGameLobby.CloseSetupGameFlyout = function (PrivateGameLobbyWidget, f29_arg1) + if PrivateGameLobbyWidget.buttonPane ~= nil and PrivateGameLobbyWidget.buttonPane.body ~= nil and PrivateGameLobbyWidget.buttonPane.body.setupGameFlyoutContainer ~= nil then + CoD.PrivateGameLobby.RemoveSetupGameFlyout(PrivateGameLobbyWidget.buttonPane) + CoD.ButtonList.EnableInput(PrivateGameLobbyWidget.buttonPane.body.buttonList) + PrivateGameLobbyWidget.buttonPane.body.buttonList:animateToState("default") + PrivateGameLobbyWidget:registerEventHandler("button_prompt_back", CoD.PrivateGameLobby.ButtonBack) + PrivateGameLobbyWidget.panelManager.slidingEnabled = true + Engine.PlaySound("cac_cmn_backout") + end +end + +CoD.PrivateGameLobby.OpenBotsMenu = function (PrivateGameLobbyWidget, ClientInstance) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_EDITING_GAME_OPTIONS) + PrivateGameLobbyWidget:openPopup("EditBotOptions", ClientInstance.controller) + Engine.PlaySound("cac_screen_fade") +end + +CoD.PrivateGameLobby.OpenChangeMap = function (PrivateGameLobbyWidget, ClientInstance) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP) + PrivateGameLobbyWidget:openPopup("ChangeMap", ClientInstance.controller) + Engine.PlaySound("cac_screen_fade") +end + +CoD.PrivateGameLobby.OpenChangeGameMode = function (PrivateGameLobbyWidget, ClientInstance) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE) + PrivateGameLobbyWidget:openPopup("ChangeGameMode", ClientInstance.controller) + Engine.PlaySound("cac_screen_fade") +end + +CoD.PrivateGameLobby.OpenEditGameOptionsMenu = function (PrivateGameLobbyWidget, ClientInstance) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_EDITING_GAME_OPTIONS) + PrivateGameLobbyWidget:openPopup("EditGameOptions", ClientInstance.controller) + Engine.PlaySound("cac_screen_fade") +end + +CoD.PrivateGameLobby.OpenViewGameOptionsMenu = function (PrivateGameLobbyWidget, ClientInstance) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_EDITING_GAME_OPTIONS) + PrivateGameLobbyWidget:openPopup("ViewGameOptions", ClientInstance.controller) +end + +CoD.PrivateGameLobby.CloseAllPopups = function (PrivateGameLobbyWidget, ClientInstance) + CoD.PrivateGameLobby.CloseSetupGameFlyout(PrivateGameLobbyWidget, ClientInstance) + CoD.Menu.MenuChanged(PrivateGameLobbyWidget, ClientInstance) +end + +CoD.PrivateGameLobby.RegisterEventHandler_Project = function (PrivateGameLobbyWidget) + if CoD.isZombie == true then + PrivateGameLobbyWidget:registerEventHandler("open_change_startLoc", CoD.PrivateGameLobby.OpenChangeStartLoc) + PrivateGameLobbyWidget:registerEventHandler("open_setup_game_flyout", CoD.PrivateGameLobby.OpenSetupGameFlyout) + -- PrivateGameLobbyWidget:registerEventHandler("open_change_map", CoD.PrivateGameLobby.OpenChangeMap) + -- PrivateGameLobbyWidget:registerEventHandler("open_change_game_mode", CoD.PrivateGameLobby.OpenChangeGameMode) + PrivateGameLobbyWidget:registerEventHandler("open_editGameOptions_menu", CoD.PrivateGameLobby.OpenEditGameOptionsMenu) + PrivateGameLobbyWidget:registerEventHandler("open_viewGameOptions_menu", CoD.PrivateGameLobby.OpenViewGameOptionsMenu) + else + PrivateGameLobbyWidget:registerEventHandler("open_setup_game_flyout", CoD.PrivateGameLobby.OpenSetupGameFlyout) + PrivateGameLobbyWidget:registerEventHandler("open_bots_menu", CoD.PrivateGameLobby.OpenBotsMenu) + PrivateGameLobbyWidget:registerEventHandler("open_change_map", CoD.PrivateGameLobby.OpenChangeMap) + PrivateGameLobbyWidget:registerEventHandler("open_change_game_mode", CoD.PrivateGameLobby.OpenChangeGameMode) + PrivateGameLobbyWidget:registerEventHandler("open_editGameOptions_menu", CoD.PrivateGameLobby.OpenEditGameOptionsMenu) + PrivateGameLobbyWidget:registerEventHandler("open_viewGameOptions_menu", CoD.PrivateGameLobby.OpenViewGameOptionsMenu) + PrivateGameLobbyWidget:registerEventHandler("close_all_popups", CoD.PrivateGameLobby.CloseAllPopups) + end +end \ No newline at end of file diff --git a/zone_source/mod.zone b/zone_source/mod.zone new file mode 100644 index 00000000..ef440acf --- /dev/null +++ b/zone_source/mod.zone @@ -0,0 +1,5 @@ +>game,T6 +>type,fastfile +>name,mod + +localize,reimagined \ No newline at end of file