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

1895 lines
59 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
unlockItem( f1_arg1.controller, f1_local0.item )
local f1_local1 = f1_local0.ItemGetFunction( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.itemIndex )
f1_local0.ItemSetFunction( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.itemIndex, f1_local0.item )
local f1_local2 = false
if f1_local0.selection_id == "edit_lethal" then
f1_local2 = f1_local0.item ~= "specialty_null"
end
f1_arg0:dispatchEventToRoot( {
name = "update_cac_info_panel",
controller = f1_arg1.controller,
dispatchChildren = true,
grenadeConflict = f1_local2
} )
if (f1_local0.item == "none" or f1_local1 == "none" or f1_local0.item == "specialty_null" or f1_local1 == "specialty_null" or f1_local0.item == "iw6_knifeonly" or f1_local1 == "iw6_knifeonly" or f1_local0.item == "uav" or f1_local1 == "uav") and f1_local0.item ~= f1_local1 then
f1_arg0:dispatchEventToRoot( {
name = "refresh_abilities_recap",
controller = f1_arg1.controller,
specialistType = false,
item = f1_local0.item
} )
end
f1_arg0:dispatchEventToRoot( {
name = "cac_update_currency_text"
} )
if f1_local0.selection_id == "edit_weapon_primary" then
elseif f1_local0.selection_id == "edit_weapon_primary_reticle" or f1_local0.selection_id == "edit_weapon_primary_camo" then
f1_arg0:dispatchEventToRoot( {
name = "update_squad_member_window_weapon",
weapon = Cac.BuildPrimaryWeaponName( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot )
} )
elseif f1_local0.selection_id == "edit_weapon_secondary" then
f1_arg0:dispatchEventToRoot( {
name = "update_squad_member_window_stowed_weapon",
weapon = Cac.BuildSecondaryWeaponName( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot )
} )
end
Engine.PlaySound( CoD.SFX.CacSpendPoints )
LUI.FlowManager.RequestLeaveMenu( f1_local0.openPopupItem )
LUI.FlowManager.RequestLeaveMenu( f1_arg0 )
end
f0_local1 = function ( f2_arg0, f2_arg1 )
LUI.FlowManager.RequestLeaveMenu( f2_arg0 )
end
function cac_cant_purchase_popup()
local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
local f3_local1 = nil
local f3_local2 = 128
local f3_local3 = 5
local f3_local4 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", f3_local0.itemName )
local f3_local5 = f3_local0.cost
local f3_local6 = RegisterMaterial( "icon_unlock_token_active" )
local f3_local7 = f3_local0.currency
if f3_local0.selection_id == "edit_lethal" or f3_local0.selection_id == "edit_tactical" then
f3_local1 = Cac.GetGrenadeImage( f3_local0.item, f3_local0.itemIndex )
f3_local2 = 64
f3_local3 = 35
else
f3_local1 = Cac.GetWeaponImage( f3_local0.item, f3_local0.itemIndex )
end
return {
type = "generic_yesno_with_image_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ),
message_image = RegisterMaterial( f3_local1 ),
message_image_width = f3_local2,
message_image_top = -15,
message_image_left = f3_local3,
message_cost_text = Engine.Localize( "@LUA_MENU_COST" ),
message_cost_image = f3_local6,
message_cost = f3_local5,
message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ),
message_squad_points_image = f3_local6,
message_squad_points = f3_local7,
no_text = f3_local4,
no_action = f0_local1
}
}
end
function cac_purchase_popup()
local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
local f4_local1 = nil
local f4_local2 = 128
local f4_local3 = 5
local f4_local4 = Engine.Localize( "@LUA_MENU_PURCHASE_N", f4_local0.itemName )
local f4_local5 = f4_local0.cost
local f4_local6 = RegisterMaterial( "icon_unlock_token_active" )
local f4_local7 = f4_local0.currency
if f4_local0.selection_id == "edit_lethal" or f4_local0.selection_id == "edit_tactical" then
f4_local1 = Cac.GetGrenadeImage( f4_local0.item, f4_local0.itemIndex )
f4_local2 = 64
f4_local3 = 35
else
f4_local1 = Cac.GetWeaponImage( f4_local0.item, f4_local0.itemIndex )
end
return {
type = "generic_yesno_with_image_popup",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ),
message_image = RegisterMaterial( f4_local1 ),
message_image_width = f4_local2,
message_image_top = -15,
message_image_left = f4_local3,
message_cost_text = Engine.Localize( "@LUA_MENU_COST" ),
message_cost_image = f4_local6,
message_cost = f4_local5,
message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ),
message_squad_points_image = f4_local6,
message_squad_points = f4_local7,
yes_text = f4_local4,
no_text = Engine.Localize( "@LUA_MENU_CANCEL" ),
yes_action = f0_local0,
no_action = f0_local1
},
additional_handlers = {
menu_create = function ( f5_arg0, f5_arg1 )
f5_arg0:setText( f4_local0.item )
end
}
}
end
f0_local2 = function ( f6_arg0, f6_arg1 )
DebugPrint( "default button action" )
end
local f0_local3 = function ( f7_arg0, f7_arg1 )
local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 )
local f7_local1 = getProperUnlockTable( f7_arg0.properties.item )
local f7_local2 = f7_arg0.properties
local f7_local3 = Cac.GetCurrency( f7_arg1.controller )
local f7_local4, f7_local5 = nil
local f7_local6 = false
if f7_local0.selection_id == "edit_weapon_primary_camo" or f7_local0.selection_id == "edit_weapon_primary_reticle" then
f7_local5, f7_local6 = Cac.IsCamoOrReticleUnlocked( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex, f7_local2.item, f7_local0.selection_id and "camo" or "reticle" )
elseif (f7_local0.selection_id == "edit_weapon_primary" or f7_local0.selection_id == "edit_weapon_secondary") and Cac.IsWeaponEntitlement( f7_local2.item ) then
f7_local6 = true
f7_local5 = Cac.IsWeaponEntitlementUnlocked( f7_arg1.controller, f7_local2.item )
else
f7_local4 = tonumber( Engine.TableLookup( f7_local1, 0, Engine.TableLookup( f7_local1, 0, f7_local2.item, 3 ), 4 ) )
f7_local5 = Cac.IsItemUnlocked( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local2.item )
end
f7_local0.item = f7_local2.item
f7_local0.itemName = f7_local0.ItemGetNameFunction( f7_local2.item )
f7_local0.cost = f7_local4
f7_local0.currency = f7_local3
if f7_local5 then
local f7_local7 = f7_local0.ItemGetFunction( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex )
f7_local0.ItemSetFunction( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex, f7_local2.item )
local f7_local8 = false
if f7_local0.selection_id == "edit_lethal" then
f7_local8 = f7_local0.item ~= "specialty_null"
end
f7_arg0:dispatchEventToRoot( {
name = "update_cac_info_panel",
controller = f7_arg1.controller,
dispatchChildren = true,
grenadeConflict = f7_local8
} )
if (f7_local2.item == "none" or f7_local7 == "none" or f7_local2.item == "specialty_null" or f7_local7 == "specialty_null" or f7_local2.item == "iw6_knifeonly" or f7_local7 == "iw6_knifeonly" or f7_local2.item == "uav" or f7_local7 == "uav") and (f7_local2.item ~= f7_local7 or f7_local7 == "specialty_null") then
f7_arg0:dispatchEventToRoot( {
name = "refresh_abilities_recap",
controller = f7_arg1.controller,
specialistType = false,
item = f7_local2.item
} )
end
if f7_local0.selection_id == "edit_weapon_primary" then
elseif f7_local0.selection_id == "edit_weapon_primary_reticle" or f7_local0.selection_id == "edit_weapon_primary_camo" then
f7_arg0:dispatchEventToRoot( {
name = "update_squad_member_window_weapon",
weapon = Cac.BuildPrimaryWeaponName( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot )
} )
elseif f7_local0.selection_id == "edit_weapon_secondary" then
f7_arg0:dispatchEventToRoot( {
name = "update_squad_member_window_stowed_weapon",
weapon = Cac.BuildSecondaryWeaponName( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot )
} )
end
if f7_local0.openMenuOnClose and f7_local0.openMenuOnClose.openOnAction then
LUI.FlowManager.RequestPopupMenu( f7_arg0, f7_local0.openMenuOnClose.menu, true, f7_arg1.controller, true, f7_local0.openMenuOnClose )
else
LUI.FlowManager.RequestLeaveMenu( f7_arg0 )
end
elseif not f7_local4 then
Engine.PlaySound( CoD.SFX.DenySelect )
if f7_local6 then
local f7_local7 = false
local f7_local8 = ""
if f7_local0.selection_id == "edit_weapon_primary_reticle" or f7_local0.selection_id == "edit_weapon_primary_camo" then
f7_local7 = Cac.IsCamoOrReticleDLC( f7_local2.item )
if f7_local7 then
f7_local8 = Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f7_local2.item, CamoReticleUnlockTable.Cols.DLCPack )
end
elseif f7_local0.selection_id == "edit_weapon_primary" or f7_local0.selection_id == "edit_weapon_secondary" then
f7_local7 = Cac.IsWeaponDLC( f7_local2.item )
if f7_local7 then
f7_local8 = Engine.TableLookup( Cac.WeaponUnlockTable.File, Cac.WeaponUnlockTable.Cols.WeaponRef, f7_local2.item, Cac.WeaponUnlockTable.Cols.DLCPack )
end
end
if f7_local7 then
DebugPrint( "DLC - Please Buy Me " .. f7_local2.item )
if string.len( f7_local8 ) > 0 then
if Engine.IsPC() then
Sns.OpenStoreMenu( f7_arg1.controller )
else
Sns.OpenStoreLinkConfirmPopup( f7_arg1.controller, f7_local8 )
end
end
end
end
elseif f7_local4 <= f7_local3 then
f7_local0.item = f7_arg0.properties.item
f7_local0.openPopupItem = f7_arg0
LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_purchase_popup", true, f7_arg1.controller, false )
else
LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_cant_purchase_popup", true, f7_arg1.controller, false )
end
end
function CacEditButtonOver( f8_arg0, f8_arg1 )
local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 )
local f8_local1 = f8_arg0.properties
local f8_local2 = f8_local0.exclusiveController
assert( f8_local2, "Cac: No controller specified, something went wrong" )
local f8_local3 = f8_local0.classLocation
assert( f8_local3, "Cac: No class location specified, something went wrong" )
local f8_local4 = f8_local0.slot
if not f8_local4 then
DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" )
cacSlot = 0
end
local f8_local5 = f8_local0.squadLocation
assert( f8_local5, "Cac: No squad location specified, something went wrong" )
local f8_local6 = f8_local0.squadMemberIndex
if not f8_local6 then
DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" )
f8_local6 = 0
end
local f8_local7 = f8_local0.itemIndex
if not f8_local7 then
DebugPrint( "[WARNING] CAC: using item index 0, this is only ok if you are editing a menu" )
f8_local7 = 0
end
if f8_local0.selection_id ~= "edit_weapon_primary_reticle" and f8_local0.selection_id ~= "edit_weapon_primary_camo" then
f8_arg0:dispatchEventToRoot( {
name = "refresh_info_pane",
controller = f8_local2,
classLocation = f8_local3,
squadLocation = f8_local5,
squadMemberIndex = f8_local6,
slot = f8_local4,
weaponIndex = f8_local7,
viewingWeapon = f8_local1.item,
selection_id = f8_local0.selection_id,
immediate = true,
dispatchChildren = true
} )
end
if MatchRules.AllowCustomClasses( f8_local3 ) then
if f8_arg0.restricted then
f8_arg0:dispatchEventToRoot( {
name = "show_class_restrictions_warning",
immediate = true
} )
else
f8_arg0:dispatchEventToRoot( {
name = "hide_class_restrictions_warning",
immediate = true
} )
end
end
end
local f0_local4 = function ( f9_arg0, f9_arg1 )
local f9_local0 = f9_arg0.properties.itemSelected
local f9_local1 = f9_arg0.properties.itemLocked
local f9_local2 = f9_arg0.properties.itemDisabled
if f9_arg1.updateProperties then
local f9_local3 = f9_arg0:getParent()
repeat
f9_local3 = f9_local3:getParent()
assert( f9_local3, "cac_edit_choose_root was not found" )
until f9_local3.id == "cac_edit_choose_root"
f9_local2 = f9_local3.properties.overrideChooseDisableCheck( f9_arg0 )
f9_arg0.properties.itemDisabled = f9_local2
end
if f9_local2 then
if f9_arg1.updateProperties then
f9_arg0:dispatchEventToChildren( {
name = "button_tab_focused_disabled"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_txt_focused_disabled"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundOutlineColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.outline_over.a
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
alpha = 0
} )
else
f9_arg0:dispatchEventToChildren( {
name = "button_txt_unfocused_disabled"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundOutlineColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.outline_up.a
} )
end
elseif f9_local0 then
f9_arg0:dispatchEventToChildren( {
name = "button_txt_selected"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_tab_selected"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_icon_selected"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.background_up.a
} )
elseif f9_local1 then
f9_arg0:dispatchEventToChildren( {
name = "button_txt_unfocused"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_locked"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.background_up.a
} )
else
if f9_arg1.updateProperties then
f9_arg0:dispatchEventToChildren( {
name = "button_tab_focused"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_icon_focused"
} )
f9_arg0:dispatchEventToChildren( {
name = "button_txt_focused"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundOutlineColor",
alpha = 0
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.background_over.a
} )
else
f9_arg0:dispatchEventToChildren( {
name = "button_txt_unfocused"
} )
f9_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.background_up.a
} )
end
f9_arg0:dispatchEventToChildren( {
name = "button_unlocked"
} )
end
end
function updateNewIcon( f10_arg0, f10_arg1 )
local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 )
local f10_local1 = ""
if f10_local0.selection_id == "edit_weapon_primary_camo" then
f10_local1 = "Camo"
end
if f10_local0.selection_id == "edit_weapon_primary" then
f10_local1 = "Weapon_Primary"
end
if f10_local0.selection_id == "edit_weapon_secondary" then
f10_local1 = "Weapon_Secondary"
end
if Cac.ItemHasNewIcon( f10_local0.exclusiveController, f10_arg0.properties.item, f10_local1 ) then
f10_arg0:processEvent( {
name = "show_new_icon"
} )
else
f10_arg0:processEvent( {
name = "hide_new_icon"
} )
end
end
local f0_local5 = function ( f11_arg0, f11_arg1 )
local f11_local0 = f11_arg0.properties
local f11_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 )
if not f11_local0 then
DebugPrint( "Missing properties on CacEditChooseImagePopup button" )
return
end
local f11_local2 = false
local f11_local3 = false
if f11_local1.selection_id == "edit_weapon_primary_reticle" or f11_local1.selection_id == "edit_weapon_primary_camo" then
f11_local2 = Cac.IsCamoOrReticleDLC( f11_local0.item )
if f11_local2 then
f11_local3 = Cac.IsCamoOrReticleUnlocked( f11_local1.exclusiveController, f11_local1.squadLocation, f11_local1.squadMemberIndex, f11_local1.classLocation, f11_local1.slot, f11_local1.itemIndex, f11_local0.item, f11_local1.selection_id and "camo" or "reticle" )
end
elseif f11_local1.selection_id == "edit_weapon_primary" or f11_local1.selection_id == "edit_weapon_secondary" then
f11_local2 = Cac.IsWeaponDLC( f11_local0.item )
if f11_local2 then
f11_local3 = Cac.IsWeaponEntitlementUnlocked( f11_local1.exclusiveController, f11_local0.item )
end
end
if f11_local2 and f11_local3 and f11_arg0.properties.itemLocked then
f11_arg0.properties.itemLocked = false
f11_arg0:processEvent( {
name = "button_unlocked"
} )
end
end
local f0_local6 = function ( f12_arg0, f12_arg1 )
local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 )
local f12_local1 = f12_arg0.properties.itemSelected
local f12_local2 = f12_arg0.properties.itemLocked
local f12_local3 = f12_arg0.properties.itemDisabled
if f12_local3 then
f12_arg0:dispatchEventToChildren( {
name = "button_tab_focused_disabled"
} )
f12_arg0:dispatchEventToChildren( {
name = "button_icon_focused_disabled"
} )
f12_arg0:dispatchEventToChildren( {
name = "updateBackgroundOutlineColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.outline_over.a
} )
else
if not f12_local1 then
f12_arg0:dispatchEventToChildren( {
name = "button_txt_focused"
} )
f12_arg0:dispatchEventToChildren( {
name = "button_tab_focused"
} )
end
f12_arg0:dispatchEventToChildren( {
name = "button_icon_focused"
} )
f12_arg0:dispatchEventToChildren( {
name = "button_bg_focused"
} )
f12_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = Cac.Selection.background_over.a
} )
end
local f12_local4 = f12_arg0.properties
if f12_local0.selection_id == "edit_weapon_primary_camo" then
f12_arg0:dispatchEventToRoot( {
name = "cac_progress_unlock_update",
parentItem = Cac.GetWeapon( f12_local0.exclusiveController, f12_local0.squadLocation, f12_local0.squadMemberIndex, f12_local0.classLocation, f12_local0.slot, f12_local0.itemIndex ),
item = f12_local4.item,
dispatchChildren = true,
immediate = true
} )
end
local f12_local5 = ""
if f12_local0.selection_id == "edit_weapon_primary_camo" then
f12_local5 = "Camo"
end
if f12_local0.selection_id == "edit_weapon_primary" then
f12_local5 = "Weapon_Primary"
end
if f12_local0.selection_id == "edit_weapon_secondary" then
f12_local5 = "Weapon_Secondary"
end
if Cac.ItemHasNewIcon( f12_local0.exclusiveController, f12_local4.item, f12_local5 ) then
Cac.MarkItemNoMoreNewIcon( f12_local0.exclusiveControllerIndex, f12_local4.item, f12_local5 )
f12_arg0:processEvent( {
name = "refresh_new_icon"
} )
f12_arg0:dispatchEventToRoot( {
name = "refresh_new_icons"
} )
end
if f12_local0.selection_id == "edit_weapon_primary_reticle" then
f12_arg0:dispatchEventToRoot( {
name = "cac_progress_unlock_update",
parentItem = Cac.GetAttachmentWithReticles( f12_local0.exclusiveController, f12_local0.squadLocation, f12_local0.squadMemberIndex, f12_local0.classLocation, f12_local0.slot, f12_local0.itemIndex ),
item = f12_local4.item,
dispatchChildren = true,
immediate = true
} )
end
if f12_local0.selection_id == "edit_weapon_primary" or f12_local0.selection_id == "edit_weapon_secondary" or f12_local0.selection_id == "edit_lethal" or f12_local0.selection_id == "edit_tactical" then
f12_arg0:dispatchEventToRoot( {
name = "update_selection_info",
disabled = f12_local3 or f12_local2,
controller = f12_local0.exclusiveController,
classLocation = f12_local0.classLocation,
squadLocation = f12_local0.squadLocation,
squadMemberIndex = f12_local0.squadMemberIndex,
slot = f12_local0.slot,
selection_id = f12_local0.selection_id,
viewingItem = f12_local4.item,
dispatchChildren = true,
immediate = true
} )
end
end
local f0_local7 = function ( f13_arg0, f13_arg1 )
local f13_local0 = f13_arg0.properties.itemSelected
local f13_local1 = f13_arg0.properties.itemLocked
if f13_arg0.properties.itemDisabled then
f13_arg0:dispatchEventToChildren( {
name = "button_tab_unfocused_disabled"
} )
f13_arg0:dispatchEventToChildren( {
name = "button_icon_unfocused_disabled"
} )
f13_arg0:dispatchEventToChildren( {
name = "updateBackgroundOutlineColor",
red = 1,
green = 1,
blue = 1,
alpha = Cac.Selection.outline_up.a
} )
else
if not f13_local0 then
f13_arg0:dispatchEventToChildren( {
name = "button_txt_unfocused"
} )
f13_arg0:dispatchEventToChildren( {
name = "button_tab_unfocused"
} )
end
f13_arg0:dispatchEventToChildren( {
name = "button_icon_unfocused"
} )
f13_arg0:dispatchEventToChildren( {
name = "button_bg_unfocused"
} )
f13_arg0:dispatchEventToChildren( {
name = "updateBackgroundColor",
red = 1,
green = 1,
blue = 1,
alpha = Cac.Selection.background_up.a
} )
end
end
function cac_edit_choose_image_button_background( f14_arg0, f14_arg1 )
local f14_local0 = f14_arg1.red or 1
local f14_local1 = f14_arg1.green or 1
local f14_local2 = f14_arg1.blue or 1
local f14_local3 = f14_arg1.alpha or 1
local f14_local4 = f14_arg1.colorLocked or false
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = top,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f14_local6 = LUI.UIImage.new()
f14_local6.id = "corner"
f14_local6:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 32,
left = 0,
right = 32,
material = RegisterMaterial( "btn_cas_item_topleft" )
} )
f14_local6:animateToState( "default" )
self:addElement( f14_local6 )
local f14_local7 = LUI.UIImage.new()
f14_local7.id = "top"
f14_local7:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 32,
left = 32,
right = 0,
material = RegisterMaterial( "white" )
} )
f14_local7:animateToState( "default" )
self:addElement( f14_local7 )
local f14_local8 = LUI.UIImage.new()
f14_local8.id = "bottom"
f14_local8:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 32,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" )
} )
f14_local8:animateToState( "default" )
self:addElement( f14_local8 )
self.colorize = function ( f15_arg0, f15_arg1, f15_arg2, f15_arg3 )
for f15_local3, f15_local4 in ipairs( {
f14_local6,
f14_local7,
f14_local8
} ) do
f15_local4:registerAnimationState( "current", {
red = f15_arg0,
green = f15_arg1,
blue = f15_arg2,
alpha = f15_arg3
} )
f15_local4:animateToState( "current" )
end
end
self.colorize( f14_local0, f14_local1, f14_local2, f14_local3 )
if not f14_local4 then
self:registerEventHandler( "updateBackgroundColor", function ( element, event )
element.colorize( event.red, event.green, event.blue, event.alpha )
end )
end
return self
end
function cac_edit_choose_image_button_background_outline( f17_arg0, f17_arg1 )
local f17_local0 = f17_arg1.red or 1
local f17_local1 = f17_arg1.green or 1
local f17_local2 = f17_arg1.blue or 1
local f17_local3 = f17_arg1.alpha or 1
local f17_local4 = 2
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = top,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f17_local6 = LUI.UIImage.new()
f17_local6.id = "corner"
f17_local6:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 32,
left = 0,
right = 32,
material = RegisterMaterial( "btn_cas_item_topleft_stroke" )
} )
f17_local6:animateToState( "default" )
self:addElement( f17_local6 )
local f17_local7 = LUI.UIImage.new()
f17_local7.id = "top"
f17_local7:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f17_local4,
left = 32,
right = 0,
material = RegisterMaterial( "white" )
} )
f17_local7:animateToState( "default" )
self:addElement( f17_local7 )
local f17_local8 = LUI.UIImage.new()
f17_local8.id = "bottom"
f17_local8:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -f17_local4,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" )
} )
f17_local8:animateToState( "default" )
self:addElement( f17_local8 )
local f17_local9 = LUI.UIImage.new()
f17_local9.id = "left"
f17_local9:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 32,
bottom = -f17_local4,
left = 0,
right = f17_local4,
material = RegisterMaterial( "white" )
} )
f17_local9:animateToState( "default" )
self:addElement( f17_local9 )
local f17_local10 = LUI.UIImage.new()
f17_local10.id = "right"
f17_local10:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = f17_local4,
bottom = -f17_local4,
left = -f17_local4,
right = 0,
material = RegisterMaterial( "white" )
} )
f17_local10:animateToState( "default" )
self:addElement( f17_local10 )
self.colorize = function ( f18_arg0, f18_arg1, f18_arg2, f18_arg3 )
for f18_local3, f18_local4 in ipairs( {
f17_local6,
f17_local7,
f17_local8,
f17_local9,
f17_local10
} ) do
f18_local4:registerAnimationState( "current", {
red = f18_arg0,
green = f18_arg1,
blue = f18_arg2,
alpha = f18_arg3
} )
f18_local4:animateToState( "current" )
end
end
self.colorize( f17_local0, f17_local1, f17_local2, f17_local3 )
self:registerEventHandler( "updateBackgroundOutlineColor", function ( element, event )
element.colorize( event.red, event.green, event.blue, event.alpha )
end )
return self
end
function cac_edit_choose_image_lock_feeder( f20_arg0 )
local f20_local0 = {}
if f20_arg0.lock_num > 0 then
f20_local0[#f20_local0 + 1] = {
type = "UIImage",
id = "cac_edit_choose_btn_lock_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
material = RegisterMaterial( "icon_unlock_token_active" ),
left = 0,
width = 16,
height = 16
}
}
}
f20_local0[#f20_local0 + 1] = {
type = "UIText",
id = "cac_edit_choose_btn_lock_num_id",
properties = {
text = MBh.Property( "lock_num" )
},
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 16,
right = 0,
height = CoD.TextSettings.TinyFont.Height,
font = CoD.TextSettings.SmallFont.Font,
alignment = LUI.Alignment.Left
} )
}
}
else
f20_local0[#f20_local0 + 1] = {
type = "UIImage",
id = "cac_edit_choose_btn_lock_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
material = RegisterMaterial( "icon_lock_mini" ),
left = 0,
width = 16,
height = 16
}
}
}
if f20_arg0.dlc == true then
f20_local0[#f20_local0 + 1] = {
type = "UIImage",
id = "cac_edit_choose_btn_dlc_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
material = RegisterMaterial( "icon_dlc" ),
right = 0,
width = 24,
height = 24
}
}
}
end
end
return f20_local0
end
function cac_edit_choose_image_button()
local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
return {
type = "UIButton",
focusable = true,
audio = {
button_over = CoD.SFX.SubMenuMouseOver
},
properties = {
text = "",
itemSelected = false,
item = "",
itemLocked = false,
itemDisabled = false,
lock_num = 0,
width = f21_local0.scrollBar and 128 or 136,
height = 75 + CoD.TextSettings.NormalFont.Height,
button_action_func = f0_local2,
material_icon = RegisterMaterial( "specialty_ks_null" ),
dlc = false
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
height = MBh.Property( "height" ),
width = MBh.Property( "width" )
}
},
handlers = {
button_action = MBh.Property( "button_action_func" ),
button_up = f0_local7,
button_over = MBh.DoMultiple( {
f0_local6,
CacEditButtonOver
} ),
button_disable = f0_local7,
button_over_disable = f0_local6,
button_update = f0_local4,
menu_create = updateNewIcon,
refresh_new_icon = updateNewIcon,
dlc_mount_complete = f0_local5
},
children = {
{
type = "UIElement",
id = "marquee_text_container",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -CoD.TextSettings.NormalFont.Height,
bottom = 0,
left = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font
}
},
children = {
{
type = "UIMarqueeText",
id = "cac_edit_choose_btn_txt_id",
properties = {
text = MBh.Property( "text" ),
scrollSpeed = 50
},
states = {
default = CoD.ColorizeState( Colors.primary_text_color, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font
} )
},
handlers = {
button_txt_selected = function ( f22_arg0, f22_arg1 )
f22_arg0:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b )
end
,
button_txt_focused = function ( f23_arg0, f23_arg1 )
f23_arg0:SetColor( Colors.white.r, Colors.white.g, Colors.white.b )
end
,
button_txt_unfocused = function ( f24_arg0, f24_arg1 )
f24_arg0:SetColor( Colors.grey_22.r, Colors.grey_22.g, Colors.grey_22.b )
end
,
button_txt_focused_locked = function ( f25_arg0, f25_arg1 )
f25_arg0:SetColor( Colors.generic_button_text_disabled_color.r, Colors.generic_button_text_disabled_color.g, Colors.generic_button_text_disabled_color.b )
end
,
button_txt_unfocused_locked = function ( f26_arg0, f26_arg1 )
f26_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b )
end
,
button_txt_focused_disabled = function ( f27_arg0, f27_arg1 )
f27_arg0:SetColor( Colors.generic_button_text_disabled_color.r, Colors.generic_button_text_disabled_color.g, Colors.generic_button_text_disabled_color.b )
end
,
button_txt_unfocused_disabled = function ( f28_arg0, f28_arg1 )
f28_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b )
end
}
}
}
},
{
type = "UIImage",
id = "new_icon",
states = {
default = {
material = RegisterMaterial( "icon_new_2" ),
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = -32,
right = 0,
top = 0,
bottom = 32,
alpha = 0
},
visible = {
alpha = 1
},
darker = {
alpha = 0.5
}
},
handlers = {
show_new_icon = MBh.AnimateLoop( {
{
"visible",
0
},
{
"darker",
300
},
{
"visible",
300
}
} ),
hide_new_icon = MBh.AnimateToState( "default", 400 )
}
},
{
type = "UIElement",
properties = {
lock_num = MBh.Property( "lock_num" ),
material_icon = MBh.Property( "material_icon" ),
item = MBh.Property( "item" ),
dlc = MBh.Property( "dlc" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = -CoD.TextSettings.NormalFont.Height,
left = 0,
right = 0
}
},
handlers = {
menu_create = function ( f29_arg0, f29_arg1 )
local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 )
if f29_local0.restrictType and MatchRules.AllowCustomClasses( f29_local0.classLocation ) then
local f29_local1 = false
if f29_local0.restrictType == "weaponRestricted" then
local f29_local2, f29_local3, f29_local4 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", Cac.GetWeaponClass( f29_arg0.properties.item ) )
f29_local1 = f29_local2 and f29_local3
end
local f29_local5 = false
if not f29_local1 then
local f29_local2, f29_local3 = Cac.SafeGetMatchRule( "commonOption", f29_local0.restrictType, f29_arg0.properties.item )
f29_local5 = f29_local2 and f29_local3
end
if f29_local1 or f29_local5 then
local f29_local2 = Cac.GetRestrictIcon( 0, 2, 28 )
f29_local2.id = "restrict_icon" .. f29_arg0.properties.item
f29_arg0:addElement( f29_local2 )
local f29_local3 = f29_arg0:getParent()
f29_local3.restricted = true
else
local f29_local2 = f29_arg0:getParent()
f29_local2.restricted = false
end
end
end
},
children = {
{
type = "UIElement",
id = "cac_edit_choose_btn_bg_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
},
dim = {
alpha = 0.8
}
},
handlers = {
button_bg_focused = MBh.AnimateLoop( {
{
"dim",
750,
true,
true
},
{
"default",
750
}
} ),
button_bg_unfocused = MBh.AnimateToState( "default", 0 )
},
children = {
{
type = "cac_edit_choose_image_button_background",
properties = {
alpha = 0
}
}
}
},
{
type = "cac_edit_choose_image_button_background_outline",
properties = {
alpha = 0
}
},
{
type = "UIImage",
id = "cac_edit_choose_btn_icon_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = f21_local0.ImageDimensions.top,
bottom = f21_local0.ImageDimensions.bottom,
left = f21_local0.ImageDimensions.left,
right = f21_local0.ImageDimensions.right,
material = MBh.Property( "material_icon" ),
alpha = 1
},
selected = {
alpha = 1
},
focused = {
scale = 0.1
},
unfocused = {
scale = 0
},
focused_disabled = {
alpha = 0.75
},
unfocused_disabled = {
alpha = 0.5
}
},
handlers = {
button_icon_selected = MBh.AnimateToState( "selected", 0 ),
button_icon_focused = MBh.AnimateSequence( {
{
"unfocused",
0
},
{
"focused",
100
},
{
"unfocused",
100
}
} ),
button_icon_unfocused = MBh.AnimateToState( "unfocused", 0 ),
button_icon_focused_disabled = MBh.AnimateToState( "focused_disabled", 0 ),
button_icon_unfocused_disabled = MBh.AnimateToState( "unfocused_disabled", 0 )
}
},
{
type = "UIImage",
id = "cac_edit_choose_btn_sel_box_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 16,
left = 0,
right = 16,
material = RegisterMaterial( "widg_triangle" ),
alpha = 0
},
focused = {
alpha = 1
},
unfocused = {
alpha = 0
},
selected = {
red = Colors.frontend_hilite.r,
green = Colors.frontend_hilite.g,
blue = Colors.frontend_hilite.b,
alpha = 1
},
deselected = {
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
},
focused_disabled = {
material = RegisterMaterial( "widg_triangle_outline" ),
alpha = Cac.Selection.outline_over.a
},
unfocused_disabled = {
material = RegisterMaterial( "widg_triangle" ),
alpha = 0
}
},
handlers = {
button_tab_selected = MBh.AnimateToState( "selected", 0 ),
button_tab_deselected = MBh.AnimateToState( "deselected", 0 ),
button_tab_focused = MBh.AnimateToState( "focused", 0 ),
button_tab_unfocused = MBh.AnimateToState( "unfocused", 0 ),
button_tab_focused_disabled = MBh.AnimateToState( "focused_disabled", 0 ),
button_tab_unfocused_disabled = MBh.AnimateToState( "unfocused_disabled", 0 )
}
},
{
type = "UIElement",
id = "price_container",
properties = {
lock_num = MBh.Property( "lock_num" ),
dlc = MBh.Property( "dlc" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = -2,
left = 3,
right = 0,
height = 20,
alpha = 0
},
locked = {
alpha = 1
},
unlocked = {
alpha = 0
}
},
handlers = {
button_locked = MBh.AnimateToState( "locked", 0 ),
button_unlocked = MBh.AnimateToState( "unlocked", 0 )
},
childrenFeeder = cac_edit_choose_image_lock_feeder
}
}
}
}
}
end
function CacEditChooseImageOnCreate( f30_arg0, f30_arg1 )
local f30_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
local f30_local1 = f30_local0.squadLocation
if not f30_local1 then
f30_local1 = f30_arg0.properties.squadLocation
end
f30_local0.squadLocation = f30_local1
f30_local1 = f30_local0.squadMemberIndex
if not f30_local1 then
f30_local1 = f30_arg0.properties.squadMemberIndex
end
f30_local0.squadMemberIndex = f30_local1
f30_local1 = f30_local0.slot
if not f30_local1 then
f30_local1 = f30_arg0.properties.slot
end
f30_local0.slot = f30_local1
f30_local1 = f30_local0.classLocation
if not f30_local1 then
f30_local1 = f30_arg0.properties.classLocation
end
f30_local0.classLocation = f30_local1
f30_local1 = f30_local0.itemIndex
if not f30_local1 then
f30_local1 = f30_arg0.properties.itemIndex
end
f30_local0.itemIndex = f30_local1
f30_local1 = f30_local0.itemTypeString
if not f30_local1 then
f30_local1 = f30_arg0.properties.itemTypeString
end
f30_local0.itemTypeString = f30_local1
f30_local1 = f30_local0.disableSetDefaultFocus
if not f30_local1 then
f30_local1 = f30_arg0.properties.disableSetDefaultFocus
end
f30_local0.disableSetDefaultFocus = f30_local1
f30_local1 = f30_local0.selection_id
if not f30_local1 then
f30_local1 = f30_arg0.properties.selection_id
end
f30_local0.selection_id = f30_local1
f30_local1 = f30_local0.ImageFunction
if not f30_local1 then
f30_local1 = f30_arg0.properties.ImageFunction
end
f30_local0.ImageFunction = f30_local1
f30_local1 = f30_local0.ItemGetFunction
if not f30_local1 then
f30_local1 = f30_arg0.properties.ItemGetFunction
end
f30_local0.ItemGetFunction = f30_local1
f30_local1 = f30_local0.ItemSetFunction
if not f30_local1 then
f30_local1 = f30_arg0.properties.ItemSetFunction
end
f30_local0.ItemSetFunction = f30_local1
f30_local1 = f30_local0.ItemGetNameFunction
if not f30_local1 then
f30_local1 = f30_arg0.properties.ItemGetNameFunction
end
f30_local0.ItemGetNameFunction = f30_local1
f30_local1 = f30_local0.itemList
if not f30_local1 then
f30_local1 = f30_arg0.properties.itemList
end
f30_local0.itemList = f30_local1
f30_local1 = f30_local0.ImageDimensions
if not f30_local1 then
f30_local1 = f30_arg0.properties.ImageDimensions
end
f30_local0.ImageDimensions = f30_local1
f30_local1 = f30_local0.scrollBar
if not f30_local1 then
f30_local1 = f30_arg0.properties.customBottom
end
f30_local0.scrollBar = f30_local1
f30_local1 = f30_local0.customTop
if not f30_local1 then
f30_local1 = f30_arg0.properties.customTop
end
f30_local0.customTop = f30_local1
f30_local1 = f30_local0.customLeft
if not f30_local1 then
f30_local1 = f30_arg0.properties.customLeft
end
f30_local0.customLeft = f30_local1
f30_local1 = f30_local0.customRight
if not f30_local1 then
f30_local1 = f30_arg0.properties.customRight
end
f30_local0.customRight = f30_local1
f30_local1 = f30_local0.customBottom
if not f30_local1 then
f30_local1 = f30_arg0.properties.customBottom
end
f30_local0.customBottom = f30_local1
f30_local1 = f30_arg0:getFirstDescendentById( "scroll_bar_id" )
local f30_local2 = f30_arg0:getFirstDescendentById( "edit_choose_grid" )
f30_local1:setList( f30_local2.vlist )
end
function CacEditChooseChildrenFeeder( f31_arg0 )
local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
local f31_local1 = {}
local f31_local2 = f31_local0.exclusiveController
if not f31_local2 then
DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" )
f31_local2 = 0
end
local f31_local3 = f31_local0.squadMemberIndex
if not f31_local3 then
DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" )
f31_local3 = 0
end
local f31_local4 = f31_local0.slot
if not f31_local4 then
DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" )
f31_local4 = 0
end
local f31_local5 = f31_local0.squadLocation
assert( f31_local5, "Cac: No squad location specified, something went wrong" )
local f31_local6 = f31_local0.classLocation
assert( f31_local6, "Cac: No class location specified, something went wrong" )
local f31_local7 = f31_local0.itemIndex
if not f31_local7 then
DebugPrint( "[WARNING] CAC: using item index 0, this is only ok if you are editing a menu" )
f31_local7 = 0
end
local f31_local8 = f31_local0.ItemGetFunction( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, f31_local7 )
local f31_local9 = f31_local0.itemList
local f31_local10 = {}
local f31_local11 = f0_local3
if f31_local0.overrideChooseAction then
f31_local11 = f31_local0.overrideChooseAction
end
local f31_local12 = not f31_local0.disableSetDefaultFocus
local f31_local13 = Cac.GetWeapon( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, 0 )
local f31_local14 = Cac.GetWeapon( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, 1 )
local f31_local15
if f31_local0.selection_id ~= "edit_weapon_primary" and f31_local0.selection_id ~= "edit_weapon_secondary" then
f31_local15 = false
else
f31_local15 = true
end
for f31_local27, f31_local28 in ipairs( f31_local9 ) do
local f31_local29 = Cac.IsAbilityPickedBySlotName( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, "Elite", "specialty_twoprimaries", "abilitiesPicked" )
if (f31_local7 ~= 1 or f31_local28 ~= f31_local13 or not f31_local29 or not f31_local15) and (f31_local7 ~= 0 or f31_local28 ~= f31_local14 or not f31_local29 or not f31_local15) then
local f31_local19 = false
if f31_local8 == f31_local28 and not f31_local0.overrideChooseDisableCheck then
f31_local19 = true
end
f31_local10[#f31_local10 + 1] = {
type = "cac_edit_choose_image_button",
id = "edit_weapon_" .. f31_local28,
listDefaultFocus = f31_local12 and f31_local8 == f31_local28,
properties = {
text = f31_local0.ItemGetNameFunction( f31_local28 ),
slot = f31_local4,
itemIndex = f31_local7,
item = f31_local28,
itemSelected = f31_local19,
button_action_func = f31_local11,
material_icon = RegisterMaterial( f31_local0.ImageFunction( f31_local28 ) )
}
}
local f31_local20 = f31_local10[#f31_local10]
if f31_local0.overrideChooseDisableCheck then
f31_local0.overrideChooseDisableCheck( f31_local20 )
end
if (f31_local0.selection_id == "edit_weapon_primary_camo" or f31_local0.selection_id == "edit_weapon_primary_reticle") and Cac.IsCamoOrReticleEntitlement( f31_local28 ) then
if not Cac.IsCamoOrReticleEntitlementUnlocked( f31_local2, f31_local28 ) then
f31_local20.itemLocked = true
f31_local20.properties.itemLocked = true
f31_local20.properties.lock_num = nil
if Cac.IsCamoOrReticleDLC( f31_local28 ) then
f31_local20.properties.dlc = true
else
f31_local20.properties.dlc = false
goto basicblock_53:
end
end
end
if f31_local15 and Cac.IsWeaponEntitlement( f31_local28 ) then
if not Cac.IsWeaponEntitlementUnlocked( f31_local2, f31_local28 ) then
f31_local20.itemLocked = true
f31_local20.properties.itemLocked = true
f31_local20.properties.lock_num = nil
if Cac.IsWeaponDLC( f31_local28 ) then
f31_local20.properties.dlc = true
else
f31_local20.properties.dlc = false
goto basicblock_53:
end
end
end
local f31_local21, f31_local22, f31_local23 = false
if f31_local0.selection_id == "edit_weapon_primary_camo" or f31_local0.selection_id == "edit_weapon_primary_reticle" then
local f31_local24 = ""
if f31_local0.selection_id == "edit_weapon_primary_camo" then
f31_local24 = Cac.GetCamoRefUnique( f31_local13, f31_local28 )
f31_local23 = Cac.GetCamoChallengeRef( f31_local13, f31_local28 )
end
if f31_local0.selection_id == "edit_weapon_primary_reticle" then
local f31_local25 = Cac.GetAttachmentWithReticles( f31_local0.exclusiveController, f31_local0.squadLocation, f31_local0.squadMemberIndex, f31_local0.classLocation, f31_local0.slot, f31_local0.itemIndex )
if f31_local25 then
f31_local24 = Cac.GetReticleRefUnique( f31_local25, f31_local28 )
f31_local23 = Cac.GetReticleChallengeRef( f31_local25, f31_local28 ) or ""
end
end
f31_local22 = Cac.GetCamoOrReticleChallengeTier( f31_local24 )
end
if Cac.IsItemUnlocked( f31_local2, f31_local5, f31_local0.squadMemberIndex, f31_local28, f31_local23, f31_local22 ) == false then
f31_local20.itemLocked = true
local f31_local24 = getProperUnlockTable( f31_local28 )
local f31_local26 = tonumber( Engine.TableLookup( f31_local24, 0, Engine.TableLookup( f31_local24, 0, f31_local20.properties.item, 3 ), 4 ) )
f31_local20.properties.itemLocked = true
f31_local20.properties.lock_num = f31_local26
end
end
end
return f31_local10
end
function cacChooseImageUpdateTitleProgress( f32_arg0, f32_arg1 )
local f32_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f32_arg0 )
local f32_local1 = nil
local f32_local2 = ""
if f32_arg1.item ~= "none" then
if SvS.IsSvS() then
f32_local2 = ""
elseif Cac.IsCamoOrReticleEntitlement( f32_arg1.item ) then
f32_local2 = Cac.GetCamoOrReticleEntitlementTitle( f32_arg1.item )
else
if f32_local0.selection_id == "edit_weapon_primary_camo" then
f32_local1 = Cac.GetCamoChallengeRef( f32_arg1.parentItem, f32_arg1.item )
else
f32_local1 = Cac.GetReticleChallengeRef( f32_arg1.parentItem, f32_arg1.item )
end
if f32_local1 then
f32_local2 = Cac.GetCamoOrReticleChallengeTitle( f32_local1 )
end
end
end
f32_arg0:setText( Engine.Localize( f32_local2, "" ) )
end
function cacChooseImageUpdateTextProgress( f33_arg0, f33_arg1 )
local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 )
local f33_local1, f33_local2 = nil
local f33_local3 = ""
if f33_arg1.item ~= "none" then
if SvS.IsSvS() then
f33_local3 = ""
elseif Cac.IsCamoOrReticleEntitlement( f33_arg1.item ) then
f33_local3 = ""
else
if f33_local0.selection_id == "edit_weapon_primary_camo" then
f33_local1 = Cac.GetCamoChallengeRef( f33_arg1.parentItem, f33_arg1.item )
f33_local2 = Cac.IsCamoChallengeComplete( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item )
else
f33_local1 = Cac.GetReticleChallengeRef( f33_arg1.parentItem, f33_arg1.item )
if f33_local1 then
f33_local2 = Cac.IsReticleChallengeComplete( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item )
end
end
if f33_local2 then
f33_local3 = Engine.Localize( "LUA_MENU_COMPLETED_CAPS" )
elseif f33_local1 then
local f33_local4 = Cac.GetCamoOrReticleChallengeProgress( f33_local0.exclusiveController, f33_local1 )
local f33_local5 = nil
if f33_local0.selection_id == "edit_weapon_primary_camo" then
f33_local5 = Cac.GetCamoChallengeTotal( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item )
else
f33_local5 = Cac.GetReticleChallengeTotal( f33_arg1.parentItem, f33_arg1.item )
end
f33_local3 = f33_local4 .. "/" .. f33_local5
end
end
end
f33_arg0:setText( f33_local3 )
end
function cacChooseImageUpdateDescProgress( f34_arg0, f34_arg1 )
local f34_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f34_arg0 )
local f34_local1 = nil
local f34_local2 = ""
if f34_arg1.item ~= "none" then
if SvS.IsSvS() then
f34_local2 = Engine.Localize( "LUA_MENU_PLAY_ONLINE_TO_UNLOCK" )
elseif Cac.IsCamoOrReticleEntitlement( f34_arg1.item ) then
if Cac.IsCamoOrReticleDLC( f34_arg1.item ) and Cac.IsCamoOrReticleEntitlementUnlocked( f34_local0.controller, f34_arg1.item ) == true then
f34_local2 = Engine.Localize( "@DLC_ALREADY_PURCHASED" )
else
f34_local2 = Engine.Localize( Cac.GetCamoOrReticleEntitlementDesc( f34_arg1.item ) )
end
else
if f34_local0.selection_id == "edit_weapon_primary_camo" then
f34_local1 = Cac.GetCamoChallengeRef( f34_arg1.parentItem, f34_arg1.item )
else
f34_local1 = Cac.GetReticleChallengeRef( f34_arg1.parentItem, f34_arg1.item )
end
if f34_local1 then
f34_local2 = Cac.GetCamoOrReticleChallengeDesc( f34_local1 )
local f34_local3 = nil
if f34_local0.selection_id == "edit_weapon_primary_camo" then
f34_local3 = Cac.GetCamoChallengeTotal( f34_local0.controller, f34_arg1.parentItem, f34_arg1.item )
else
f34_local3 = Cac.GetReticleChallengeTotal( f34_arg1.parentItem, f34_arg1.item )
end
f34_local2 = Engine.Localize( f34_local2, f34_local3 )
end
end
end
f34_arg0:setText( f34_local2 )
end
function CacChooseImageRequirementsWindow( f35_arg0 )
if f35_arg0 then
return {
type = "generic_menu_background",
id = "cac_progress_background_id",
properties = {
shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = 0,
top = -101,
bottom = -1
}
},
children = {
{
type = "UIMarqueeText",
id = "cac_progress_unlock_title_id",
properties = {
text = ""
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 12,
right = 185,
top = 8,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.window_title_text_color.r,
green = Colors.window_title_text_color.g,
blue = Colors.window_title_text_color.b
}
},
handlers = {
cac_progress_unlock_update = cacChooseImageUpdateTitleProgress
}
},
{
type = "UIText",
id = "cac_progress_unlock_text_id",
properties = {
text = ""
},
states = {
default = {
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
right = -12,
top = 8,
height = CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Right,
red = Colors.window_title_text_color.r,
green = Colors.window_title_text_color.g,
blue = Colors.window_title_text_color.b
}
},
handlers = {
cac_progress_unlock_update = cacChooseImageUpdateTextProgress
}
},
{
type = "UIText",
id = "cac_progress_unlock_desc_id",
properties = {
text = ""
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 12,
right = -12,
top = 30,
height = 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
}
},
handlers = {
cac_progress_unlock_update = cacChooseImageUpdateDescProgress
}
}
}
}
else
end
end
function cac_edit_choose_image_popup()
local f36_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" )
local f36_local1 = f36_local0.scrollBar and 1 or 0
local f36_local2
if not (f36_local0.selection_id == "edit_weapon_primary_camo" or f36_local0.selection_id == "edit_weapon_primary_reticle") or f36_local0.squadLocation == "privateMatchSquadMembers" then
f36_local2 = false
else
f36_local2 = true
end
local f36_local3
if f36_local2 then
f36_local3 = -110
if not f36_local3 then
else
local f36_local4 = {
type = "UIElement",
id = "cac_edit_choose_root",
properties = {
squadLocation = "privateMatchSquadMembers",
squadMemberIndex = 0,
slot = 0,
classLocation = "loadouts",
itemIndex = 0,
itemTypeString = "",
disableSetDefaultFocus = false,
selection_id = false,
ImageFunction = function ( f37_arg0, f37_arg1 )
return ""
end,
ItemGetFunction = function ( f38_arg0, f38_arg1 )
return ""
end,
ItemSetFunction = function ( f39_arg0, f39_arg1 )
return ""
end,
ItemGetNameFunction = function ( f40_arg0, f40_arg1 )
return ""
end,
itemList = {},
ImageDimensions = {},
scrollBar = false,
elementsPerRow = 2,
customTop = 0,
customLeft = 0,
customRight = 0,
customBottom = 0,
customWidth = 305
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = MBh.Property( "customTop" ),
left = MBh.Property( "customLeft" )
}
},
handlers = {
menu_create = function ( f41_arg0, f41_arg1 )
CacEditChooseImageOnCreate( f41_arg0, f41_arg1 )
f41_arg0:dispatchEventToChildren( {
name = "button_update"
} )
end
}
}
local f36_local5 = {}
local f36_local6 = {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = Cac.Layout.ChooseDialog.top,
left = Cac.Layout.ChooseDialog.left,
width = MBh.Property( "customWidth" ),
height = 540
}
}
}
local f36_local7 = {}
local f36_local8 = {
type = "generic_menu_titlebar",
id = "cac_grenade_choose_titlebar",
properties = {
title_bar_text = f36_local0.itemTypeString,
font = CoD.TextSettings.BoldFont,
title_bar_text_indent = 25,
title_bar_alignment = LUI.Alignment.Left
}
}
local f36_local9 = {
type = "generic_menu_background_withfade",
id = "cac_background_id",
properties = {
fade_height = 100,
shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow
}
}
local f36_local10 = {
type = "UIStencil",
id = "grid_container_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = GenericTitleBarDims.TitleBarHeight + 1,
bottom = f36_local3,
left = 0,
right = 0
}
},
children = {
{
type = "UIGrid",
id = "edit_choose_grid",
properties = {
elementsPerRow = MBh.Property( "elementsPerRow" ),
hSpacing = 10,
rowHeight = 77 + CoD.TextSettings.NormalFont.Height,
hAlign = LUI.Alignment.Left,
vAlign = LUI.Alignment.Top,
sendScrollEvents = true,
scrollByChildHeight = true
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 5,
bottom = 0,
left = 10,
right = 0
}
},
childrenFeeder = CacEditChooseChildrenFeeder
},
{
type = "UIVerticalScrollbar",
id = "scroll_bar_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 5,
bottom = -10,
right = -9,
width = 10,
alpha = f36_local1
}
}
}
}
}
local f36_local11 = CacChooseImageRequirementsWindow( f36_local2 )
f36_local6.children = f36_local8
f36_local7 = {
type = "generic_back_button",
handlers = {
button_secondary = function ( f42_arg0, f42_arg1 )
local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_arg0 )
if f42_local0.openMenuOnClose then
LUI.FlowManager.RequestPopupMenu( f42_arg0, f42_local0.openMenuOnClose.menu, true, f42_arg1.controller, true, f42_local0.openMenuOnClose )
else
LUI.FlowManager.RequestLeaveMenu( f42_arg0 )
end
end
}
}
f36_local5[1] = f36_local6
f36_local5[2] = f36_local7
f36_local4.children = f36_local5
return f36_local4
end
end
f36_local3 = -1
end
LUI.MenuBuilder.registerDef( "cac_cant_purchase_popup", cac_cant_purchase_popup )
LUI.MenuBuilder.registerDef( "cac_purchase_popup", cac_purchase_popup )
LUI.MenuBuilder.registerDef( "cac_edit_choose_image_popup", cac_edit_choose_image_popup )
LUI.MenuBuilder.registerDef( "cac_edit_choose_image_button", cac_edit_choose_image_button )
LUI.MenuBuilder.registerType( "cac_edit_choose_image_button_background", cac_edit_choose_image_button_background )
LUI.MenuBuilder.registerType( "cac_edit_choose_image_button_background_outline", cac_edit_choose_image_button_background_outline )
LockTable( _M )