h1-mod/data/cdata/ui_scripts/server_list/lobby.lua

88 lines
3.1 KiB
Lua
Raw Normal View History

2022-03-02 18:21:09 -05:00
local Lobby = luiglobals.Lobby
local MPLobbyOnline = LUI.mp_menus.MPLobbyOnline
function LeaveLobby(f5_arg0)
2022-03-11 17:35:50 -05:00
LeaveXboxLive()
if Lobby.IsInPrivateParty() == false or Lobby.IsPrivatePartyHost() then
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive")
Engine.ExecNow("clearcontrollermap")
end
2022-03-02 18:21:09 -05:00
end
function menu_xboxlive(f16_arg0, f16_arg1)
2022-03-11 17:35:50 -05:00
local menu = LUI.MPLobbyBase.new(f16_arg0, {
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
memberListState = Lobby.MemberListStates.Prelobby
})
2022-03-02 18:21:09 -05:00
2022-03-11 17:35:50 -05:00
menu:setClass(LUI.MPLobbyOnline)
2022-03-02 18:21:09 -05:00
2022-03-11 17:35:50 -05:00
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1, a2)
2022-03-02 18:21:09 -05:00
LUI.FlowManager.RequestAddMenu(a1, "menu_systemlink_join", true, nil)
end)
2022-03-11 17:35:50 -05:00
serverListButton:setDisabledRefreshRate(500)
if Engine.IsCoreMode() then
menu:AddCACButton()
menu:AddBarracksButton()
menu:AddPersonalizationButton()
2022-05-20 11:58:42 -04:00
menu:AddDepotButton()
2022-09-03 06:06:45 -04:00
-- kinda a weird place to do this, but it's whatever
-- add "MODS" button below depot button
local modsButton = menu:AddButton("@MENU_MODS", function(a1, a2)
LUI.FlowManager.RequestAddMenu(a1, "mods_menu", true, nil)
end)
2022-03-11 17:35:50 -05:00
end
2022-03-02 18:21:09 -05:00
2022-05-20 11:58:42 -04:00
local privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,
2022-03-11 17:35:50 -05:00
MPLobbyOnline.disablePrivateMatchButton)
2022-05-20 11:58:42 -04:00
privateMatchButton:rename("menu_xboxlive_private_match")
privateMatchButton:setDisabledRefreshRate(500)
2022-03-11 17:35:50 -05:00
if not Engine.IsCoreMode() then
local leaderboardButton = menu:AddButton("@LUA_MENU_LEADERBOARD", "OpLeaderboardMain")
leaderboardButton:rename("OperatorMenu_leaderboard")
end
2022-03-02 18:21:09 -05:00
2022-03-11 17:35:50 -05:00
menu:AddOptionsButton()
local natType = Lobby.GetNATType()
if natType then
local natTypeText = Engine.Localize("NETWORK_YOURNATTYPE", natType)
local properties = CoD.CreateState(nil, nil, 2, -62, CoD.AnchorTypes.BottomRight)
properties.width = 250
properties.height = CoD.TextSettings.BodyFontVeryTiny.Height
properties.font = CoD.TextSettings.BodyFontVeryTiny.Font
properties.color = luiglobals.Colors.white
properties.alpha = 0.25
local self = LUI.UIText.new(properties)
self:setText(natTypeText)
menu:addElement(self)
end
2022-03-02 18:21:09 -05:00
2022-03-11 17:35:50 -05:00
menu.isSignInMenu = true
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
menu:registerEventHandler("player_joined", luiglobals.Cac.PlayerJoinedEvent)
menu:registerEventHandler("exit_live_lobby", LeaveLobby)
2022-03-02 18:21:09 -05:00
2022-03-11 17:35:50 -05:00
if Engine.IsCoreMode() then
Engine.ExecNow("eliteclan_refresh", Engine.GetFirstActiveController())
end
2022-03-02 18:21:09 -05:00
2022-06-25 16:40:37 -04:00
local root = Engine.GetLuiRoot()
if (root.vltimer) then
root.vltimer:close()
end
root.vltimer = LUI.UITimer.new(4000, "vl")
root:addElement(root.vltimer)
root:registerEventHandler("vl", function()
if (Engine.GetDvarBool("virtualLobbyReady")) then
root.vltimer:close()
game:virtuallobbypresentable()
end
2022-06-25 16:06:25 -04:00
end)
2022-03-11 17:35:50 -05:00
return menu
2022-03-02 18:21:09 -05:00
end
LUI.MenuBuilder.m_types_build["menu_xboxlive"] = menu_xboxlive