iw6-lui/lui/mp_menus/squadsmodeselect.dec.lua
2024-09-12 17:25:45 +02:00

1294 lines
34 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function SquadsModeMenuCreate( f1_arg0, f1_arg1 )
local f1_local0 = Engine.GetFirstActiveController()
assert( Engine.GetDvarBool( "onlinegame" ) )
Engine.SetDvarBool( "squad_match", false )
f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
if (Engine.IsPS3() or Engine.IsPS4()) and SvS.ShowChatRestrict == true then
f1_arg0:dispatchEventToRoot( {
name = "show_chat_restrict",
controller = f1_arg1.controller
} )
SvS.ShowChatRestrict = false
end
end
function SquadsHQCreate( f2_arg0, f2_arg1 )
f2_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
Engine.ExecNow( "uploadstats", f2_arg1.controller )
end
function OnMenuBackOut( f3_arg0, f3_arg1 )
local f3_local0 = Engine.GetFirstActiveController()
Engine.SetDvarBool( "onlinegame", false )
Engine.SetDvarBool( "splitscreen", false )
Engine.ExecNow( "forcesplitscreencontrol menu_xboxlive_CLOSE", f3_local0 )
LUI.FlowManager.RequestLeaveMenu( f3_arg0 )
end
function SelectMode( f4_arg0, f4_arg1 )
if not SvS.IsSquadModeDisabled( f4_arg1 ) then
Engine.ExecNow( "resetSplitscreenSignIn", f4_arg0 )
Engine.SetDvarBool( "splitscreen", false )
Engine.ExecNow( "xstartprivateparty", f4_arg0 )
SvS.SetCurrentSquadModeInfo( f4_arg1 )
LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive", false, f4_arg0, false )
end
end
function DisplaySubModePopup( f5_arg0, f5_arg1 )
LUI.FlowManager.RequestPopupMenu( self, "squads_mode_sub_mode_popup", true, f5_arg0, false, {
categoryInfo = f5_arg1
} )
end
function SubMenuSelectionAction( f6_arg0, f6_arg1 )
return SelectMode( f6_arg1.controller, f6_arg0.properties.modeInfo )
end
function CategoryButtonAction( f7_arg0, f7_arg1 )
local f7_local0 = f7_arg0.properties.categoryInfo
if #f7_local0.Modes == 1 then
return SelectMode( f7_arg1.controller, f7_local0.Modes[1] )
else
return DisplaySubModePopup( f7_arg1.controller, f7_local0 )
end
end
function CheckCategoryDisabled( f8_arg0 )
for f8_local0 = 1, #f8_arg0.Modes, 1 do
if not SvS.IsSquadModeDisabled( f8_arg0.Modes[f8_local0] ) then
return false
end
end
return true
end
function RefreshCategoryButtonDisabled( f9_arg0, f9_arg1 )
local f9_local0 = CheckCategoryDisabled( f9_arg0.properties.categoryInfo )
if f9_local0 and not f9_arg0.disabled then
f9_arg0:processEvent( {
name = "disable"
} )
elseif not f9_local0 and f9_arg0.disabled then
f9_arg0:processEvent( {
name = "enable"
} )
end
end
function SubModePopupChildfeeder( f10_arg0 )
assert( f10_arg0 and f10_arg0.categoryInfo )
local f10_local0 = f10_arg0.categoryInfo
local f10_local1 = {}
for f10_local2 = 1, #f10_local0.Modes, 1 do
local f10_local5 = f10_local0.Modes[f10_local2]
if not SvS.IsSquadModeDisabled( f10_local5 ) then
local f10_local6, f10_local7 = SvS.GetPlaylistFromSquadMode( f10_local5 )
f10_local1[#f10_local1 + 1] = {
type = "UIGenericButton",
id = "sub_mode_popup_" .. f10_local2,
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Playlist.GetItemName( f10_local6, f10_local7 ),
modeInfo = f10_local5
},
handlers = {
button_action = SubMenuSelectionAction,
button_over = function ( f11_arg0, f11_arg1 )
f11_arg0:dispatchEventToRoot( {
name = "update_popup_desc_text",
modeInfo = f11_arg0.properties.modeInfo,
immediate = true
} )
end
}
}
end
end
return f10_local1
end
function squads_mode_sub_mode_popup()
local f12_local0 = 550
local f12_local1 = 250
local f12_local2 = 30
return {
type = "UIElement",
id = "squads_mode_sub_mode_popup_container_id",
properties = {
categoryInfo = {}
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "squads_mode_sub_mode_popup_overlay_id",
states = {
default = CoD.ColorizeState( Swatches.Overlay.Color, {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = -200,
bottom = 175,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
alpha = Swatches.Overlay.AlphaMore
} )
}
},
{
type = "UIElement",
id = "squads_mode_sub_mode_popup_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -(f12_local1 / 2 + f12_local2),
bottom = f12_local1 / 2 - f12_local2,
width = f12_local0
}
},
children = {
{
type = "generic_drop_shadow",
id = "squads_mode_sub_mode_popup_dropshadow_id",
properties = {
offset_shadow = 0
}
},
{
type = "generic_menu_titlebar",
id = "squads_mode_sub_mode_popup_titlebar_id",
properties = {
title_bar_text = Engine.Localize( "MENU_GAME_TYPES" ),
fill_alpha = 1
}
},
{
type = "generic_menu_background",
id = "squads_mode_sub_mode_popup_background_id",
properties = {
fill_alpha = 1,
categoryInfo = MBh.Property( "categoryInfo" )
},
children = {
{
type = "UIElement",
id = "squads_mode_sub_mode_popup_icon_container_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 3,
left = 3,
width = 128,
height = 128
}
},
children = {
{
type = "UIImage",
id = "squads_mode_sub_mode_popup_icon_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -20,
width = 192,
height = 192
}
},
handlers = {
update_popup_desc_text = function ( f13_arg0, f13_arg1 )
if f13_arg1.modeInfo then
local f13_local0 = SvS.GetSquadPlaylistImageByMode( f13_arg1.modeInfo )
if f13_arg1.modeInfo == SvS.SquadModes.SafeguardExtended and f13_local0 == "icon_pl_safeguard" then
f13_local0 = "icon_pl_safeguard_extended"
end
if f13_local0 and f13_local0 ~= "" then
f13_arg0:setImage( RegisterMaterial( f13_local0 ) )
end
end
end
}
}
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 1,
bottom = -1,
left = 133,
width = 1,
material = RegisterMaterial( "white" ),
alpha = Swatches.GenericMenu.BackgroundAlpha
} )
}
},
{
type = "UIStencil",
id = "squads_mode_sub_mode_popup_list_container_id",
properties = {
categoryInfo = MBh.Property( "categoryInfo" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 5,
left = 138,
right = -5,
height = 115,
alignment = LUI.Alignment.Top
}
},
children = {
{
type = "UIVerticalList",
id = "squads_mode_sub_mode_popup_list_id",
properties = {
categoryInfo = MBh.Property( "categoryInfo" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
childrenFeeder = SubModePopupChildfeeder
}
}
},
{
type = "UIMarqueeText",
id = "squads_mode_sub_mode_popup_mode_desc_id",
properties = {
text = "",
useTextWrapping = true,
textHeight = CoD.TextSettings.NormalFont.Height
},
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 115,
left = 138,
right = -5,
height = 3 * CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} )
},
handlers = {
update_popup_desc_text = function ( f14_arg0, f14_arg1 )
if f14_arg1.modeInfo then
f14_arg0:setText( SvS.GetSquadModeDesc( f14_arg1.modeInfo ) )
end
end
}
},
{
type = "UIText",
id = "squads_mode_sub_mode_popup_player_desc_id",
properties = {
categoryInfo = MBh.Property( "categoryInfo" )
},
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = -10,
left = 138,
right = -5,
height = CoD.TextSettings.ExtraBigFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center
} )
},
handlers = {
menu_create = function ( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg0.properties.categoryInfo.PlayersAltDescLocRef
local f15_local1 = ""
if f15_local0 ~= "" then
f15_local1 = Engine.Localize( f15_local0 )
end
f15_arg0:setText( f15_local1 )
end
}
}
}
}
}
},
{
type = "UIBindButton",
handlers = {
button_secondary = function ( f16_arg0, f16_arg1 )
LUI.FlowManager.RequestLeaveMenu( f16_arg0 )
end
}
}
}
}
end
function BuildSquadsCategoryButton( f17_arg0 )
return {
type = "UIGenericButton",
id = "squads_mode_button_" .. f17_arg0.Devname,
disabled = CheckCategoryDisabled( f17_arg0 ),
listDefaultFocus = SvS.GetSquadCategoryFromMode( SvS.GetCurrentSquadModeInfo() ) == f17_arg0,
properties = {
button_text = Engine.Localize( f17_arg0.NameLocRefCaps ),
button_action_func = CategoryButtonAction,
categoryInfo = f17_arg0,
additional_handlers = {
check_buttons = RefreshCategoryButtonDisabled
}
},
handlers = {
button_over = function ( f18_arg0, f18_arg1 )
f18_arg0:dispatchEventToRoot( {
name = "update_squads_mode_desc",
categoryInfo = f17_arg0
} )
end
,
button_over_disable = function ( f19_arg0, f19_arg1 )
f19_arg0:dispatchEventToRoot( {
name = "update_squads_mode_desc",
categoryInfo = f17_arg0
} )
end
}
}
end
function HideDescPanelEvent( f20_arg0, f20_arg1 )
f20_arg0:dispatchEventToRoot( {
name = "update_squads_mode_desc"
} )
end
function SquadsModeMainButtonListChildFeeder( f21_arg0 )
local f21_local0 = {}
for f21_local1 = 1, #SvS.SquadCategories, 1 do
f21_local0[#f21_local0 + 1] = BuildSquadsCategoryButton( SvS.SquadCategories[f21_local1] )
end
local f21_local1 = Engine.GetDvarInt( "num_available_map_packs" )
if 1 <= f21_local1 or f21_local1 < #SvS.SquadDLCCategories then
f21_local0[#f21_local0 + 1] = BuildSquadsCategoryButton( SvS.SquadDLCCategories[f21_local1] )
end
f21_local0[#f21_local0 + 1] = {
type = "generic_separator",
id = "spacer_line_id"
}
f21_local0[#f21_local0 + 1] = {
type = "UIGenericButton",
id = "squads_mode_button_squad_reports",
properties = {
button_text = Engine.Localize( "@LUA_MENU_SQUAD_HQ_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_SQUAD_HQ_DESC" ),
button_action_func = function ( f22_arg0, f22_arg1 )
LUI.FlowManager.RequestAddMenu( f22_arg0, "squads_hq_menu", true, f22_arg1.controller, false, {
controller = f22_arg1.controller
} )
end,
additional_handlers = {
button_over = HideDescPanelEvent
}
}
}
f21_local0[#f21_local0 + 1] = {
type = "UIGenericButton",
id = "store_button_id",
disabled = false,
properties = {
button_text = Engine.Localize( "@LUA_MENU_STORE_CAPS" ),
button_action_func = function ( f23_arg0, f23_arg1 )
Cac.ClearAllNewIconsForType( f23_arg1.controller, "Store" )
Sns.OpenStoreMenu( f23_arg1.controller )
end,
desc_text = Engine.Localize( "@LUA_MENU_STORE_DESC" ),
additional_handlers = {
button_over = HideDescPanelEvent,
refresh_new_icons = function ( f24_arg0, f24_arg1 )
if Cac.AnyUnseenMDLCItems( Engine.GetFirstActiveController(), {
"Store"
} ) then
f24_arg0:processEvent( {
name = "show_new_icon"
} )
end
end
}
}
}
f21_local0[#f21_local0 + 1] = {
type = "button_desc_text",
id = "squads_mode_desc_text_id",
states = {
default = {},
visible = {
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_squads_mode_desc = function ( f25_arg0, f25_arg1 )
if f25_arg1.categoryInfo then
f25_arg0:animateToState( "hidden", 100 )
else
f25_arg0:animateToState( "visible", 100 )
end
end
}
}
return f21_local0
end
function squad_mode_desc_pane()
local f26_local0 = 100 - GenericTitleBarDims.TitleBarHeight
local f26_local1 = 650
return {
type = "UIElement",
id = "gamemode_desc_pane_id",
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = true,
left = -120,
right = 576,
top = 1024,
bottom = 1024 + f26_local1 - f26_local0
},
visible = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = -120,
right = 576,
top = f26_local0,
bottom = f26_local1
}
},
handlers = {
update_squads_mode_desc = function ( f27_arg0, f27_arg1 )
if f27_arg1.categoryInfo and f27_arg1.categoryInfo.Image ~= "" then
f27_arg0:animateToState( "visible", 250 )
else
f27_arg0:animateToState( "default", 250 )
end
f27_arg0:dispatchEventToChildren( f27_arg1 )
end
},
children = {
{
type = "generic_menu_background_withfade",
id = "gamemode_bg_fade_id",
properties = {
shadow_top_offset = GenericTitleBarDims.TitleBarHeight
},
children = {
{
type = "UIImage",
id = "gamemode_image_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = GenericTitleBarDims.TitleBarHeight + 10,
left = 10,
height = 370,
width = 676
},
hidden = {
alpha = 0
}
},
handlers = {
update_squads_mode_desc = function ( f28_arg0, f28_arg1 )
if f28_arg1.categoryInfo and f28_arg1.categoryInfo.Image ~= "" then
f28_arg0:setImage( RegisterMaterial( f28_arg1.categoryInfo.Image ) )
end
end
}
},
{
type = "UIImage",
id = "playlist_image_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 325,
left = -40,
width = 256,
height = 256,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_squads_mode_desc = function ( f29_arg0, f29_arg1 )
if f29_arg1.categoryInfo then
local f29_local0 = SvS.GetSquadPlaylistImage( f29_arg1.categoryInfo )
if f29_local0 == "" and f29_arg1.categoryInfo.Devname == "squads_dlc" then
f29_local0 = SvS.GetSquadPlaylistImage( SvS.SquadDLCCategories[1] )
end
if f29_local0 and f29_local0 ~= "" then
f29_arg0:setImage( RegisterMaterial( f29_local0 ) )
f29_arg0:animateToState( "default", 0 )
else
f29_arg0:animateToState( "hidden", 0 )
end
end
end
}
},
{
type = "UIMarqueeText",
id = "gamemode_desc_id",
properties = {
textHeight = CoD.TextSettings.NormalFont.Height,
useTextWrapping = true
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 165,
top = 415,
right = -5,
height = CoD.TextSettings.NormalFont.Height * 3,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
},
handlers = {
update_squads_mode_desc = function ( f30_arg0, f30_arg1 )
if f30_arg1.categoryInfo then
f30_arg0:setText( SvS.GetSquadCategoryDesc( f30_arg1.categoryInfo ) )
end
end
}
},
{
type = "UIText",
id = "gamemode_players_desc_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 165,
top = 490,
right = -5,
height = CoD.TextSettings.ExtraBigFont.Height + 10,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.secondary_text_color.r,
green = Colors.secondary_text_color.g,
blue = Colors.secondary_text_color.b
}
},
handlers = {
update_squads_mode_desc = function ( f31_arg0, f31_arg1 )
local f31_local0 = ""
if f31_arg1.categoryInfo and f31_arg1.categoryInfo.PlayersDescLocRef ~= "" then
f31_local0 = Engine.Localize( f31_arg1.categoryInfo.PlayersDescLocRef )
end
f31_arg0:setText( f31_local0 )
end
}
}
}
}
}
}
end
function SquadsShowChatRestrict( f32_arg0, f32_arg1 )
if Engine.IsPS3() or Engine.IsPS4() then
LUI.FlowManager.RequestPopupMenu( f32_arg0, "mp_no_squad_assault", true, f32_arg1.controller, false )
end
end
function squads_mode_select_menu()
return {
type = "UIElement",
id = "squads_mode_select_menu",
properties = {
additional_handlers = {
gain_focus = function ( f34_arg0, f34_arg1 )
f34_arg0:dispatchEventToRoot( {
name = "refresh_new_icons",
immediate = true
} )
f34_arg0:dispatchEventToRoot( {
name = "open_motd",
immediate = true
} )
end
,
restore_focus = function ( f35_arg0, f35_arg1 )
f35_arg0:dispatchEventToRoot( {
name = "refresh_new_icons",
immediate = true
} )
end
}
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = SquadsModeMenuCreate,
show_chat_restrict = SquadsShowChatRestrict
},
children = {
{
type = "generic_menu_title",
id = "squads_mode_select_menu_title_text_id",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_SQUAD_MODE_CAPS" )
}
},
{
type = "UIVerticalList",
id = "squads_mode_select_menu_button_list_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
alignment = LUI.Alignment.Top
}
},
childrenFeeder = SquadsModeMainButtonListChildFeeder
},
{
type = "squad_mode_desc_pane",
id = "squads_mode_select_desc_pane_id"
},
{
type = "button_helper_text_main",
id = "squads_mode_select_button_helper_text_id"
},
{
type = "online_friends_widget",
id = "squads_mode_select_friends_widget_id"
},
{
type = "SocialFeedTicker",
id = "social_ticker_id"
},
{
type = "UIBindButton",
id = "squads_mode_select_bind_button",
handlers = {
button_secondary = OnMenuBackOut
}
},
{
type = "UITimer",
id = "bnt_lock_tmr",
properties = {
event = "check_buttons",
interval = 100,
disposable = false
}
}
}
}
end
function squads_hq_stat_bar()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 26,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "squads_hq_stat_bar_bg",
states = {
default = CoD.ColorizeState( Colors.very_dark_cyan, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
alpha = 0.8
} )
}
},
{
type = "UIImage",
id = "squads_hq_stat_bar_cap",
states = {
default = CoD.ColorizeState( Colors.grey_22, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -272,
right = -240,
material = RegisterMaterial( "box_angle_ltcap" ),
alpha = 0.5
} )
}
},
{
type = "UIImage",
id = "squads_hq_stat_bar_alt_bg",
states = {
default = CoD.ColorizeState( Colors.grey_22, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -240,
right = 0,
material = RegisterMaterial( "white" ),
alpha = 0.5
} )
}
},
{
type = "UIText",
id = "squads_hq_stat_bar_title_text",
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = 5,
right = 300,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left
} )
},
properties = {
text = MBh.Property( "title_text" )
}
},
{
type = "UIText",
id = "squads_hq_stat_bar_value_text",
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = -240,
right = -10,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} )
},
properties = {
text = MBh.Property( "value_text" )
},
handlers = {
set_stat_value = function ( f37_arg0, f37_arg1 )
f37_arg0:setText( f37_arg1.text )
end
}
}
}
}
end
function SquadsHQStatListChildFeeder( f38_arg0 )
local f38_local0 = {}
local f38_local1 = f38_arg0.exclusiveController
local f38_local2 = SvS.GetLocalPlayerBaseName( f38_local1 )
local f38_local3 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "squad_mode" )
local f38_local4 = nil
if f38_local3 then
f38_local4 = Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f38_local3, GameTypesTable.Cols.Name ) )
end
local f38_local5 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "wins" )
local f38_local6 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "loses" )
local f38_local7 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "win_streak" )
local f38_local8 = Engine.FormatTimeHoursMinutesSeconds( Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "prestigeDoubleXpMaxTimePlayed" ) - Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "prestigeDoubleXpTimePlayed" ) )
local f38_local9 = nil
if f38_local5 + f38_local6 == 0 then
f38_local9 = 0
elseif f38_local6 == 0 then
f38_local9 = f38_local5
elseif f38_local5 == 0 then
f38_local9 = 0
else
f38_local9 = f38_local5 / f38_local6
end
local f38_local10 = string.format( "%.3f", f38_local9 )
f38_local0[#f38_local0 + 1] = {
type = "UIImage",
id = "squads_hq_stat_map_image_id",
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
height = 256,
width = 512,
material = RegisterMaterial( SvS.GetBasePreviewImageLarge( f38_local2 ) )
} )
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_name_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_SQUAD_NAME" ),
value_text = Engine.MarkLocalized( Squad.GetPlayerSquadName( f38_arg0.exclusiveController ) ),
exclusiveController = f38_arg0.exclusiveController
},
handlers = {
update_squad_name = function ( f39_arg0, f39_arg1 )
f39_arg0:processEvent( {
name = "set_stat_value",
text = Engine.MarkLocalized( Squad.GetPlayerSquadName( f39_arg0.properties.exclusiveController ) )
} )
end
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_mode_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_SQUAD_GAME_MODE" ),
value_text = f38_local4
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_map_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_SQUAD_BASE" ),
value_text = Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( SvS.GetLocalPlayerBaseName( f38_local1 ) ) )
}
}
f38_local0[#f38_local0 + 1] = {
type = "UIImage",
id = "squads_hq_stat_spacer_id",
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
height = 4,
alpha = 0.15,
material = RegisterMaterial( "white" )
} )
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_wins_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_WINS" ),
value_text = f38_local5
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_losses_id",
properties = {
title_text = Engine.Localize( "MENU_LOSSES" ),
value_text = f38_local6
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_ratio_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_WL_RATIO" ),
value_text = f38_local10
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_streak_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_CURRENT_STREAK" ),
value_text = f38_local7
}
}
f38_local0[#f38_local0 + 1] = {
type = "squads_hq_stat_bar",
id = "squads_hq_stat_xp_time_id",
properties = {
title_text = Engine.Localize( "LUA_MENU_XP_TIME_REMAINING" ),
value_text = f38_local8
}
}
return f38_local0
end
function SquadsHQMainButtonListChildFeeder( f40_arg0 )
local f40_local0 = {}
local f40_local1 = f40_arg0.exclusiveController
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squads_mode_button_create_a_class",
disabled = false,
properties = {
button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ),
button_action_func = function ( f41_arg0, f41_arg1 )
Cac.ValidateAllPlayersPublicSquadMembers()
LUI.FlowManager.RequestAddMenu( f41_arg0, "cac_member_select_main", true, f41_arg1.controller, false, {
next_screen = "cac_edit_main",
squad_location = "squadMembers",
class_location = "loadouts"
} )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squads_mode_button_leaderboards",
properties = {
button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS_SQUADS" ),
button_action_func = function ( f42_arg0, f42_arg1 )
LUI.FlowManager.RequestAddMenu( f42_arg0, "leaderboards", true, f42_arg1.controller )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squads_mode_button_squad_reports",
properties = {
button_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ),
desc_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS_DESC" ),
button_action_func = function ( f43_arg0, f43_arg1 )
LUI.FlowManager.RequestAddMenu( f43_arg0, "squad_reports_menu", false, f43_arg1.controller, false, {
controller = f43_arg1.controller,
fromSquadsModeMenu = true
} )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squad_name_button",
properties = {
button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_NAME_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_NAME_DESC" ),
button_action_func = function ( f44_arg0, f44_arg1 )
Squad.ChangeName( f44_arg1.controller )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squad_game_mode_button",
properties = {
button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_GAME_MODE_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_GAME_MODE_DESC" ),
button_action_func = function ( f45_arg0, f45_arg1 )
LUI.FlowManager.RequestAddMenu( f45_arg0, "settings_recipe_choosetype", true, f45_arg1.controller, false, {
requestedGameMode = "Standard",
menu_title = Cac.GetGameModeTypeString( "Standard" ),
squadBaseSelect = true,
teamsOnly = true
} )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squad_base_button",
properties = {
button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_BASE_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_BASE_DESC" ),
button_action_func = function ( f46_arg0, f46_arg1 )
LUI.FlowManager.RequestAddMenu( f46_arg0, "mapsetup_menu_main", true, f46_arg1.controller, false, {
rotationAllowed = false,
squadBaseSelect = true
} )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "UIGenericButton",
id = "squad_order_button",
properties = {
button_text = Engine.Localize( "@LUA_MENU_SET_SQUAD_ORDER_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_SET_SQUAD_ORDER_DESC" ),
button_action_func = function ( f47_arg0, f47_arg1 )
LUI.FlowManager.RequestPopupMenu( f47_arg0, "cac_squad_order_popup", true, f47_arg1.controller, false, {
squad_location = "squadMembers"
} )
end
}
}
f40_local0[#f40_local0 + 1] = {
type = "button_desc_text",
id = "squads_mode_desc_text_id",
properties = {
lines = 4
}
}
return f40_local0
end
function squads_hq_menu()
return {
type = "UIElement",
id = "squads_hq_menu",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = SquadsHQCreate,
cac_update_header_text = function ( f49_arg0, f49_arg1 )
if f49_arg0.properties.exclusiveController then
Engine.Exec( "uploadstats", f49_arg0.properties.exclusiveController )
end
f49_arg0:processEvent( {
name = "update_squad_name"
} )
end
},
children = {
{
type = "generic_menu_title",
id = "squads_hq_menu_title_text_id",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_SQUAD_HQ_CAPS" )
}
},
{
type = "UIVerticalList",
id = "squads_hq_menu_button_list_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
alignment = LUI.Alignment.Top
}
},
childrenFeeder = SquadsHQMainButtonListChildFeeder
},
{
type = "generic_menu_background_withfade",
id = "squads_hq_menu_stats_pane_id",
properties = {
shadow_top_offset = GenericTitleBarDims.TitleBarHeight
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 100 - GenericTitleBarDims.TitleBarHeight,
bottom = 650,
left = -720,
width = 532
},
hidden = {
alpha = 0
}
},
handlers = {
update_squads_mode_desc = function ( f50_arg0, f50_arg1 )
if f50_arg1.categoryInfo then
f50_arg0:setImage( RegisterMaterial( f50_arg1.categoryInfo.Image ) )
end
end
},
children = {
{
type = "UIVerticalList",
id = "squads_hq_menu_stat_list_id",
states = {
default = {
spacing = 4,
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = GenericTitleBarDims.TitleBarHeight + 10,
bottom = 0,
left = 10,
right = -10
}
},
childrenFeeder = SquadsHQStatListChildFeeder
}
}
},
{
type = "button_helper_text_main",
id = "squads_hq_button_helper_text_id"
},
{
type = "online_friends_widget",
id = "squads_hq_friends_widget_id"
},
{
type = "generic_back_button"
}
}
}
end
LUI.MenuBuilder.registerDef( "squads_mode_select_menu", squads_mode_select_menu )
LUI.MenuBuilder.registerDef( "squads_mode_sub_mode_popup", squads_mode_sub_mode_popup )
LUI.MenuBuilder.registerDef( "squad_mode_desc_pane", squad_mode_desc_pane )
LUI.FlowManager.RegisterStackPushBehaviour( "squads_mode_select_menu", function ()
PersistentBackground.ProcessEvent( {
name = "blur_persistent_background",
duration = 500
} )
end )
LUI.FlowManager.RegisterStackPopBehaviour( "squads_mode_select_menu", function ()
PersistentBackground.ProcessEvent( {
name = "unblur_persistent_background",
duration = 500
} )
end )
LUI.MenuBuilder.registerDef( "squads_hq_menu", squads_hq_menu )
LUI.MenuBuilder.registerDef( "squads_hq_stat_bar", squads_hq_stat_bar )
LockTable( _M )