maint(ui_scripts): remove whitespaces and reorganize files (#5)
All checks were successful
test / Test on Linux (push) Successful in 6s
All checks were successful
test / Test on Linux (push) Successful in 6s
Co-authored-by: Wanted <wanted@no-reply@alterware.dev> Co-committed-by: Wanted <wanted@no-reply@alterware.dev>
This commit is contained in:
parent
8adb43f7fa
commit
7411101e22
@ -3,4 +3,4 @@ if (game:issingleplayer()) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
require("settings")
|
require("settings")
|
||||||
require("hud")
|
require("hud")
|
||||||
|
@ -106,17 +106,17 @@ function infoelement(data)
|
|||||||
b = 0.6,
|
b = 0.6,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
value:addElement(LUI.UITimer.new(data.interval, "update"))
|
value:addElement(LUI.UITimer.new(data.interval, "update"))
|
||||||
value:setText(data.getvalue())
|
value:setText(data.getvalue())
|
||||||
value:addEventHandler("update", function()
|
value:addEventHandler("update", function()
|
||||||
value:setText(data.getvalue())
|
value:setText(data.getvalue())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
container:addElement(background)
|
container:addElement(background)
|
||||||
container:addElement(label)
|
container:addElement(label)
|
||||||
container:addElement(value)
|
container:addElement(value)
|
||||||
|
|
||||||
return container
|
return container
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ LUI.MenuBuilder.m_types_build["mp_hud"] = function()
|
|||||||
infobar:removeAllChildren()
|
infobar:removeAllChildren()
|
||||||
populateinfobar(infobar)
|
populateinfobar(infobar)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hud.static:addElement(infobar)
|
hud.static:addElement(infobar)
|
||||||
|
|
||||||
return hud
|
return hud
|
||||||
|
@ -2,97 +2,5 @@ if (game:issingleplayer() or not Engine.InFrontend()) then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local MPLobbyPublic = LUI.mp_menus.MPLobbyPublic
|
require("menu_xboxlive")
|
||||||
|
require("menu_xboxlive_lobby")
|
||||||
function StartButtonAction(f2_arg0, f2_arg1)
|
|
||||||
Engine.SetDvarInt("party_minplayers", 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
function StartButtonText(f5_arg0, f5_arg1)
|
|
||||||
f5_arg0:processEvent({
|
|
||||||
name = "refresh_disabled"
|
|
||||||
})
|
|
||||||
f5_arg0:setText(Engine.Localize("@LUA_MENU_START_GAME"))
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnLeaveLobby(f6_arg0)
|
|
||||||
LUI.MarketingPanel.ClearViewedMessages({
|
|
||||||
LUI.MarketingLocation.Lobby
|
|
||||||
})
|
|
||||||
LUI.FlowManager.RequestLeaveMenu(f6_arg0)
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnGameSetup(f10_arg0, f10_arg1)
|
|
||||||
LUI.FlowManager.RequestAddMenu(f10_arg0, "gamesetup_menu_main", true, f10_arg1.controller, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
function menu_xboxlive_lobby(f7_arg0, f7_arg1)
|
|
||||||
local f7_local0 = false
|
|
||||||
if not Engine.IsZombiesMode() and Engine.GetDvarBool("ui_opensummary") then
|
|
||||||
f7_local0 = true
|
|
||||||
end
|
|
||||||
if Engine.IsZombiesMode() then
|
|
||||||
ZombiesUpdateMapBkg()
|
|
||||||
end
|
|
||||||
local f7_local1 = LUI.MPLobbyBase.new(f7_arg0, {
|
|
||||||
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
|
|
||||||
has_match_summary = true,
|
|
||||||
has_new_item_usage_widget = true
|
|
||||||
}, true)
|
|
||||||
f7_local1:setClass(LUI.MPLobbyPublic)
|
|
||||||
if Engine.IsMultiplayer() then
|
|
||||||
f7_local1:AddReadyUpButton("pt_AliensReadyUpPublicInUse", StartButtonAction, false, StartButtonText)
|
|
||||||
end
|
|
||||||
if Engine.IsCoreMode() then
|
|
||||||
f7_local1:AddNewItemsWidget()
|
|
||||||
f7_local1:AddCACButton()
|
|
||||||
f7_local1:AddCAOButton()
|
|
||||||
f7_local1:AddArmoryButton()
|
|
||||||
end
|
|
||||||
f7_local1:AddOptionsButton()
|
|
||||||
if not f7_local1:CheckAddMapAndMarketingPanels(f7_local0) then
|
|
||||||
f7_local1:registerEventHandler("CheckAddMapAndMarketingPanels", function(element, event)
|
|
||||||
LUI.MPLobbyPublic.CheckAddMapAndMarketingPanels(element, f7_local0)
|
|
||||||
end)
|
|
||||||
local self = LUI.UITimer.new(100, "CheckAddMapAndMarketingPanels")
|
|
||||||
self.id = "MPLobbyPublic_add_map_timer"
|
|
||||||
f7_local1.mapTimer = self
|
|
||||||
f7_local1:addElement(self)
|
|
||||||
end
|
|
||||||
f7_local1:registerEventHandler("exit_public_lobby", OnLeaveLobby)
|
|
||||||
f7_local1:registerEventHandler("player_joined", Cac.PlayerJoinedEvent)
|
|
||||||
f7_local1:registerEventHandler("loadout_request", Cac.PlayerJoinedEvent)
|
|
||||||
Lobby.EnteredLobby()
|
|
||||||
if f7_local0 then
|
|
||||||
LUI.InventoryUtils.ProcessLootExpiration()
|
|
||||||
end
|
|
||||||
return f7_local1
|
|
||||||
end
|
|
||||||
|
|
||||||
LUI.MenuBuilder.m_types_build["menu_xboxlive_lobby"] = menu_xboxlive_lobby
|
|
||||||
|
|
||||||
LUI.FlowManager.RegisterMenuStack("menu_xboxlive_lobby", function()
|
|
||||||
if Engine.IsCoreMode() and Playlist.GetPreselectedCategoryClass() ~= 8 then
|
|
||||||
return {
|
|
||||||
"mp_main_menu",
|
|
||||||
"menu_xboxlive",
|
|
||||||
"FindGameMenu",
|
|
||||||
"FindGameSubMenu"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
"mp_main_menu",
|
|
||||||
"menu_xboxlive",
|
|
||||||
"FindGameMenu"
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
VLobby.InitMenuMode("menu_xboxlive_lobby", VirtualLobbyModes.LUI_MODE_LOBBY, function()
|
|
||||||
if LUI.MPLobbyBase.UseReadyUp then
|
|
||||||
Lobby.ClearLocalReadyUpFlag()
|
|
||||||
end
|
|
||||||
local f10_local0 = PersistentBackground.StackFunc(nil)
|
|
||||||
f10_local0()
|
|
||||||
end, LUI.MPLobbyBase.CollectGarbage)
|
|
||||||
|
|
||||||
LUI.FlowManager.RegisterStackResumeBehaviour("menu_xboxlive_lobby", PersistentBackground.StackFunc(nil))
|
|
||||||
|
112
ui_scripts/lobby/menu_xboxlive.lua
Normal file
112
ui_scripts/lobby/menu_xboxlive.lua
Normal 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
|
95
ui_scripts/lobby/menu_xboxlive_lobby.lua
Normal file
95
ui_scripts/lobby/menu_xboxlive_lobby.lua
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
local MPLobbyPublic = LUI.mp_menus.MPLobbyPublic
|
||||||
|
|
||||||
|
function StartButtonAction(f2_arg0, f2_arg1)
|
||||||
|
Engine.SetDvarInt("party_minplayers", 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function StartButtonText(f5_arg0, f5_arg1)
|
||||||
|
f5_arg0:processEvent({
|
||||||
|
name = "refresh_disabled"
|
||||||
|
})
|
||||||
|
f5_arg0:setText(Engine.Localize("@LUA_MENU_START_GAME"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function OnLeaveLobby(f6_arg0)
|
||||||
|
LUI.MarketingPanel.ClearViewedMessages({
|
||||||
|
LUI.MarketingLocation.Lobby
|
||||||
|
})
|
||||||
|
LUI.FlowManager.RequestLeaveMenu(f6_arg0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function OnGameSetup(f10_arg0, f10_arg1)
|
||||||
|
LUI.FlowManager.RequestAddMenu(f10_arg0, "gamesetup_menu_main", true, f10_arg1.controller, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function menu_xboxlive_lobby(f7_arg0, f7_arg1)
|
||||||
|
local f7_local0 = false
|
||||||
|
if not Engine.IsZombiesMode() and Engine.GetDvarBool("ui_opensummary") then
|
||||||
|
f7_local0 = true
|
||||||
|
end
|
||||||
|
if Engine.IsZombiesMode() then
|
||||||
|
ZombiesUpdateMapBkg()
|
||||||
|
end
|
||||||
|
local f7_local1 = LUI.MPLobbyBase.new(f7_arg0, {
|
||||||
|
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
|
||||||
|
has_match_summary = true,
|
||||||
|
has_new_item_usage_widget = true
|
||||||
|
}, true)
|
||||||
|
f7_local1:setClass(LUI.MPLobbyPublic)
|
||||||
|
if Engine.IsMultiplayer() then
|
||||||
|
f7_local1:AddReadyUpButton("pt_AliensReadyUpPublicInUse", StartButtonAction, false, StartButtonText)
|
||||||
|
-- f7_local1:AddButton( "@LUA_MENU_GAME_SETUP", OnGameSetup ) -- WIP
|
||||||
|
end
|
||||||
|
if Engine.IsCoreMode() then
|
||||||
|
f7_local1:AddNewItemsWidget()
|
||||||
|
f7_local1:AddCACButton()
|
||||||
|
f7_local1:AddCAOButton()
|
||||||
|
f7_local1:AddArmoryButton()
|
||||||
|
end
|
||||||
|
f7_local1:AddOptionsButton()
|
||||||
|
if not f7_local1:CheckAddMapAndMarketingPanels(f7_local0) then
|
||||||
|
f7_local1:registerEventHandler("CheckAddMapAndMarketingPanels", function(element, event)
|
||||||
|
LUI.MPLobbyPublic.CheckAddMapAndMarketingPanels(element, f7_local0)
|
||||||
|
end)
|
||||||
|
local self = LUI.UITimer.new(100, "CheckAddMapAndMarketingPanels")
|
||||||
|
self.id = "MPLobbyPublic_add_map_timer"
|
||||||
|
f7_local1.mapTimer = self
|
||||||
|
f7_local1:addElement(self)
|
||||||
|
end
|
||||||
|
f7_local1:registerEventHandler("exit_public_lobby", OnLeaveLobby)
|
||||||
|
f7_local1:registerEventHandler("player_joined", Cac.PlayerJoinedEvent)
|
||||||
|
f7_local1:registerEventHandler("loadout_request", Cac.PlayerJoinedEvent)
|
||||||
|
Lobby.EnteredLobby()
|
||||||
|
if f7_local0 then
|
||||||
|
LUI.InventoryUtils.ProcessLootExpiration()
|
||||||
|
end
|
||||||
|
return f7_local1
|
||||||
|
end
|
||||||
|
|
||||||
|
LUI.MenuBuilder.m_types_build["menu_xboxlive_lobby"] = menu_xboxlive_lobby
|
||||||
|
|
||||||
|
LUI.FlowManager.RegisterMenuStack("menu_xboxlive_lobby", function()
|
||||||
|
if Engine.IsCoreMode() and Playlist.GetPreselectedCategoryClass() ~= 8 then
|
||||||
|
return {
|
||||||
|
"mp_main_menu",
|
||||||
|
"menu_xboxlive",
|
||||||
|
"FindGameMenu",
|
||||||
|
"FindGameSubMenu"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
"mp_main_menu",
|
||||||
|
"menu_xboxlive",
|
||||||
|
"FindGameMenu"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
VLobby.InitMenuMode("menu_xboxlive_lobby", VirtualLobbyModes.LUI_MODE_LOBBY, function()
|
||||||
|
if LUI.MPLobbyBase.UseReadyUp then
|
||||||
|
Lobby.ClearLocalReadyUpFlag()
|
||||||
|
end
|
||||||
|
local f10_local0 = PersistentBackground.StackFunc(nil)
|
||||||
|
f10_local0()
|
||||||
|
end, LUI.MPLobbyBase.CollectGarbage)
|
||||||
|
|
||||||
|
LUI.FlowManager.RegisterStackResumeBehaviour("menu_xboxlive_lobby", PersistentBackground.StackFunc(nil))
|
@ -10,7 +10,7 @@ end
|
|||||||
function CanChangeTeam()
|
function CanChangeTeam()
|
||||||
local f9_local0 = GameX.GetGameMode()
|
local f9_local0 = GameX.GetGameMode()
|
||||||
local f9_local1
|
local f9_local1
|
||||||
if f9_local0 ~= "aliens" and Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f9_local0, GameTypesTable.Cols.TeamChoice ) == "1" then
|
if f9_local0 ~= "aliens" and Engine.TableLookup(GameTypesTable.File, GameTypesTable.Cols.Ref, f9_local0, GameTypesTable.Cols.TeamChoice) == "1" then
|
||||||
f9_local1 = not MLG.IsMLGSpectator()
|
f9_local1 = not MLG.IsMLGSpectator()
|
||||||
else
|
else
|
||||||
f9_local1 = false
|
f9_local1 = false
|
||||||
|
@ -13,7 +13,7 @@ scoreboard.maxPlayersOnTeam = GetTeamLimitForMaxPlayers(GetPartyMaxPlayers())
|
|||||||
scoreboard.scoreColumns.ping = {
|
scoreboard.scoreColumns.ping = {
|
||||||
width = Engine.IsZombiesMode() and 90 or 60,
|
width = Engine.IsZombiesMode() and 90 or 60,
|
||||||
title = "LUA_MENU_PING",
|
title = "LUA_MENU_PING",
|
||||||
getter = function (scoreinfo)
|
getter = function(scoreinfo)
|
||||||
return scoreinfo.ping == 0 and "BOT" or tostring(scoreinfo.ping)
|
return scoreinfo.ping == 0 and "BOT" or tostring(scoreinfo.ping)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,4 @@ if (game:issingleplayer() or not Engine.InFrontend()) then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lobby")
|
|
||||||
require("serverlist")
|
require("serverlist")
|
||||||
|
@ -39,6 +39,7 @@ game:addlocalizedstring("LUA_MENU_RANK_DESC", "Edit rank.")
|
|||||||
|
|
||||||
local armorybutton = LUI.MPLobbyBase.AddArmoryButton
|
local armorybutton = LUI.MPLobbyBase.AddArmoryButton
|
||||||
LUI.MPLobbyBase.AddArmoryButton = function(menu)
|
LUI.MPLobbyBase.AddArmoryButton = function(menu)
|
||||||
|
-- armorybutton(menu) -- disabled armory button until support for supply drops is added
|
||||||
menu:AddButton("@LUA_MENU_STATS", function(a1, a2)
|
menu:AddButton("@LUA_MENU_STATS", function(a1, a2)
|
||||||
LUI.FlowManager.RequestAddMenu(a1, "menu_stats", true, nil)
|
LUI.FlowManager.RequestAddMenu(a1, "menu_stats", true, nil)
|
||||||
end)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user