mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-07 21:59:49 -05:00
Optimize private game lobby
This commit is contained in:
parent
5d38a04bbc
commit
52d946ed09
@ -134,7 +134,6 @@ CoD.MainLobby.OpenPlayerMatchPartyLobby = function(MainLobbyWidget, ClientInstan
|
||||
if CoD.isZombie == true then
|
||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST)
|
||||
CoD.PlaylistCategoryFilter = "playermatch"
|
||||
CoD.PrivateGameLobby.InGameLobby = nil
|
||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
||||
CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||
else
|
||||
@ -189,12 +188,11 @@ 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)
|
||||
CoD.MainLobby.SwitchToPrivateLobby(ClientInstance)
|
||||
if CoD.isZombie == true then
|
||||
-- Engine.SetDvar("ui_zm_mapstartlocation", "")
|
||||
CoD.PrivateGameLobby.InGameLobby = nil
|
||||
CoD.MainLobby.InitMapDvars()
|
||||
Engine.SetDvar("party_solo", 0)
|
||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
||||
CoD.MainLobby.OpenPrivateGameLobbyAndSelectGameModeList(MainLobbyWidget, ClientInstance)
|
||||
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||
else
|
||||
local PrivateOnlineLobbyMenu = MainLobbyWidget:openMenu("PrivateOnlineGameLobby", ClientInstance.controller)
|
||||
@ -208,19 +206,45 @@ CoD.MainLobby.OpenSoloLobby_Zombie = function(MainLobbyWidget, ClientInstance)
|
||||
return
|
||||
elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 then
|
||||
if CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, 1) == 1 then
|
||||
CoD.MainLobby.SwitchToPrivateLobby(ClientInstance)
|
||||
CoD.MainLobby.InitMapDvars()
|
||||
MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1
|
||||
-- CoD.SwitchToPlayerMatchLobby(ClientInstance.controller)
|
||||
Engine.SetDvar("party_solo", 1)
|
||||
Dvar.party_maxplayers:set(1)
|
||||
CoD.PlaylistCategoryFilter = CoD.Zombie.PLAYLIST_CATEGORY_FILTER_SOLOMATCH
|
||||
CoD.PrivateGameLobby.InGameLobby = nil
|
||||
Engine.SetDvar("party_solo", 1)
|
||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
||||
CoD.MainLobby.OpenPrivateGameLobbyAndSelectGameModeList(MainLobbyWidget, ClientInstance)
|
||||
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||
MainLobbyWidget:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CoD.MainLobby.SwitchToPrivateLobby = function(ClientInstance)
|
||||
local gameType = UIExpression.DvarString(nil, "ui_gametype")
|
||||
local mapName = UIExpression.DvarString(nil, "ui_mapname")
|
||||
CoD.SwitchToPrivateLobby(ClientInstance.controller) -- this changes these dvars
|
||||
Engine.SetDvar("ui_gametype", gameType)
|
||||
Engine.SetDvar("ui_mapname", mapName)
|
||||
end
|
||||
|
||||
CoD.MainLobby.InitMapDvars = function()
|
||||
Engine.SetDvar("ui_mapname", "zm_transit")
|
||||
Engine.SetDvar("ui_zm_mapstartlocation", "transit")
|
||||
Engine.SetDvar("ui_zm_gamemodegroup", "zclassic")
|
||||
Engine.SetDvar("ui_gametype", "zclassic")
|
||||
Engine.SetDvar("ui_mapname_index", 1)
|
||||
Engine.SetDvar("ui_zm_mapstartlocation_index", 1)
|
||||
Engine.SetDvar("ui_gametype_index", 1)
|
||||
end
|
||||
|
||||
CoD.MainLobby.OpenPrivateGameLobbyAndSelectGameModeList = function(MainLobbyWidget, ClientInstance)
|
||||
-- open both menus so map background is shown
|
||||
local PrivateGameLobbyWidget = MainLobbyWidget:openMenu("PrivateOnlineGameLobby", ClientInstance.controller)
|
||||
local SelectGameModeListWidget = PrivateGameLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
||||
SelectGameModeListWidget:setPreviousMenu("PrivateOnlineGameLobby")
|
||||
PrivateGameLobbyWidget:close()
|
||||
end
|
||||
|
||||
CoD.MainLobby.OpenTheaterLobby = function(MainLobbyWidget, ClientInstance)
|
||||
if CoD.MainLobby.ShouldPreventCreateLobby() then
|
||||
return
|
||||
|
@ -42,14 +42,6 @@ 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
|
||||
@ -123,11 +115,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
||||
local self = CoD.Menu.New("SelectGameModeListZM")
|
||||
self.controller = controller
|
||||
|
||||
if CoD.PrivateGameLobby.InGameLobby == true then
|
||||
self:setPreviousMenu("PrivateOnlineGameLobby")
|
||||
else
|
||||
self:setPreviousMenu("MainLobby")
|
||||
end
|
||||
self:setPreviousMenu("PrivateOnlineGameLobby")
|
||||
|
||||
self:registerEventHandler("open_menu", CoD.Lobby.OpenMenu)
|
||||
self:addSelectButton()
|
||||
@ -143,13 +131,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
||||
listBox:addScrollBar(530 + (8 * 12), 2)
|
||||
|
||||
if UIExpression.DvarBool(nil, "party_solo") == 1 then
|
||||
local numGameModes = 2
|
||||
|
||||
if index > numGameModes then
|
||||
index = 1
|
||||
end
|
||||
|
||||
listBox:setTotalItems(numGameModes, index)
|
||||
listBox:setTotalItems(2, index)
|
||||
else
|
||||
listBox:setTotalItems(#CoD.MapsList.GameModes, index)
|
||||
end
|
||||
@ -162,6 +144,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
||||
self:registerEventHandler("click", gameModeListSelectionClickedEventHandler)
|
||||
|
||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE)
|
||||
CoD.PrivateGameLobby.FadeIn = true
|
||||
|
||||
return self
|
||||
end
|
||||
@ -194,10 +177,6 @@ local function mapListSelectionClickedEventHandler(self, event)
|
||||
Engine.SetDvar("ui_zm_mapstartlocation", "tomb")
|
||||
end
|
||||
|
||||
if CoD.PrivateGameLobby.InGameLobby == nil then
|
||||
switchToPrivateLobby(self)
|
||||
end
|
||||
|
||||
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
||||
|
||||
self:close()
|
||||
@ -243,6 +222,7 @@ function LUI.createMenu.SelectMapListZM(controller)
|
||||
self:registerEventHandler("click", mapListSelectionClickedEventHandler)
|
||||
|
||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
||||
CoD.PrivateGameLobby.FadeIn = true
|
||||
|
||||
return self
|
||||
end
|
||||
@ -310,10 +290,6 @@ local function locationListSelectionClickedEventHandler(self, event)
|
||||
-- TODO: set dvars when location is added
|
||||
end
|
||||
|
||||
if CoD.PrivateGameLobby.InGameLobby == nil then
|
||||
switchToPrivateLobby(self)
|
||||
end
|
||||
|
||||
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
||||
|
||||
self:close()
|
||||
@ -359,6 +335,7 @@ function LUI.createMenu.SelectLocationListZM(controller)
|
||||
self:registerEventHandler("click", locationListSelectionClickedEventHandler)
|
||||
|
||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
||||
CoD.PrivateGameLobby.FadeIn = true
|
||||
|
||||
return self
|
||||
end
|
||||
|
@ -9,14 +9,18 @@ LUI.createMenu.PrivateOnlineGameLobby = function(f1_arg0)
|
||||
f1_local0:addTitle(f1_local1)
|
||||
f1_local0.panelManager.panels.buttonPane.titleText = f1_local1
|
||||
|
||||
f1_local0:registerAnimationState("hide", {
|
||||
alpha = 0,
|
||||
})
|
||||
f1_local0:animateToState("hide")
|
||||
f1_local0:registerAnimationState("show", {
|
||||
alpha = 1,
|
||||
})
|
||||
f1_local0:animateToState("show", 500)
|
||||
if CoD.PrivateGameLobby.FadeIn == true then
|
||||
CoD.PrivateGameLobby.FadeIn = nil
|
||||
|
||||
f1_local0:registerAnimationState("hide", {
|
||||
alpha = 0,
|
||||
})
|
||||
f1_local0:animateToState("hide")
|
||||
f1_local0:registerAnimationState("show", {
|
||||
alpha = 1,
|
||||
})
|
||||
f1_local0:animateToState("show", 500)
|
||||
end
|
||||
|
||||
return f1_local0
|
||||
end
|
||||
|
@ -464,7 +464,6 @@ CoD.PrivateGameLobby.LeaveLobby_Project = function(PrivateGameLobbyWidget, Clien
|
||||
end
|
||||
|
||||
CoD.PrivateGameLobby.OpenChangeStartLoc = function(PrivateGameLobbyWidget, ClientInstance)
|
||||
CoD.PrivateGameLobby.InGameLobby = true
|
||||
if UIExpression.DvarString(nil, "ui_gameType") == "zclassic" then
|
||||
local f27_local0 = PrivateGameLobbyWidget:openMenu("SelectMapListZM", ClientInstance.controller)
|
||||
f27_local0:setPreviousMenu("SelectGameModeListZM")
|
||||
|
Loading…
x
Reference in New Issue
Block a user