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

2732 lines
86 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function GetInterMenuData( f1_arg0 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
return {
open_char_list = true,
squadLocation = f1_local0.squadLocation,
squadMemberIndex = f1_local0.squadMemberIndex,
slot = f1_local0.loadout_slot,
alternateCacMenus = f1_local0.alternateCacMenus,
allowMemberSwap = f1_local0.allowMemberSwap
}
end
function RebindShoulderButtons( f2_arg0, f2_arg1 )
f2_arg0:dispatchEventToRoot( {
name = "rebind_shoulder_buttons",
immediate = true
} )
end
function UnbindShoulderButtons( f3_arg0, f3_arg1 )
f3_arg0:dispatchEventToRoot( {
name = "unbind_shoulder_buttons",
immediate = true
} )
end
function ChangeGender( f4_arg0, f4_arg1, f4_arg2 )
local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f4_local1 = Cac.ResetGenderDependantFields
local f4_local2 = f4_local0.exclusiveControllerIndex
local f4_local3 = f4_local0.squadLocation
local f4_local4 = f4_local0.squadMemberIndex
local f4_local5
if f4_arg2 then
f4_local5 = Cac.Customization.Gender.Female
if not f4_local5 then
else
f4_local1( f4_local2, f4_local3, f4_local4, f4_local5 )
f4_arg0:processEvent( {
name = "content_refresh"
} )
f4_arg0:dispatchEventToRoot( {
name = "character_full_refresh"
} )
f4_arg0:dispatchEventToRoot( {
name = "refresh_new_icons"
} )
end
end
f4_local5 = Cac.Customization.Gender.Male
end
function cac_customize_gender_popup()
local f5_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f5_local1 = Cac.GetCurrentGender( f5_local0.exclusiveControllerIndex, f5_local0.squadLocation, f5_local0.squadMemberIndex ) == Cac.Customization.Gender.Female
local f5_local2 = {
type = "generic_yesno_popup"
}
local f5_local3 = {
cancel_means_no = false,
popup_title = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_GENDER_CAPS" ),
message_text = Engine.Localize( "@LUA_MENU_CHOOSE_GENDER" ),
yes_action = function ( f6_arg0, f6_arg1 )
ChangeGender( f6_arg0, f6_arg1, true )
end,
no_action = function ( f7_arg0, f7_arg1 )
ChangeGender( f7_arg0, f7_arg1, false )
end,
yes_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FEMALE_CAPS" ),
no_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_MALE_CAPS" )
}
local f5_local4
if f5_local1 then
f5_local4 = 1
if not f5_local4 then
else
f5_local3.default_focus_index = f5_local4
f5_local2.properties = f5_local3
return f5_local2
end
end
f5_local4 = 2
end
function InputClanTagComplete( f8_arg0, f8_arg1 )
if f8_arg1.text then
local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
Engine.SetAndEnableCustomClanTag( f8_local0.exclusiveControllerIndex, f8_arg1.text )
RefreshClanTag( f8_arg0 )
end
end
function RefreshClanTag( f9_arg0 )
local f9_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag]
local f9_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
f9_arg0:dispatchEventToRoot( {
name = "preview_element",
field = f9_local0,
elementRef = f9_local0.GetSavedRef( f9_local1.exclusiveControllerIndex )
} )
end
function cac_customize_clan_tag_popup()
local f10_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
Engine.AntiCheatBanCheck( f10_local0.exclusiveControllerIndex, CoD.AntiCheat.Ban.FEATURE_BAN_CLAN_TAGS )
if not f10_local0.currentField or not f10_local0.exclusiveControllerIndex then
DebugPrint( "WARNING: Opening cac_customize_clan_tag_popup while no field is currently selected, this should only happen on LUI reload. Closing popup." )
return {
type = "UIElement",
handlers = {
menu_create = MBh.LeaveMenu()
}
}
end
local f10_local1 = Clan.AlreadyMember( f10_local0.exclusiveControllerIndex ) and Clan.GetName( f10_local0.exclusiveControllerIndex ) or nil
local f10_local2 = Engine.IsXbox360()
if not f10_local2 then
f10_local2 = Engine.IsXB3()
end
return {
type = "generic_selectionList_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_CHOOSE_" .. f10_local0.currentField.LocName ),
popup_width = 700,
popup_childfeeder = function ()
local f11_local0 = {}
local f11_local1 = #f11_local0 + 1
local f11_local2 = {
type = "UIGenericButton",
id = "use_custom_tag"
}
local f11_local3 = f10_local2
if f11_local3 then
f11_local3 = not Engine.IsUserSignedInToLive( f10_local0.exclusiveControllerIndex )
end
f11_local2.disabled = f11_local3
f11_local2.properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG" ),
button_action_func = function ( f12_arg0, f12_arg1 )
Engine.OpenScreenKeyboard( f10_local0.exclusiveControllerIndex, Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG" ), Engine.GetCustomClanTag( f10_local0.exclusiveControllerIndex ) or "", 4, true, true )
LUI.FlowManager.RequestLeaveMenu( f12_arg0 )
end,
button_over_disable_func = function ( f13_arg0, f13_arg1 )
f13_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@PLATFORM_REQUIRE_ONLINE_FOR_CLAN_TAG" )
} )
end,
button_over_func = function ( f14_arg0, f14_arg1 )
f14_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG_DESC" )
} )
end
}
f11_local0[f11_local1] = f11_local2
if Clan.IsEnabled() then
f11_local0[#f11_local0 + 1] = {
type = "UIGenericButton",
id = "use_tag_from_clan",
disabled = not Clan.AlreadyMember( f10_local0.exclusiveControllerIndex ),
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = f10_local1 and Engine.Localize( "@LUA_MENU_USE_TAG_FROM_NAMED_ELITE_CLAN", Engine.MarkLocalized( f10_local1 ) ) or Engine.Localize( "@LUA_MENU_USE_TAG_FROM_ELITE_CLAN" ),
button_action_func = function ( f15_arg0, f15_arg1 )
Engine.SetProfileDataUseEliteClanTag( f10_local0.exclusiveControllerIndex, true )
LUI.FlowManager.RequestLeaveMenu( f15_arg0 )
RefreshClanTag( f15_arg0 )
end,
button_over_disable_func = function ( f16_arg0, f16_arg1 )
f16_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@LUA_MENU_USE_TAG_FROM_ELITE_CLAN_DESC" )
} )
end,
button_over_func = function ( f17_arg0, f17_arg1 )
f17_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@LUA_MENU_USE_TAG_FROM_NAMED_ELITE_CLAN_DESC" )
} )
end
}
}
end
f11_local1 = #f11_local0 + 1
f11_local2 = {
type = "UIGenericButton",
id = "clear_tag"
}
f11_local3 = f10_local2
if f11_local3 then
f11_local3 = not Engine.IsUserSignedInToLive( f10_local0.exclusiveControllerIndex )
end
f11_local2.disabled = f11_local3
f11_local2.properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@LUA_MENU_CLEAR_YOUR_CLAN_TAG" ),
button_action_func = function ( f18_arg0, f18_arg1 )
Engine.ClearCustomClanTag( f10_local0.exclusiveControllerIndex )
Engine.SetProfileDataUseEliteClanTag( f10_local0.exclusiveControllerIndex, false )
RefreshClanTag( f18_arg0 )
LUI.FlowManager.RequestLeaveMenu( f18_arg0 )
end,
button_over_disable_func = function ( f19_arg0, f19_arg1 )
f19_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@PLATFORM_REQUIRE_ONLINE_FOR_CLAN_TAG" )
} )
end,
button_over_func = function ( f20_arg0, f20_arg1 )
f20_arg0:dispatchEventToRoot( {
name = "update_clan_tag_help",
text = Engine.Localize( "@LUA_MENU_CLEAR_CLAN_TAG_DESC" )
} )
end
}
f11_local0[f11_local1] = f11_local2
f11_local0[#f11_local0 + 1] = {
type = "UIElement",
id = "spacer",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 10
}
}
}
f11_local0[#f11_local0 + 1] = {
type = "UIText",
id = "help_text",
properties = {
text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG_DESC" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1
}
},
handlers = {
update_clan_tag_help = function ( f21_arg0, f21_arg1 )
if f21_arg1.text then
f21_arg0:setText( f21_arg1.text )
end
end
}
}
return f11_local0
end
}
}
end
function CustomizeSmallPopupButton( f22_arg0, f22_arg1 )
assert( f22_arg0.currentField )
local f22_local0 = Cac.IsCustomizationItemDLC( f22_arg0.currentField, f22_arg1 )
local f22_local1 = function ( f23_arg0, f23_arg1 )
if f22_arg0.currentField.PreviewFunction then
f23_arg0.previewOutput = f22_arg0.currentField.PreviewFunction( nil, nil, nil, f22_arg1, nil, nil )
end
assert( f22_arg0.currentField.UnlockType )
Cac.MarkItemNoMoreNewIcon( f22_arg0.exclusiveControllerIndex, f22_arg1, f22_arg0.currentField.UnlockType )
f23_arg0:dispatchEventToRoot( {
name = "refresh_new_icons",
immediate = true
} )
f23_arg0:processEvent( {
name = "hide_new_icon"
} )
end
local f22_local2 = function ( f24_arg0, f24_arg1 )
if f24_arg0.previewOutput then
Engine.StopSound( f24_arg0.previewOutput )
f24_arg0.previewOutput = nil
end
end
local self = LUI.UIGenericButton.new( nil, {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
button_text = Engine.Localize( f22_arg0.currentField.GetName( f22_arg1 ) ),
button_over_func = f22_local1,
button_over_disable_func = f22_local1,
button_up_func = f22_local2,
button_disable_func = f22_local2,
button_action_func = function ( f25_arg0, f25_arg1 )
f22_arg0.currentField.SaveRef( f25_arg1.controller, f22_arg0.squadLocation, f22_arg0.squadMemberIndex, f22_arg1 )
LUI.FlowManager.RequestLeaveMenu( f25_arg0 )
end,
button_action_disable_func = function ( f26_arg0, f26_arg1 )
if f22_local0 and not Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 ) and not IsOfflineMatch() then
if Engine.IsPC() then
Sns.OpenStoreMenu( f22_arg0.exclusiveControllerIndex )
else
assert( f22_arg0.currentField.DLCOffer )
Sns.OpenStoreLinkConfirmPopup( f22_arg0.exclusiveControllerIndex, Engine.TableLookup( f22_arg0.currentField.csv, 0, f22_arg1, f22_arg0.currentField.DLCOffer ) )
end
end
end
} )
self.id = "button_" .. f22_arg1
self.properties = self.properties or {}
self.properties.allowDisabledAction = true
local f22_local4 = function ( f27_arg0, f27_arg1 )
local f27_local0 = Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 )
local f27_local1 = f27_arg0
local f27_local2 = f27_arg0.processEvent
local f27_local3 = {}
local f27_local4
if f27_local0 then
f27_local4 = "enable"
if not f27_local4 then
else
f27_local3.name = f27_local4
f27_local2( f27_local1, f27_local3 )
f27_arg0:processEvent( {
name = "update_dlc_icon"
} )
end
end
f27_local4 = "disable"
end
self:registerEventHandler( "refresh_lock", f22_local4 )
self:registerEventHandler( "menu_create", f22_local4 )
if f22_local0 then
self:registerEventHandler( "dlc_mount_complete", f22_local4 )
end
if f22_local0 then
local f22_local5 = 24
local f22_local6 = LUI.UIImage.new( {
material = RegisterMaterial( "icon_dlc" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 5,
right = -f22_local5,
width = f22_local5,
height = f22_local5,
alpha = 0
} )
f22_local6:registerAnimationState( "visible", {
alpha = 1
} )
f22_local6.id = "icon_dlc"
self:addElement( f22_local6 )
f22_local6:registerEventHandler( "menu_create", function ( element, event )
element:processEvent( {
name = "update_dlc_icon"
} )
end )
f22_local6:registerEventHandler( "update_dlc_icon", function ( element, event )
local f29_local0 = Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 )
local f29_local1 = element
local f29_local2 = element.animateToState
local f29_local3
if f29_local0 then
f29_local3 = "default"
if not f29_local3 then
else
f29_local2( f29_local1, f29_local3 )
end
end
f29_local3 = "visible"
end )
end
assert( f22_arg0.currentField.UnlockType )
if Cac.ItemHasNewIcon( f22_arg0.exclusiveControllerIndex, f22_arg1, f22_arg0.currentField.UnlockType ) then
self:processEvent( {
name = "show_new_icon"
} )
end
return self
end
function cac_customize_small_popup()
local f30_local0 = 430
local f30_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f30_local1.currentField then
DebugPrint( "WARNING: Opening cac_customize_small_popup while no field is currently selected, this should only happen on LUI reload. Closing popup." )
local self = LUI.UIElement.new()
self:registerEventHandler( "menu_create", MBh.LeaveMenu() )
return self
end
assert( f30_local1.categories )
assert( f30_local1.categories[1] )
f30_local1.elements = f30_local1.categories[1].elements
assert( f30_local1.elements )
local self = LUI.MenuBuilder.BuildRegisteredType( "generic_selectionList_popup", {
popup_title = f30_local1.categories[1].name
} )
if f30_local1.currentField.HelpText then
local f30_local3 = LUI.UIText.new( CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
left = 12,
right = -12,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f30_local3.id = "help_text"
f30_local3:setText( Engine.Localize( f30_local1.currentField.HelpText ) )
self.addListElement( f30_local3 )
local f30_local4 = LUI.UIElement.new( {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
height = 12,
left = 0,
right = 0
} )
f30_local4.id = "separator"
self.addListElement( f30_local4 )
end
for f30_local6, f30_local7 in ipairs( f30_local1.elements ) do
self.addListElement( CustomizeSmallPopupButton( f30_local1, f30_local7 ) )
end
return self
end
function cac_customize_navigation_dots()
local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f31_local1 = 12
local f31_local2 = {
type = "UIHorizontalList",
id = "cac_customize_navigation_dots",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 43,
bottom = 0,
alignment = LUI.Alignment.Center,
spacing = 3,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
menu_create = function ( f32_arg0, f32_arg1 )
local f32_local0 = f32_arg0
local f32_local1 = f32_arg0.animateToState
local f32_local2
if #f31_local0.categories > 1 then
f32_local2 = "default"
if not f32_local2 then
else
f32_local1( f32_local0, f32_local2 )
end
end
f32_local2 = "hidden"
end
},
children = {}
}
for f31_local3 = 1, #f31_local0.categories, 1 do
local f31_local6 = f31_local3
local f31_local7 = {
type = "UIImage",
id = "nav_dot_" .. f31_local6,
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = f31_local1,
top = 0,
bottom = f31_local1,
material = RegisterMaterial( "widg_circle_empty" )
},
focused = {
material = RegisterMaterial( "widg_circle_fill" )
}
}
}
local f31_local8 = {}
local f31_local9 = MBh.AnimateToState
local f31_local10
if f31_local6 == f31_local0.currentPage then
f31_local10 = "focused"
if not f31_local10 then
else
f31_local8.menu_create = f31_local9( f31_local10 )
f31_local8.element_refresh = function ( f33_arg0, f33_arg1 )
if f33_arg1.page_change then
local f33_local0 = f33_arg0
local f33_local1 = f33_arg0.animateToState
local f33_local2 = f31_local6
local f33_local3 = f31_local0.currentPage
f33_local1( f33_local0, REG6 and "focused" or "default" )
end
end
f31_local7.handlers = f31_local8
table.insert( f31_local2.children, f31_local7 )
end
end
f31_local10 = "default"
end
return f31_local2
end
function CloseCustomizeGrid( f34_arg0, f34_arg1 )
f34_arg0:dispatchEventToRoot( {
name = "close_customize_popup",
immediate = true
} )
local f34_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
f34_local0.currentPage = nil
f34_local0.rowsOffset = nil
f34_local0.categories = nil
f34_local0.elements = nil
f34_local0.popup = nil
end
function cac_customize_element_description()
return {
type = "UIElement",
id = "desc_container_id",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 10,
right = -5,
top = -5 - 2 * CoD.TextSettings.NormalFont.Height,
bottom = -5 - CoD.TextSettings.NormalFont.Height
}
},
handlers = {
popup_focus_changed = function ( f36_arg0, f36_arg1 )
local f36_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if f36_local0.currentElementRef then
local f36_local1, f36_local2 = Cac.Customization.GetReqsStringForItem( f36_local0.currentElementRef, f36_local0.currentField, f36_local0.exclusiveControllerIndex, true, true )
if f36_local1 then
local f36_local3 = f36_arg0:getChildById( "element_description_main" )
if f36_local3 then
f36_local3:setText( f36_local1 )
end
end
if f36_local2 then
local f36_local3 = f36_arg0:getChildById( "element_description_sub" )
if f36_local3 then
f36_local3:setText( f36_local2 )
end
end
end
end
},
children = {
{
type = "UIMarqueeText",
id = "element_description_main",
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -120,
top = 0,
bottom = 0
} )
}
},
{
type = "UIMarqueeText",
id = "element_description_sub",
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -10,
top = CoD.TextSettings.NormalFont.Height,
bottom = CoD.TextSettings.NormalFont.Height
} )
}
}
}
}
end
function cac_customize_element_counter()
return {
type = "UIText",
id = "element_counter",
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = -5,
top = -5 - 2 * CoD.TextSettings.NormalFont.Height,
bottom = -5 - CoD.TextSettings.NormalFont.Height,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
},
handlers = {
popup_focus_changed = function ( f38_arg0, f38_arg1 )
local f38_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f38_local1 = ""
if not SvS.IsSvS() and (IsPublicMatch() or IsOnlineAliens()) and f38_local0.currentElementRef then
local f38_local2 = getUnlockReqsForItemOfType( f38_local0.currentElementRef, f38_local0.currentField.UnlockType )
if f38_local2.chalAndTier and f38_local2.chalAndTier ~= "" then
local f38_local3, f38_local4 = parseChallengeName( f38_local2.chalAndTier )
local f38_local5 = getGroupRefForOperation( f38_local3 )
local f38_local6 = f38_local5
local f38_local7
if f38_local5 ~= "" then
f38_local7 = isOpActive( f38_local0.exclusiveControllerIndex, f38_local3 )
else
f38_local7 = false
end
if f38_local7 then
local f38_local8 = getOperationState( f38_local0.exclusiveControllerIndex, f38_local3 )
if f38_local8 <= f38_local4 then
local f38_local9 = operationGetTargetForTier( f38_local3, f38_local4, true )
local f38_local10 = operationGetProgress( f38_local0.exclusiveControllerIndex, f38_local3 )
if f38_local8 > 1 then
f38_local10 = f38_local10 + operationGetTargetForTier( f38_local3, f38_local8 - 1, true )
end
if f38_local3 == "ch_longersprint_pro" then
local f38_local11 = 528
f38_local9 = math.floor( tonumber( f38_local9 ) / f38_local11 )
f38_local10 = math.floor( f38_local10 / f38_local11 )
end
f38_local1 = f38_local10 .. "/" .. f38_local9
end
end
elseif f38_local2.killsExt and f38_local2.killsExt ~= "" then
local f38_local3 = tonumber( f38_local2.killsExt )
local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerWeaponKills( f38_local0.exclusiveControllerIndex )
if f38_local4 < f38_local3 then
f38_local1 = f38_local4 .. "/" .. f38_local3
end
elseif f38_local2.escapesExt and f38_local2.escapesExt ~= "" then
local f38_local3 = tonumber( f38_local2.escapesExt )
local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerEscapes( f38_local0.exclusiveControllerIndex )
if f38_local4 < f38_local3 then
f38_local1 = f38_local4 .. "/" .. f38_local3
end
elseif f38_local2.revivesExt and f38_local2.revivesExt ~= "" then
local f38_local3 = tonumber( f38_local2.revivesExt )
local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerRevives( f38_local0.exclusiveControllerIndex )
if f38_local4 < f38_local3 then
f38_local1 = f38_local4 .. "/" .. f38_local3
end
end
end
f38_arg0:setText( f38_local1 )
end
}
}
end
function PreviewElement( f39_arg0, f39_arg1 )
local f39_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if f39_local0.currentField then
f39_arg0:dispatchEventToRoot( {
name = "preview_element",
immediate = true,
field = f39_local0.currentField,
elementRef = f39_arg1
} )
end
end
function RefreshScrollbar( f40_arg0, f40_arg1 )
if f40_arg1.scrollbar and f40_arg0.properties and f40_arg0.properties.elementsPerRow then
f40_arg1.scrollbar:manualUpdate( f40_arg1.rowsOffset, f40_arg0.properties.maxRows, math.ceil( #f40_arg1.elements / f40_arg0.properties.elementsPerRow ), f40_arg0.properties.rowHeight )
end
end
function ScrollBy( f41_arg0, f41_arg1, f41_arg2, f41_arg3 )
local f41_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f41_local1 = math.ceil( #f41_local0.elements / f41_arg0.properties.elementsPerRow )
local f41_local2 = f41_local0.rowsOffset
f41_local0.rowsOffset = LUI.clamp( f41_local0.rowsOffset + f41_arg3, 0, math.max( 0, f41_local1 - f41_arg0.properties.maxRows ) )
if f41_local2 ~= f41_local0.rowsOffset then
if f41_arg1.qualifier ~= ButtonQualifiers.Mousewheel then
f41_local0.popup:processEvent( {
name = "lose_focus"
} )
end
f41_local0.popup:processEvent( {
name = "element_refresh",
dispatchChildren = true
} )
if f41_arg1.qualifier ~= ButtonQualifiers.Mousewheel then
assert( f41_arg2 )
local f41_local3 = "button" .. f41_arg2
local f41_local4 = f41_local0.popup:getFirstDescendentById( f41_local3 )
assert( f41_local4, "Element not found " .. f41_local3 )
f41_local4:processEvent( {
name = "gain_focus"
} )
end
RefreshScrollbar( f41_arg0, f41_local0 )
end
end
function CustomizePopupGamepadButton( f42_arg0, f42_arg1 )
local f42_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f42_local0.elements then
return
elseif f42_arg1.down and not f42_arg0.m_ignoreMouseFocus and f42_arg1.qualifier == ButtonQualifiers.Mousewheel then
if f42_arg1.button == "down" then
ScrollBy( f42_arg0, f42_arg1, nil, 1 )
elseif f42_arg1.button == "up" then
ScrollBy( f42_arg0, f42_arg1, nil, -1 )
end
return true
else
return LUI.UIElement.GamepadButton( f42_arg0, f42_arg1 )
end
end
function CustomizePopupButtonGamepadButton( f43_arg0, f43_arg1, f43_arg2 )
local f43_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if f43_arg1.down and f43_arg0:isInFocus() then
local f43_local1 = f43_arg2 <= f43_arg0.properties.elementsPerRow
if f43_arg1.button == "down" and f43_arg0.properties.elementsPerRow * (f43_arg0.properties.maxRows - 1) < f43_arg2 then
ScrollBy( f43_arg0, f43_arg1, f43_arg2, 1 )
return true
elseif f43_arg1.button == "up" and f43_local1 then
ScrollBy( f43_arg0, f43_arg1, f43_arg2, -1 )
return true
end
end
return LUI.UIButton.GamepadButton( f43_arg0, f43_arg1 )
end
function PropagateFocusChange( f44_arg0, f44_arg1, f44_arg2 )
f44_arg1.popup:processEvent( {
name = "popup_focus_changed"
} )
PreviewElement( f44_arg0, f44_arg2 )
end
function CustomizePopupGridButtonOver( f45_arg0, f45_arg1, f45_arg2 )
local f45_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f45_local0.elements or not f45_local0.popup then
return
end
local f45_local1 = math.ceil( f45_local0.currentButtonSlot / f45_arg0.properties.elementsPerRow )
local f45_local2 = math.ceil( f45_arg2 / f45_arg0.properties.elementsPerRow )
local f45_local3 = f45_local0.currentButtonSlot or f45_arg2
local f45_local4 = f45_local0.elements[f45_local0.rowsOffset * f45_arg0.properties.elementsPerRow + f45_arg2]
f45_local0.currentElementRef = f45_local4
f45_local0.currentButtonSlot = f45_arg2
if f45_local0.autoFocusButtonNumber == nil then
if f45_local1 ~= f45_local2 and (Engine.IsConsoleGame() or f45_arg1.focusType ~= FocusType.MouseOver) then
if f45_local2 == 1 then
ScrollBy( f45_arg0, f45_arg1, f45_local3, -1 )
elseif f45_local2 == f45_arg0.properties.maxRows then
ScrollBy( f45_arg0, f45_arg1, f45_local3, 1 )
end
end
else
f45_arg0.listDefaultFocus = nil
f45_local0.autoFocusButtonNumber = nil
end
PropagateFocusChange( f45_arg0, f45_local0, f45_local4 )
end
function CustomizePopupGridButtonActionFactory( f46_arg0, f46_arg1 )
return function ( f47_arg0, f47_arg1 )
if f46_arg1.rowsOffset then
f46_arg1.currentField.SaveRef( f47_arg1.controller, f46_arg1.squadLocation, f46_arg1.squadMemberIndex, f46_arg1.elements[f46_arg1.rowsOffset * f47_arg0.properties.elementsPerRow + f46_arg0] )
CloseCustomizeGrid( f47_arg0, f47_arg1 )
end
end
end
function CustomizePopupGridButtonActionDisableFactory( f48_arg0, f48_arg1 )
return function ( f49_arg0, f49_arg1 )
if f48_arg1.rowsOffset and f48_arg1.currentField.DLCOffer then
local f49_local0 = Engine.TableLookup( f48_arg1.currentField.csv, 0, f48_arg1.elements[f48_arg1.rowsOffset * f49_arg0.properties.elementsPerRow + f48_arg0], f48_arg1.currentField.DLCOffer )
if string.len( f49_local0 ) > 0 then
if Engine.IsPC() then
Sns.OpenStoreMenu( f49_arg1.controller )
else
Sns.OpenStoreLinkConfirmPopup( f49_arg1.controller, f49_local0 )
end
end
end
end
end
function CustomizePopupGridGenericButtonUpdateLock( f50_arg0, f50_arg1, f50_arg2 )
local f50_local0 = Cac.IsCustomizationItemUnlocked( f50_arg1.exclusiveControllerIndex, f50_arg1.currentField, f50_arg2 )
if f50_arg0:isInFocus() then
if f50_arg1.currentElementRef ~= f50_arg2 then
f50_arg1.currentElementRef = f50_arg2
PropagateFocusChange( f50_arg0, f50_arg1, f50_arg2 )
end
local f50_local1 = f50_arg0
local f50_local2 = f50_arg0.dispatchEventToChildren
local f50_local3 = {}
local f50_local4
if f50_local0 then
f50_local4 = "button_over"
if not f50_local4 then
else
f50_local3.name = f50_local4
f50_local3.dispatchChildren = true
f50_local2( f50_local1, f50_local3 )
end
end
f50_local4 = "button_over_disable"
else
local f50_local1 = f50_arg0
local f50_local2 = f50_arg0.processEvent
local f50_local3 = {}
local f50_local4
if f50_local0 then
f50_local4 = "button_up"
if not f50_local4 then
else
f50_local3.name = f50_local4
f50_local3.dispatchChildren = true
f50_local2( f50_local1, f50_local3 )
end
end
f50_local4 = "button_disable"
end
if not f50_local0 and Cac.IsCustomizationItemDLC( f50_arg1.currentField, f50_arg2 ) == true then
f50_arg0:processEvent( {
name = "button_dlc"
} )
else
f50_arg0:processEvent( {
name = "button_no_dlc"
} )
end
f50_arg0.disabled = true
if f50_local0 then
f50_arg0.disabled = false
end
end
function CustomizePopupNewIconCheckFactory( f51_arg0, f51_arg1, f51_arg2, f51_arg3 )
return function ( f52_arg0, f52_arg1 )
if f51_arg1.elements and f51_arg1.rowsOffset and f51_arg1.exclusiveControllerIndex and f51_arg1.currentField and f51_arg1.currentField.UnlockType then
local f52_local0 = f51_arg1.elements[f51_arg1.rowsOffset * f52_arg0.properties.elementsPerRow + f51_arg0]
local f52_local1 = Cac.ItemHasNewIcon
local f52_local2 = f51_arg1.exclusiveControllerIndex
local f52_local3 = f52_local0
local f52_local4 = f51_arg3
if not f52_local4 then
f52_local4 = f51_arg1.currentField.UnlockType
end
if f52_local1( f52_local2, f52_local3, f52_local4 ) then
f52_arg0:addElement( LUI.UITimer.new( 500, "clear_new_icon", nil, true ) )
end
end
end
end
function CustomizePopupNewIconFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 )
return {
type = "UIImage",
id = "newIcon",
states = {
default = {
material = RegisterMaterial( "icon_new_2" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = f53_arg2,
height = 32,
left = 2,
width = 32,
alpha = 0,
scale = 0
},
visible = {
alpha = 1,
scale = 0
},
darker = {
alpha = 0.5,
scale = -0.1
}
},
handlers = {
element_refresh = function ( f54_arg0, f54_arg1 )
local f54_local0 = f53_arg1.elements[f53_arg1.rowsOffset * f54_arg0.properties.elementsPerRow + f53_arg0]
if f54_local0 and Cac.ItemHasNewIcon( f53_arg1.exclusiveControllerIndex, f54_local0, f53_arg3 or nil, f53_arg1.currentField ) then
local f54_local1 = MBh.AnimateLoop( {
{
"visible",
0
},
{
"darker",
300
},
{
"visible",
300
}
} )
f54_local1( f54_arg0, f54_arg1 )
else
f54_arg0:animateToState( "default" )
end
end
,
button_over = CustomizePopupNewIconCheckFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 ),
button_over_disable = CustomizePopupNewIconCheckFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 ),
clear_new_icon = function ( f55_arg0, f55_arg1 )
if f53_arg1.elements and f53_arg1.rowsOffset and f53_arg1.exclusiveControllerIndex and f53_arg1.currentField and f53_arg1.currentField.UnlockType then
local f55_local0 = f53_arg1.elements[f53_arg1.rowsOffset * f55_arg0.properties.elementsPerRow + f53_arg0]
local f55_local1 = Cac.ItemHasNewIcon
local f55_local2 = f53_arg1.exclusiveControllerIndex
local f55_local3 = f55_local0
local f55_local4 = f53_arg3
if not f55_local4 then
f55_local4 = f53_arg1.currentField.UnlockType
end
if f55_local1( f55_local2, f55_local3, f55_local4 ) then
f55_local1 = Cac.MarkItemNoMoreNewIcon
f55_local2 = f53_arg1.exclusiveControllerIndex
f55_local3 = f55_local0
f55_local4 = f53_arg3
if not f55_local4 then
f55_local4 = f53_arg1.currentField.UnlockType
end
f55_local1( f55_local2, f55_local3, f55_local4 )
f55_arg0:animateToState( "default", 400 )
f55_arg0:dispatchEventToRoot( {
name = "refresh_new_icons"
} )
end
end
end
}
}
end
function CustomizePopupGridGenericButton( f56_arg0, f56_arg1 )
local f56_local0 = function ( f57_arg0, f57_arg1 )
local f57_local0 = 0
local f57_local1 = 1
if f56_arg1.rowsOffset and f57_arg0.properties.elementsPerRow then
f57_local1 = f56_arg1.elements[f56_arg1.rowsOffset * f57_arg0.properties.elementsPerRow + f56_arg0]
f57_local0 = tostring( f56_arg1.currentField.GetSavedRef( f56_arg1.exclusiveControllerIndex, f56_arg1.squadLocation, f56_arg1.squadMemberIndex ) )
end
if f57_local1 == f57_local0 then
f57_arg0:animateToState( "visible" )
else
f57_arg0:animateToState( "default" )
end
end
local f56_local1 = {
type = "UIGenericButton",
id = "button" .. f56_arg0,
listDefaultFocus = f56_arg0 == f56_arg1.autoFocusButtonNumber,
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
maxRows = MBh.Property( "maxRows" ),
rowHeight = MBh.Property( "rowHeight" ),
elementWidth = MBh.Property( "elementWidth" ),
elementsPerRow = MBh.Property( "elementsPerRow" ),
allowDisabledAction = true,
button_over_func = function ( f58_arg0, f58_arg1 )
CustomizePopupGridButtonOver( f58_arg0, f58_arg1, f56_arg0 )
end,
button_over_disable_func = function ( f59_arg0, f59_arg1 )
CustomizePopupGridButtonOver( f59_arg0, f59_arg1, f56_arg0 )
end,
button_action_func = CustomizePopupGridButtonActionFactory( f56_arg0, f56_arg1 ),
button_action_disable_func = CustomizePopupGridButtonActionDisableFactory( f56_arg0, f56_arg1 )
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = MBh.Property( "elementWidth" ),
top = 0,
bottom = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
gamepad_button = function ( f60_arg0, f60_arg1 )
return CustomizePopupButtonGamepadButton( f60_arg0, f60_arg1, f56_arg0 )
end,
element_refresh = function ( f61_arg0, f61_arg1 )
local f61_local0 = f56_arg1.elements[f56_arg1.rowsOffset * f61_arg0.properties.elementsPerRow + f56_arg0]
if f61_local0 then
f61_arg0.m_focusable = true
local f61_local1 = f56_arg1.currentField.GetName( f61_local0 )
if f61_local1 then
f61_arg0:setText( Engine.Localize( f61_local1 ) )
end
CustomizePopupGridGenericButtonUpdateLock( f61_arg0, f56_arg1, f61_local0 )
else
f61_arg0:makeNotFocusable()
f61_arg0:animateToState( "hidden" )
end
end
}
}
local f56_local2 = {}
local f56_local3 = {
type = "UIImage",
id = "selection_triangle",
properties = {
elementsPerRow = MBh.Property( "elementsPerRow" )
},
states = {
default = CoD.ColorizeState( Colors.frontend_hilite, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
material = RegisterMaterial( "widg_triangle" ),
top = 3,
left = 3,
width = 12,
height = 12,
alpha = 0
} ),
visible = {
alpha = 1
}
},
handlers = {
button_over = MBh.AnimateToState( "default" ),
button_up = f56_local0,
element_refresh = f56_local0
}
}
local f56_local4 = {
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 4,
right = -24,
width = 24,
height = 24,
material = RegisterMaterial( "icon_dlc" ),
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
button_no_dlc = MBh.AnimateToState( "default" ),
button_dlc = MBh.AnimateToState( "visible" )
}
}
local f56_local5 = CustomizePopupNewIconFactory( f56_arg0, f56_arg1, 0, f56_arg1.specialField and "Special" or nil )
f56_local1.children = f56_local3
return f56_local1
end
function CustomizePopupGridGraphicalButton( f62_arg0, f62_arg1 )
return {
type = "UIButton",
id = "button" .. f62_arg0,
listDefaultFocus = f62_arg0 == f62_arg1.autoFocusButtonNumber,
properties = {
elementsPerRow = MBh.Property( "elementsPerRow" ),
elementWidth = MBh.Property( "elementWidth" ),
rowHeight = MBh.Property( "rowHeight" ),
maxRows = MBh.Property( "maxRows" ),
allowDisabledAction = true
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = MBh.Property( "elementWidth" ),
top = 0,
bottom = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
gamepad_button = function ( f63_arg0, f63_arg1 )
return CustomizePopupButtonGamepadButton( f63_arg0, f63_arg1, f62_arg0 )
end
,
element_refresh = function ( f64_arg0, f64_arg1 )
local f64_local0 = f62_arg1.elements[f62_arg1.rowsOffset * f64_arg0.properties.elementsPerRow + f62_arg0]
if f64_local0 then
f64_arg0.m_focusable = true
CustomizePopupGridGenericButtonUpdateLock( f64_arg0, f62_arg1, f64_local0 )
else
f64_arg0:makeNotFocusable()
f64_arg0:animateToState( "hidden" )
end
end
,
button_over = function ( f65_arg0, f65_arg1 )
CustomizePopupGridButtonOver( f65_arg0, f65_arg1, f62_arg0 )
end
,
button_over_disable = function ( f66_arg0, f66_arg1 )
CustomizePopupGridButtonOver( f66_arg0, f66_arg1, f62_arg0 )
end
,
button_action = CustomizePopupGridButtonActionFactory( f62_arg0, f62_arg1 ),
button_action_disable = CustomizePopupGridButtonActionDisableFactory( f62_arg0, f62_arg1 ),
button_disable = function ( f67_arg0, f67_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f67_arg0.properties.elementsPerRow + f62_arg0] then
f67_arg0:animateToState( "default" )
end
end
,
button_up = function ( f68_arg0, f68_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f68_arg0.properties.elementsPerRow + f62_arg0] then
f68_arg0:animateToState( "default" )
end
end
},
children = {
{
type = "UIImage",
id = "patch",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
},
disabled = {
alpha = 0.2
}
},
handlers = {
element_refresh = function ( f69_arg0, f69_arg1 )
local f69_local0 = f62_arg1.elements[f62_arg1.rowsOffset * f69_arg0.properties.elementsPerRow + f62_arg0]
if f69_local0 then
f69_arg0:setImage( RegisterMaterial( f62_arg1.currentField.GetUIMaterial( f69_local0 ) ) )
end
end
,
button_disable = function ( f70_arg0, f70_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f70_arg0.properties.elementsPerRow + f62_arg0] then
f70_arg0:animateToState( "disabled" )
end
end
,
button_over_disable = function ( f71_arg0, f71_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f71_arg0.properties.elementsPerRow + f62_arg0] then
f71_arg0:animateToState( "disabled" )
end
end
,
button_up = function ( f72_arg0, f72_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f72_arg0.properties.elementsPerRow + f62_arg0] then
f72_arg0:animateToState( "default" )
end
end
,
button_over = function ( f73_arg0, f73_arg1 )
if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f73_arg0.properties.elementsPerRow + f62_arg0] then
f73_arg0:animateToState( "default" )
end
end
}
},
CustomizePopupNewIconFactory( f62_arg0, f62_arg1, 2, nil ),
{
type = "UIImage",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
bottom = -5,
right = -5,
width = 16,
height = 16,
material = RegisterMaterial( "icon_lock_mini" )
},
button_up = {
alpha = 0
},
button_over = {
alpha = 0
},
button_disable = {
alpha = 1
},
button_over_disable = {
alpha = 1
}
},
handlers = {
button_up = MBh.AnimateToState( "button_up" ),
button_over = MBh.AnimateToState( "button_over" ),
button_disable = MBh.AnimateToState( "button_disable" ),
button_over_disable = MBh.AnimateToState( "button_over_disable" )
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 5,
right = -2,
width = 24,
height = 24,
material = RegisterMaterial( "icon_dlc" ),
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
button_no_dlc = MBh.AnimateToState( "default" ),
button_dlc = MBh.AnimateToState( "visible" )
}
},
{
type = "UIImage",
properties = {
elementsPerRow = MBh.Property( "elementsPerRow" )
},
states = {
default = CoD.ColorizeState( Colors.grey_4, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
material = RegisterMaterial( "widg_triangle" ),
top = 3,
left = 3,
width = 12,
height = 12
} ),
button_up = CoD.ColorizeState( Colors.grey_4, {
alpha = 0
} ),
button_disable = CoD.ColorizeState( Colors.grey_14, {
alpha = 0
} ),
button_over = CoD.ColorizeState( Colors.white, {
alpha = 1
} ),
button_over_disable = CoD.ColorizeState( Colors.white, {
alpha = 0
} ),
button_selected = CoD.ColorizeState( Colors.frontend_hilite, {
alpha = 1
} )
},
handlers = {
button_up = function ( f74_arg0, f74_arg1 )
local f74_local0 = 0
local f74_local1 = 1
if f62_arg1.rowsOffset and f74_arg0.properties.elementsPerRow then
f74_local1 = f62_arg1.elements[f62_arg1.rowsOffset * f74_arg0.properties.elementsPerRow + f62_arg0]
f74_local0 = tostring( f62_arg1.currentField.GetSavedRef( f62_arg1.exclusiveControllerIndex, f62_arg1.squadLocation, f62_arg1.squadMemberIndex ) )
end
if f74_local1 == f74_local0 then
f74_arg0:animateToState( "button_selected" )
else
f74_arg0:animateToState( "button_up" )
end
end
,
button_disable = MBh.AnimateToState( "button_disable" ),
button_over = function ( f75_arg0, f75_arg1 )
local f75_local0 = 0
local f75_local1 = 1
if f62_arg1.rowsOffset and f75_arg0.properties.elementsPerRow then
f75_local1 = f62_arg1.elements[f62_arg1.rowsOffset * f75_arg0.properties.elementsPerRow + f62_arg0]
f75_local0 = tostring( f62_arg1.currentField.GetSavedRef( f62_arg1.exclusiveControllerIndex, f62_arg1.squadLocation, f62_arg1.squadMemberIndex ) )
end
if f75_local1 == f75_local0 then
f75_arg0:animateToState( "button_selected" )
else
f75_arg0:animateToState( "button_over" )
end
end
,
button_over_disable = MBh.AnimateToState( "button_over_disable" )
}
},
{
type = "generic_border",
properties = {
inner = true,
thickness = Engine.IsConsoleGame() and 1 or 2,
border_red = Colors.grey_4.r,
border_green = Colors.grey_4.g,
border_blue = Colors.grey_4.b
},
handlers = {
button_up = function ( f76_arg0, f76_arg1 )
f76_arg0:processEvent( {
name = "updateBorderColor",
red = Colors.grey_4.r,
green = Colors.grey_4.g,
blue = Colors.grey_4.b
} )
end
,
button_disable = function ( f77_arg0, f77_arg1 )
f77_arg0:processEvent( {
name = "updateBorderColor",
red = Colors.grey_14.r,
green = Colors.grey_14.g,
blue = Colors.grey_14.b
} )
end
,
button_over = function ( f78_arg0, f78_arg1 )
f78_arg0:processEvent( {
name = "updateBorderColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
end
,
button_over_disable = function ( f79_arg0, f79_arg1 )
f79_arg0:processEvent( {
name = "updateBorderColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
end
}
}
}
}
end
function CustomizePopupGridFeeder( f80_arg0 )
local f80_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f80_local0.popup then
return {}
end
local f80_local1 = {}
for f80_local2 = 1, f80_arg0.maxRows * f80_arg0.elementsPerRow, 1 do
table.insert( f80_local1, f80_local0.currentField.SelectionButtonFactory( f80_local2, f80_local0 ) )
end
return f80_local1
end
function cac_customize_base_popup( f81_arg0 )
local f81_local0 = f81_arg0.width or 448
local f81_local1 = 10
local f81_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f81_local2.currentField then
DebugPrint( "WARNING: Opening cac_customize_grid_popup while no field or page is currently selected, this should only happen on LUI reload. Closing popup." )
return {
type = "UIElement",
handlers = {
menu_create = MBh.LeaveMenu()
}
}
end
local f81_local3 = {
type = "UIElement",
id = "cac_customize_popup",
properties = {
maxRows = f81_arg0.maxRows or 4,
elementsPerRow = f81_arg0.elementsPerRow or 4,
rowHeight = f81_arg0.rowHeight or 95,
elementWidth = f81_arg0.elementWidth or 95
},
states = {
visible = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 100,
top = 108,
width = f81_local0,
height = 530
},
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = -f81_local0,
top = 108,
width = f81_local0,
height = 530
}
},
handlers = {
popup_active = function ( f83_arg0, f83_arg1 )
f83_arg0.m_ignoreMouseFocus = true
UnbindShoulderButtons( f83_arg0, f83_arg1 )
end,
popup_inactive = function ( f84_arg0, f84_arg1 )
f84_arg0.m_ignoreMouseFocus = nil
RebindShoulderButtons( f84_arg0, f84_arg1 )
end,
gamepad_button = CustomizePopupGamepadButton,
menu_create = function ( f85_arg0, f85_arg1 )
f85_arg0:animateToState( "visible", 80 )
local f85_local0 = f85_arg0:getFirstDescendentById( "custom_elements_grid" )
f85_local0 = f85_local0.vlist
f81_local2.scrollbar = f85_arg0:getFirstDescendentById( "scrollbar" )
f81_local2.scrollbar:setList( f85_local0 )
f85_arg0:dispatchEventToRoot( {
name = "open_customize_popup",
immediate = true
} )
if #f81_local2.categories <= 1 then
RebindShoulderButtons( f85_arg0, f85_arg1 )
else
f85_arg0:dispatchEventToRoot( {
name = "add_button_helper_text",
button_ref = "button_shoulderl",
button_ref2 = "",
helper_text = "",
side = "left",
clickable = true,
immediate = true
} )
end
f85_arg0:addElement( LUI.MenuBuilder.buildItems( {
type = "online_friends_widget",
states = {
default = {
scale = -1,
alpha = 0
}
}
}, {} ) )
f85_arg0:dispatchEventToRoot( {
name = "rebind_back_button",
immediate = true
} )
if not Engine.IsAliensMode() and f81_local2.squadLocation == "squadMembers" then
f85_arg0:dispatchEventToRoot( {
name = "add_button_helper_text",
button_ref = "button_alt1",
button_ref2 = "",
helper_text = Engine.Localize( "@LUA_MENU_OPERATIONS" ),
side = "left",
clickable = true,
immediate = true
} )
else
f85_arg0:dispatchEventToRoot( {
name = "add_button_helper_text",
button_ref = "button_alt1",
button_ref2 = "",
helper_text = "",
side = "left",
clickable = true,
immediate = true
} )
end
f85_arg0:processEvent( {
name = "change_page",
diff = 0
} )
end,
close_customize_popup = function ( f86_arg0, f86_arg1 )
f86_arg0:dispatchEventToRoot( {
name = "add_loadout_button_helper"
} )
f86_arg0:dispatchEventToRoot( {
name = "update_camo"
} )
f86_arg0:animateToState( "default", 80 )
f86_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( "default" ), MBh.LeaveMenu() )
end,
menu_close = function ( f87_arg0, f87_arg1 )
f87_arg0:dispatchEventToRoot( {
name = "character_full_refresh",
immediate = true
} )
end,
change_page = function ( f82_arg0, f82_arg1 )
assert( f82_arg1.diff, "Invalid page change" )
if not f81_local2.categories then
return
elseif f82_arg1.diff ~= 0 and #f81_local2.categories <= 1 then
return
end
f81_local2.popup = f82_arg0
if f82_arg1.diff ~= 0 then
f81_local2.currentPage = f81_local2.currentPage or 1
f81_local2.currentPage = 1 + (f81_local2.currentPage - 1 + f82_arg1.diff) % #f81_local2.categories
f81_local2.rowsOffset = 0
f81_local2.currentButtonSlot = 1
end
f81_local2.elements = f81_local2.categories[f81_local2.currentPage].elements
f82_arg0:processEvent( {
name = "refresh_info_pane_header",
header = f81_local2.categories[f81_local2.currentPage].name
} )
local f82_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f82_arg0 )
if f82_arg1.diff ~= 0 then
f82_arg0:processEvent( {
name = "lose_focus"
} )
end
if f82_local0.filledGrid then
f82_arg0:processEvent( {
name = "element_refresh",
page_change = true,
dispatchChildren = true
} )
else
f82_arg0:processEvent( {
name = "menu_refresh"
} )
f82_arg0:processEvent( {
name = "update_navigation"
} )
f82_local0.filledGrid = true
end
if f82_arg1.diff ~= 0 then
f82_arg0:processEvent( {
name = "update_navigation"
} )
f82_arg0:clearSavedState()
if not f82_arg1.mouse then
f82_arg0:processEvent( {
name = "gain_focus"
} )
end
RefreshScrollbar( f82_arg0, f81_local2 )
end
end,
dlc_mount_complete = function ( f88_arg0, f88_arg1 )
f88_arg0:processEvent( {
name = "element_refresh"
} )
end
}
}
local f81_local4 = {}
local f81_local5 = {
type = "cac_basic_info_pane_header",
properties = {
titleText = "Oink",
width = f81_local0,
height = GenericTitleBarDims.TitleBarHeight
},
handlers = {
menu_create = function ( f89_arg0, f89_arg1 )
if #f81_local2.categories > 1 then
f89_arg0:processEvent( {
name = "show_lt"
} )
f89_arg0:processEvent( {
name = "show_rt"
} )
else
f89_arg0:processEvent( {
name = "hide_lt"
} )
f89_arg0:processEvent( {
name = "hide_rt"
} )
end
end,
info_panel_go_left = MBh.EmitEventToParent( {
name = "change_page",
mouse = true,
diff = -1
} ),
info_panel_go_right = MBh.EmitEventToParent( {
name = "change_page",
mouse = true,
diff = 1
} )
}
}
local f81_local6 = {
type = "generic_menu_background_withfade"
}
local f81_local7 = cac_customize_navigation_dots()
local f81_local8 = {
type = "UIVerticalScrollbar",
id = "scrollbar",
properties = {
maxRows = MBh.Property( "maxRows" ),
rowHeight = MBh.Property( "rowHeight" ),
elementsPerRow = MBh.Property( "elementsPerRow" ),
on_move_func = function ( f90_arg0, f90_arg1, f90_arg2, f90_arg3 )
if f81_local2.elements then
local f90_local0 = math.ceil( #f81_local2.elements / f90_arg3.elementsPerRow )
f81_local2.rowsOffset = math.floor( f90_arg2 * f90_local0 )
f81_local2.rowsOffset = LUI.clamp( f81_local2.rowsOffset, 0, math.max( 0, f90_local0 - f90_arg3.maxRows ) )
f90_arg1:processEvent( {
name = "element_refresh",
dispatchChildren = true,
immediate = true
} )
f90_arg0:manualUpdate( f81_local2.rowsOffset, f90_arg3.maxRows, f90_local0, f90_arg3.rowHeight )
end
end
}
}
local f81_local9 = {}
local f81_local10 = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true
}
local f81_local11
if #f81_local2.categories > 1 then
f81_local11 = 64
if not f81_local11 then
else
f81_local10.top = f81_local11
f81_local10.height = 2 + f81_arg0.maxRows * f81_arg0.rowHeight + f81_local1 * math.max( 0, f81_arg0.maxRows - 1 )
f81_local10.width = 10
f81_local10.right = -5
f81_local9.default = f81_local10
f81_local8.states = f81_local9
f81_local8.handlers = {
init_scrollbar = function ( f91_arg0, f91_arg1 )
local f91_local0 = f91_arg0.properties
if f81_local2.elements then
f91_arg0:manualUpdate( f81_local2.rowsOffset, f91_local0.maxRows, math.ceil( #f81_local2.elements / f91_local0.elementsPerRow ), f91_local0.rowHeight )
end
end
}
f81_local8.children = {
{
type = "UITimer",
properties = {
event = "init_scrollbar",
interval = 1,
disposable = true,
deferNextFrame = true
}
}
}
f81_local9 = cac_customize_element_description()
f81_local10 = cac_customize_element_counter()
f81_local11 = {
type = "UIGrid",
id = "custom_elements_grid",
properties = {
maxRows = MBh.Property( "maxRows" ),
elementsPerRow = MBh.Property( "elementsPerRow" ),
rowHeight = MBh.Property( "rowHeight" ),
elementWidth = MBh.Property( "elementWidth" ),
hSpacing = 10,
vSpacing = f81_local1,
disableVWrap = true,
disableHWrap = true
}
}
local f81_local12 = {}
local f81_local13 = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true
}
local f81_local14
if #f81_local2.categories > 1 then
f81_local14 = 64
if not f81_local14 then
else
f81_local13.top = f81_local14
f81_local13.left = 6
f81_local13.right = 0
f81_local13.bottom = 0
f81_local12.default = f81_local13
f81_local11.states = f81_local12
f81_local11.childrenFeeder = CustomizePopupGridFeeder
f81_local12 = {
type = "UIBindButton",
handlers = {
button_secondary = CloseCustomizeGrid,
button_shoulderl = function ( f92_arg0, f92_arg1 )
if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then
local f92_local0 = f92_arg0:getParent()
f92_local0:processEvent( {
name = "change_page",
diff = -1
} )
end
end,
button_shoulderr = function ( f93_arg0, f93_arg1 )
if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then
local f93_local0 = f93_arg0:getParent()
f93_local0:processEvent( {
name = "change_page",
diff = 1
} )
end
end,
button_alt1 = function ( f94_arg0, f94_arg1 )
local f94_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not Engine.IsAliensMode() and f94_local0 and f94_local0.squadLocation == "squadMembers" then
LUI.FlowManager.RequestPopupMenu( f94_arg0, "operations_main_menu", true, f94_arg1.controller, false )
end
end
}
}
f81_local4[1] = f81_local5
f81_local4[2] = f81_local6
f81_local4[3] = f81_local7
f81_local4[4] = f81_local8
f81_local4[5] = f81_local9
f81_local4[6] = f81_local10
f81_local4[7] = f81_local11
f81_local4[8] = f81_local12
f81_local3.children = f81_local4
return f81_local3
end
end
f81_local14 = 42
end
end
f81_local11 = 42
end
function ComputeCustomizationPopupDefaultFocus( f95_arg0, f95_arg1, f95_arg2 )
local f95_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
if not f95_local0.currentField then
return
end
local f95_local1 = f95_local0.currentField.GetSavedRef( f95_local0.exclusiveControllerIndex, f95_local0.squadLocation, f95_local0.squadMemberIndex )
for f95_local8, f95_local9 in ipairs( f95_local0.categories ) do
for f95_local5, f95_local6 in ipairs( f95_local9.elements ) do
if Cac.ItemHasNewIcon( f95_local0.exclusiveControllerIndex, f95_local6, f95_local0.specialField and "Special" or f95_local0.currentField.UnlockType ) then
f95_local0.currentPage = f95_local8
f95_local0.rowsOffset = LUI.clamp( math.ceil( f95_local5 / f95_arg2 ) - 1, 0, math.max( 0, math.ceil( #f95_local9.elements / f95_arg2 ) - f95_arg1 ) )
if f95_local0.rowsOffset ~= f95_local5 - 1 then
f95_local0.autoFocusButtonNumber = f95_local5 - f95_local0.rowsOffset * f95_arg2
f95_local0.currentButtonSlot = f95_local0.autoFocusButtonNumber
end
return
end
end
end
for f95_local8, f95_local9 in ipairs( f95_local0.categories ) do
for f95_local5, f95_local6 in ipairs( f95_local9.elements ) do
if tonumber( f95_local6 ) == f95_local1 then
f95_local0.currentPage = f95_local8
f95_local0.rowsOffset = LUI.clamp( math.ceil( f95_local5 / f95_arg2 ) - 1, 0, math.max( 0, math.ceil( #f95_local9.elements / f95_arg2 ) - f95_arg1 ) )
if f95_local0.rowsOffset ~= f95_local5 - 1 then
f95_local0.autoFocusButtonNumber = f95_local5 - f95_local0.rowsOffset * f95_arg2
f95_local0.currentButtonSlot = f95_local0.autoFocusButtonNumber
end
end
end
end
end
function cac_customize_buttons_popup()
local f96_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f96_local1
if f96_local0.categories then
if #f96_local0.categories > 1 then
f96_local1 = 11
if not f96_local1 then
else
local f96_local2 = 1
ComputeCustomizationPopupDefaultFocus( f96_local0, f96_local1, f96_local2 )
return cac_customize_base_popup( {
width = 436,
maxRows = f96_local1,
elementsPerRow = f96_local2,
rowHeight = GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height,
elementWidth = 410
} )
end
end
f96_local1 = 12
if not f96_local1 then
f96_local1 = 1
end
else
f96_local1 = 1
end
local f96_local2 = 1
ComputeCustomizationPopupDefaultFocus( f96_local0, f96_local1, f96_local2 )
return cac_customize_base_popup( {
width = 436,
maxRows = f96_local1,
elementsPerRow = f96_local2,
rowHeight = GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height,
elementWidth = 410
} )
end
function cac_customize_vlist_popup()
local f97_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f97_local1 = 6
local f97_local2 = 1
ComputeCustomizationPopupDefaultFocus( f97_local0, f97_local1, f97_local2 )
return cac_customize_base_popup( {
width = 436,
maxRows = f97_local1,
elementsPerRow = f97_local2,
rowHeight = 59,
elementWidth = 410
} )
end
function cac_customize_grid_popup()
local f98_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f98_local1 = 4
local f98_local2 = 4
ComputeCustomizationPopupDefaultFocus( f98_local0, f98_local1, f98_local2 )
return cac_customize_base_popup( {
width = 436,
maxRows = f98_local1,
elementsPerRow = f98_local2,
rowHeight = 95,
elementWidth = 95
} )
end
function refresh_customize_new_icon( f99_arg0, f99_arg1, f99_arg2, f99_arg3, f99_arg4 )
local f99_local0 = Cac.GetCurrentGender( f99_arg1, f99_arg2, f99_arg3 )
if not Cac.IsCommonGender( f99_local0 ) then
f99_local0 = Cac.Customization.Gender.Male
end
if Cac.AnyUnseenMDLCItems( f99_arg1, {
f99_arg4.UnlockType
}, f99_local0 ) then
f99_arg0:processEvent( {
name = "show_new_icon"
} )
else
f99_arg0:processEvent( {
name = "hide_new_icon"
} )
end
end
function refresh_customize_new_icon_gender( f100_arg0, f100_arg1, f100_arg2, f100_arg3, f100_arg4 )
local f100_local0 = Cac.GetCurrentGender( f100_arg1, f100_arg2, f100_arg3 )
local f100_local1 = nil
if f100_local0 == "m" then
f100_local1 = "f"
else
f100_local1 = "m"
end
if Cac.AnyUnseenMDLCItems( f100_arg1, {
"Head",
"Body"
}, f100_local1 ) then
f100_arg0:processEvent( {
name = "show_new_icon"
} )
else
f100_arg0:processEvent( {
name = "hide_new_icon"
} )
end
end
function fields_vlist()
local f101_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" )
local f101_local1 = function ( f102_arg0, f102_arg1 )
f102_arg0:dispatchEventToRoot( {
name = "show_playercard",
immediate = true,
fade = 100
} )
end
local f101_local2 = function ( f103_arg0, f103_arg1 )
f103_arg0:dispatchEventToRoot( {
name = "hide_playercard",
immediate = true,
fade = 100
} )
end
local f101_local3 = function ( f104_arg0, f104_arg1 )
if f104_arg1.ImpactsPlayercard then
f101_local1( f104_arg0, event )
else
f101_local2( f104_arg0, event )
end
end
local f101_local4 = function ( f105_arg0, f105_arg1 )
local f105_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head]
local f105_local1 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet]
local f105_local2 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body]
local f105_local3 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.GuardDog]
local f105_local4 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Announcer]
local f105_local5 = f105_arg1 == f105_local0
local f105_local6 = f105_arg1 == "gender"
local f105_local7 = f105_arg1 == "special"
local f105_local8 = not Cac.IsCommonGender( Cac.GetCurrentGender( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex ) )
if f105_local5 or f105_local2 or f105_local1 or f105_local6 then
if f105_local8 then
f105_arg0:dispatchEventToRoot( {
name = "show_warning",
immediate = true,
text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_SPECIAL_WARNING" )
} )
elseif f105_local1 and not Cac.DoesHeadUseHelmet( f105_local0.GetSavedRef( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex ) ) then
f105_arg0:dispatchEventToRoot( {
name = "show_warning",
immediate = true,
text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_HELMET_WARNING" )
} )
else
f105_arg0:dispatchEventToRoot( {
name = "hide_warning",
immediate = true
} )
end
elseif f105_local7 and not f105_local8 then
f105_arg0:dispatchEventToRoot( {
name = "show_warning",
immediate = true,
text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_RESET_WARNING" )
} )
elseif f105_local3 then
f105_arg0:dispatchEventToRoot( {
name = "show_warning",
immediate = true,
text = Engine.Localize( "LUA_MENU_MP_CUSTOMIZATION_DOG_WARNING" )
} )
elseif f105_local4 then
f105_arg0:dispatchEventToRoot( {
name = "show_warning",
immediate = true,
text = Engine.Localize( "LUA_MENU_MP_CUSTOMIZATION_DOG_WARNING" )
} )
else
f105_arg0:dispatchEventToRoot( {
name = "hide_warning",
immediate = true
} )
end
end
local f101_local5 = {
type = "UIVerticalList",
id = "fields_vlist",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
top = GenericMenuDims.menu_top,
bottom = 9000,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
open_customize_popup = MBh.AnimateToState( "hidden", 80 ),
close_customize_popup = MBh.AnimateToState( "default", 80 )
},
children = {}
}
table.insert( f101_local5.children, {
type = "UIGenericButton",
id = "button_special",
properties = {
button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_SPECIAL_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_SPECIAL" ),
button_action_func = function ( f106_arg0, f106_arg1 )
f101_local0.currentField = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body]
f101_local0.specialField = true
f101_local0.currentPage = 1
f101_local0.rowsOffset = 0
f101_local0.currentButtonSlot = 1
f101_local0.categories = Cac.Customization.GetCategorizedElementRefsForField( f106_arg1.controller, f101_local0.currentField, function ( f107_arg0 )
return not Cac.IsCommonGender( f107_arg0 )
end )
LUI.FlowManager.RequestPopupMenu( f106_arg0, "cac_customize_buttons_popup", true, f106_arg1.controller, false )
end,
button_over_func = function ( f108_arg0, f108_arg1 )
f101_local2( f108_arg0, f108_arg1 )
f101_local4( f108_arg0, "special" )
end,
additional_handlers = {
refresh_new_icons = function ( f109_arg0, f109_arg1 )
if Cac.AnyUnseenMDLCItems( f101_local0.exclusiveControllerIndex, {
"Special"
} ) then
f109_arg0:processEvent( {
name = "show_new_icon"
} )
else
f109_arg0:processEvent( {
name = "hide_new_icon"
} )
end
end,
menu_create = function ( f110_arg0, f110_arg1 )
if Cac.AnyUnseenMDLCItems( f101_local0.exclusiveControllerIndex or 0, {
"Special"
} ) then
f110_arg0:processEvent( {
name = "show_new_icon"
} )
end
end
}
}
} )
table.insert( f101_local5.children, {
type = "UIGenericButton",
id = "button_gender",
properties = {
button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_GENDER_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_GENDER" ),
button_action_func = function ( f111_arg0, f111_arg1 )
LUI.FlowManager.RequestPopupMenu( f111_arg0, "cac_customize_gender_popup", true, f111_arg1.controller, false, {} )
end,
button_over_func = function ( f112_arg0, f112_arg1 )
f101_local2( f112_arg0, f112_arg1 )
f101_local4( f112_arg0, "gender" )
end,
additional_handlers = {
refresh_new_icons = function ( f113_arg0, f113_arg1 )
if Engine.IsAliensMode() then
refresh_customize_new_icon_gender( f113_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, field )
else
refresh_customize_new_icon_gender( f113_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, field )
end
end,
menu_create = function ( f114_arg0, f114_arg1 )
if Engine.IsAliensMode() then
refresh_customize_new_icon_gender( f114_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, field )
else
refresh_customize_new_icon_gender( f114_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, field )
end
end
}
}
} )
local f101_local6 = IsPublicMatch()
if not f101_local6 then
f101_local6 = IsOnlineAliens()
end
for f101_local22, f101_local23 in ipairs( Cac.Customization.Fields ) do
if not f101_local23.PublicOnly or f101_local6 then
local f101_local10 = f101_local22 == Cac.Customization.FieldIndexes.ClanTag
local f101_local11 = f101_local22 == Cac.Customization.FieldIndexes.Patchbacking
local f101_local12 = f101_local22 == Cac.Customization.FieldIndexes.GuardDog
local f101_local13 = f101_local22 == Cac.Customization.FieldIndexes.Announcer
local f101_local14
if 1 == Engine.GetDvarInt( "igs_swp" ) then
f101_local14 = not Engine.IsAliensMode()
else
f101_local14 = false
end
local f101_local15
if 0 ~= Engine.GetDvarInt( "igs_announcer" ) then
f101_local15 = not Engine.IsAliensMode()
else
f101_local15 = false
end
if not f101_local11 and (not f101_local10 or Engine.IsConsoleGame()) and (not f101_local12 or f101_local14) and (not f101_local13 or f101_local15) then
local f101_local16 = f101_local23.buttonVariant
if not f101_local16 then
f101_local16 = GenericButtonSettings.Variants.Plain
end
if f101_local12 then
table.insert( f101_local5.children, {
type = "generic_separator"
} )
end
local f101_local17 = table.insert
local f101_local18 = f101_local5.children
local f101_local19 = {
type = "UIGenericButton",
id = "button_" .. f101_local23.LocName
}
local f101_local20 = {}
local f101_local21
if f101_local16 ~= GenericButtonSettings.Variants.Plain then
f101_local21 = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = 0,
bottom = GenericButtonSettings.Styles.GradientButton.height,
right = GenericMenuDims.menu_right_wide,
left = 0
}
if not f101_local21 then
else
f101_local20.default = f101_local21
f101_local19.states = f101_local20
f101_local19.properties = {
variant = f101_local16,
button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_" .. f101_local23.LocName .. "_CAPS" ),
desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_" .. f101_local23.LocName ),
button_display_func = function ( f115_arg0, f115_arg1 )
local f115_local0 = assert
local f115_local1 = f101_local23.GetSavedRef
if f115_local1 then
f115_local1 = f101_local23.GetName
end
f115_local0( f115_local1 )
return Engine.Localize( f101_local23.GetName( f101_local23.GetSavedRef( f101_local0.exclusiveControllerIndex or 0 ) ) )
end,
button_action_func = function ( f116_arg0, f116_arg1 )
f101_local0.currentPage = 1
f101_local0.rowsOffset = 0
f101_local0.currentButtonSlot = 1
if not f101_local10 then
local f116_local0 = Cac.GetCurrentGender( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex )
if not Cac.IsCommonGender( f116_local0 ) then
f116_local0 = Cac.Customization.Gender.Male
end
f101_local0.categories = Cac.Customization.GetCategorizedElementRefsForField( f116_arg1.controller, f101_local0.currentField, f116_local0 )
end
LUI.FlowManager.RequestPopupMenu( f116_arg0, f101_local23.SelectionPopup, true, f116_arg1.controller, false )
end,
button_over_func = function ( f117_arg0, f117_arg1 )
f101_local0.currentField = f101_local23
f101_local0.specialField = false
f117_arg0:dispatchEventToRoot( {
name = "current_field_changed",
immediate = true
} )
f117_arg0:processEvent( {
name = "content_refresh"
} )
f101_local3( f117_arg0, f101_local23 )
f101_local4( f117_arg0, f101_local23 )
end,
button_over_disable_func = function ( f118_arg0, f118_arg1 )
f101_local3( f118_arg0, f101_local23 )
f101_local4( f118_arg0, f101_local23 )
end,
additional_handlers = {
refresh_new_icons = function ( f119_arg0, f119_arg1 )
if Engine.IsAliensMode() then
refresh_customize_new_icon( f119_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, f101_local23 )
else
refresh_customize_new_icon( f119_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, f101_local23 )
end
end,
menu_create = function ( f120_arg0, f120_arg1 )
if Engine.IsAliensMode() then
refresh_customize_new_icon( f120_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, f101_local23 )
else
refresh_customize_new_icon( f120_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, f101_local23 )
end
end
},
text_padding_with_content = 250,
content_width = 225
}
f101_local17( f101_local18, f101_local19 )
end
end
f101_local21 = {}
end
end
end
table.insert( f101_local5.children, {
type = "button_desc_text",
properties = {
lines = 1
}
} )
table.insert( f101_local5.children, {
type = "cac_customize_warning"
} )
return f101_local5
end
function cac_customize_warning()
local f121_local0 = {
"icon_new",
"icon_new_2"
}
local f121_local1 = {
"default",
"alt"
}
return {
type = "UIElement",
id = "warning",
properties = {
text_offset = 2
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
hide_warning = MBh.AnimateToState( "default", 100 ),
show_warning = function ( f122_arg0, f122_arg1 )
f122_arg0:animateToState( "visible", 100 )
if f122_arg1.text then
local f122_local0 = f122_arg0:getChildById( "warning_text" )
f122_local0:setText( f122_arg1.text )
if f122_arg1.style and f122_arg1.style > 0 and f122_arg1.style <= #f121_local1 then
f122_local0 = f122_arg0:getChildById( "warning_text" )
f122_local0:animateToState( f121_local1[f122_arg1.style] )
end
end
if f122_arg1.style and f122_arg1.style > 0 and f122_arg1.style <= #f121_local0 then
local f122_local0 = f122_arg0:getChildById( "warning_exclamation" )
f122_local0:setImage( RegisterMaterial( f121_local0[f122_arg1.style] ) )
end
end
},
children = {
{
type = "UIImage",
id = "warning_exclamation",
states = {
default = {
material = RegisterMaterial( "icon_new" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 95,
width = 32,
top = 0,
height = 32
}
}
},
{
type = "UIText",
id = "warning_text",
states = {
default = CoD.ColorizeState( Cac.Swatches.warning_text, {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 130,
right = 0,
top = MBh.Property( "text_offset" ),
height = CoD.TextSettings.NormalFont.Height
} ),
alt = CoD.ColorizeState( Cac.Swatches.new_icon_text, {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 130,
right = 0,
top = MBh.Property( "text_offset" ),
height = CoD.TextSettings.NormalFont.Height
} )
}
}
}
}
end
function SetCamoButtonHelper( f123_arg0, f123_arg1 )
f123_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_shoulderl",
button_ref2 = "button_shoulderr",
helper_text = Engine.Localize( "PATCH_MENU_CAMO_PREVIEW" ),
side = "left",
clickable = true,
immediate = true
} )
end
function MenuCreate( f124_arg0, f124_arg1 )
local f124_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f124_arg0 )
if not f124_local0.exclusiveControllerIndex then
DebugPrint( "WARNING: Opening cac_customize_main menu without exclusive controller, controller index 0 will be used. This should ONLY happen on LUI reload." )
f124_local0.exclusiveControllerIndex = 0
end
f124_local0.currentCamo = 5
f124_local0.camos = Cac.GetCamoRefs()
f124_local0.squadLocation = f124_arg0.properties.squadLocation
f124_local0.squadMemberIndex = f124_arg0.properties.squadMemberIndex
f124_arg0:processEvent( {
name = "update_playercard",
gamertag = Engine.GetUsernameByController and Engine.GetUsernameByController( f124_local0.exclusiveControllerIndex ) or nil
} )
f124_arg0:processEvent( {
name = "hide_playercard"
} )
f124_arg0:processEvent( {
name = "update_camo"
} )
end
function BackButtonAction( f125_arg0, f125_arg1 )
local f125_local0 = CoD.GetStatsGroupForGameMode()
Cac.SyncPrivateDataFromPlayercard( f125_arg1.controller )
Engine.Exec( "uploadstats", f125_arg1.controller )
if f125_local0 == CoD.StatsGroup.Ranked or f125_local0 == CoD.StatsGroup.Coop then
Engine.Exec( "upload_playercard", f125_arg1.controller )
end
local f125_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f125_arg0 )
if f125_local1.alternateCacMenus then
local f125_local2 = GetInterMenuData( f125_arg0 )
f125_local2.alternateCacMenus = not f125_local2.alternateCacMenus
LUI.FlowManager.RequestAddMenu( f125_arg0, "cac_edit_main", true, f125_arg1.controller, true, f125_local2 )
else
LUI.FlowManager.RequestLeaveMenu( f125_arg0 )
end
end
function cac_customize_main()
local f126_local0 = {
type = "UIElement",
id = "cac_customize_main",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
properties = {
classLocation = "loadouts",
alternateCacMenus = false,
squadLocation = Cac.GetSquadLoc(),
squadMemberIndex = 0,
loadout_slot = 0
},
handlers = {
menu_create = MenuCreate,
preview_element = function ( f127_arg0, f127_arg1 )
f127_arg0.currentSetup = f127_arg0.currentSetup or {}
local f127_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f127_arg0 )
assert( f127_arg1.field, "Missing field for previewing element!" )
assert( f127_arg1.field.PreviewFunction and f127_arg1.elementRef, "Missing data for previewing element" )
local f127_local1 = f127_arg1.field.PreviewFunction( f127_local0.exclusiveControllerIndex, f127_arg0, "customize_char_handle", f127_arg1.elementRef, f127_local0.squadMemberIndex, f127_local0.camos[f127_local0.currentCamo] )
if f127_local1 then
for f127_local5, f127_local6 in pairs( f127_local1 ) do
f127_arg0.currentSetup[f127_local5] = f127_local6
end
end
end,
update_camo = function ( f128_arg0, f128_arg1 )
f128_arg0.currentSetup = f128_arg0.currentSetup or {}
local f128_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f128_arg0 )
local f128_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body]
local f128_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head]
local f128_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet]
local f128_local4 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch]
local f128_local5 = f128_arg0.currentSetup[f128_local1]
if not f128_local5 then
f128_local5 = f128_local1.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex )
end
local f128_local6 = f128_local1.MakeModelName( f128_local5, f128_local0.camos[f128_local0.currentCamo] )
local f128_local7 = f128_local4.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex )
local f128_local8 = f128_arg0.currentSetup[f128_local2]
if not f128_local8 then
f128_local8 = f128_local2.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex )
end
local f128_local9 = f128_arg0.currentSetup[f128_local3]
if not f128_local9 then
f128_local9 = f128_local3.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex )
end
local f128_local10 = f128_local2.MakeModelName( f128_local8, f128_local9, f128_local0.camos[f128_local0.currentCamo] )
CharacterScene.ChangeBody( "customize_char_handle", f128_local6, f128_local7 )
CharacterScene.ChangeHead( "customize_char_handle", f128_local10 )
SetCamoButtonHelper( f128_arg0, f128_local0 )
end,
text_input_complete = InputClanTagComplete
}
}
local f126_local1 = {}
local f126_local2 = {
type = "UIImage",
id = "menu_background",
states = {
default = {
material = RegisterMaterial( "bkgd_cas" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
}
}
local f126_local3 = {
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_CUSTOMIZE_APPEARANCE_CAPS" )
}
}
local f126_local4 = fields_vlist()
local f126_local5 = {
type = "UISquadMemberWindow"
}
local f126_local6 = {
use_playercard = true,
use_background = true
}
local f126_local7 = {}
local f126_local8 = IsPublicMatch()
if not f126_local8 then
f126_local8 = Engine.IsAliensMode()
end
f126_local7.use_level_progress = f126_local8
f126_local6.card_props = f126_local7
f126_local6.card_dims = {
top = -120,
bottom = -155,
left = -50,
right = -50
}
f126_local6.card_scale = -0.15
f126_local6.charHandle = "customize_char_handle"
f126_local6.default_anim = Cac.Customization.Animations.default
f126_local6.char_window_dims = {
top = 0,
bottom = 610,
left = -175,
right = 435
}
f126_local6.uv_values = {
0,
0,
1,
1
}
f126_local6.character_pos = CharacterCameraPresets.CustomizeMenu.Default.Position
f126_local6.controller = MBh.Property( "exclusiveController" )
f126_local6.squad_member_index = MBh.Property( "squadMemberIndex" )
f126_local6.squad_location = MBh.Property( "squadLocation" )
f126_local6.loadout_slot = MBh.Property( "loadout_slot" )
f126_local6.mask_pos_data = {
top = 17,
bottom = 0,
left = 0,
right = 0
}
f126_local5.properties = f126_local6
f126_local5.states = {
default = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 70,
left = 0 + Cac.Layout.CacEditPanel.shift_delta,
bottom = 670,
right = 746 + Cac.Layout.CacEditPanel.shift_delta
}
}
f126_local5.handlers = {
character_full_refresh = function ( f129_arg0, f129_arg1 )
local f129_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f129_arg0 )
f129_arg0:updateSquadMember( f129_local0.exclusiveControllerIndex, f129_local0.squadMemberIndex )
local f129_local1 = f129_arg0:getParent()
f129_local1.currentSetup = {}
f129_local1 = f129_arg0:getParent()
f129_local1:processEvent( {
name = "update_camo"
} )
end,
current_field_changed = function ( f130_arg0, f130_arg1 )
local f130_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f130_arg0 )
assert( f130_local0.currentField )
end,
character_init_complete = function ( f131_arg0, f131_arg1 )
local f131_local0 = f131_arg0:getParent()
f131_local0 = f131_local0.currentSetup
if f131_local0 then
for f131_local4, f131_local5 in pairs( f131_local0 ) do
f131_arg0:dispatchEventToRoot( {
name = "preview_element",
immediate = true,
field = f131_local4,
elementRef = f131_local5
} )
end
end
end
}
f126_local6 = Cac.GetEditCurrency()
f126_local7 = {
type = "button_helper_text_main",
handlers = {
menu_create = function ( f132_arg0, f132_arg1 )
f132_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
f132_arg0:processEvent( {
name = "add_loadout_button_helper"
} )
end,
add_loadout_button_helper = function ( f133_arg0, f133_arg1 )
if not Engine.IsAliensMode() then
f133_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize( "@LUA_MENU_LOADOUT_EDIT" ),
side = "left",
clickable = true,
immediate = true
} )
end
end,
rebind_shoulder_buttons = MBh.EmitEvent( {
name = "rebind",
buttonLeft = ButtonMap.button_shoulderl
} ),
rebind_back_button = MBh.EmitEvent( {
name = "rebind",
buttonLeft = ButtonMap.button_secondary
} )
}
}
f126_local8 = {
type = "online_friends_widget",
properties = {
ignorePopups = true
}
}
local f126_local9 = {
type = "UIBindButton",
id = "customization_button_bind",
handlers = {
button_secondary = BackButtonAction,
button_alt1 = function ( f134_arg0, f134_arg1 )
if not Engine.IsAliensMode() then
local f134_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f134_arg0 )
f134_local0.alternateCacMenus = not f134_local0.alternateCacMenus
local f134_local1 = GetInterMenuData( f134_arg0 )
f134_local1.alternateCacMenus = f134_local0.alternateCacMenus
LUI.FlowManager.RequestAddMenu( f134_arg0, "cac_edit_main", true, f134_arg1.controller, true, f134_local1 )
end
end
}
}
local f126_local10 = {
type = "UIBindButton",
id = "customization_shoulder_buttons_bind",
handlers = {
button_shoulderl = function ( f135_arg0, f135_arg1 )
Engine.PlaySound( CoD.SFX.SubMenuMouseOver )
local f135_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f135_arg0 )
f135_local0.currentCamo = 1 + (#f135_local0.camos + f135_local0.currentCamo - 2) % #f135_local0.camos
f135_arg0:dispatchEventToRoot( {
name = "update_camo"
} )
end,
button_shoulderr = function ( f136_arg0, f136_arg1 )
Engine.PlaySound( CoD.SFX.SubMenuMouseOver )
local f136_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f136_arg0 )
f136_local0.currentCamo = 1 + f136_local0.currentCamo % #f136_local0.camos
f136_arg0:dispatchEventToRoot( {
name = "update_camo"
} )
end,
rebind_shoulder_buttons = function ( f137_arg0, f137_arg1 )
LUI.UIBindButton.ElementEnable( f137_arg0 )
end,
unbind_shoulder_buttons = function ( f138_arg0, f138_arg1 )
LUI.UIBindButton.ElementDisable( f138_arg0 )
end
}
}
f126_local1[1] = f126_local2
f126_local1[2] = f126_local3
f126_local1[3] = f126_local4
f126_local1[4] = f126_local5
f126_local1[5] = f126_local6
f126_local1[6] = f126_local7
f126_local1[7] = f126_local8
f126_local1[8] = f126_local9
f126_local1[9] = f126_local10
f126_local0.children = f126_local1
return f126_local0
end
LUI.MenuBuilder.registerDef( "cac_customize_buttons_popup", cac_customize_buttons_popup )
LUI.MenuBuilder.registerDef( "cac_customize_vlist_popup", cac_customize_vlist_popup )
LUI.MenuBuilder.registerDef( "cac_customize_grid_popup", cac_customize_grid_popup )
LUI.MenuBuilder.registerType( "cac_customize_small_popup", cac_customize_small_popup )
LUI.MenuBuilder.registerDef( "cac_customize_clan_tag_popup", cac_customize_clan_tag_popup )
LUI.MenuBuilder.registerDef( "cac_customize_gender_popup", cac_customize_gender_popup )
LUI.MenuBuilder.registerDef( "cac_customize_warning", cac_customize_warning )
LUI.MenuBuilder.registerDef( "cac_customize_main", cac_customize_main )
LockTable( _M )