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

Set correct UI state in private match lobby

This commit is contained in:
Jbleezy 2024-06-04 23:50:14 -07:00
parent bdd18980fd
commit 1272bd6841
3 changed files with 17 additions and 13 deletions

View File

@ -209,8 +209,7 @@ CoD.MainLobby.OpenSoloLobby_Zombie = function(MainLobbyWidget, ClientInstance)
elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then
if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, 1) == 1 then if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, 1) == 1 then
MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1 MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1
CoD.SwitchToPlayerMatchLobby(ClientInstance.controller) -- CoD.SwitchToPlayerMatchLobby(ClientInstance.controller)
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST)
Dvar.party_maxplayers:set(1) Dvar.party_maxplayers:set(1)
CoD.PlaylistCategoryFilter = CoD.Zombie.PLAYLIST_CATEGORY_FILTER_SOLOMATCH CoD.PlaylistCategoryFilter = CoD.Zombie.PLAYLIST_CATEGORY_FILTER_SOLOMATCH
CoD.PrivateGameLobby.InGameLobby = nil CoD.PrivateGameLobby.InGameLobby = nil

View File

@ -42,6 +42,14 @@ CoD.MapsList.Locations = {
-- "ZMUI_CRAZY_PLACE_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 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 function gameModeListFocusChangedEventHandler(self, event)
local focusedIndex = self.listBox:getFocussedIndex() local focusedIndex = self.listBox:getFocussedIndex()
end end
@ -153,6 +161,8 @@ function LUI.createMenu.SelectGameModeListZM(controller)
self:registerEventHandler("listbox_focus_changed", gameModeListFocusChangedEventHandler) self:registerEventHandler("listbox_focus_changed", gameModeListFocusChangedEventHandler)
self:registerEventHandler("click", gameModeListSelectionClickedEventHandler) self:registerEventHandler("click", gameModeListSelectionClickedEventHandler)
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE)
return self return self
end end
@ -185,11 +195,7 @@ local function mapListSelectionClickedEventHandler(self, event)
end end
if CoD.PrivateGameLobby.InGameLobby == nil then if CoD.PrivateGameLobby.InGameLobby == nil then
local gameType = UIExpression.DvarString(nil, "ui_gametype") switchToPrivateLobby(self)
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)
end end
self:openMenu("PrivateOnlineGameLobby", self.controller) self:openMenu("PrivateOnlineGameLobby", self.controller)
@ -236,6 +242,8 @@ function LUI.createMenu.SelectMapListZM(controller)
self:registerEventHandler("listbox_focus_changed", mapListFocusChangedEventHandler) self:registerEventHandler("listbox_focus_changed", mapListFocusChangedEventHandler)
self:registerEventHandler("click", mapListSelectionClickedEventHandler) self:registerEventHandler("click", mapListSelectionClickedEventHandler)
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
return self return self
end end
@ -303,11 +311,7 @@ local function locationListSelectionClickedEventHandler(self, event)
end end
if CoD.PrivateGameLobby.InGameLobby == nil then if CoD.PrivateGameLobby.InGameLobby == nil then
local gameType = UIExpression.DvarString(nil, "ui_gametype") switchToPrivateLobby(self)
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)
end end
self:openMenu("PrivateOnlineGameLobby", self.controller) self:openMenu("PrivateOnlineGameLobby", self.controller)
@ -354,5 +358,7 @@ function LUI.createMenu.SelectLocationListZM(controller)
self:registerEventHandler("listbox_focus_changed", locationListFocusChangedEventHandler) self:registerEventHandler("listbox_focus_changed", locationListFocusChangedEventHandler)
self:registerEventHandler("click", locationListSelectionClickedEventHandler) self:registerEventHandler("click", locationListSelectionClickedEventHandler)
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
return self return self
end end

View File

@ -464,7 +464,6 @@ CoD.PrivateGameLobby.LeaveLobby_Project = function(PrivateGameLobbyWidget, Clien
end end
CoD.PrivateGameLobby.OpenChangeStartLoc = function(PrivateGameLobbyWidget, ClientInstance) CoD.PrivateGameLobby.OpenChangeStartLoc = function(PrivateGameLobbyWidget, ClientInstance)
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE)
CoD.PrivateGameLobby.InGameLobby = true CoD.PrivateGameLobby.InGameLobby = true
if UIExpression.DvarString(nil, "ui_gameType") == "zclassic" then if UIExpression.DvarString(nil, "ui_gameType") == "zclassic" then
local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectMapListZM", ClientInstance.controller) local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectMapListZM", ClientInstance.controller)