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

1378 lines
42 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( "Registering " .. _NAME )
SQUAD_MEMBER_NAME_LENGTH = 20
function OnCreate( f1_arg0, f1_arg1 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
f1_local0.nextScreen = f1_arg0.properties.next_screen
f1_local0.classLocation = f1_arg0.properties.class_location
f1_local0.squadLocation = f1_arg0.properties.squad_location
f1_local0.forceToNextScreen = f1_arg0.properties.force_to_next_screen
f1_local0.exclusiveController = f1_arg0.properties.exclusiveController
f1_local0.memberWindow = f1_arg0:getChildById( "member_select_member_window_id" )
f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
UpdateMemberWindow( f1_local0.exclusiveController, f1_local0.memberWindow, Cac.GetEditSquadMember(), true )
local f1_local1 = false
local f1_local2 = CoD.GetStatsGroupForGameMode()
if f1_local2 == CoD.StatsGroup.Ranked then
f1_local1 = Engine.GetPlayerDataEx( f1_arg0.properties.exclusiveController, CoD.GetStatsGroupForGameMode(), "squadMembers", Cac.GetActiveSquadMember( f1_arg0.properties.exclusiveController ) or 0, "defaultSet" )
end
if f1_local2 == CoD.StatsGroup.Ranked and (f1_local1 == nil or f1_local1 == false) and not f1_local0.alreadyWelcomed then
f1_arg0:dispatchEventToRoot( {
name = "first_time"
} )
end
Engine.Exec( "uploadstats", f1_arg1.controller )
f1_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize( "LUA_MENU_SET_ACTIVE_SQUAD_MEMBER_HELPER" ),
side = "left",
clickable = true
} )
end
function UpdateMemberWindow( f2_arg0, f2_arg1, f2_arg2, f2_arg3 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg1 )
local f2_local1 = f2_local0.squadLocation
if not f2_local1 then
f2_local1 = f2_arg1.properties.squad_location
end
local f2_local2
if f2_arg3 then
f2_local2 = Cac.GetSquadMemberName( f2_arg0, f2_local1, f2_arg2 )
if not f2_local2 then
else
local f2_local3
if f2_arg3 then
f2_local3 = Engine.TableLookup( "mp/cac/backgrounds.csv", 0, Cac.GetBackgroundIndex( f2_arg0, f2_local1, f2_arg2 ), 1 )
if not f2_local3 then
else
local f2_local4
if f2_arg3 then
f2_local4 = Cac.GetPatchIndex( f2_arg0, f2_local1, f2_arg2 )
if not f2_local4 then
else
local f2_local5
if f2_arg3 then
f2_local5 = Cac.GetPatchbackingIndex( f2_arg0, f2_local1, f2_arg2 )
if not f2_local5 then
else
local f2_local6 = Cac.Customization.Animations.default
local f2_local7
if f2_arg3 then
f2_local7 = tonumber( Engine.GetPlayerDataEx( f2_arg0, CoD.GetStatsGroupForGameMode(), f2_local1, f2_arg2, "squadMemXP" ) )
if not f2_local7 then
else
local f2_local8 = Lobby.GetRankForXP( f2_local7 )
local f2_local9 = Cac.GetPrestigeLevel( f2_arg0, f2_local1 )
local f2_local10 = Engine.GetUsernameByController and Engine.GetUsernameByController( f2_arg0 ) or f2_local2
local f2_local11 = Engine.GetProfileDataUseEliteClanTag( f2_arg0 ) and Engine.GetClanTag( f2_arg0 ) or Engine.GetCustomClanTag( f2_arg0 )
f2_arg1:setDisplayName( f2_local2 )
f2_arg1:setBackground( f2_local3 )
if Cac.HasSquadMemberPrestiged( f2_arg0, f2_local0.squadLocation, f2_arg2 ) then
local f2_local12 = Cac.GetSquadMemberPrestigeLevel( f2_arg0, f2_local0.squadLocation, f2_arg2 )
f2_arg1:processEvent( {
name = "show_prestige_icon"
} )
f2_arg1:setPrestigeIcon( RegisterMaterial( Rank.GetRankIcon( f2_local8, f2_local12 ) ) )
else
f2_arg1:processEvent( {
name = "hide_prestige_icon"
} )
end
f2_arg1:updateSquadMember( f2_arg0, f2_arg2 )
f2_arg1:processEvent( {
name = "update_playercard",
gamertag = f2_local10,
clantag = f2_local11,
background = Cac.GetBackgroundIndex( f2_arg0, f2_local1, f2_arg2 ),
rank = f2_local8,
prestige = f2_local9,
patchShape = f2_local5,
patchEmblem = f2_local4,
experience = f2_local7
} )
if f2_arg3 then
f2_arg1:processEvent( {
name = "set_normal"
} )
f2_arg1:processEvent( {
name = "show_playercard",
dispatchChildren = true
} )
f2_arg1:dispatchEventToRoot( {
name = "hide_unlock_text",
dispatchChildren = true,
immediate = true
} )
else
f2_arg1:processEvent( {
name = "set_silhouette"
} )
f2_arg1:dispatchEventToRoot( {
name = "show_unlock_text",
dispatchChildren = true,
immediate = true
} )
end
end
end
f2_local7 = 0
end
end
f2_local5 = 0
end
end
f2_local4 = 0
end
end
f2_local3 = ""
end
end
f2_local2 = ""
end
function OnButtonOver( f3_arg0, f3_arg1, f3_arg2 )
local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 )
local f3_local1 = Cac.IsSquadMemberInUse( f3_arg1, f3_local0.squadLocation, f3_arg2 )
f3_local0.memberIndex = f3_arg2
UpdateMemberWindow( f3_arg1, f3_local0.memberWindow, f3_arg2, f3_local1 )
f3_arg0:dispatchEventToRoot( {
name = "updateMemberIndex",
memIndex = f3_arg2
} )
f3_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
valid = f3_local1,
memberIndex = f3_arg2,
controller = f3_arg1
} )
end
function OnButtonAction( f4_arg0, f4_arg1, f4_arg2 )
local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 )
local f4_local1 = Cac.IsSquadMemberInUse( f4_arg1, f4_local0.squadLocation, f4_arg2 )
f4_local0.activeMember = f4_arg2
if f4_local1 then
SelectSquadMember( f4_arg0, f4_arg2, f4_arg1 )
else
SelectNewMember( f4_arg0, f4_arg2, f4_arg1 )
end
end
function SelectSquadMember( f5_arg0, f5_arg1, f5_arg2 )
local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 )
Engine.PlaySound( CoD.SFX.MouseClick )
local f5_local1 = {
open_char_list = true,
squadLocation = f5_local0.squadLocation,
squadMemberIndex = f5_arg1,
classLocation = f5_local0.classLocation,
allowMemberSwap = f5_local0.forceToNextScreen,
findMatch = f5_local0.findMatch
}
Cac.SetEditSquadMember( f5_arg1 )
local f5_local2 = CoD.GetStatsGroupForGameMode()
local f5_local3 = true
if f5_local2 == CoD.StatsGroup.Ranked then
f5_local3 = Engine.GetPlayerDataEx( f5_arg2, CoD.GetStatsGroupForGameMode(), f5_local0.squadLocation, f5_arg1, "defaultSet" )
end
if f5_local3 == nil or f5_local3 == false then
syncXP( f5_arg2, f5_arg1 )
LUI.FlowManager.RequestAddMenu( f5_arg0, "menu_archetype_select", true, f5_arg2, false, f5_local1 )
elseif f5_local0.nextScreen then
LUI.FlowManager.RequestAddMenu( f5_arg0, f5_local0.nextScreen, true, f5_arg2, f5_local0.forceToNextScreen or false, f5_local1 )
else
DebugPrint( "No next screen data available! Ensure the next_screen property is set and passes to this screen when adding it. Note that this is also normal during a LUI Reload." )
end
end
function SelectNewMember( f6_arg0, f6_arg1, f6_arg2 )
local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 )
local f6_local1 = Cac.GetCurrency( f6_arg2 )
local f6_local2 = Cac.MemberCost[f6_arg1 + 1]
Engine.PlaySound( CoD.SFX.MouseClick )
if f6_local2 <= f6_local1 then
LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_unlock_member_popup", true, f6_arg2, false, {
callback_params = {
next_screen = f6_local0.nextScreen,
squad_location = f6_local0.squadLocation,
class_location = f6_local0.classLocation
}
} )
else
LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_unlock_fail_popup", true, f6_arg2, false, false )
end
end
function CreateNewSquadMember( f7_arg0, f7_arg1 )
LUI.FlowManager.RequestLeaveMenu( f7_arg0, true )
local f7_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" )
Cac.UnlockSquadMember( f7_arg1.controller, f7_local0.squadLocation, f7_local0.memberIndex )
Cac.SetCurrency( f7_arg1.controller, Cac.GetCurrency( f7_arg1.controller ) - Cac.MemberCost[f7_local0.memberIndex + 1] )
Cac.SetEditSquadMember( f7_local0.memberIndex )
LUI.FlowManager.RequestAddMenu( f7_arg0, "menu_archetype_select", true, f7_arg1.controller, false, {
open_char_list = true,
classLocation = f7_arg0.properties.callback_params.class_location,
squadLocation = f7_arg0.properties.callback_params.squad_location,
squadMemberIndex = f7_local0.memberIndex,
allowMemberSwap = f7_local0.forceToNextScreen,
findMatch = f7_local0.findMatch
} )
end
function GetMoveUpButtonRef()
return ShouldUseAlternateReorderUsage() and "button_right_trigger" or "button_shoulderl"
end
function GetMoveDownButtonRef()
return "button_shoulderr"
end
function ShouldUseAlternateReorderUsage()
local f10_local0
if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() ~= 0 then
f10_local0 = false
else
f10_local0 = true
end
return f10_local0
end
function ReorderSquad( f11_arg0, f11_arg1 )
local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_squad_order_popup" )
if ShouldUseAlternateReorderUsage() and not f11_local0.clickedButton then
return
end
local f11_local1 = f11_local0.exclusiveController
local f11_local2 = f11_local0.clickedButton and f11_local0.clickedButton.properties.orderIndex or f11_local0.activeOrderIndex
local f11_local3 = f11_local2 + f11_arg1
if not f11_local2 or f11_local3 < 0 or f11_local3 > SvS.OrderArraySize - 1 then
return
end
local f11_local4 = SvS.GetSquadMemberIndexFromOrderIndex( f11_local1, f11_local2 )
local f11_local5 = SvS.GetSquadMemberIndexFromOrderIndex( f11_local1, f11_local3 )
SvS.SetSquadMemberOrder( f11_local1, f11_local3, f11_local4 )
SvS.SetSquadMemberOrder( f11_local1, f11_local2, f11_local5 )
f11_arg0:dispatchEventToChildren( {
name = "refresh_order_button"
} )
local f11_local6 = f11_arg0:getChildById( "squad_order_member_" .. f11_local2 )
local f11_local7 = f11_arg0:getChildById( "squad_order_member_" .. f11_local3 )
f11_local6:processEvent( {
name = "lose_focus",
controller = f11_local1
} )
f11_local7:processEvent( {
name = "gain_focus",
controller = f11_local1
} )
if f11_local0.clickedButton then
f11_local6:processEvent( {
name = "button_unlock"
} )
f11_local7:processEvent( {
name = "button_lock"
} )
f11_local7.m_ignoreMouseFocus = false
f11_local0.clickedButton = f11_local7
end
end
function ActiveMemberIconHandler( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 )
if Cac.GetActiveSquadMember( f12_arg0.properties.controller ) == f12_arg0.properties.memberIndex then
f12_arg0:animateToState( f12_arg1, f12_arg2 )
else
f12_arg0:animateToState( f12_arg3, f12_arg4 )
end
end
function MemberButtonChildrenFeeder( f13_arg0 )
local f13_local0 = {
[#f13_local0 + 1] = {
type = "UIImage",
id = "active_character_image",
properties = {
memberIndex = f13_arg0.memberIndex,
controller = f13_arg0.controller,
isUnlocked = f13_arg0.isUnlocked
},
states = Cac.GetActiveCharacterImageStates(),
handlers = {
menu_create = function ( f14_arg0, f14_arg1 )
ActiveMemberIconHandler( f14_arg0, "button_up", 0, "default", 0 )
end,
button_over = function ( f15_arg0, f15_arg1 )
ActiveMemberIconHandler( f15_arg0, "button_over", 100, "default", 0 )
end,
button_up = function ( f16_arg0, f16_arg1 )
ActiveMemberIconHandler( f16_arg0, "button_up", 0, "default", 0 )
end,
button_update_active_member = function ( f17_arg0, f17_arg1 )
if f17_arg0.properties and f17_arg0.properties.isUnlocked then
local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f17_arg0 )
local f17_local1 = true
local f17_local2 = true
if CoD.GetStatsGroupForGameMode() == CoD.StatsGroup.Ranked then
f17_local1 = Engine.GetPlayerDataEx( f17_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), "squadMembers", f17_arg0.properties.memberIndex, "defaultSet" )
f17_local2 = f17_local0.memberIndex and Engine.GetPlayerDataEx( f17_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), "squadMembers", f17_local0.memberIndex, "defaultSet" )
end
local f17_local3 = f17_local0.memberIndex
if f17_local3 then
f17_local3 = f17_arg0.properties.memberIndex == f17_local0.memberIndex
end
if f17_local3 and f17_local1 then
if f17_arg0.properties and f17_arg0.properties.controller and f17_arg0.properties.memberIndex then
Cac.SetActiveSquadMember( f17_arg0.properties.controller, f17_arg0.properties.memberIndex )
Engine.PlaySound( CoD.SFX.CacSelectAbility )
end
local f17_local4 = MBh.AnimateSequence( {
{
"button_over",
0
},
{
"popped",
50
},
{
"button_over",
50
}
} )
f17_local4( f17_arg0, f17_arg1 )
elseif not f17_local3 and Cac.GetActiveSquadMember( f17_arg0.properties.controller ) == f17_arg0.properties.memberIndex and not f17_local2 then
local f17_local5 = MBh.AnimateSequence( {
{
"button_up",
0
},
{
"popped_unfocused",
50
},
{
"button_up",
50
}
} )
f17_local5( f17_arg0, f17_arg1 )
else
f17_arg0:animateToState( "default", 0 )
if f17_local3 and not f17_local1 then
Engine.PlaySound( CoD.SFX.DenySelect )
end
end
end
end
}
},
[#f13_local0 + 1] = {
type = "UIImage",
id = "character_locked_image",
properties = {
childNum = f13_arg0.memberIndex,
memberIndex = f13_arg0.memberIndex,
controller = f13_arg0.controller,
squadLocation = Cac.GetSquadLoc()
},
states = {
default = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 10,
right = -25,
height = 16,
width = 16,
material = RegisterMaterial( "icon_lock_mini" ),
red = Colors.secondary_text_color.r,
green = Colors.secondary_text_color.g,
blue = Colors.secondary_text_color.b,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
menu_create = function ( f18_arg0, f18_arg1 )
if Cac.IsSquadMemberInUse( f18_arg0.properties.controller, f18_arg0.properties.squadLocation, f18_arg0.properties.memberIndex ) then
f18_arg0:animateToState( "default" )
else
f18_arg0:animateToState( "visible" )
end
end,
button_over = function ( f19_arg0, f19_arg1 )
f19_arg0:animateToState( "default" )
end,
button_up = function ( f20_arg0, f20_arg1 )
if Cac.IsSquadMemberInUse( f20_arg0.properties.controller, f20_arg0.properties.squadLocation, f20_arg0.properties.memberIndex ) then
f20_arg0:animateToState( "default" )
else
f20_arg0:animateToState( "visible" )
end
end
}
}
}
return f13_local0
end
function MemberFeeder( f21_arg0 )
local f21_local0 = {}
local f21_local1 = f21_arg0.squad_location
local f21_local2 = Cac.MaxSquadMemberCount( f21_local1 )
local f21_local3 = f21_arg0.exclusiveController
local f21_local4 = Engine.GetUsernameByController( f21_local3 )
local f21_local5 = Engine.GetProfileDataUseEliteClanTag( f21_local3 ) and Clan.GetTag( f21_local3 ) or Engine.GetCustomClanTag( f21_local3 )
for f21_local6 = 0, f21_local2 - 1, 1 do
local f21_local9 = f21_local6
local f21_local10 = Cac.GetSquadMemberName( f21_local3, f21_local1, f21_local9 )
local f21_local11 = Cac.IsSquadMemberInUse( f21_local3, f21_local1, f21_local9 )
local f21_local12 = #f21_local0 + 1
local f21_local13 = {
type = "UIGenericButton",
id = "member_card_" .. f21_local9,
listDefaultFocus = Cac.GetActiveSquadMember( f21_local3 ) == f21_local9
}
local f21_local14 = {
memberIndex = f21_local9,
controller = f21_local3,
isUnlocked = f21_local11,
button_text = f21_local10
}
local f21_local15
if f21_local11 then
f21_local15 = Colors.white
if not f21_local15 then
else
f21_local14.text_default_color = f21_local15
f21_local14.additional_children_func = MemberButtonChildrenFeeder
f21_local14.button_action_func = function ( f22_arg0, f22_arg1 )
OnButtonAction( f22_arg0, f22_arg1.controller, f21_local9 )
end
f21_local14.button_over_func = function ( f23_arg0, f23_arg1 )
local f23_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f23_arg0 )
OnButtonOver( f23_arg0, f23_local0.exclusiveController, f21_local9 )
if Cac.AnyUnseenMDLCItems( f21_local3, NewIconsTable.CACItemTypes ) then
f23_arg0:processEvent( {
name = "show_new_icon"
} )
end
end
f21_local14.button_up_func = function ( f24_arg0, f24_arg1 )
f24_arg0:processEvent( {
name = "hide_new_icon"
} )
end
f21_local13.properties = f21_local14
f21_local13.handlers = {
update_member_name = function ( f25_arg0, f25_arg1 )
if f25_arg1.index == f21_local9 and f25_arg1.newName then
f25_arg0:setText( f25_arg1.newName )
end
end
}
f21_local0[f21_local12] = f21_local13
end
end
f21_local15 = Colors.grey_4
end
return f21_local0
end
function SquadOrderMemberListChildrenFeeder( f26_arg0 )
local f26_local0 = {}
local f26_local1 = f26_arg0.squad_location
local f26_local2 = Cac.MaxSquadMemberCount( f26_local1 )
local f26_local3 = f26_arg0.exclusiveController
local f26_local4 = Cac.GetActiveSquadMember( f26_local3 )
for f26_local5 = 0, SvS.OrderArraySize - 1, 1 do
local f26_local8 = SvS.GetSquadMemberIndexFromOrderIndex( f26_local3, f26_local5 )
local f26_local9 = Cac.GetSquadMemberName( f26_local3, f26_local1, f26_local8 )
local f26_local10 = f26_local8 == Cac.GetActiveSquadMember( f26_local3 )
f26_local0[#f26_local0 + 1] = {
type = "UIGenericButton",
id = "squad_order_member_" .. f26_local5,
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
variant = GenericButtonSettings.Variants.Plain,
text = f26_local9,
orderIndex = f26_local5,
squad_location = f26_local1,
controller = f26_local3
},
handlers = {
button_over = function ( f27_arg0, f27_arg1 )
local f27_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f27_arg0 )
f27_local0.activeOrderIndex = f27_arg0.properties.orderIndex
end,
refresh_order_button = function ( f28_arg0, f28_arg1 )
local f28_local0 = f28_arg0.properties.controller
f26_local9 = Cac.GetSquadMemberName( f28_local0, f28_arg0.properties.squad_location, SvS.GetSquadMemberIndexFromOrderIndex( f28_local0, f28_arg0.properties.orderIndex ) )
f28_arg0:setText( f26_local9 )
f28_arg0:dispatchEventToChildren( f28_arg1 )
end,
button_action = function ( f29_arg0, f29_arg1 )
if ShouldUseAlternateReorderUsage() then
local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 )
if f29_local0.clickedButton == nil then
f29_local0.clickedButton = f29_arg0
f29_arg0:processEvent( {
name = "button_lock"
} )
f29_arg0.m_ignoreMouseFocus = false
elseif f29_local0.clickedButton == f29_arg0 then
f29_local0.clickedButton = nil
f29_arg0:processEvent( {
name = "button_unlock"
} )
end
f29_arg0:dispatchEventToChildren( f29_arg1 )
f29_arg0:dispatchEventToParent( {
name = "update_button_helpers"
} )
end
end
},
children = {
{
type = "UIImage",
id = "squad_order_in_squad_icon",
properties = {
orderIndex = f26_local5,
squad_location = f26_local1,
controller = f26_local3
},
states = {
default = CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "icon_ai_loadout" ),
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 2,
left = 10,
bottom = 28,
right = 36,
alpha = 1
} ),
squadLeader = CoD.ColorizeState( Colors.frontend_hilite, {
material = RegisterMaterial( "icon_ai_loadout" ),
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 2,
left = 10,
bottom = 28,
right = 36,
alpha = 1
} ),
hidden = {
alpha = 0
}
},
handlers = {
menu_create = function ( f30_arg0, f30_arg1 )
f30_arg0:processEvent( {
name = "refresh_order_button"
} )
end,
refresh_order_button = function ( f31_arg0, f31_arg1 )
local f31_local0 = Cac.GetActiveSquadMember( f31_arg0.properties.controller )
local f31_local1 = f31_arg0.properties.orderIndex
local f31_local2 = SvS.MaxSquadSize - 1
local f31_local3 = SvS.FindSquadMemberOrderIndex( f31_arg0.properties.controller, f31_local0 )
local f31_local4 = SvS.GetSquadMemberIndexFromOrderIndex( f26_local3, f31_arg0.properties.orderIndex ) == Cac.GetActiveSquadMember( f26_local3 )
if f31_local2 < f31_local3 then
f31_local2 = f31_local2 - 1
end
if f31_local1 <= f31_local2 or f31_local1 == f31_local3 then
local f31_local5 = f31_arg0
local f31_local6 = f31_arg0.animateToState
local f31_local7
if f31_local4 then
f31_local7 = "squadLeader"
if not f31_local7 then
else
f31_local6( f31_local5, f31_local7 )
end
end
f31_local7 = "default"
else
f31_arg0:animateToState( "hidden" )
end
end
}
}
}
}
end
return f26_local0
end
function SquadOrderPopupMainChildrenFeeder( f32_arg0 )
local f32_local0 = {}
local f32_local1 = f32_arg0.exclusiveController
local f32_local2 = Engine.Localize( "LUA_MENU_SQUAD_LEADER_PREFIX", Engine.MarkLocalized( Cac.GetSquadMemberName( f32_local1, f32_arg0.squad_location, Cac.GetActiveSquadMember( f32_local1 ) ) ) )
local f32_local3 = Engine.Localize( "LUA_MENU_ACTIVE_SQUAD_MEMBER_DESC" )
local f32_local4, f32_local5, f32_local6, f32_local7 = GetTextDimensions( f32_local3, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
local f32_local8 = f32_local6 - f32_local4
f32_local0[#f32_local0 + 1] = {
type = "UIElement",
id = "squad_order_player_bar",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
bottom = CoD.TextSettings.NormalFont.Height,
right = 0,
alpha = 1
}
},
children = {
{
type = "UIImage",
id = "squad_order_player_bar_BG",
properties = {
text = f32_local2
},
states = {
default = CoD.ColorizeState( {
r = 0.17,
g = 0.17,
b = 0.17
}, {
material = RegisterMaterial( "white" ),
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = -4,
left = -4,
bottom = 4,
right = 4,
alpha = 1
} )
}
},
{
type = "UIText",
id = "squad_order_player_bar_text",
properties = {
text = f32_local2
},
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} )
}
}
}
}
f32_local0[#f32_local0 + 1] = {
type = "UIVerticalList",
id = "squad_order_member_list",
focusable = true,
properties = {
squad_location = f32_arg0.squad_location
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
bottom = 270,
right = 0,
alpha = 1
}
},
handlers = {
shift_down = function ( f33_arg0, f33_arg1 )
ReorderSquad( f33_arg0, 1 )
end,
shift_up = function ( f34_arg0, f34_arg1 )
ReorderSquad( f34_arg0, -1 )
end
},
childrenFeeder = SquadOrderMemberListChildrenFeeder
}
f32_local0[#f32_local0 + 1] = {
type = "UIMarqueeText",
id = "squad_order_desc_text_1",
properties = {
text = Engine.Localize( "LUA_MENU_SQUAD_ORDER_DESC" )
},
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
bottom = CoD.TextSettings.NormalFont.Height,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
alpha = 1
} )
}
}
f32_local0[#f32_local0 + 1] = {
type = "UIElement",
id = "squad_order_desc_line_2",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
bottom = 26,
right = 0
}
},
children = {
{
type = "UIImage",
id = "squad_order_desc_image_2",
states = {
default = CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "icon_ai_loadout" ),
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = -f32_local8 * 0.5 - 27,
bottom = 27,
right = -f32_local8 * 0.5,
alpha = 1
} )
}
},
{
type = "UIText",
id = "squad_order_desc_text_2",
properties = {
text = f32_local3
},
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 3,
left = 32,
bottom = CoD.TextSettings.NormalFont.Height + 3,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
alpha = 1
} )
}
}
}
}
f32_local0[#f32_local0 + 1] = {
type = "button_helper_text_main",
id = "squad_order_button_helpers",
properties = {
height = 70,
spacing = 0,
right_inset = 0,
left_inset = 0,
background_alpha = 0
}
}
local f32_local9 = {
type = "UIBindButton",
id = "squad_order_bind_button",
handlers = {}
}
f32_local0[#f32_local0 + 1] = f32_local9
f32_local9.handlers[GetMoveUpButtonRef()] = function ( f35_arg0, f35_arg1 )
local f35_local0 = f35_arg0:getParent()
f35_local0:processEvent( {
name = "shift_up"
} )
end
f32_local9.handlers[GetMoveDownButtonRef()] = function ( f36_arg0, f36_arg1 )
local f36_local0 = f36_arg0:getParent()
f36_local0:processEvent( {
name = "shift_down"
} )
end
return f32_local0
end
function cac_squad_order_popup()
return {
type = "generic_selectionList_popup",
properties = {
popup_title = Engine.Localize( "LUA_MENU_SQUAD_ORDER_TITLE" ),
popup_width = 525,
popup_list_spacing = 5,
popup_childfeeder = SquadOrderPopupMainChildrenFeeder
},
handlers = {
menu_create = function ( f38_arg0, f38_arg1 )
f38_arg0:processEvent( {
name = "update_button_helpers"
} )
end
,
update_button_helpers = function ( f39_arg0, f39_arg1 )
local f39_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f39_arg0 )
if not ShouldUseAlternateReorderUsage() or f39_local0.clickedButton then
f39_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = GetMoveDownButtonRef(),
helper_text = Engine.Localize( "LUA_MENU_MOVE_DOWN" ),
side = "left",
clickable = true
} )
f39_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = GetMoveUpButtonRef(),
helper_text = Engine.Localize( "LUA_MENU_MOVE_UP" ),
side = "left",
clickable = true
} )
else
f39_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = GetMoveDownButtonRef(),
helper_text = "",
side = "left",
clickable = true
} )
f39_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = GetMoveUpButtonRef(),
helper_text = "",
side = "left",
clickable = true
} )
end
f39_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
}
}
end
function cac_unlock_member_popup()
local f40_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" )
return {
type = "generic_yesno_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_NEW_MEMBER" ),
message_text = Engine.Localize( "@LUA_MENU_UNLOCK_SQUAD_MEMBER_CONFIRMATION", Cac.MemberCost[f40_local0.activeMember + 1] ),
yes_action = CreateNewSquadMember,
no_action = MBh.LeaveMenu()
}
}
end
function cac_unlock_fail_popup()
local f41_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" )
return {
type = "generic_confirmation_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_INSUFFICIENT_CURRENCY" ),
message_text = Engine.Localize( "@LUA_MENU_UNLOCK_SQUAD_MEMBER_FAIL", Cac.MemberCost[f41_local0.activeMember + 1] ),
button_text = Engine.Localize( "@MENU_OK" ),
confirmation_action = MBh.LeaveMenu()
}
}
end
function cac_setup_first()
return {
type = "generic_confirmation_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_WELCOME" ),
message_text = Engine.Localize( "@LUA_MENU_SELECT_YOUR_LOADOUT" ),
button_text = Engine.Localize( "@MENU_OK" ),
confirmation_action = MBh.LeaveMenu()
}
}
end
function cac_member_unlock_widget()
local f43_local0 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[1] )
local f43_local1, f43_local2, f43_local3, f43_local4 = GetTextDimensions( f43_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
local f43_local5 = 32
return {
type = "UIElement",
id = "member_select_unlock_widget_container",
states = {
default = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 555,
left = Cac.Layout.CacEditPanel.shift_delta,
bottom = 610,
right = Cac.Layout.CacEditPanel.shift_delta + 400,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
show_unlock_text = MBh.AnimateToState( "default" ),
hide_unlock_text = MBh.AnimateToState( "hidden" )
},
children = {
{
type = "generic_drop_shadow",
properties = {
offset_shadow = 0
}
},
{
type = "generic_menu_background",
id = "cac_member_unlock_widget_background",
properties = {
top_offset = 0,
fill_alpha = 1,
border_alpha = 1
}
},
{
type = "UIHorizontalList",
id = "member_select_unlock_widget_hlist",
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
top = 0,
right = 0,
bottom = 0,
alpha = 1,
alignment = LUI.Alignment.Center,
spacing = 2
}
},
children = {
{
type = "UIImage",
id = "cac_member_unlock_widget_point_icon",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
height = f43_local5,
left = 0,
right = f43_local5,
material = RegisterMaterial( "icon_unlock_token_32" )
}
}
},
{
type = "UIText",
id = "cac_member_unlock_widget_point_cost",
properties = {
text = f43_local0,
textStyle = CoD.TextStyle.Shadowed
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 0,
height = CoD.TextSettings.NormalFont.Height,
right = f43_local3 + 18,
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 = {
updateMemberIndex = function ( f44_arg0, f44_arg1 )
local f44_local0 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[f44_arg1.memIndex + 1] )
local f44_local1, f44_local2, f44_local3, f44_local4 = GetTextDimensions( f44_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
f44_arg0:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 0,
height = CoD.TextSettings.NormalFont.Height,
right = f44_local3 + 18,
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
} )
f44_arg0:animateToState( "default" )
f44_arg0:setText( f44_local0 )
end
}
}
}
}
}
}
end
function cac_member_select_main()
local f45_local0 = {
type = "UIElement",
id = "cac_member_select_root",
properties = {
squad_location = Cac.GetSquadLoc()
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OnCreate,
first_time = function ( f46_arg0, f46_arg1 )
LUI.FlowManager.RequestPopupMenu( nil, "cac_setup_first", true, f46_arg1.controller, false, false, false, false )
end,
menu_close = function ( f47_arg0, f47_arg1 )
Engine.Exec( "uploadstats", f47_arg1.controller )
end,
text_input_complete = function ( f48_arg0, f48_arg1 )
local f48_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f48_arg0 )
LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "CloseKeyboard" )
if f48_local0.renameIndex and f48_arg1.text then
Cac.SetSquadMemberName( f48_arg1.controller, f48_local0.squadLocation, f48_local0.renameIndex, f48_arg1.text )
f48_arg0:processEvent( {
name = "update_member_name",
index = f48_local0.renameIndex,
newName = f48_arg1.text
} )
Engine.Exec( "uploadstats", f48_arg1.controller )
f48_local0.renameIndex = nil
end
end
}
}
local f45_local1 = {}
local f45_local2 = {
type = "UIImage",
id = "member_select_background",
states = {
default = {
material = RegisterMaterial( "bkgd_cas" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
}
}
local f45_local3 = {
type = "generic_menu_title",
id = "member_select_title_id",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_SELECT_SQUAD_MEMBER_CAPS" )
}
}
local f45_local4 = Cac.GetEditCurrency( "select_member_currency_display_id" )
local f45_local5 = {
type = "UIVerticalList",
id = "member_select_member_list",
childrenFeeder = MemberFeeder,
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
top = GenericMenuDims.menu_top,
bottom = 800
}
}
}
local f45_local6 = {
type = "UISquadMemberWindow",
id = "member_select_member_window_id"
}
local f45_local7 = {
use_3d_model = true,
use_2d_character_image = false,
use_member_name = false,
use_prestige_icon = true,
use_playercard = true,
use_background = true,
use_border = false
}
local f45_local8 = {}
local f45_local9 = IsPublicMatch()
if not f45_local9 then
f45_local9 = Engine.IsAliensMode()
end
f45_local8.use_level_progress = f45_local9
f45_local7.card_props = f45_local8
f45_local7.card_dims = {
top = -130,
bottom = -165,
left = -725,
right = -725
}
f45_local7.card_scale = -0.15
f45_local7.default_anim = Cac.Customization.Animations.default
f45_local7.char_window_dims = {
top = 0,
bottom = 610,
left = -175,
right = 435
}
f45_local7.uv_values = {
0,
0,
1,
1
}
f45_local7.character_pos = CharacterCameraPresets.MemberSelect.Position
f45_local7.controller = MBh.Property( "exclusiveController" )
f45_local7.squad_location = MBh.Property( "squad_location" )
f45_local7.mask_pos_data = {
top = 17,
bottom = 0,
left = 0,
right = 0
}
f45_local6.properties = f45_local7
f45_local6.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
}
}
f45_local6.handlers = {
menu_close = function ( f49_arg0, f49_arg1 )
LUI.UISquadMemberWindow.Shutdown( f49_arg0 )
end
}
f45_local7 = {
type = "cac_member_unlock_widget",
id = "cac_member_unlock_widget_id"
}
f45_local8 = {
type = "UIBindButton",
id = "member_select_bind_button_id",
handlers = {
button_secondary = function ( f50_arg0, f50_arg1 )
local f50_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f50_arg0 )
if f50_local0.forceToNextScreen then
Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f50_arg1.controller ) )
LUI.FlowManager.RequestAddMenu( element, f50_local0.nextScreen, true, f50_arg1.controller, true, {
open_char_list = true,
squadLocation = f50_local0.squadLocation,
squadMemberIndex = Cac.GetEditSquadMember(),
classLocation = f50_local0.classLocation,
allowMemberSwap = true
} )
else
LUI.FlowManager.RequestLeaveMenu( f50_arg0 )
end
end,
button_shoulderl = function ( f51_arg0, f51_arg1 )
local f51_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f51_arg0 )
if f51_local0.memberIndex and Cac.HasSquadMemberPrestiged( f51_arg1.controller, f51_local0.squadLocation, f51_local0.memberIndex ) then
Engine.PlaySound( CoD.SFX.MouseClick )
LUI.FlowManager.RequestAddMenu( element, "prestige_details_main", true, f51_arg1.controller, false, {
squadLocation = f51_local0.squadLocation,
squadMemberIndex = f51_local0.memberIndex,
classLocation = f51_local0.classLocation
} )
end
end,
button_shoulderr = function ( f52_arg0, f52_arg1 )
local f52_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f52_arg0 )
if f52_local0.memberIndex then
local f52_local1 = f52_local0.squadLocation
if not f52_local1 then
f52_local1 = Cac.GetSquadLoc()
end
if Cac.IsSquadMemberInUse( f52_arg1.controller, f52_local0.squadLocation, f52_local0.memberIndex ) then
Engine.PlaySound( CoD.SFX.MouseClick )
local f52_local2 = Cac.GetSquadMemberName( f52_arg1.controller, f52_local1, f52_local0.memberIndex )
LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "OpenKeyboard" )
Engine.OpenScreenKeyboard( f52_arg1.controller, Engine.Localize( "@LUA_MENU_ENTER_NAME" ), f52_local2, SQUAD_MEMBER_NAME_LENGTH, true, true )
f52_local0.renameIndex = f52_local0.memberIndex
end
end
end,
button_alt1 = function ( f53_arg0, f53_arg1 )
local f53_local0 = f53_arg0:getParent()
f53_local0:processEvent( {
name = "button_update_active_member",
controller = f53_arg1.controller
} )
end
}
}
f45_local9 = {
type = "button_helper_text_main",
id = "member_select_helper_text_id",
handlers = {
update_button_helpers = function ( f54_arg0, f54_arg1 )
local f54_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f54_arg0 )
local f54_local1 = f54_arg1.valid
if f54_local1 then
f54_local1 = Cac.HasSquadMemberPrestiged( f54_arg1.controller, f54_local0.squadLocation, f54_local0.memberIndex )
end
f54_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = "",
side = "left",
clickable = true
} )
f54_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderl",
helper_text = "",
side = "left",
clickable = true,
dispatchChildren = true
} )
f54_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderr",
helper_text = "",
side = "left",
clickable = true,
dispatchChildren = true
} )
f54_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = f54_arg1.valid and Engine.Localize( "LUA_MENU_SET_ACTIVE_SQUAD_MEMBER_HELPER" ) or "",
side = "left",
clickable = true
} )
local f54_local2 = f54_arg0
local f54_local3 = f54_arg0.processEvent
local f54_local4 = {
name = "add_button_helper_text",
button_ref = "button_shoulderl"
}
local f54_local5
if f54_local1 then
f54_local5 = Engine.Localize( "@LUA_MENU_PRESTIGE_DETAILS" )
if not f54_local5 then
else
f54_local4.helper_text = f54_local5
f54_local4.side = "left"
f54_local4.clickable = true
f54_local4.dispatchChildren = true
f54_local3( f54_local2, f54_local4 )
f54_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderr",
helper_text = f54_arg1.valid and Engine.Localize( "@LUA_MENU_EDIT_MEMBER_NAME" ) or "",
side = "left",
clickable = true,
dispatchChildren = true
} )
end
end
f54_local5 = ""
end
}
}
local f45_local10 = {
type = "online_friends_widget",
id = "online_friends_widget_id"
}
f45_local1[1] = f45_local2
f45_local1[2] = f45_local3
f45_local1[3] = f45_local4
f45_local1[4] = f45_local5
f45_local1[5] = f45_local6
f45_local1[6] = f45_local7
f45_local1[7] = f45_local8
f45_local1[8] = f45_local9
f45_local1[9] = f45_local10
f45_local0.children = f45_local1
return f45_local0
end
LUI.MenuBuilder.registerDef( "cac_member_select_main", cac_member_select_main )
LUI.MenuBuilder.registerDef( "cac_unlock_member_popup", cac_unlock_member_popup )
LUI.MenuBuilder.registerDef( "cac_unlock_fail_popup", cac_unlock_fail_popup )
LUI.MenuBuilder.registerDef( "cac_member_unlock_widget", cac_member_unlock_widget )
LUI.MenuBuilder.registerDef( "cac_setup_first", cac_setup_first )
LUI.MenuBuilder.registerDef( "cac_squad_order_popup", cac_squad_order_popup )
LockTable( _M )