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
|
if CoD.isZombie == true then
|
||||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST)
|
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_PLAYLIST)
|
||||||
CoD.PlaylistCategoryFilter = "playermatch"
|
CoD.PlaylistCategoryFilter = "playermatch"
|
||||||
CoD.PrivateGameLobby.InGameLobby = nil
|
|
||||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
||||||
CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||||
else
|
else
|
||||||
@ -189,12 +188,11 @@ CoD.MainLobby.OpenCustomGamesLobby = function(MainLobbyWidget, ClientInstance)
|
|||||||
if CoD.MainLobby.ShouldPreventCreateLobby() then
|
if CoD.MainLobby.ShouldPreventCreateLobby() then
|
||||||
return
|
return
|
||||||
elseif CoD.MainLobby.OnlinePlayAvailable(MainLobbyWidget, ClientInstance) == 1 and CoD.MainLobby.IsControllerCountValid(MainLobbyWidget, ClientInstance.controller, UIExpression.DvarInt(ClientInstance.controller, "party_maxlocalplayers_privatematch")) == 1 then
|
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
|
if CoD.isZombie == true then
|
||||||
-- Engine.SetDvar("ui_zm_mapstartlocation", "")
|
CoD.MainLobby.InitMapDvars()
|
||||||
CoD.PrivateGameLobby.InGameLobby = nil
|
|
||||||
Engine.SetDvar("party_solo", 0)
|
Engine.SetDvar("party_solo", 0)
|
||||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
CoD.MainLobby.OpenPrivateGameLobbyAndSelectGameModeList(MainLobbyWidget, ClientInstance)
|
||||||
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||||
else
|
else
|
||||||
local PrivateOnlineLobbyMenu = MainLobbyWidget:openMenu("PrivateOnlineGameLobby", ClientInstance.controller)
|
local PrivateOnlineLobbyMenu = MainLobbyWidget:openMenu("PrivateOnlineGameLobby", ClientInstance.controller)
|
||||||
@ -208,19 +206,45 @@ CoD.MainLobby.OpenSoloLobby_Zombie = function(MainLobbyWidget, ClientInstance)
|
|||||||
return
|
return
|
||||||
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
|
||||||
|
CoD.MainLobby.SwitchToPrivateLobby(ClientInstance)
|
||||||
|
CoD.MainLobby.InitMapDvars()
|
||||||
MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1
|
MainLobbyWidget.lobbyPane.body.lobbyList.maxLocalPlayers = 1
|
||||||
-- CoD.SwitchToPlayerMatchLobby(ClientInstance.controller)
|
Engine.SetDvar("party_solo", 1)
|
||||||
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.MainLobby.OpenPrivateGameLobbyAndSelectGameModeList(MainLobbyWidget, ClientInstance)
|
||||||
Engine.SetDvar("party_solo", 1)
|
|
||||||
MainLobbyWidget:openMenu("SelectGameModeListZM", ClientInstance.controller)
|
|
||||||
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
-- CoD.GameGlobeZombie.MoveToCenter(ClientInstance.controller)
|
||||||
MainLobbyWidget:close()
|
MainLobbyWidget:close()
|
||||||
end
|
end
|
||||||
end
|
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)
|
CoD.MainLobby.OpenTheaterLobby = function(MainLobbyWidget, ClientInstance)
|
||||||
if CoD.MainLobby.ShouldPreventCreateLobby() then
|
if CoD.MainLobby.ShouldPreventCreateLobby() then
|
||||||
return
|
return
|
||||||
|
@ -42,14 +42,6 @@ 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
|
||||||
@ -123,11 +115,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
|||||||
local self = CoD.Menu.New("SelectGameModeListZM")
|
local self = CoD.Menu.New("SelectGameModeListZM")
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
|
|
||||||
if CoD.PrivateGameLobby.InGameLobby == true then
|
self:setPreviousMenu("PrivateOnlineGameLobby")
|
||||||
self:setPreviousMenu("PrivateOnlineGameLobby")
|
|
||||||
else
|
|
||||||
self:setPreviousMenu("MainLobby")
|
|
||||||
end
|
|
||||||
|
|
||||||
self:registerEventHandler("open_menu", CoD.Lobby.OpenMenu)
|
self:registerEventHandler("open_menu", CoD.Lobby.OpenMenu)
|
||||||
self:addSelectButton()
|
self:addSelectButton()
|
||||||
@ -143,13 +131,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
|||||||
listBox:addScrollBar(530 + (8 * 12), 2)
|
listBox:addScrollBar(530 + (8 * 12), 2)
|
||||||
|
|
||||||
if UIExpression.DvarBool(nil, "party_solo") == 1 then
|
if UIExpression.DvarBool(nil, "party_solo") == 1 then
|
||||||
local numGameModes = 2
|
listBox:setTotalItems(2, index)
|
||||||
|
|
||||||
if index > numGameModes then
|
|
||||||
index = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
listBox:setTotalItems(numGameModes, index)
|
|
||||||
else
|
else
|
||||||
listBox:setTotalItems(#CoD.MapsList.GameModes, index)
|
listBox:setTotalItems(#CoD.MapsList.GameModes, index)
|
||||||
end
|
end
|
||||||
@ -162,6 +144,7 @@ function LUI.createMenu.SelectGameModeListZM(controller)
|
|||||||
self:registerEventHandler("click", gameModeListSelectionClickedEventHandler)
|
self:registerEventHandler("click", gameModeListSelectionClickedEventHandler)
|
||||||
|
|
||||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE)
|
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_GAMETYPE)
|
||||||
|
CoD.PrivateGameLobby.FadeIn = true
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -194,10 +177,6 @@ local function mapListSelectionClickedEventHandler(self, event)
|
|||||||
Engine.SetDvar("ui_zm_mapstartlocation", "tomb")
|
Engine.SetDvar("ui_zm_mapstartlocation", "tomb")
|
||||||
end
|
end
|
||||||
|
|
||||||
if CoD.PrivateGameLobby.InGameLobby == nil then
|
|
||||||
switchToPrivateLobby(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
||||||
|
|
||||||
self:close()
|
self:close()
|
||||||
@ -243,6 +222,7 @@ function LUI.createMenu.SelectMapListZM(controller)
|
|||||||
self:registerEventHandler("click", mapListSelectionClickedEventHandler)
|
self:registerEventHandler("click", mapListSelectionClickedEventHandler)
|
||||||
|
|
||||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
||||||
|
CoD.PrivateGameLobby.FadeIn = true
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -310,10 +290,6 @@ local function locationListSelectionClickedEventHandler(self, event)
|
|||||||
-- TODO: set dvars when location is added
|
-- TODO: set dvars when location is added
|
||||||
end
|
end
|
||||||
|
|
||||||
if CoD.PrivateGameLobby.InGameLobby == nil then
|
|
||||||
switchToPrivateLobby(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
self:openMenu("PrivateOnlineGameLobby", self.controller)
|
||||||
|
|
||||||
self:close()
|
self:close()
|
||||||
@ -359,6 +335,7 @@ function LUI.createMenu.SelectLocationListZM(controller)
|
|||||||
self:registerEventHandler("click", locationListSelectionClickedEventHandler)
|
self:registerEventHandler("click", locationListSelectionClickedEventHandler)
|
||||||
|
|
||||||
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
Engine.PartyHostSetUIState(CoD.PARTYHOST_STATE_SELECTING_MAP)
|
||||||
|
CoD.PrivateGameLobby.FadeIn = true
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
@ -9,14 +9,18 @@ LUI.createMenu.PrivateOnlineGameLobby = function(f1_arg0)
|
|||||||
f1_local0:addTitle(f1_local1)
|
f1_local0:addTitle(f1_local1)
|
||||||
f1_local0.panelManager.panels.buttonPane.titleText = f1_local1
|
f1_local0.panelManager.panels.buttonPane.titleText = f1_local1
|
||||||
|
|
||||||
f1_local0:registerAnimationState("hide", {
|
if CoD.PrivateGameLobby.FadeIn == true then
|
||||||
alpha = 0,
|
CoD.PrivateGameLobby.FadeIn = nil
|
||||||
})
|
|
||||||
f1_local0:animateToState("hide")
|
f1_local0:registerAnimationState("hide", {
|
||||||
f1_local0:registerAnimationState("show", {
|
alpha = 0,
|
||||||
alpha = 1,
|
})
|
||||||
})
|
f1_local0:animateToState("hide")
|
||||||
f1_local0:animateToState("show", 500)
|
f1_local0:registerAnimationState("show", {
|
||||||
|
alpha = 1,
|
||||||
|
})
|
||||||
|
f1_local0:animateToState("show", 500)
|
||||||
|
end
|
||||||
|
|
||||||
return f1_local0
|
return f1_local0
|
||||||
end
|
end
|
||||||
|
@ -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)
|
||||||
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)
|
||||||
f27_local0:setPreviousMenu("SelectGameModeListZM")
|
f27_local0:setPreviousMenu("SelectGameModeListZM")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user