From 1272bd68411d6952ede08bae79ca8d9f6b4e8c09 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Tue, 4 Jun 2024 23:50:14 -0700 Subject: [PATCH] Set correct UI state in private match lobby --- ui/t6/mainlobby.lua | 3 +-- ui/t6/mapslist.lua | 26 +++++++++++++-------- ui_mp/t6/menus/privategamelobby_project.lua | 1 - 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ui/t6/mainlobby.lua b/ui/t6/mainlobby.lua index 3ea20d41..5efee877 100644 --- a/ui/t6/mainlobby.lua +++ b/ui/t6/mainlobby.lua @@ -209,8 +209,7 @@ CoD.MainLobby.OpenSoloLobby_Zombie = function(MainLobbyWidget, ClientInstance) 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) + -- CoD.SwitchToPlayerMatchLobby(ClientInstance.controller) Dvar.party_maxplayers:set(1) CoD.PlaylistCategoryFilter = CoD.Zombie.PLAYLIST_CATEGORY_FILTER_SOLOMATCH CoD.PrivateGameLobby.InGameLobby = nil diff --git a/ui/t6/mapslist.lua b/ui/t6/mapslist.lua index cf67dc05..b6e24af7 100644 --- a/ui/t6/mapslist.lua +++ b/ui/t6/mapslist.lua @@ -42,6 +42,14 @@ CoD.MapsList.Locations = { -- "ZMUI_CRAZY_PLACE_CAPS", -- TODO: add localized string, uncomment when location is added } +local function switchToPrivateLobby(self) + local gameType = UIExpression.DvarString(nil, "ui_gametype") + local mapName = UIExpression.DvarString(nil, "ui_mapname") + CoD.SwitchToPrivateLobby(self.controller) -- this changes these dvars + Engine.SetDvar("ui_gametype", gameType) + Engine.SetDvar("ui_mapname", mapName) +end + local function gameModeListFocusChangedEventHandler(self, event) local focusedIndex = self.listBox:getFocussedIndex() end @@ -153,6 +161,8 @@ function LUI.createMenu.SelectGameModeListZM(controller) self:registerEventHandler("listbox_focus_changed", gameModeListFocusChangedEventHandler) self:registerEventHandler("click", gameModeListSelectionClickedEventHandler) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE) + return self end @@ -185,11 +195,7 @@ local function mapListSelectionClickedEventHandler(self, event) end if CoD.PrivateGameLobby.InGameLobby == nil then - local gameType = UIExpression.DvarString(nil, "ui_gametype") - local mapName = UIExpression.DvarString(nil, "ui_mapname") - CoD.SwitchToPrivateLobby(self.controller) -- this changes "ui_gametype" and "ui_mapname" - Engine.SetDvar("ui_gametype", gameType) - Engine.SetDvar("ui_mapname", mapName) + switchToPrivateLobby(self) end self:openMenu("PrivateOnlineGameLobby", self.controller) @@ -236,6 +242,8 @@ function LUI.createMenu.SelectMapListZM(controller) self:registerEventHandler("listbox_focus_changed", mapListFocusChangedEventHandler) self:registerEventHandler("click", mapListSelectionClickedEventHandler) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP) + return self end @@ -303,11 +311,7 @@ local function locationListSelectionClickedEventHandler(self, event) end if CoD.PrivateGameLobby.InGameLobby == nil then - local gameType = UIExpression.DvarString(nil, "ui_gametype") - local mapName = UIExpression.DvarString(nil, "ui_mapname") - CoD.SwitchToPrivateLobby(self.controller) -- this changes "ui_gametype" and "ui_mapname" - Engine.SetDvar("ui_gametype", gameType) - Engine.SetDvar("ui_mapname", mapName) + switchToPrivateLobby(self) end self:openMenu("PrivateOnlineGameLobby", self.controller) @@ -354,5 +358,7 @@ function LUI.createMenu.SelectLocationListZM(controller) self:registerEventHandler("listbox_focus_changed", locationListFocusChangedEventHandler) self:registerEventHandler("click", locationListSelectionClickedEventHandler) + Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP) + return self end diff --git a/ui_mp/t6/menus/privategamelobby_project.lua b/ui_mp/t6/menus/privategamelobby_project.lua index 32a45dda..f1d86730 100644 --- a/ui_mp/t6/menus/privategamelobby_project.lua +++ b/ui_mp/t6/menus/privategamelobby_project.lua @@ -464,7 +464,6 @@ CoD.PrivateGameLobby.LeaveLobby_Project = function(PrivateGameLobbyWidget, Clien end CoD.PrivateGameLobby.OpenChangeStartLoc = function(PrivateGameLobbyWidget, ClientInstance) - Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE) CoD.PrivateGameLobby.InGameLobby = true if UIExpression.DvarString(nil, "ui_gameType") == "zclassic" then local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectMapListZM", ClientInstance.controller)