Standard Lua formatting

This commit is contained in:
WantedDV 2023-04-12 19:09:36 -02:30
parent 70297f04c8
commit 727b4eadeb
5 changed files with 237 additions and 233 deletions

View File

@ -1,35 +1,35 @@
local f0_local0 = function ( f1_arg0, f1_arg1 ) local f0_local0 = function(f1_arg0, f1_arg1)
if not CoD.useMouse then if not CoD.useMouse then
return return
else else
LUI.OverrideFunction_CallOriginalFirst( f1_arg0, "setState", function ( element, controller ) LUI.OverrideFunction_CallOriginalFirst(f1_arg0, "setState", function(element, controller)
if IsSelfInState( f1_arg0, "SelectingMap" ) then if IsSelfInState(f1_arg0, "SelectingMap") then
f1_arg0.mapList:setMouseDisabled( false ) f1_arg0.mapList:setMouseDisabled(false)
f1_arg0.mapCategoriesList:setMouseDisabled( true ) f1_arg0.mapCategoriesList:setMouseDisabled(true)
f1_arg0.m_categorySet = false f1_arg0.m_categorySet = false
else else
f1_arg0.mapList:setMouseDisabled( true ) f1_arg0.mapList:setMouseDisabled(true)
f1_arg0.mapCategoriesList:setMouseDisabled( false ) f1_arg0.mapCategoriesList:setMouseDisabled(false)
end end
end ) end)
f1_arg0.mapList:setMouseDisabled( true ) f1_arg0.mapList:setMouseDisabled(true)
f1_arg0.mapList:registerEventHandler( "leftclick_outside", function ( element, event ) f1_arg0.mapList:registerEventHandler("leftclick_outside", function(element, event)
if IsSelfInState( f1_arg0, "SelectingMap" ) and f1_arg0.m_categorySet then if IsSelfInState(f1_arg0, "SelectingMap") and f1_arg0.m_categorySet then
CoD.PCUtil.SimulateButtonPress( f1_arg1, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE ) CoD.PCUtil.SimulateButtonPress(f1_arg1, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE)
end end
f1_arg0.m_categorySet = true f1_arg0.m_categorySet = true
return true return true
end ) end)
end end
end end
local PostLoadFunc = function ( f4_arg0, f4_arg1 ) local PostLoadFunc = function(f4_arg0, f4_arg1)
f0_local0( f4_arg0, f4_arg1 ) f0_local0(f4_arg0, f4_arg1)
end end
local f0_local2 = 10000 local f0_local2 = 10000
local f0_local3 = 10001 local f0_local3 = 10001
local f0_local4 = function ( f5_arg0 ) local f0_local4 = function(f5_arg0)
local f5_local0 = CoD.mapsTable[f5_arg0] local f5_local0 = CoD.mapsTable[f5_arg0]
if CoD.CONTENT_DLC6_INDEX <= f5_local0.dlc_pack or f5_arg0 == "mp_redwood_ice" or f5_arg0 == "mp_veiled_heyday" then if CoD.CONTENT_DLC6_INDEX <= f5_local0.dlc_pack or f5_arg0 == "mp_redwood_ice" or f5_arg0 == "mp_veiled_heyday" then
return f0_local3 return f0_local3
@ -40,16 +40,16 @@ local f0_local4 = function ( f5_arg0 )
end end
end end
DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup( "ChangeMapCategories", function ( f6_arg0 ) DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup("ChangeMapCategories", function(f6_arg0)
local f6_local0 = {} local f6_local0 = {}
local f6_local1 = CoD.GetMapValue( Engine.DvarString( nil, "ui_mapname" ), "dlc_pack", CoD.CONTENT_ORIGINAL_MAP_INDEX ) local f6_local1 = CoD.GetMapValue(Engine.DvarString(nil, "ui_mapname"), "dlc_pack", CoD.CONTENT_ORIGINAL_MAP_INDEX)
local f6_local2 = function ( f7_arg0, f7_arg1 ) local f6_local2 = function(f7_arg0, f7_arg1)
return { return {
models = { models = {
text = Engine.Localize( "MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_CAPS" ), text = Engine.Localize("MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_CAPS"),
buttonText = Engine.Localize( "MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_CAPS" ), buttonText = Engine.Localize("MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_CAPS"),
image = "playlist_map", image = "playlist_map",
description = Engine.Localize( "MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_DESC" ) description = Engine.Localize("MPUI_MAP_CATEGORY_" .. f7_arg0 .. "_DESC")
}, },
properties = { properties = {
category = f7_arg1, category = f7_arg1,
@ -59,9 +59,9 @@ DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup( "ChangeMapCategor
end end
CoD.mapsTable = Engine.GetGDTMapsTable() CoD.mapsTable = Engine.GetGDTMapsTable()
local f6_local3 = function ( f8_arg0 ) local f6_local3 = function(f8_arg0)
for f8_local3, f8_local4 in pairs( CoD.mapsTable ) do for f8_local3, f8_local4 in pairs(CoD.mapsTable) do
if f8_local4.session_mode == CoD.gameModeEnum and f0_local4( f8_local3 ) == f8_arg0 and (ShowPurchasableMap( f6_arg0, f8_local3 ) or Engine.IsMapValid( f8_local3 )) then if f8_local4.session_mode == CoD.gameModeEnum and f0_local4(f8_local3) == f8_arg0 and (ShowPurchasableMap(f6_arg0, f8_local3) or Engine.IsMapValid(f8_local3)) then
return true return true
end end
end end
@ -69,30 +69,28 @@ DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup( "ChangeMapCategor
end end
if CoD.isCampaign == true then if CoD.isCampaign == true then
table.insert( f6_local0, f6_local2( "missions", CoD.CONTENT_ORIGINAL_MAP_INDEX ) ) table.insert(f6_local0, f6_local2("missions", CoD.CONTENT_ORIGINAL_MAP_INDEX))
table.insert( f6_local0, f6_local2( "dev", CoD.CONTENT_DEV_MAP_INDEX ) ) table.insert(f6_local0, f6_local2("dev", CoD.CONTENT_DEV_MAP_INDEX))
else else
table.insert( f6_local0, f6_local2( "standard", CoD.CONTENT_ORIGINAL_MAP_INDEX ) ) table.insert(f6_local0, f6_local2("standard", CoD.CONTENT_ORIGINAL_MAP_INDEX))
if not Dvar.ui_execdemo:get() and f6_local3( f0_local2 ) then if not Dvar.ui_execdemo:get() and f6_local3(f0_local2) then
table.insert( f6_local0, f6_local2( "dlc", f0_local2 ) ) table.insert(f6_local0, f6_local2("dlc", f0_local2))
end end
if not Dvar.ui_execdemo:get() and f6_local3( f0_local3 ) then if not Dvar.ui_execdemo:get() and f6_local3(f0_local3) then
table.insert( f6_local0, f6_local2( "dlc_bonus", f0_local3 ) ) table.insert(f6_local0, f6_local2("dlc_bonus", f0_local3))
end end
if Mods_Enabled() then --and Engine.Mods_Lists_GetInfoEntries( LuaEnums.USERMAP_BASE_PATH, 0, Engine.Mods_Lists_GetInfoEntriesCount( LuaEnums.USERMAP_BASE_PATH ) ) ~= nil then if Mods_Enabled() then --and Engine.Mods_Lists_GetInfoEntries( LuaEnums.USERMAP_BASE_PATH, 0, Engine.Mods_Lists_GetInfoEntriesCount( LuaEnums.USERMAP_BASE_PATH ) ) ~= nil then
local f9_local11 = Engine.Mods_Lists_GetInfoEntries(LuaEnums.USERMAP_BASE_PATH, 0,
local f9_local11 = Engine.Mods_Lists_GetInfoEntries( LuaEnums.USERMAP_BASE_PATH, 0, Engine.Mods_Lists_GetInfoEntriesCount( LuaEnums.USERMAP_BASE_PATH ) ) Engine.Mods_Lists_GetInfoEntriesCount(LuaEnums.USERMAP_BASE_PATH))
if f9_local11 then if f9_local11 then
for f9_local12 = 0, #f9_local11, 1 do for f9_local12 = 0, #f9_local11, 1 do
local f9_local17 = f9_local11[f9_local12] local f9_local17 = f9_local11[f9_local12]
if LUI.startswith( f9_local17.internalName, "mp_" ) then if LUI.startswith(f9_local17.internalName, "mp_") then
table.insert(f6_local0, f6_local2("mods", CoD.CONTENT_MODS_INDEX))
table.insert( f6_local0, f6_local2( "mods", CoD.CONTENT_MODS_INDEX ) )
end end
end end
end end
end end
end end
return f6_local0 return f6_local0
end, true ) end, true)

View File

@ -1,24 +1,24 @@
local f0_local0 = function ( f1_arg0, f1_arg1 ) local f0_local0 = function(f1_arg0, f1_arg1)
if not CoD.useMouse then if not CoD.useMouse then
return return
else else
f1_arg0.Options:setHandleMouse( true ) f1_arg0.Options:setHandleMouse(true)
f1_arg0.Options:registerEventHandler( "leftclick_outside", function ( element, event ) f1_arg0.Options:registerEventHandler("leftclick_outside", function(element, event)
CoD.PCUtil.SimulateButtonPress( event.controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE ) CoD.PCUtil.SimulateButtonPress(event.controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE)
return true return true
end ) end)
end end
end end
local PostLoadFunc = function ( f3_arg0, f3_arg1 ) local PostLoadFunc = function(f3_arg0, f3_arg1)
f0_local0( f3_arg0, f3_arg1 ) f0_local0(f3_arg0, f3_arg1)
f3_arg0.disableBlur = true f3_arg0.disableBlur = true
f3_arg0.disablePopupOpenCloseAnim = true f3_arg0.disablePopupOpenCloseAnim = true
Engine.SetModelValue( Engine.CreateModel( Engine.GetGlobalModel(), "GameSettingsFlyoutOpen" ), true ) Engine.SetModelValue(Engine.CreateModel(Engine.GetGlobalModel(), "GameSettingsFlyoutOpen"), true)
LUI.OverrideFunction_CallOriginalSecond( f3_arg0, "close", function ( element ) LUI.OverrideFunction_CallOriginalSecond(f3_arg0, "close", function(element)
Engine.SetModelValue( Engine.CreateModel( Engine.GetGlobalModel(), "GameSettingsFlyoutOpen" ), false ) Engine.SetModelValue(Engine.CreateModel(Engine.GetGlobalModel(), "GameSettingsFlyoutOpen"), false)
end ) end)
f3_arg0:registerEventHandler( "occlusion_change", function ( element, event ) f3_arg0:registerEventHandler("occlusion_change", function(element, event)
local f5_local0 = element:getParent() local f5_local0 = element:getParent()
if f5_local0 then if f5_local0 then
local f5_local1 = f5_local0:getFirstChild() local f5_local1 = f5_local0:getFirstChild()
@ -30,30 +30,32 @@ local PostLoadFunc = function ( f3_arg0, f3_arg1 )
end end
if f5_local1 then if f5_local1 then
if event.occluded == true then if event.occluded == true then
f5_local1:setAlpha( 0 ) f5_local1:setAlpha(0)
end end
f5_local1:setAlpha( 1 ) f5_local1:setAlpha(1)
end end
end end
element:OcclusionChange( event ) element:OcclusionChange(event)
end ) end)
f3_arg0:subscribeToModel( Engine.CreateModel( Engine.GetGlobalModel(), "lobbyRoot.lobbyNav", true ), function ( model ) f3_arg0:subscribeToModel(Engine.CreateModel(Engine.GetGlobalModel(), "lobbyRoot.lobbyNav", true), function(model)
local f6_local0 = f3_arg0.occludedBy local f6_local0 = f3_arg0.occludedBy
while f6_local0 do while f6_local0 do
if f6_local0.occludedBy ~= nil then if f6_local0.occludedBy ~= nil then
f6_local0 = f6_local0.occludedBy f6_local0 = f6_local0.occludedBy
end end
while f6_local0 and f6_local0.menuName ~= "Lobby" do while f6_local0 and f6_local0.menuName ~= "Lobby" do
f6_local0 = GoBack( f6_local0, f3_arg1 ) f6_local0 = GoBack(f6_local0, f3_arg1)
end end
Engine.SendClientScriptNotify( f3_arg1, "menu_change" .. Engine.GetLocalClientNum( f3_arg1 ), "Main", "closeToMenu" ) Engine.SendClientScriptNotify(f3_arg1, "menu_change" .. Engine.GetLocalClientNum(f3_arg1), "Main",
"closeToMenu")
return return
end end
GoBack( f3_arg0, f3_arg1 ) GoBack(f3_arg0, f3_arg1)
end, false ) end, false)
end end
DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup( "GameSettingsFlyoutButtonsCustom", function ( f7_arg0 ) DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup("GameSettingsFlyoutButtonsCustom",
function(f7_arg0)
local f7_local0 = { local f7_local0 = {
{ {
optionDisplay = "MPUI_CHANGE_MAP_CAPS", optionDisplay = "MPUI_CHANGE_MAP_CAPS",
@ -84,10 +86,10 @@ DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup( "Game
-- } ) -- } )
-- end -- end
local f7_local1 = {} local f7_local1 = {}
for f7_local5, f7_local6 in ipairs( f7_local0 ) do for f7_local5, f7_local6 in ipairs(f7_local0) do
table.insert( f7_local1, { table.insert(f7_local1, {
models = { models = {
displayText = Engine.Localize( f7_local6.optionDisplay ), displayText = Engine.Localize(f7_local6.optionDisplay),
customId = f7_local6.customId, customId = f7_local6.customId,
disabled = f7_local6.disabled disabled = f7_local6.disabled
}, },
@ -97,155 +99,162 @@ DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup( "Game
action = f7_local6.action, action = f7_local6.action,
actionParam = f7_local6.actionParam actionParam = f7_local6.actionParam
} }
} ) })
end end
return f7_local1 return f7_local1
end, nil, nil, nil ) end, nil, nil, nil)
LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller ) LUI.createMenu.GameSettingsFlyoutMPCustom = function(controller)
local self = CoD.Menu.NewForUIEditor( "GameSettingsFlyoutMPCustom" ) local self = CoD.Menu.NewForUIEditor("GameSettingsFlyoutMPCustom")
if PreLoadFunc then if PreLoadFunc then
PreLoadFunc( self, controller ) PreLoadFunc(self, controller)
end end
self.soundSet = "default" self.soundSet = "default"
self:setOwner( controller ) self:setOwner(controller)
self:setLeftRight( true, true, 0, 0 ) self:setLeftRight(true, true, 0, 0)
self:setTopBottom( true, true, 0, 0 ) self:setTopBottom(true, true, 0, 0)
self:playSound( "menu_open", controller ) self:playSound("menu_open", controller)
self.buttonModel = Engine.CreateModel( Engine.GetModelForController( controller ), "GameSettingsFlyoutMP.buttonPrompts" ) self.buttonModel = Engine.CreateModel(Engine.GetModelForController(controller), "GameSettingsFlyoutMP.buttonPrompts")
self.anyChildUsesUpdateState = true self.anyChildUsesUpdateState = true
local Options = LUI.UIList.new( self, controller, -2, 0, nil, false, false, 0, 0, false, false ) local Options = LUI.UIList.new(self, controller, -2, 0, nil, false, false, 0, 0, false, false)
Options:makeFocusable() Options:makeFocusable()
Options:setLeftRight( true, false, 243.43, 523.43 ) Options:setLeftRight(true, false, 243.43, 523.43)
Options:setTopBottom( true, false, 177.56, 329.56 ) Options:setTopBottom(true, false, 177.56, 329.56)
Options:setYRot( 25 ) Options:setYRot(25)
Options:setWidgetType( CoD.FE_List1ButtonLarge_PH ) Options:setWidgetType(CoD.FE_List1ButtonLarge_PH)
Options:setVerticalCount( 3 ) Options:setVerticalCount(3)
Options:setSpacing( -2 ) Options:setSpacing(-2)
Options:setDataSource( "GameSettingsFlyoutButtonsCustom" ) Options:setDataSource("GameSettingsFlyoutButtonsCustom")
Options:registerEventHandler( "gain_focus", function ( element, event ) Options:registerEventHandler("gain_focus", function(element, event)
local f9_local0 = nil local f9_local0 = nil
if element.gainFocus then if element.gainFocus then
f9_local0 = element:gainFocus( event ) f9_local0 = element:gainFocus(event)
elseif element.super.gainFocus then elseif element.super.gainFocus then
f9_local0 = element.super:gainFocus( event ) f9_local0 = element.super:gainFocus(event)
end end
CoD.Menu.UpdateButtonShownState( element, self, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS ) CoD.Menu.UpdateButtonShownState(element, self, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS)
return f9_local0 return f9_local0
end ) end)
Options:registerEventHandler( "lose_focus", function ( element, event ) Options:registerEventHandler("lose_focus", function(element, event)
local f10_local0 = nil local f10_local0 = nil
if element.loseFocus then if element.loseFocus then
f10_local0 = element:loseFocus( event ) f10_local0 = element:loseFocus(event)
elseif element.super.loseFocus then elseif element.super.loseFocus then
f10_local0 = element.super:loseFocus( event ) f10_local0 = element.super:loseFocus(event)
end end
return f10_local0 return f10_local0
end ) end)
self:AddButtonCallbackFunction( Options, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "ENTER", function ( element, menu, controller, model ) self:AddButtonCallbackFunction(Options, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "ENTER",
ProcessListAction( self, element, controller ) function(element, menu, controller, model)
ProcessListAction(self, element, controller)
return true return true
end, function ( element, menu, controller ) end, function(element, menu, controller)
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "MENU_SELECT" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "MENU_SELECT")
return true return true
end, false ) end, false)
self:addElement( Options ) self:addElement(Options)
self.Options = Options self.Options = Options
self:mergeStateConditions( { self:mergeStateConditions({
{ {
stateName = "Local", stateName = "Local",
condition = function ( menu, element, event ) condition = function(menu, element, event)
return IsLobbyNetworkModeLAN() return IsLobbyNetworkModeLAN()
end end
} }
} ) })
self:subscribeToModel( Engine.GetModel( Engine.GetGlobalModel(), "lobbyRoot.lobbyNetworkMode" ), function ( model ) self:subscribeToModel(Engine.GetModel(Engine.GetGlobalModel(), "lobbyRoot.lobbyNetworkMode"), function(model)
local f14_local0 = self local f14_local0 = self
local f14_local1 = { local f14_local1 = {
controller = controller, controller = controller,
name = "model_validation", name = "model_validation",
modelValue = Engine.GetModelValue( model ), modelValue = Engine.GetModelValue(model),
modelName = "lobbyRoot.lobbyNetworkMode" modelName = "lobbyRoot.lobbyNetworkMode"
} }
CoD.Menu.UpdateButtonShownState( f14_local0, self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE ) CoD.Menu.UpdateButtonShownState(f14_local0, self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE)
end ) end)
self:subscribeToModel( Engine.GetModel( Engine.GetGlobalModel(), "lobbyRoot.lobbyNav" ), function ( model ) self:subscribeToModel(Engine.GetModel(Engine.GetGlobalModel(), "lobbyRoot.lobbyNav"), function(model)
local f15_local0 = self local f15_local0 = self
local f15_local1 = { local f15_local1 = {
controller = controller, controller = controller,
name = "model_validation", name = "model_validation",
modelValue = Engine.GetModelValue( model ), modelValue = Engine.GetModelValue(model),
modelName = "lobbyRoot.lobbyNav" modelName = "lobbyRoot.lobbyNav"
} }
CoD.Menu.UpdateButtonShownState( f15_local0, self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE ) CoD.Menu.UpdateButtonShownState(f15_local0, self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE)
end ) end)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, nil, function ( element, menu, controller, model ) self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, nil,
GoBack( self, controller ) function(element, menu, controller, model)
ClearMenuSavedState( menu ) GoBack(self, controller)
ClearMenuSavedState(menu)
return true return true
end, function ( element, menu, controller ) end, function(element, menu, controller)
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, "" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, "")
return false return false
end, false ) end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_START, "M", function ( element, menu, controller, model ) self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_START, "M",
GoBackAndOpenOverlayOnParent( self, "StartMenu_Main", controller ) function(element, menu, controller, model)
GoBackAndOpenOverlayOnParent(self, "StartMenu_Main", controller)
return true return true
end, function ( element, menu, controller ) end, function(element, menu, controller)
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_START, "MENU_MENU" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_START, "MENU_MENU")
return true return true
end, false ) end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "S", function ( element, menu, controller, model ) self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "S",
if not IsLAN() and not IsPlayerAGuest( controller ) and IsPlayerAllowedToPlayOnline( controller ) then function(element, menu, controller, model)
GoBackAndOpenOverlayOnParent( self, "Social_Main", controller ) if not IsLAN() and not IsPlayerAGuest(controller) and IsPlayerAllowedToPlayOnline(controller) then
GoBackAndOpenOverlayOnParent(self, "Social_Main", controller)
return true return true
else else
end end
end, function ( element, menu, controller ) end, function(element, menu, controller)
if not IsLAN() and not IsPlayerAGuest( controller ) and IsPlayerAllowedToPlayOnline( controller ) then if not IsLAN() and not IsPlayerAGuest(controller) and IsPlayerAllowedToPlayOnline(controller) then
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "")
return false return false
else else
return false return false
end end
end, false ) end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_LB, nil, function ( element, menu, controller, model ) self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_LB, nil,
SendButtonPressToOccludedMenu( menu, controller, model, Enum.LUIButton.LUI_KEY_LB ) function(element, menu, controller, model)
SendButtonPressToOccludedMenu(menu, controller, model, Enum.LUIButton.LUI_KEY_LB)
return true return true
end, function ( element, menu, controller ) end, function(element, menu, controller)
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_LB, "" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_LB, "")
return false return false
end, false ) end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_RB, nil, function ( element, menu, controller, model ) self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_RB, nil,
SendButtonPressToOccludedMenu( menu, controller, model, Enum.LUIButton.LUI_KEY_RB ) function(element, menu, controller, model)
SendButtonPressToOccludedMenu(menu, controller, model, Enum.LUIButton.LUI_KEY_RB)
return true return true
end, function ( element, menu, controller ) end, function(element, menu, controller)
CoD.Menu.SetButtonLabel( menu, Enum.LUIButton.LUI_KEY_RB, "" ) CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_RB, "")
return false return false
end, false ) end, false)
Options.id = "Options" Options.id = "Options"
self:processEvent( { self:processEvent({
name = "menu_loaded", name = "menu_loaded",
controller = controller controller = controller
} ) })
self:processEvent( { self:processEvent({
name = "update_state", name = "update_state",
menu = self menu = self
} ) })
if not self:restoreState() then if not self:restoreState() then
self.Options:processEvent( { self.Options:processEvent({
name = "gain_focus", name = "gain_focus",
controller = controller controller = controller
} ) })
end end
LUI.OverrideFunction_CallOriginalSecond( self, "close", function ( element ) LUI.OverrideFunction_CallOriginalSecond(self, "close", function(element)
element.Options:close() element.Options:close()
Engine.UnsubscribeAndFreeModel( Engine.GetModel( Engine.GetModelForController( controller ), "GameSettingsFlyoutMP.buttonPrompts" ) ) Engine.UnsubscribeAndFreeModel(Engine.GetModel(Engine.GetModelForController(controller),
end ) "GameSettingsFlyoutMP.buttonPrompts"))
end)
if PostLoadFunc then if PostLoadFunc then
PostLoadFunc( self, controller ) PostLoadFunc(self, controller)
end end
return self return self
end end

View File

@ -1,31 +1,31 @@
DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", function ( f44_arg0 ) DataSources.StartMenuTabs = ListHelper_SetupDataSource("StartMenuTabs", function(f44_arg0)
local f44_local0 = {} local f44_local0 = {}
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabIcon = CoD.buttonStrings.shoulderl tabIcon = CoD.buttonStrings.shoulderl
}, },
properties = { properties = {
m_mouseDisabled = true m_mouseDisabled = true
} }
} ) })
if Engine.IsDemoPlaying() then if Engine.IsDemoPlaying() then
local f44_local1 = "CoD.StartMenu_GameOptions" local f44_local1 = "CoD.StartMenu_GameOptions"
if Engine.IsZombiesGame() then if Engine.IsZombiesGame() then
f44_local1 = "CoD.StartMenu_GameOptions_ZM" f44_local1 = "CoD.StartMenu_GameOptions_ZM"
end end
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = Engine.Localize( "MENU_THEATER_CAPS" ), tabName = Engine.Localize("MENU_THEATER_CAPS"),
tabWidget = f44_local1, tabWidget = f44_local1,
tabIcon = "" tabIcon = ""
}, },
properties = { properties = {
tabId = "gameOptions" tabId = "gameOptions"
} }
} ) })
elseif Engine.IsInGame() then elseif Engine.IsInGame() then
if IsGameTypeDOA() and not InSafehouse() then if IsGameTypeDOA() and not InSafehouse() then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "DOA", tabName = "DOA",
tabWidget = "CoD.StartMenu_GameOptions_DOA", tabWidget = "CoD.StartMenu_GameOptions_DOA",
@ -34,21 +34,21 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "gameOptions" tabId = "gameOptions"
} }
} ) })
elseif CoD.isCampaign then elseif CoD.isCampaign then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), tabName = SessionModeToUnlocalizedSessionModeCaps(Engine.CurrentSessionMode()),
tabWidget = "CoD.StartMenu_GameOptions_CP", tabWidget = "CoD.StartMenu_GameOptions_CP",
tabIcon = "" tabIcon = ""
}, },
properties = { properties = {
tabId = "gameOptions" tabId = "gameOptions"
} }
} ) })
if not Engine.IsCampaignModeZombies() then if not Engine.IsCampaignModeZombies() then
if CoD.isSafehouse and CoD.isOnlineGame() and not IsInTrainingSim( f44_arg0 ) and Dvar.ui_safehousebarracks:get() and not IsPlayerAGuest( f44_arg0 ) then if CoD.isSafehouse and CoD.isOnlineGame() and not IsInTrainingSim(f44_arg0) and Dvar.ui_safehousebarracks:get() and not IsPlayerAGuest(f44_arg0) then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "CPUI_BARRACKS_CAPS", tabName = "CPUI_BARRACKS_CAPS",
tabWidget = "CoD.CombatRecordCP_Contents", tabWidget = "CoD.CombatRecordCP_Contents",
@ -57,10 +57,10 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "combatRecord" tabId = "combatRecord"
} }
} ) })
end end
if HighestMapReachedGreaterThan( f44_arg0, 1 ) or LUI.DEV ~= nil then if HighestMapReachedGreaterThan(f44_arg0, 1) or LUI.DEV ~= nil then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "CPUI_TACTICAL_MODE_CAPS", tabName = "CPUI_TACTICAL_MODE_CAPS",
tabWidget = "CoD.StartMenu_TacticalMode", tabWidget = "CoD.StartMenu_TacticalMode",
@ -69,10 +69,10 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "tacticalMode" tabId = "tacticalMode"
} }
} ) })
end end
if not CoD.isSafehouse and not IsPlayerAGuest( f44_arg0 ) then if not CoD.isSafehouse and not IsPlayerAGuest(f44_arg0) then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "CPUI_ACCOLADES", tabName = "CPUI_ACCOLADES",
tabWidget = "CoD.MissionRecordVault_Challenges", tabWidget = "CoD.MissionRecordVault_Challenges",
@ -81,35 +81,35 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "accolades" tabId = "accolades"
} }
} ) })
end end
end end
elseif Engine.IsZombiesGame() then elseif Engine.IsZombiesGame() then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), tabName = SessionModeToUnlocalizedSessionModeCaps(Engine.CurrentSessionMode()),
tabWidget = "CoD.StartMenu_GameOptions_ZM", tabWidget = "CoD.StartMenu_GameOptions_ZM",
tabIcon = "" tabIcon = ""
}, },
properties = { properties = {
tabId = "gameOptions" tabId = "gameOptions"
} }
} ) })
else else
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), tabName = SessionModeToUnlocalizedSessionModeCaps(Engine.CurrentSessionMode()),
tabWidget = "CoD.StartMenu_GameOptions", tabWidget = "CoD.StartMenu_GameOptions",
tabIcon = "" tabIcon = ""
}, },
properties = { properties = {
tabId = "gameOptions" tabId = "gameOptions"
} }
} ) })
end end
else else
if not IsPlayerAGuest( f44_arg0 ) then if not IsPlayerAGuest(f44_arg0) then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "MENU_TAB_IDENTITY_CAPS", tabName = "MENU_TAB_IDENTITY_CAPS",
tabWidget = "CoD.StartMenu_Identity", tabWidget = "CoD.StartMenu_Identity",
@ -119,10 +119,10 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
tabId = "identity", tabId = "identity",
disabled = Dvar.ui_execdemo_gamescom:get() disabled = Dvar.ui_execdemo_gamescom:get()
} }
} ) })
end end
if not IsLobbyNetworkModeLAN() and not Dvar.ui_execdemo:get() and not Engine.IsCampaignModeZombies() and not IsPlayerAGuest( f44_arg0 ) then if not IsLobbyNetworkModeLAN() and not Dvar.ui_execdemo:get() and not Engine.IsCampaignModeZombies() and not IsPlayerAGuest(f44_arg0) then
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "MENU_TAB_CHALLENGES_CAPS", tabName = "MENU_TAB_CHALLENGES_CAPS",
tabWidget = "CoD.StartMenu_Challenges", tabWidget = "CoD.StartMenu_Challenges",
@ -131,12 +131,12 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "challenges" tabId = "challenges"
} }
} ) })
local f44_local1 = CoD.isPC local f44_local1 = CoD.isPC
if f44_local1 then if f44_local1 then
f44_local1 = false --Mods_IsUsingMods() f44_local1 = false --Mods_IsUsingMods()
end end
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "MENU_TAB_BARRACKS_CAPS", tabName = "MENU_TAB_BARRACKS_CAPS",
tabWidget = "CoD.StartMenu_Barracks", tabWidget = "CoD.StartMenu_Barracks",
@ -146,11 +146,11 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
properties = { properties = {
tabId = "barracks" tabId = "barracks"
} }
} ) })
if CommunityOptionsEnabled() then if CommunityOptionsEnabled() then
local f44_local2 = CoD.perController[f44_arg0].openMediaTabAfterClosingGroups local f44_local2 = CoD.perController[f44_arg0].openMediaTabAfterClosingGroups
CoD.perController[f44_arg0].openMediaTabAfterClosingGroups = false CoD.perController[f44_arg0].openMediaTabAfterClosingGroups = false
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabName = "MENU_TAB_MEDIA_CAPS", tabName = "MENU_TAB_MEDIA_CAPS",
tabWidget = "CoD.StartMenu_Media", tabWidget = "CoD.StartMenu_Media",
@ -160,7 +160,7 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
tabId = "media", tabId = "media",
selectIndex = f44_local2 selectIndex = f44_local2
} }
} ) })
end end
end end
end end
@ -183,7 +183,7 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
end end
f44_local4.selectIndex = f44_local5 f44_local4.selectIndex = f44_local5
f44_local3.properties = f44_local4 f44_local3.properties = f44_local4
f44_local1( f44_local2, f44_local3 ) f44_local1(f44_local2, f44_local3)
else else
local f44_local1 = table.insert local f44_local1 = table.insert
local f44_local2 = f44_local0 local f44_local2 = f44_local0
@ -203,15 +203,15 @@ DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", functio
end end
f44_local4.selectIndex = f44_local5 f44_local4.selectIndex = f44_local5
f44_local3.properties = f44_local4 f44_local3.properties = f44_local4
f44_local1( f44_local2, f44_local3 ) f44_local1(f44_local2, f44_local3)
end end
table.insert( f44_local0, { table.insert(f44_local0, {
models = { models = {
tabIcon = CoD.buttonStrings.shoulderr tabIcon = CoD.buttonStrings.shoulderr
}, },
properties = { properties = {
m_mouseDisabled = true m_mouseDisabled = true
} }
} ) })
return f44_local0 return f44_local0
end, true ) end, true)

View File

@ -2,8 +2,8 @@ if Engine.GetCurrentMap() ~= "core_frontend" then
return return
end end
local EnableLobbyMapVote = true -- toggle map vote in public lobby local enableLobbyMapVote = true -- toggle map vote in public lobby
local EnableLargeServerBrowserButton = true -- toggle large server browser button local enableLargeServerBrowserButton = true -- toggle large server browser button
local utils = require("utils") local utils = require("utils")
require("DataSources_StartMenuTabs") require("DataSources_StartMenuTabs")
@ -52,43 +52,42 @@ CoD.LobbyButtons.SETTING_UP_BOTS = {
CoD.LobbyButtons.GameSettingsFlyoutArenas = { CoD.LobbyButtons.GameSettingsFlyoutArenas = {
stringRef = "MPUI_SETUP_GAME_CAPS", stringRef = "MPUI_SETUP_GAME_CAPS",
action = function( self, element, controller, param, menu ) action = function(self, element, controller, param, menu)
SetPerControllerTableProperty( controller, "disableGameSettingsOptions", true ) SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
OpenPopup( menu, "GameSettingsFlyoutMP", controller ) OpenPopup(menu, "GameSettingsFlyoutMP", controller)
end, end,
customId = "btnGameSettingsFlyoutMP" customId = "btnGameSettingsFlyoutMP"
} }
CoD.LobbyButtons.GameSettingsFlyoutMP = { CoD.LobbyButtons.GameSettingsFlyoutMP = {
stringRef = "MPUI_SETUP_GAME_CAPS", stringRef = "MPUI_SETUP_GAME_CAPS",
action = function( self, element, controller, param, menu ) action = function(self, element, controller, param, menu)
SetPerControllerTableProperty( controller, "disableGameSettingsOptions", true ) SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
OpenPopup( menu, "GameSettingsFlyoutMPCustom", controller ) OpenPopup(menu, "GameSettingsFlyoutMPCustom", controller)
end, end,
customId = "btnGameSettingsFlyoutMPCustom" customId = "btnGameSettingsFlyoutMPCustom"
} }
CoD.LobbyButtons.SERVER_BROWSER = { CoD.LobbyButtons.SERVER_BROWSER = {
stringRef = "MENU_SERVER_BROWSER_CAPS", stringRef = "MENU_SERVER_BROWSER_CAPS",
action = function( self, element, controller, param, menu ) action = function(self, element, controller, param, menu)
SetPerControllerTableProperty( controller, "disableGameSettingsOptions", true ) SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
OpenPopup( menu, "LobbyServerBrowserOnline", controller ) OpenPopup(menu, "LobbyServerBrowserOnline", controller)
end, end,
customId = "btnDedicated" customId = "btnDedicated"
} }
local LobbyMapVoteIsEnabled = EnableLobbyMapVote local lobbyMapVoteIsEnabled = enableLobbyMapVote
local LobbyMapVote = function( LobbyMapVoteIsEnabled ) local lobbyMapVote = function(lobbyMapVoteIsEnabled)
if LobbyMapVoteIsEnabled == true then if lobbyMapVoteIsEnabled == true then
Engine.Exec( nil, "LobbyStopDemo" ) Engine.Exec(nil, "LobbyStopDemo")
end end
end end
local addCustomButtons = function(controller, menuId, buttonTable, isLeader) local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
if menuId == LobbyData.UITargets.UI_MPLOBBYMAIN.id then if menuId == LobbyData.UITargets.UI_MPLOBBYMAIN.id then
utils.RemoveSpaces(buttonTable) utils.RemoveSpaces(buttonTable)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.THEATER_MP)-1) utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.THEATER_MP) - 1)
end end
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then
@ -100,11 +99,10 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
end end
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then
LobbyMapVoteIsEnabled = EnableLobbyMapVote lobbyMapVoteIsEnabled = enableLobbyMapVote
if EnableLargeServerBrowserButton then if enableLargeServerBrowserButton then
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.SERVER_BROWSER, 1) utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.SERVER_BROWSER, 1)
end end
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
utils.RemoveButton(buttonTable, CoD.LobbyButtons.MP_PUBLIC_LOBBY_LEADERBOARD) utils.RemoveButton(buttonTable, CoD.LobbyButtons.MP_PUBLIC_LOBBY_LEADERBOARD)
@ -112,9 +110,8 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP, 2) utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP, 2)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP)) utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP))
LobbyMapVote( LobbyMapVoteIsEnabled ) lobbyMapVote(lobbyMapVoteIsEnabled)
LobbyMapVoteIsEnabled = false lobbyMapVoteIsEnabled = false
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME.id then elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME.id then
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1) utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1)
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutArenas, 2) utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutArenas, 2)
@ -125,11 +122,11 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
if menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then if menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then
-- utils.RemoveButton(buttonTable,CoD.LobbyButtons.ZM_FIND_MATCH) -- utils.RemoveButton(buttonTable,CoD.LobbyButtons.ZM_FIND_MATCH)
utils.RemoveButton(buttonTable, CoD.LobbyButtons.THEATER_ZM) utils.RemoveButton(buttonTable, CoD.LobbyButtons.THEATER_ZM)
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.THEATER_ZM, #buttonTable+1) utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.THEATER_ZM, #buttonTable + 1)
utils.RemoveSpaces(buttonTable) utils.RemoveSpaces(buttonTable)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.SERVER_BROWSER)) utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.SERVER_BROWSER))
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.ZM_BUBBLEGUM_BUFFS)-1) utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.ZM_BUBBLEGUM_BUFFS) - 1)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.STATS)) utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.STATS))
end end
end end

View File

@ -19,7 +19,7 @@ end
local RemoveButton = function(buttonTable, button) local RemoveButton = function(buttonTable, button)
for id, v in pairs(buttonTable) do for id, v in pairs(buttonTable) do
if buttonTable[id].optionDisplay == button.stringRef then if buttonTable[id].optionDisplay == button.stringRef then
table.remove(buttonTable,id) table.remove(buttonTable, id)
end end
end end
end end