847 lines
27 KiB
Lua
847 lines
27 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
function selection_info_panel_header()
|
|
return {
|
|
type = "UIElement",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 30,
|
|
height = GenericButtonDims.button_height
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "info_panel_header_text",
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
selection_info_set_header_text = function ( f2_arg0, f2_arg1 )
|
|
assert( f2_arg1.newText )
|
|
f2_arg0:setText( f2_arg1.newText )
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 25,
|
|
right = 0,
|
|
top = -0.5 * CoD.TextSettings.BoldFont.Height,
|
|
bottom = 0.5 * CoD.TextSettings.BoldFont.Height,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
red = Colors.primary_text_color.r,
|
|
green = Colors.primary_text_color.g,
|
|
blue = Colors.primary_text_color.b
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function selection_info_panel_footer()
|
|
return {
|
|
type = "UIElement",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = Cac.Layout.SelectionInfo.textTop,
|
|
bottom = Cac.Layout.SelectionInfo.textTop + 40
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "info_panel_description_new_icon",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
top = 0,
|
|
left = -8,
|
|
width = 32,
|
|
height = 32,
|
|
material = RegisterMaterial( "icon_new" ),
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
selection_info_set_footer_text = function ( f4_arg0, f4_arg1 )
|
|
if f4_arg1.newIcon then
|
|
f4_arg0:animateToState( "visible" )
|
|
if f4_arg1.newIconMaterial then
|
|
CoD.SetMaterial( f4_arg0, RegisterMaterial( f4_arg1.newIconMaterial ) )
|
|
end
|
|
else
|
|
f4_arg0:animateToState( "default" )
|
|
end
|
|
end
|
|
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "info_panel_footer_text",
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
selection_info_set_footer_text = function ( f5_arg0, f5_arg1 )
|
|
assert( f5_arg1.newText )
|
|
f5_arg0:setText( f5_arg1.newText )
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 25,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
red = Colors.secondary_text_color.r,
|
|
green = Colors.secondary_text_color.g,
|
|
blue = Colors.secondary_text_color.b
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "warning_exclamation",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = 0,
|
|
top = 0,
|
|
width = 32,
|
|
height = 32,
|
|
material = RegisterMaterial( "icon_new" ),
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
update_warning_text = function ( f6_arg0, f6_arg1 )
|
|
if f6_arg1.conflictFooter then
|
|
local f6_local0 = f6_arg0:getParent()
|
|
f6_local0 = f6_local0:getChildById( "info_panel_footer_text" )
|
|
local f6_local1, f6_local2 = f6_local0:getElementTextDims()
|
|
f6_arg0:registerAnimationState( "visible", {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = -10,
|
|
top = f6_local2 + 5,
|
|
width = 32,
|
|
height = 32,
|
|
alpha = 1
|
|
} )
|
|
f6_arg0:animateToState( "visible" )
|
|
else
|
|
f6_arg0:animateToState( "default" )
|
|
end
|
|
end
|
|
|
|
}
|
|
},
|
|
{
|
|
type = "UIMarqueeText",
|
|
id = "warning_text",
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_LETHAL_WARNING" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Cac.Swatches.warning_text, {
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 32,
|
|
right = 0,
|
|
top = 10 + CoD.TextSettings.NormalFont.Height * 3,
|
|
bottom = 10 + CoD.TextSettings.NormalFont.Height * 4,
|
|
alpha = 0
|
|
} )
|
|
},
|
|
properties = {
|
|
scrollSpeed = 100
|
|
},
|
|
handlers = {
|
|
update_warning_text = function ( f7_arg0, f7_arg1 )
|
|
if f7_arg1.conflictFooter then
|
|
f7_arg0:setText( f7_arg1.conflictFooter )
|
|
local f7_local0 = f7_arg0:getParent()
|
|
f7_local0 = f7_local0:getChildById( "info_panel_footer_text" )
|
|
local f7_local1, f7_local2 = f7_local0:getElementTextDims()
|
|
f7_arg0:registerAnimationState( "visible", {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 25,
|
|
right = 300,
|
|
top = 10 + f7_local2,
|
|
bottom = 10 + f7_local2 + CoD.TextSettings.NormalFont.Height,
|
|
alpha = 1
|
|
} )
|
|
f7_arg0:animateToState( "visible" )
|
|
else
|
|
f7_arg0:animateToState( "default" )
|
|
end
|
|
end
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function UpdateAbilitiesInfoPanel( f8_arg0, f8_arg1 )
|
|
f8_arg0:closeChildren()
|
|
if f8_arg1.selection_id == "edit_abilities" then
|
|
for f8_local6, f8_local7 in ipairs( Cac.GetAbilityTypes() ) do
|
|
for f8_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do
|
|
if Cac.IsAbilityPicked( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, f8_local7, f8_local5 - 1, "abilitiesPicked" ) then
|
|
local f8_local3 = Cac.GetAbilityRef( f8_local7 )
|
|
local f8_local4 = Cac.GetAbilitySlotRef( f8_local3, f8_local5 )
|
|
f8_arg0:addElement( abilities_info_container( nil, {
|
|
categoryColor = Colors.cac_ability[f8_local3],
|
|
iconImage = Cac.GetPerkImage( f8_local4 ),
|
|
costText = Cac.GetPerkCost( f8_local4 ),
|
|
title = Cac.GetPerkName( f8_local4 ),
|
|
description = Cac.GetPerkDesc( f8_local4 ),
|
|
iconSize = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height,
|
|
id = "abilities_info_container_" .. f8_local5 .. "_" .. f8_local7,
|
|
menu_left = 10,
|
|
description_right = 325,
|
|
cost_left = 0
|
|
} ) )
|
|
end
|
|
end
|
|
end
|
|
f8_local0 = Cac.GetNumberAbilitiesPicked( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, "abilitiesPicked" )
|
|
f8_arg0:registerAnimationState( "compressed", {
|
|
spacing = math.min( (550 - f8_local0 * (CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height)) / f8_local0, 27 )
|
|
} )
|
|
f8_arg0:animateToState( "compressed" )
|
|
elseif f8_arg1.selection_id == "edit_killstreaks" then
|
|
local f8_local0 = Cac.GetStreakType( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot )
|
|
if f8_local0 == "specialty_null" then
|
|
f8_local0 = "streaktype_assault"
|
|
end
|
|
f8_local0 = Cac.GetStreakTypeReference( f8_local0 )
|
|
local f8_local1 = 0
|
|
for f8_local2 = 0, 2, 1 do
|
|
local f8_local8 = Cac.GetStreak( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, f8_local0, f8_local2 )
|
|
local f8_local9 = Cac.GetStreakIcon( f8_local8, f8_arg1.controller )
|
|
local f8_local10 = 64
|
|
local f8_local11 = 10
|
|
local f8_local3 = -25
|
|
if f8_local0 == "specialistStreaks" then
|
|
local f8_local4 = Cac.GetPerkCost( Cac.StripSuffix( f8_local8, "_ks" ) )
|
|
if f8_local4 ~= "" and f8_local4 then
|
|
f8_local1 = f8_local1 + f8_local4 + 1
|
|
end
|
|
else
|
|
f8_local1 = Cac.GetStreakCost( f8_local8 )
|
|
end
|
|
local f8_local4 = abilities_info_container( nil, {
|
|
categoryColor = Colors.even_stripe,
|
|
iconImage = f8_local9,
|
|
costText = f8_local1,
|
|
title = Cac.GetStreakName( f8_local8 ),
|
|
iconSize = f8_local10,
|
|
description = Cac.GetStreakDesc( f8_local8 ),
|
|
id = "abilities_info_container_" .. f8_local2,
|
|
menu_left = f8_local11,
|
|
description_right = 300,
|
|
cost_left = f8_local3
|
|
} )
|
|
if f8_local8 ~= "none" then
|
|
f8_arg0:addElement( f8_local4 )
|
|
end
|
|
end
|
|
f8_arg0:animateToState( "strike_spaced" )
|
|
end
|
|
f8_arg0:animateToState( "visible" )
|
|
end
|
|
|
|
function abilities_info_container( menu, controller )
|
|
local self = LUI.UIElement.new()
|
|
self.id = controller.id
|
|
self.properties = controller
|
|
self:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = controller.menu_left + math.abs( controller.cost_left ),
|
|
right = 0,
|
|
top = 0,
|
|
height = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height
|
|
} )
|
|
self:animateToState( "default" )
|
|
local f9_local1 = LUI.UIElement.new()
|
|
f9_local1.id = "abilities_info_image_container"
|
|
f9_local1:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
width = 60,
|
|
top = 0,
|
|
bottom = 0
|
|
} )
|
|
f9_local1:animateToState( "default" )
|
|
local f9_local2 = LUI.UIImage.new()
|
|
f9_local2.id = "abilities_info_tab_id"
|
|
f9_local2:registerAnimationState( "default", CoD.ColorizeState( controller.categoryColor, {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
bottom = 16,
|
|
left = 0,
|
|
right = 16,
|
|
material = RegisterMaterial( "widg_triangle" )
|
|
} ) )
|
|
f9_local2:animateToState( "default" )
|
|
f9_local1:addElement( f9_local2 )
|
|
local f9_local3 = LUI.UIImage.new()
|
|
f9_local3.id = "abilities_info_icon_id"
|
|
f9_local3:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
right = -3,
|
|
width = controller.iconSize,
|
|
height = controller.iconSize,
|
|
material = RegisterMaterial( controller.iconImage ),
|
|
alpha = 1
|
|
} )
|
|
f9_local3:animateToState( "default" )
|
|
f9_local1:addElement( f9_local3 )
|
|
local f9_local4 = LUI.UIText.new()
|
|
f9_local4.id = "abilities_info_cost_id"
|
|
f9_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, {
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
left = controller.cost_left,
|
|
right = 0,
|
|
height = CoD.TextSettings.SmallFont.Height,
|
|
font = CoD.TextSettings.SmallFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
} ) )
|
|
f9_local4:animateToState( "default" )
|
|
f9_local4:setText( controller.costText )
|
|
f9_local1:addElement( f9_local4 )
|
|
self:addElement( f9_local1 )
|
|
local f9_local5 = LUI.UIElement.new()
|
|
f9_local5.id = "abilities_info_description_container_id"
|
|
f9_local5:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 60,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
} )
|
|
f9_local5:animateToState( "default" )
|
|
local f9_local6 = LUI.UIText.new()
|
|
f9_local6.id = "abilities_info_description_title_id"
|
|
f9_local6:setText( controller.title )
|
|
f9_local6:registerAnimationState( "default", {
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 5,
|
|
right = 350 - controller.menu_left,
|
|
top = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
f9_local6:animateToState( "default" )
|
|
f9_local5:addElement( f9_local6 )
|
|
local f9_local7 = LUI.UIMarqueeText.new()
|
|
LUI.UIMarqueeText.SetSpeed( f9_local7, 100 )
|
|
f9_local7.id = "abilities_info_description_text_id"
|
|
f9_local7:setText( controller.description )
|
|
f9_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, {
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 5,
|
|
right = controller.description_right,
|
|
top = CoD.TextSettings.BoldFont.Height,
|
|
bottom = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height
|
|
} ) )
|
|
f9_local7:animateToState( "default" )
|
|
f9_local5:addElement( f9_local7 )
|
|
self:addElement( f9_local5 )
|
|
return self
|
|
end
|
|
|
|
function abilities_info_panel()
|
|
return {
|
|
type = "UIVerticalList",
|
|
id = "abilities_info_panel_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 145,
|
|
bottom = 400,
|
|
alignment = LUI.Alignment.Middle,
|
|
spacing = 27
|
|
},
|
|
strike_spaced = {
|
|
spacing = 80
|
|
}
|
|
},
|
|
handlers = {
|
|
update_abilities_info_panel = UpdateAbilitiesInfoPanel,
|
|
hide_abilities_info_panel = function ( f11_arg0, f11_arg1 )
|
|
f11_arg0:closeChildren()
|
|
end
|
|
|
|
}
|
|
}
|
|
end
|
|
|
|
function UpdateSelectionInfoPanelMainImage( f12_arg0, f12_arg1 )
|
|
assert( f12_arg1.newImage )
|
|
f12_arg0:animateToState( "visible", 0 )
|
|
f12_arg0.properties.material = f12_arg1.newImage
|
|
f12_arg0:setImage( f12_arg1.newImage )
|
|
end
|
|
|
|
f0_local0 = function ()
|
|
local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" )
|
|
local f13_local1 = false
|
|
if GetCurrentGameType() == "infect" and Cac.IsDefaultClass( f13_local0.classLocation ) and f13_local0.currTeam == Teams.axis then
|
|
f13_local1 = true
|
|
end
|
|
return f13_local1
|
|
end
|
|
|
|
function UpdateSelectionInfoPanel( f14_arg0, f14_arg1 )
|
|
assert( f14_arg1.selection_id )
|
|
assert( f14_arg1.classLocation )
|
|
assert( f14_arg1.slot )
|
|
assert( f14_arg1.controller )
|
|
local f14_local0 = f14_arg1.selection_id
|
|
local f14_local1 = f14_arg1.squadLocation
|
|
local f14_local2 = f14_arg1.squadMemberIndex
|
|
local f14_local3 = f14_arg1.classLocation
|
|
local f14_local4 = f14_arg1.slot
|
|
local f14_local5 = f14_arg1.controller
|
|
local f14_local6 = "UnknownSelectionId"
|
|
local f14_local7 = ""
|
|
local f14_local8 = ""
|
|
local f14_local9 = false
|
|
local f14_local10 = false
|
|
local f14_local11 = false
|
|
local f14_local12 = "icon_new"
|
|
if f14_local0 == "edit_weapon_primary" or f14_local0 == "edit_weapon_primary_camo" or f14_local0 == "edit_weapon_primary_reticle" then
|
|
if f14_arg1.viewingItem then
|
|
f14_local7 = f14_arg1.viewingItem
|
|
else
|
|
f14_local7 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, Cac.Indices.Weapons.Primary )
|
|
end
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info_panel_main_image",
|
|
newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local7 ) ),
|
|
immediate = true
|
|
} )
|
|
if f14_local7 == "iw6_knifeonly" then
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "LUA_MENU_PRIMARY" )
|
|
end
|
|
f14_local6 = Cac.GetWeaponName( f14_local7 )
|
|
elseif f14_local0 == "edit_weapon_secondary" then
|
|
if f14_arg1.viewingItem then
|
|
f14_local7 = f14_arg1.viewingItem
|
|
else
|
|
f14_local7 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, Cac.Indices.Weapons.Secondary )
|
|
end
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info_panel_main_image",
|
|
newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local7 ) ),
|
|
immediate = true
|
|
} )
|
|
f14_local6 = Cac.GetWeaponName( f14_local7 )
|
|
if f14_local0 == "edit_weapon_secondary" and Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and not f14_arg1.viewingItem and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 1 ) ), true ) then
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_SECOND_PRIMARY" )
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_overkill"
|
|
elseif f14_local7 == "none" then
|
|
f14_local6 = ""
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "LUA_MENU_SECONDARY" )
|
|
end
|
|
elseif f14_local0 == "edit_weapon_primary_attach1" or f14_local0 == "edit_weapon_primary_attach2" or f14_local0 == "edit_weapon_primary_attach3" or f14_local0 == "edit_weapon_secondary_attach1" or f14_local0 == "edit_weapon_secondary_attach2" then
|
|
local f14_local13 = nil
|
|
if f14_local0 == "edit_weapon_primary_attach1" then
|
|
f14_local13 = Cac.Indices.Attachments.PrimaryAttachment1
|
|
elseif f14_local0 == "edit_weapon_primary_attach2" then
|
|
f14_local13 = Cac.Indices.Attachments.PrimaryAttachment2
|
|
elseif f14_local0 == "edit_weapon_primary_attach3" then
|
|
f14_local13 = Cac.Indices.Attachments.PrimaryAttachment3
|
|
elseif f14_local0 == "edit_weapon_secondary_attach1" then
|
|
f14_local13 = Cac.Indices.Attachments.SecondaryAttachment1
|
|
elseif f14_local0 == "edit_weapon_secondary_attach2" then
|
|
f14_local13 = Cac.Indices.Attachments.SecondaryAttachment2
|
|
else
|
|
assert( false, "How the hell did I get here?!" )
|
|
end
|
|
local f14_local14 = f14_arg1.weaponIndex or 0
|
|
local f14_local15 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local14 )
|
|
local f14_local16 = Cac.GetWeaponClass( f14_local15 )
|
|
local f14_local17 = Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local14, f14_local13 )
|
|
local f14_local18 = RegisterMaterial( Cac.GetAttachmentImageFull( f14_local17, f14_local15 ) )
|
|
f14_local7 = f14_local17
|
|
f14_local6 = Cac.GetAttachmentName( f14_local17, f14_local15 )
|
|
f14_local9 = Cac.GetAttachmentDesc( f14_local17, f14_local15 )
|
|
if f14_local17 == "none" then
|
|
f14_local6 = ""
|
|
f14_local9 = ""
|
|
end
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info_panel_main_image",
|
|
newImage = f14_local18,
|
|
immediate = true
|
|
} )
|
|
if f14_local0 == "edit_weapon_primary_attach3" or f14_local0 == "edit_weapon_secondary_attach2" then
|
|
local f14_local19 = Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_attachment", "abilitiesPicked" )
|
|
if f14_local19 and Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 0, 2 ) == "none" and f14_local0 == "edit_weapon_primary_attach3" then
|
|
if f14_local15 == "iw6_knifeonly" or f14_local15 == "iw6_riotshield" then
|
|
f14_local9 = Engine.Localize( "PATCH_MENU_THIRD_ATTACHMENT_LOCKED" )
|
|
else
|
|
f14_local9 = Engine.Localize( "LUA_MENU_SELECT_THIRD_ATTACHMENT" )
|
|
end
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_extra_attach"
|
|
elseif f14_local19 and Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 1, 1 ) == "none" and f14_local0 == "edit_weapon_secondary_attach2" then
|
|
if f14_local15 == "iw6_riotshield" or f14_local15 == "none" or f14_local16 == "weapon_projectile" then
|
|
f14_local9 = Engine.Localize( "PATCH_MENU_SECOND_ATTACHMENT_LOCKED" )
|
|
else
|
|
f14_local9 = Engine.Localize( "LUA_MENU_SELECT_SECOND_ATTACHMENT" )
|
|
end
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_extra_attach"
|
|
elseif not f14_local19 then
|
|
f14_local9 = Engine.Localize( "LUA_MENU_EQUIP_EXTRA_ATTACH" )
|
|
end
|
|
end
|
|
elseif f14_local0 == "edit_lethal" then
|
|
if f14_arg1.viewingItem then
|
|
f14_local7 = f14_arg1.viewingItem
|
|
f14_local8 = Cac.StripSuffix( f14_local7, "_mp" )
|
|
else
|
|
f14_local7 = Cac.GetPrimaryGrenade( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4 )
|
|
f14_local8 = Cac.StripSuffix( f14_local7, "_mp" )
|
|
end
|
|
local f14_local13 = nil
|
|
for f14_local17, f14_local18 in pairs( Cac.Indices.Weapons ) do
|
|
local f14_local19
|
|
if f14_local18 == Cac.Indices.Weapons.Primary then
|
|
f14_local19 = 2
|
|
if not f14_local19 then
|
|
|
|
else
|
|
local f14_local20 = false
|
|
for f14_local21 = 0, f14_local19, 1 do
|
|
local f14_local24 = Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local18, f14_local21 )
|
|
if f14_local24 == "shotgun" or f14_local24 == "gl" then
|
|
if f14_local7 == "specialty_null" and not f14_arg1.viewingItem then
|
|
|
|
else
|
|
f14_local10 = Engine.Localize( "@LUA_MENU_LETHAL_WARNING" )
|
|
end
|
|
local f14_local25 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local18 )
|
|
f14_local6 = Cac.GetAttachmentName( f14_local24, f14_local25 )
|
|
f14_local9 = Cac.GetAttachmentDesc( f14_local24, f14_local25 )
|
|
f14_local10 = Engine.Localize( "@LUA_MENU_LETHAL_REPLACED_WARNING" )
|
|
f14_local13 = RegisterMaterial( Cac.GetAttachmentImageFull( f14_local24, f14_local25 ) )
|
|
end
|
|
end
|
|
if f14_local20 then
|
|
|
|
end
|
|
end
|
|
end
|
|
f14_local19 = 1
|
|
end
|
|
if not f14_local13 then
|
|
f14_local13 = RegisterMaterial( Cac.GetWeaponFullImage( f14_local8 ) )
|
|
f14_local6 = Cac.GetWeaponName( f14_local8 )
|
|
if f14_local7 == "specialty_null" then
|
|
f14_local6 = ""
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "MENU_EQUIPMENT" )
|
|
end
|
|
end
|
|
if Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_deadly", "abilitiesPicked" ) and f14_local7 == "specialty_null" then
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_LETHAL" )
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_extra_lethal"
|
|
end
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info_panel_main_image",
|
|
newImage = f14_local13,
|
|
immediate = true
|
|
} )
|
|
elseif f14_local0 == "edit_tactical" then
|
|
if f14_arg1.viewingItem then
|
|
f14_local7 = f14_arg1.viewingItem
|
|
f14_local8 = Cac.StripSuffix( f14_local7, "_mp" )
|
|
else
|
|
f14_local7 = Cac.GetSecondaryGrenade( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4 )
|
|
f14_local8 = Cac.StripSuffix( f14_local7, "_mp" )
|
|
end
|
|
f14_local6 = Cac.GetWeaponName( f14_local8 )
|
|
if Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_equipment", "abilitiesPicked" ) and f14_local7 == "specialty_null" then
|
|
f14_local6 = ""
|
|
if f0_local0() then
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_MP_INFECTED_SELECT_TACTICAL" )
|
|
else
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_TACTICAL" )
|
|
end
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_extra_tactical"
|
|
elseif f14_local7 == "specialty_null" then
|
|
f14_local6 = ""
|
|
if f0_local0() then
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_MP_INFECTED_TACTICAL" )
|
|
f14_local11 = true
|
|
f14_local12 = "icon_perks_extra_tactical"
|
|
else
|
|
f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "MENU_TACTICAL" )
|
|
end
|
|
end
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info_panel_main_image",
|
|
newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local8 ) ),
|
|
immediate = true
|
|
} )
|
|
elseif f14_local0 == "edit_killstreaks" or f14_local0 == "edit_abilities" then
|
|
f14_arg0:processEvent( {
|
|
name = "update_abilities_info_panel",
|
|
controller = f14_local5,
|
|
squadLocation = f14_local1,
|
|
squadMemberIndex = f14_local2,
|
|
classLocation = f14_local3,
|
|
slot = f14_local4,
|
|
selection_id = f14_local0
|
|
} )
|
|
f14_arg0:processEvent( {
|
|
name = "hide_main_info_panel"
|
|
} )
|
|
else
|
|
assert( false, "Unknown selection_id in UpdateSelectionInfoPanel" )
|
|
end
|
|
if f14_local0 ~= "edit_killstreaks" and f14_local0 ~= "edit_abilities" then
|
|
f14_arg0:processEvent( {
|
|
name = "hide_abilities_info_panel"
|
|
} )
|
|
f14_arg0:processEvent( {
|
|
name = "show_main_info_panel"
|
|
} )
|
|
end
|
|
if f14_local0 == "edit_lethal" or f14_local0 == "edit_tactical" or not IsOnlineMatch() or Engine.GetDvarBool( "xblive_privatematch" ) then
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "hide_lt",
|
|
immediate = true
|
|
} )
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "hide_rt",
|
|
immediate = true
|
|
} )
|
|
else
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "show_lt"
|
|
} )
|
|
f14_arg0:dispatchEventToRoot( {
|
|
name = "show_rt"
|
|
} )
|
|
end
|
|
local f14_local13 = f14_arg0:getFirstDescendentById( "focus_dialog_header_id" )
|
|
if f14_local13 then
|
|
f14_local13:processEvent( {
|
|
name = "selection_info_set_header_text",
|
|
newText = f14_local6,
|
|
immediate = true,
|
|
dispatchChildren = true
|
|
} )
|
|
end
|
|
local f14_local14 = f14_arg0:getFirstDescendentById( "focus_dialog_footer_id" )
|
|
if f14_local14 and f14_local7 ~= "" then
|
|
local f14_local15 = ""
|
|
if f14_local9 then
|
|
f14_local15 = f14_local9
|
|
else
|
|
local f14_local16 = f14_local7
|
|
if f14_local0 == "edit_tactical" or f14_local0 == "edit_lethal" then
|
|
f14_local16 = Cac.StripSuffix( f14_local7, "_mp" )
|
|
end
|
|
f14_local15 = Cac.GetWeaponDesc( f14_local16 )
|
|
end
|
|
f14_local14:processEvent( {
|
|
name = "selection_info_set_footer_text",
|
|
newText = f14_local15,
|
|
immediate = true,
|
|
dispatchChildren = true,
|
|
newIcon = f14_local11,
|
|
newIconMaterial = f14_local12
|
|
} )
|
|
f14_local14:processEvent( {
|
|
name = "update_warning_text",
|
|
attachment = attachFooter,
|
|
conflictFooter = f14_local10
|
|
} )
|
|
end
|
|
end
|
|
|
|
function selection_info_panel_main()
|
|
return {
|
|
type = "UIElement",
|
|
id = "selection_info_panel_container_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = Cac.Layout.SelectionInfo.height
|
|
}
|
|
},
|
|
handlers = {
|
|
menu_create = CreateSelectionInfoPanel,
|
|
update_selection_info = UpdateSelectionInfoPanel
|
|
},
|
|
children = {
|
|
{
|
|
type = "abilities_info_panel",
|
|
id = "abilities_info_panel_id"
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "selection_main_info_panel_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
alpha = 1
|
|
},
|
|
hidden = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
show_main_info_panel = MBh.AnimateToState( "default" ),
|
|
hide_main_info_panel = MBh.AnimateToState( "hidden" )
|
|
},
|
|
children = {
|
|
{
|
|
type = "selection_info_panel_header",
|
|
id = "focus_dialog_header_id"
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "selection_info_panel_main_image_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 85,
|
|
height = 155,
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
update_selection_info_panel_main_image = UpdateSelectionInfoPanelMainImage
|
|
}
|
|
},
|
|
{
|
|
type = "selection_info_panel_footer",
|
|
id = "focus_dialog_footer_id"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "selection_info_panel_header", selection_info_panel_header )
|
|
LUI.MenuBuilder.registerDef( "selection_info_panel_footer", selection_info_panel_footer )
|
|
LUI.MenuBuilder.registerDef( "selection_info_panel_main", selection_info_panel_main )
|
|
LUI.MenuBuilder.registerDef( "abilities_info_panel", abilities_info_panel )
|
|
LUI.MenuBuilder.registerDef( "abilities_info_container", abilities_info_container )
|
|
LockTable( _M )
|