This commit is contained in:
2023-12-25 20:34:53 +01:00
commit b69e014cbd
26 changed files with 12739 additions and 0 deletions

View File

@ -0,0 +1,6 @@
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
require("lobby")
require("serverlist")

View File

@ -0,0 +1,112 @@
local Lobby = Lobby
local MPLobbyOnline = LUI.mp_menus.MPLobbyOnline
local MenuData = LUI.mp_menus.MenuData
local MPLobbyUtils = LUI.mp_menus.MPLobbyUtils
game:addlocalizedstring("LUA_MENU_SERVERLIST", "Server List")
game:addlocalizedstring("LUA_MENU_SERVERLIST_DESC", "Browse available servers.");
LeaveXboxLive = function(f5_arg0)
local f73_local0 = Engine.GetFirstActiveController()
if f73_local0 ~= nil then
Engine.ExecNow("xstopprivateparty", f73_local0)
Cac.NotifyVirtualLobby("leave_lobby", Engine.GetXUIDByController(f73_local0))
Engine.SetSplitScreen(false)
Engine.ExecNow("forcesplitscreencontrol menu_xboxlive_CLOSE", f73_local0)
else
Engine.Exec("xstopprivateparty")
end
end
function LeaveLobby(a1)
LUI.MarketingPanel.ClearViewedMessages({ LUI.MarketingLocation.CaC, LUI.MarketingLocation.PlayOnline,
LUI.MarketingLocation.CaO })
LeaveXboxLive()
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive_lobby", nil, true)
end
function menu_xboxlive(a1, a2)
Engine.SetDvarBool("ui_opensummary", false)
local menu = LUI.MPLobbyBase.new(a1, {
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
memberListState = Lobby.MemberListStates.Prelobby,
has_new_item_usage_widget = true
})
menu:setClass(LUI.MPLobbyOnline)
menu.handleGamepadButton = MPLobbyOnline.menu_xboxlive_handleGamepadButton
if Engine.IsCoreMode() then
menu:AddNewItemsWidget()
end
-- server list button
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1, a2)
LUI.FlowManager.RequestAddMenu(a1, "menu_systemlink_join", true, nil)
end)
serverListButton:setDisabledRefreshRate(500)
-- private match button
privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,
MPLobbyOnline.disablePrivateMatchButton)
privateMatchButton:rename("menu_xboxlive_private_match")
privateMatchButton:setDisabledRefreshRate(500)
-- combat training button
if Engine.IsCoreMode() then
game:addlocalizedstring("LUA_MENU_COMBAT", "Combat Training");
game:addlocalizedstring("LUA_MENU_COMBAT_DESC", "Rank up offline with bots.");
local FindGameButton = menu:AddButton("@LUA_MENU_COMBAT",
MPLobbyOnline.OnPublicMatch, MPLobbyOnline.disablePublicMatchButton)
FindGameButton:rename("menu_xboxlive_find_game")
FindGameButton:setDisabledRefreshRate(500)
end
if Engine.IsCoreMode() then
menu:AddCACButton()
menu:AddCAOButton()
menu:AddArmoryButton()
end
if not Engine.IsCoreMode() then
local leaderboardButton = menu:AddButton("@LUA_MENU_LEADERBOARD", "OpLeaderboardMain")
leaderboardButton:rename("OperatorMenu_leaderboard")
end
if Engine.IsZombiesMode() then
menu:AddButton("@ZOMBIES_MENU_MOVIES", "ZombiesMoviesMenu")
end
menu:AddOptionsButton()
local natType = Lobby.GetNATType()
if natType then
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "nat",
helper_text = Engine.Localize("NETWORK_YOURNATTYPE", natType),
side = "left",
clickable = false
})
end
if Engine.IsZombiesMode() then
menu:AddZombiesStats(true)
end
menu.isSignInMenu = true
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
menu:registerEventHandler("player_joined", Cac.PlayerJoinedEvent)
menu:registerEventHandler("exit_live_lobby", LeaveLobby)
if PersistentBackground.IsCurrent(PersistentBackground.Variants.AARBackground) then
PersistentBackground.Hide(PersistentBackground.Duration)
end
if Engine.IsCoreMode() then
Engine.ExecNow("eliteclan_refresh", Engine.GetFirstActiveController())
end
return menu
end
LUI.MenuBuilder.m_types_build["menu_xboxlive"] = menu_xboxlive

View File

@ -0,0 +1,76 @@
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
local SystemLinkJoinMenu = LUI.mp_menus.SystemLinkJoinMenu
game:addlocalizedstring("PLATFORM_SYSTEM_LINK_TITLE", "SERVER LIST")
game:addlocalizedstring("MENU_NUMPLAYERS", "Players")
game:addlocalizedstring("MENU_PING", "Ping")
local offsets = {10, 400, 600, 900, 1075}
local columns = {"@MENU_HOST_NAME", "@MENU_MAP", "@MENU_TYPE1", "@MENU_NUMPLAYERS", "@MENU_PING"}
SystemLinkJoinMenu.AddServerButton = function(menu, controller, index)
local serverInformation = nil
local button = menu:AddButton("", SystemLinkJoinMenu.OnJoinGame)
if index == nil then
button:makeNotFocusable()
serverInformation = function(i)
return Engine.Localize(columns[i])
end
else
button:makeFocusable()
button.index = index
serverInformation = function(i)
return Lobby.GetServerData(controller, index, i - 1)
end
end
for size = 1, #offsets do
SystemLinkJoinMenu.MakeText(button, offsets[size], serverInformation(size))
end
return button
end
function menu_systemlink_join(f19_arg0, f19_arg1)
local menu = LUI.MenuTemplate.new(f19_arg0, {
menu_title = "@PLATFORM_SYSTEM_LINK_TITLE",
menu_width = CoD.DesignGridHelper(28)
})
Lobby.BuildServerList(Engine.GetFirstActiveController())
Lobby.RefreshServerList(Engine.GetFirstActiveController())
SystemLinkJoinMenu.UpdateGameList(menu)
menu:registerEventHandler("updateGameList", SystemLinkJoinMenu.UpdateGameList)
menu:addElement(LUI.UITimer.new(250, "updateGameList"))
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize("@MENU_SB_TOOLTIP_BTN_REFRESH"),
side = "right",
clickable = true,
priority = -1000
}, function(f10_arg0, f10_arg1)
SystemLinkJoinMenu.RefreshServers(f10_arg0, f10_arg1, menu)
end)
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = Engine.Localize("@MENU_JOIN_GAME1"),
side = "right",
clickable = false,
priority = -1000
})
menu:AddBackButton()
return menu
end
LUI.MenuBuilder.m_types_build["menu_systemlink_join"] = menu_systemlink_join