1923 lines
64 KiB
Lua
1923 lines
64 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
abilityTypes = Cac.GetAbilityTypes()
|
|
f0_local0 = function ( f1_arg0, f1_arg1 )
|
|
local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
unlockItem( f1_arg1.controller, f1_local0.slotRef )
|
|
f1_arg0:dispatchEventToRoot( {
|
|
name = "button_update",
|
|
controller = f1_arg1.controller,
|
|
immediate = true
|
|
} )
|
|
f1_arg0:dispatchEventToRoot( {
|
|
name = "button_purchased",
|
|
slotRef = f1_local0.slotRef,
|
|
controller = f1_arg1.controller,
|
|
immediate = true
|
|
} )
|
|
f1_arg0:dispatchEventToRoot( {
|
|
name = "cac_update_currency_text"
|
|
} )
|
|
Engine.PlaySound( CoD.SFX.CacSpendPoints )
|
|
LUI.FlowManager.RequestLeaveMenu( f1_arg0 )
|
|
end
|
|
|
|
f0_local1 = function ( f2_arg0, f2_arg1 )
|
|
LUI.FlowManager.RequestLeaveMenu( f2_arg0 )
|
|
end
|
|
|
|
function cac_cant_purchase_ability_popup()
|
|
local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f3_local1 = Rank.GetRankDisplay( Lobby.GetRankForXP( Engine.GetPlayerDataEx( f3_local0.controller, CoD.StatsGroup.Ranked, "squadMembers", Cac.GetEditSquadMember(), "squadMemXP" ) ) )
|
|
local f3_local2 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f3_local1 - 1, RankIconTable.Cols.Standard ) )
|
|
local f3_local3 = f3_local0.currency
|
|
local f3_local4 = f3_local0.unlockLevelReq
|
|
local f3_local5 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f3_local4 - 1, RankIconTable.Cols.Standard ) )
|
|
local f3_local6 = Cac.GetItemCost( f3_local0.slotRef )
|
|
local f3_local7 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", Cac.GetPerkName( f3_local0.slotRef ) )
|
|
local f3_local8 = RegisterMaterial( "icon_unlock_token_active" )
|
|
return {
|
|
type = "generic_yesno_with_image_popup",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@LUA_MENU_UNLOCK_EARLY_CAPS" ),
|
|
message_image = RegisterMaterial( Cac.GetPerkImage( f3_local0.slotRef ) ),
|
|
message_image_top = 10,
|
|
message_image_left = 35,
|
|
message_required_rank_text = Engine.Localize( "@LUA_MENU_UNLOCK_RANK" ),
|
|
message_required_rank_image = f3_local5,
|
|
message_required_rank = f3_local4,
|
|
message_current_rank_text = Engine.Localize( "@LUA_MENU_CURRENT_RANK" ),
|
|
message_current_rank_image = f3_local2,
|
|
message_current_rank = f3_local1,
|
|
message_cost_text = Engine.Localize( "@LUA_MENU_COST" ),
|
|
message_cost_image = f3_local8,
|
|
message_cost = f3_local6,
|
|
message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ),
|
|
message_squad_points_image = f3_local8,
|
|
message_squad_points = f3_local3,
|
|
no_text = f3_local7,
|
|
no_action = f0_local1
|
|
}
|
|
}
|
|
end
|
|
|
|
function cac_purchase_ability_popup()
|
|
local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f4_local1 = Rank.GetRankDisplay( Lobby.GetRankForXP( Engine.GetPlayerDataEx( f4_local0.controller, CoD.StatsGroup.Ranked, "squadMembers", Cac.GetEditSquadMember(), "squadMemXP" ) ) )
|
|
local f4_local2 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f4_local1 - 1, RankIconTable.Cols.Standard ) )
|
|
local f4_local3 = f4_local0.currency
|
|
local f4_local4 = f4_local0.unlockLevelReq
|
|
local f4_local5 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f4_local4 - 1, RankIconTable.Cols.Standard ) )
|
|
local f4_local6 = Cac.GetItemCost( f4_local0.slotRef )
|
|
local f4_local7 = Engine.Localize( "@LUA_MENU_PURCHASE_N", Cac.GetPerkName( f4_local0.slotRef ) )
|
|
local f4_local8 = RegisterMaterial( "icon_unlock_token_active" )
|
|
return {
|
|
type = "generic_yesno_with_image_popup",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@LUA_MENU_UNLOCK_EARLY_CAPS" ),
|
|
message_image = RegisterMaterial( Cac.GetPerkImage( f4_local0.slotRef ) ),
|
|
message_image_top = 10,
|
|
message_image_left = 35,
|
|
message_required_rank_text = Engine.Localize( "@LUA_MENU_UNLOCK_RANK" ),
|
|
message_required_rank_image = f4_local5,
|
|
message_required_rank = f4_local4,
|
|
message_current_rank_text = Engine.Localize( "@LUA_MENU_CURRENT_RANK" ),
|
|
message_current_rank_image = f4_local2,
|
|
message_current_rank = f4_local1,
|
|
message_cost_text = Engine.Localize( "@LUA_MENU_COST" ),
|
|
message_cost_image = f4_local8,
|
|
message_cost = f4_local6,
|
|
message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ),
|
|
message_squad_points_image = f4_local8,
|
|
message_squad_points = f4_local3,
|
|
yes_text = f4_local7,
|
|
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.abilityName )
|
|
end
|
|
|
|
}
|
|
}
|
|
end
|
|
|
|
f0_local2 = function ( f6_arg0, f6_arg1 )
|
|
local f6_local0 = f6_arg0.selected
|
|
local f6_local1 = f6_arg0.streakSelected
|
|
local f6_local2 = f6_arg0.blocked
|
|
local f6_local3 = f6_arg0.buttonLocked
|
|
local f6_local4 = f6_arg0.is_unlocked
|
|
local f6_local5 = f6_arg0._scoped
|
|
if f6_local0 or f6_local1 then
|
|
local f6_local6
|
|
if f6_local5.strikePackage and not f6_local1 then
|
|
f6_local6 = Colors.cac_specialist_bonus
|
|
if not f6_local6 then
|
|
|
|
else
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_selected",
|
|
streak_selected = f6_local1
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = f6_local6.r,
|
|
green = f6_local6.g,
|
|
blue = f6_local6.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_up.attach
|
|
} )
|
|
end
|
|
end
|
|
f6_local6 = Colors.yellow
|
|
elseif f6_local2 or f6_local3 then
|
|
if not f6_local3 then
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_unfocused_blocked"
|
|
} )
|
|
end
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_unfocused_disabled"
|
|
} )
|
|
if f6_local4 then
|
|
if f6_local5.strikePackage and f6_arg0.blockedSpecialist then
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused_blocked"
|
|
} )
|
|
else
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused"
|
|
} )
|
|
end
|
|
else
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused_blocked"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "locked"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "unfocused_locked"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_lock_unfocused"
|
|
} )
|
|
end
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 0
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
alpha = 0
|
|
} )
|
|
else
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_unfocused"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_unfocused"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "button_bg_unfocused"
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_up.attach
|
|
} )
|
|
f6_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
alpha = 0
|
|
} )
|
|
end
|
|
f6_arg0.focused = false
|
|
end
|
|
|
|
local f0_local3 = function ( f7_arg0, f7_arg1 )
|
|
local f7_local0 = f7_arg0.streakSelected
|
|
local f7_local1 = f7_arg0.selected
|
|
local f7_local2 = f7_arg0.blocked
|
|
local f7_local3 = f7_arg0.buttonLocked
|
|
local f7_local4 = f7_arg0._scoped
|
|
if f7_local1 or f7_local0 then
|
|
local f7_local5
|
|
if f7_local4.strikePackage and not f7_local0 then
|
|
f7_local5 = Colors.cac_specialist_bonus
|
|
if not f7_local5 then
|
|
|
|
else
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = f7_local5.r,
|
|
green = f7_local5.g,
|
|
blue = f7_local5.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach + 0.1
|
|
} )
|
|
end
|
|
end
|
|
f7_local5 = Colors.yellow
|
|
elseif f7_local2 or f7_local3 then
|
|
if not f7_local3 then
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused_blocked"
|
|
} )
|
|
else
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "locked"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused_locked"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_lock_focused"
|
|
} )
|
|
end
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_focused_disabled"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_focused_blocked"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach + 0.1
|
|
} )
|
|
else
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_focused_enabled"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "button_bg_focused"
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach
|
|
} )
|
|
f7_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach + 0.1
|
|
} )
|
|
end
|
|
f7_arg0.focused = true
|
|
if MatchRules.AllowCustomClasses( f7_local4.classLocation ) then
|
|
if f7_arg0.restricted or f7_arg0.classRestricted then
|
|
f7_arg0:dispatchEventToRoot( {
|
|
name = "show_class_restrictions_warning",
|
|
immediate = true
|
|
} )
|
|
else
|
|
f7_arg0:dispatchEventToRoot( {
|
|
name = "hide_class_restrictions_warning",
|
|
immediate = true
|
|
} )
|
|
end
|
|
end
|
|
end
|
|
|
|
local f0_local4 = function ( f8_arg0, f8_arg1 )
|
|
local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f8_local1 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f8_arg0.properties.abilityCategoryNumber ), f8_arg0.properties.columnNumber )
|
|
f8_arg0.blockedSpecialist = false
|
|
local f8_local2 = Cac.IsAbilityPicked( f8_arg1.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local0.classLocation, f8_local0.slot, f8_arg0.properties.abilityCategoryNumber, f8_arg0.properties.columnNumber - 1, "abilitiesPicked" )
|
|
local f8_local3 = Cac.IsPerkUnlocked( f8_arg1.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local1 )
|
|
f8_arg0.is_unlocked = f8_local3
|
|
if not f8_local3 then
|
|
f8_arg0.blocked = true
|
|
f8_arg0.buttonLocked = true
|
|
elseif f8_local0.strikePackage and f8_local2 then
|
|
f8_arg0.blockedSpecialist = true
|
|
f8_arg0.blocked = true
|
|
elseif tonumber( f8_arg0.properties.ability_cost ) <= f8_local0.sparePoints then
|
|
if not f8_arg0.selected and not f8_arg0.streakSelected then
|
|
f8_arg0.blocked = false
|
|
end
|
|
elseif not f8_arg0.selected and not f8_arg0.streakSelected then
|
|
if f8_local0.strikePackage and f8_local0.firstKsNone <= #f8_local0.ks then
|
|
f8_arg0.blocked = false
|
|
else
|
|
f8_arg0.blockedSpecialist = true
|
|
f8_arg0.blocked = true
|
|
end
|
|
end
|
|
if f8_arg0.buttonLocked and f8_local3 then
|
|
f8_arg0.buttonLocked = false
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "unlocked",
|
|
dispatchChildren = true
|
|
} )
|
|
end
|
|
if f8_local0.strikePackage then
|
|
for f8_local4 = 1, #Cac.Abilities.BlockedSpecialist, 1 do
|
|
if f8_local1 == Cac.Abilities.BlockedSpecialist[f8_local4] then
|
|
f8_arg0.blocked = true
|
|
f8_arg0.blockedSpecialist = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if f8_arg1.reset then
|
|
f8_arg0.selected = false
|
|
if not f8_arg0.blockedSpecialist then
|
|
f8_arg0.blocked = false
|
|
end
|
|
f8_arg0.shouldHighlight = false
|
|
if f8_arg0.focused then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "reset",
|
|
dispatchChildren = true
|
|
} )
|
|
f0_local3( f8_arg0, f8_arg1 )
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "reset",
|
|
dispatchChildren = true
|
|
} )
|
|
f0_local2( f8_arg0, f8_arg1 )
|
|
end
|
|
elseif f8_arg0.streakSelected then
|
|
f8_arg0:processEvent( {
|
|
name = "streakSelected",
|
|
dispatchChildren = true
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_selected"
|
|
} )
|
|
if f8_arg0.focused then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach
|
|
} )
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_selected",
|
|
streak_selected = f8_arg0.streakSelected
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_up.attach
|
|
} )
|
|
end
|
|
elseif f8_arg0.selected then
|
|
local f8_local4 = f8_local0.strikePackage and Colors.cac_specialist_bonus or Colors.yellow
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_selected"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_selected"
|
|
} )
|
|
if f8_arg0.focused then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = f8_local4.r,
|
|
green = f8_local4.g,
|
|
blue = f8_local4.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach
|
|
} )
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_selected",
|
|
streak_selected = f8_arg0.streakSelected
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = f8_local4.r,
|
|
green = f8_local4.g,
|
|
blue = f8_local4.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_up.attach
|
|
} )
|
|
end
|
|
elseif f8_arg0.blocked or f8_arg0.buttonLocked then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_unfocused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
alpha = 0
|
|
} )
|
|
if not f8_arg0.shouldHighlight then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_unfocused_blocked"
|
|
} )
|
|
if f8_local3 then
|
|
if f8_local0.strikePackage and f8_arg0.blockedSpecialist then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused_blocked"
|
|
} )
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused"
|
|
} )
|
|
end
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused_blocked"
|
|
} )
|
|
end
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 0
|
|
} )
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused_blocked"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused_locked"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_focused_blocked"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.outline_over.attach
|
|
} )
|
|
f8_arg0.shouldHighlight = false
|
|
end
|
|
if f8_arg0.buttonLocked then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "locked",
|
|
dispatchChildren = true
|
|
} )
|
|
end
|
|
elseif f8_arg0.shouldHighlight then
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_bg_focused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_over.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
alpha = 0
|
|
} )
|
|
f8_arg0.shouldHighlight = false
|
|
else
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_tab_unfocused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_txt_unfocused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "button_icon_unfocused"
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundColor",
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = Cac.Selection.background_up.attach
|
|
} )
|
|
f8_arg0:dispatchEventToChildren( {
|
|
name = "updateBackgroundOutlineColor",
|
|
alpha = 0
|
|
} )
|
|
end
|
|
end
|
|
|
|
local f0_local5 = function ( f9_arg0, f9_arg1 )
|
|
local f9_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f9_local1 = f9_arg0.properties
|
|
f9_arg0.selected = Cac.IsAbilityPicked( f9_arg1.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_arg0.properties.abilityCategoryNumber, f9_arg0.properties.columnNumber - 1, f9_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked" )
|
|
if f9_local0.strikePackage then
|
|
f9_arg0.streakSelected = false
|
|
local f9_local2 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f9_arg0.properties.abilityCategoryNumber ), f9_local1.columnNumber ) .. "_ks"
|
|
for f9_local3 = 1, #f9_local0.ks, 1 do
|
|
if f9_local2 == f9_local0.ks[f9_local3] then
|
|
f9_arg0.streakSelected = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function AbilityButtonOver( f10_arg0, f10_arg1 )
|
|
local f10_local0 = f10_arg0.properties
|
|
local f10_local1 = f10_arg0:getParent()
|
|
f10_local0.is_unlocked = f10_local1.is_unlocked
|
|
f10_arg0:dispatchEventToRoot( {
|
|
name = "current_ability_changed",
|
|
columnNumber = f10_arg0.properties.columnNumber,
|
|
description = f10_arg0.properties.description,
|
|
material = f10_arg0.properties.material,
|
|
title = f10_arg0.properties.name,
|
|
ability_cost = f10_arg0.properties.ability_cost,
|
|
purchase_cost = f10_arg0.properties.purchase_cost,
|
|
item_level = f10_arg0.properties.item_level,
|
|
is_unlocked = f10_arg0.properties.is_unlocked,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function AdjustSpecialistStreaks( f11_arg0, f11_arg1, f11_arg2, f11_arg3 )
|
|
local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
for f11_local1 = f11_arg3, f11_local0.firstKsNone - 1, 1 do
|
|
local f11_local4
|
|
if f11_local1 == #f11_arg2 then
|
|
f11_local4 = "none"
|
|
if not f11_local4 then
|
|
|
|
else
|
|
Cac.SetKillstreak( f11_arg1.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, "specialistStreaks", f11_local1 - 1, f11_local4 )
|
|
f11_arg2[f11_local1] = f11_local4
|
|
end
|
|
end
|
|
f11_local4 = f11_arg2[f11_local1 + 1]
|
|
end
|
|
for f11_local1 = f11_arg3, #f11_arg2, 1 do
|
|
local f11_local4 = 0
|
|
if f11_local1 < f11_local0.firstKsNone - 1 then
|
|
for f11_local5 = 1, f11_local1, 1 do
|
|
local f11_local8 = Cac.GetPerkCost( f11_arg2[f11_local5] and "specialty_null" or Cac.StripSuffix( f11_arg2[f11_local5], "_ks" ) )
|
|
if f11_local8 ~= "" and f11_local8 and f11_local8 ~= "0" then
|
|
f11_local4 = f11_local4 + f11_local8 + 1
|
|
end
|
|
end
|
|
end
|
|
Cac.SetSpecialistKills( f11_arg1.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local1 - 1, f11_local4 )
|
|
end
|
|
f11_local0.firstKsNone = f11_local0.firstKsNone - 1
|
|
end
|
|
|
|
function cac_ability_alt_button( f12_arg0, f12_arg1 )
|
|
local f12_local0 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f12_arg1.abilityCategoryNumber ), f12_arg1.columnNumber )
|
|
local f12_local1 = Cac.GetPerkName( f12_local0 )
|
|
local f12_local2 = Cac.GetPerkDesc( f12_local0 )
|
|
local f12_local3 = Cac.GetPerkImage( f12_local0 )
|
|
local f12_local4 = tonumber( f12_arg1.ability_cost )
|
|
if f12_local3 == "" or f12_local3 == nil then
|
|
f12_local3 = "specialty_ks_null"
|
|
end
|
|
local self = LUI.UIButton.new()
|
|
self.id = "cac_ability_alt_button_" .. f12_arg1.columnNumber
|
|
self:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
element.listDefaultFocus = element.properties.columnNumber == event.columnNumber
|
|
end )
|
|
self:addEventHandler( "lose_focus", function ( f14_arg0, f14_arg1 )
|
|
local f14_local0 = f14_arg0:getParent()
|
|
if f14_local0 then
|
|
f14_local0:clearSavedState()
|
|
end
|
|
end )
|
|
self:registerEventHandler( "button_action", function ( element, event )
|
|
local f15_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f15_local1 = f15_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked"
|
|
local f15_local2 = f12_local0 .. "_ks"
|
|
local f15_local3 = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "abilitiesPicked" )
|
|
local f15_local4 = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks" )
|
|
local f15_local5 = Cac.IsPerkUnlocked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f12_local0 )
|
|
local f15_local6 = false
|
|
if f15_local0.strikePackage then
|
|
for f15_local7 = 1, #Cac.Abilities.BlockedSpecialist, 1 do
|
|
if f12_local0 == Cac.Abilities.BlockedSpecialist[f15_local7] then
|
|
f15_local6 = true
|
|
end
|
|
end
|
|
end
|
|
f15_local0.purchase_cost = tonumber( Cac.GetItemCost( f12_local0 ) )
|
|
f15_local0.currency = tonumber( Cac.GetCurrency( event.controller ) )
|
|
f15_local0.unlockLevelReq = Cac.GetPerkUnlockReq( f12_local0 )
|
|
if not f15_local5 then
|
|
f15_local0.slotRef = f12_local0
|
|
if f15_local0.currency < f15_local0.purchase_cost then
|
|
LUI.FlowManager.RequestPopupMenu( element, "cac_cant_purchase_ability_popup", true, event.controller, false, f12_arg1 )
|
|
else
|
|
LUI.FlowManager.RequestPopupMenu( element, "cac_purchase_ability_popup", true, event.controller, false, f12_arg1 )
|
|
end
|
|
elseif (not f15_local0.strikePackage or not f15_local3) and not f15_local6 then
|
|
if f15_local0.strikePackage and f15_local0.firstKsNone == #f15_local0.ks + 1 then
|
|
if f15_local2 ~= f15_local0.ks[1] and f15_local2 ~= f15_local0.ks[2] and f15_local2 ~= f15_local0.ks[3] then
|
|
if not f15_local4 and f15_local0.sparePoints < f12_local4 then
|
|
Engine.PlaySound( CoD.SFX.DenySelect )
|
|
return
|
|
end
|
|
Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage )
|
|
element.selected = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 )
|
|
else
|
|
for f15_local7 = 1, #f15_local0.ks, 1 do
|
|
if f15_local0.ks[f15_local7] == f15_local2 then
|
|
AdjustSpecialistStreaks( element, event, f15_local0.ks, f15_local7 )
|
|
element.streakSelected = false
|
|
end
|
|
end
|
|
end
|
|
elseif f15_local0.strikePackage then
|
|
for f15_local7 = 1, f15_local0.firstKsNone, 1 do
|
|
if f15_local0.ks[f15_local7] == f15_local2 then
|
|
AdjustSpecialistStreaks( element, event, f15_local0.ks, f15_local7 )
|
|
element.streakSelected = false
|
|
elseif f15_local7 == f15_local0.firstKsNone then
|
|
Cac.SetKillstreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", f15_local7 - 1, f15_local2 )
|
|
f15_local0.ks[f15_local7] = f15_local2
|
|
local f15_local10 = 0
|
|
for f15_local11 = 1, f15_local7, 1 do
|
|
local f15_local14 = Cac.GetPerkCost( Cac.StripSuffix( f15_local0.ks[f15_local11], "_ks" ) )
|
|
if f15_local14 ~= "" and f15_local14 then
|
|
f15_local10 = f15_local10 + f15_local14 + 1
|
|
end
|
|
end
|
|
Cac.SetSpecialistKills( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, f15_local7 - 1, f15_local10 )
|
|
f15_local0.firstKsNone = f15_local0.firstKsNone + 1
|
|
element.streakSelected = true
|
|
if Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 ) then
|
|
Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage )
|
|
element.selected = false
|
|
end
|
|
end
|
|
end
|
|
else
|
|
Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage )
|
|
element.selected = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 )
|
|
if not element.blocked then
|
|
if Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks" ) then
|
|
Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks", true, f15_local0.strikePackage )
|
|
else
|
|
local f15_local8 = {
|
|
Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak1 ),
|
|
Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak2 ),
|
|
Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak3 )
|
|
}
|
|
f15_local0.firstKsNone = #f15_local8 + 1
|
|
for f15_local9 = #f15_local8, 1, -1 do
|
|
if f15_local8[f15_local9] == "none" then
|
|
f15_local0.firstKsNone = f15_local9
|
|
end
|
|
end
|
|
for f15_local9 = 1, f15_local0.firstKsNone, 1 do
|
|
if f15_local8[f15_local9] == f15_local2 then
|
|
AdjustSpecialistStreaks( element, event, f15_local8, f15_local9 )
|
|
end
|
|
end
|
|
end
|
|
else
|
|
Engine.PlaySound( CoD.SFX.DenySelect )
|
|
return
|
|
end
|
|
end
|
|
element.shouldHighlight = true
|
|
f15_local0.sparePoints = (f15_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot )) - Cac.CountSpentPoints( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, f15_local1 )
|
|
if element.selected or element.streakSelected then
|
|
Engine.PlaySound( CoD.SFX.CacSelectAbility )
|
|
elseif not element.blocked then
|
|
Engine.PlaySound( CoD.SFX.CacDeselectAbility )
|
|
end
|
|
element:dispatchEventToRoot( {
|
|
name = "button_update",
|
|
dispatchChildren = true,
|
|
controller = event.controller,
|
|
immediate = true
|
|
} )
|
|
element:dispatchEventToRoot( {
|
|
name = "refresh_specialist_abilities_recap",
|
|
controller = event.controller,
|
|
specialistType = Cac.GetPerk( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, Cac.Indices.StreakType ) == "streaktype_specialist",
|
|
selected = f15_local0.strikePackage,
|
|
immediate = true
|
|
} )
|
|
if not f15_local0.strikePackage then
|
|
element:dispatchEventToRoot( {
|
|
name = "refresh_abilities_recap",
|
|
controller = event.controller,
|
|
selected = true,
|
|
immediate = true
|
|
} )
|
|
end
|
|
element:dispatchEventToRoot( {
|
|
name = "update_cac_info_panel",
|
|
controller = cac_controllerId,
|
|
dispatchChildren = true
|
|
} )
|
|
else
|
|
Engine.PlaySound( CoD.SFX.DenySelect )
|
|
return
|
|
end
|
|
end )
|
|
self:registerEventHandler( "button_over", f0_local3 )
|
|
self:registerEventHandler( "button_up", f0_local2 )
|
|
self:registerEventHandler( "button_update", f0_local4 )
|
|
self:registerEventHandler( "button_check", f0_local5 )
|
|
self:registerEventHandler( "button_purchased", function ( element, event )
|
|
if event.slotRef and event.slotRef == element.properties.slotRef then
|
|
element:processEvent( {
|
|
name = "button_action",
|
|
controller = event.controller,
|
|
immediate = true
|
|
} )
|
|
end
|
|
end )
|
|
self:registerEventHandler( "menu_create", function ( element, event )
|
|
local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
|
|
if MatchRules.AllowCustomClasses( f17_local0.classLocation ) then
|
|
local f17_local1, f17_local2 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", f12_local0 )
|
|
if f17_local1 and f17_local2 then
|
|
local f17_local3 = Cac.GetRestrictIcon( -2, -2, 28 )
|
|
f17_local3.id = "restrict_icon" .. f12_local0
|
|
element:addElement( f17_local3 )
|
|
element.restricted = true
|
|
else
|
|
element.restricted = false
|
|
end
|
|
local f17_local3, f17_local4 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", Cac.GetPerkGroup( f12_local0 ) )
|
|
element.classRestricted = f17_local3 and f17_local4
|
|
end
|
|
end )
|
|
self:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
width = 76,
|
|
top = 0,
|
|
bottom = 0
|
|
} )
|
|
self:animateToState( "default" )
|
|
local f12_local6 = LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( {}, {
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alpha = 0.25,
|
|
colorLocked = true
|
|
} )
|
|
local f12_local7 = LUI.UIElement.new()
|
|
f12_local7:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0,
|
|
alpha = 1
|
|
} )
|
|
f12_local7:animateToState( "default" )
|
|
f12_local7:registerAnimationState( "dim", {
|
|
alpha = 0.8
|
|
} )
|
|
f12_local7:registerEventHandler( "button_bg_focused", MBh.AnimateLoop( {
|
|
{
|
|
"dim",
|
|
750,
|
|
true,
|
|
true
|
|
},
|
|
{
|
|
"default",
|
|
750,
|
|
true,
|
|
true
|
|
}
|
|
} ) )
|
|
f12_local7:registerEventHandler( "button_bg_unfocused", MBh.AnimateToState( "default", 0 ) )
|
|
self:addElement( f12_local7 )
|
|
f12_local7:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( {}, {
|
|
alpha = 0
|
|
} ) )
|
|
self:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background_outline( {}, {
|
|
alpha = 0
|
|
} ) )
|
|
local f12_local8 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
local f12_local9 = f12_local8.strikePackage and Colors.cac_specialist_bonus or Colors.yellow
|
|
local f12_local10 = LUI.UIImage.new()
|
|
f12_local10:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
bottom = 16,
|
|
left = 0,
|
|
right = 16,
|
|
material = RegisterMaterial( "widg_triangle" ),
|
|
alpha = 0
|
|
} )
|
|
f12_local10:animateToState( "default" )
|
|
f12_local10:registerAnimationState( "focused", {
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local10:registerAnimationState( "focused_enabled", {
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 1,
|
|
material = RegisterMaterial( "widg_triangle" )
|
|
} )
|
|
f12_local10:registerAnimationState( "unfocused", {
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 0
|
|
} )
|
|
f12_local10:registerAnimationState( "focused_disabled", {
|
|
alpha = 1
|
|
} )
|
|
f12_local10:registerAnimationState( "unfocused_disabled", {
|
|
alpha = 0
|
|
} )
|
|
f12_local10:registerAnimationState( "selected", {
|
|
red = f12_local9.r,
|
|
green = f12_local9.g,
|
|
blue = f12_local9.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local10:registerAnimationState( "streakSelected", {
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local10:registerEventHandler( "streakSelected", MBh.AnimateToState( "streakSelected", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_selected", MBh.AnimateToState( "selected", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_focused", MBh.AnimateToState( "focused", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_unfocused", MBh.AnimateToState( "unfocused", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_focused_enabled", MBh.AnimateToState( "focused_enabled", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_focused_disabled", MBh.AnimateToState( "focused_disabled", 0 ) )
|
|
f12_local10:registerEventHandler( "button_tab_unfocused_disabled", MBh.AnimateToState( "unfocused_disabled", 0 ) )
|
|
self:addElement( f12_local10 )
|
|
local f12_local11 = LUI.UIImage.new()
|
|
f12_local11.id = "ability_icon_id"
|
|
f12_local11.properties = {
|
|
columnNumber = f12_arg1.columnNumber,
|
|
name = f12_local1,
|
|
description = f12_local2,
|
|
material = f12_local3,
|
|
ability_cost = f12_local4,
|
|
purchase_cost = f12_arg1.purchase_cost,
|
|
item_level = Cac.GetItemLevel( f12_local0 ),
|
|
is_unlocked = Cac.IsPerkUnlocked( f12_local8.controller, f12_local8.squadLocation, f12_local8.squadMemberIndex, f12_local0 )
|
|
}
|
|
f12_local11:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
right = -3,
|
|
width = 48,
|
|
height = 48,
|
|
material = RegisterMaterial( f12_local3 ),
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local11:animateToState( "default" )
|
|
f12_local11:registerAnimationState( "selected", {
|
|
alpha = 1
|
|
} )
|
|
f12_local11:registerAnimationState( "focused_up", {
|
|
scale = 0.1,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local11:registerAnimationState( "focused", {
|
|
scale = 0,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local11:registerAnimationState( "unfocused", {
|
|
scale = 0,
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 1
|
|
} )
|
|
f12_local11:registerAnimationState( "focused_blocked_up", {
|
|
scale = 0.1,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.b,
|
|
alpha = 0.6
|
|
} )
|
|
f12_local11:registerAnimationState( "focused_blocked", {
|
|
scale = 0,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.b,
|
|
alpha = 0.6
|
|
} )
|
|
f12_local11:registerAnimationState( "unfocused_blocked", {
|
|
scale = 0,
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 0.2
|
|
} )
|
|
f12_local11:registerEventHandler( "button_over", AbilityButtonOver )
|
|
f12_local11:registerEventHandler( "button_icon_selected", MBh.AnimateToState( "selected", 0 ) )
|
|
f12_local11:registerEventHandler( "button_icon_focused", MBh.AnimateSequence( {
|
|
{
|
|
"focused",
|
|
0
|
|
},
|
|
{
|
|
"focused_up",
|
|
100
|
|
},
|
|
{
|
|
"focused",
|
|
100
|
|
}
|
|
} ) )
|
|
f12_local11:registerEventHandler( "button_icon_unfocused", MBh.AnimateToState( "unfocused", 0 ) )
|
|
f12_local11:registerEventHandler( "button_icon_focused_blocked", MBh.AnimateSequence( {
|
|
{
|
|
"focused_blocked",
|
|
0
|
|
},
|
|
{
|
|
"focused_blocked_up",
|
|
100
|
|
},
|
|
{
|
|
"focused_blocked",
|
|
100
|
|
}
|
|
} ) )
|
|
f12_local11:registerEventHandler( "button_icon_unfocused_blocked", MBh.AnimateToState( "unfocused_blocked", 0 ) )
|
|
self:addElement( f12_local11 )
|
|
local f12_local12 = LUI.UIText.new()
|
|
f12_local12.id = "ability_cost_id"
|
|
local f12_local13 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" )
|
|
f12_local12:setText( f12_local4 )
|
|
f12_local12:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, {
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
left = 5,
|
|
right = 0,
|
|
height = CoD.TextSettings.SmallFont.Height,
|
|
font = CoD.TextSettings.SmallFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
} ) )
|
|
f12_local12:animateToState( "default" )
|
|
f12_local12:registerAnimationState( "streakSelected", CoD.ColorizeState( Colors.yellow, {} ) )
|
|
f12_local12:registerAnimationState( "selected", CoD.ColorizeState( f12_local9, {} ) )
|
|
f12_local12:registerAnimationState( "unselected", CoD.ColorizeState( Colors.white, {} ) )
|
|
f12_local12:registerAnimationState( "focused", CoD.ColorizeState( Colors.black, {} ) )
|
|
f12_local12:registerAnimationState( "unfocused", CoD.ColorizeState( Colors.secondary_text_color, {} ) )
|
|
f12_local12:registerAnimationState( "focused_blocked", CoD.ColorizeState( {
|
|
r = Colors.black.r,
|
|
g = Colors.black.g,
|
|
b = Colors.black.b,
|
|
a = 1
|
|
}, {} ) )
|
|
f12_local12:registerAnimationState( "unfocused_blocked", CoD.ColorizeState( {
|
|
r = Colors.secondary_text_color.r,
|
|
g = Colors.secondary_text_color.g,
|
|
b = Colors.secondary_text_color.b,
|
|
a = 0.5
|
|
}, {} ) )
|
|
f12_local12:registerAnimationState( "locked", CoD.ColorizeState( {
|
|
r = Colors.secondary_text_color.r,
|
|
g = Colors.secondary_text_color.g,
|
|
b = Colors.secondary_text_color.b,
|
|
a = 0.75
|
|
}, {} ) )
|
|
f12_local12:registerEventHandler( "streakSelected", MBh.AnimateToState( "streakSelected", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_selected", function ( element, event )
|
|
if not event.streak_selected then
|
|
local f18_local0 = MBh.AnimateToState( "selected", 0 )
|
|
f18_local0( element )
|
|
else
|
|
local f18_local0 = MBh.AnimateToState( "streakSelected", 0 )
|
|
f18_local0( element )
|
|
end
|
|
end )
|
|
f12_local12:registerEventHandler( "button_txt_unselected", MBh.AnimateToState( "unselected", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_focused", MBh.AnimateToState( "focused", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_unfocused", MBh.AnimateToState( "unfocused", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_focused_blocked", MBh.AnimateToState( "focused_blocked", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_unfocused_blocked", MBh.AnimateToState( "unfocused_blocked", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_focused_locked", MBh.AnimateToState( "focused_blocked", 0 ) )
|
|
f12_local12:registerEventHandler( "button_txt_unfocused_locked", MBh.AnimateToState( "locked", 0 ) )
|
|
f12_local12:registerEventHandler( "reset", function ( element, event )
|
|
if element.blocked or element.buttonLocked then
|
|
MBh.AnimateToState( "locked", 0 )
|
|
else
|
|
MBh.AnimateToState( "default", 0 )
|
|
end
|
|
end )
|
|
f12_local12:registerEventHandler( "locked", MBh.AnimateToState( "locked", 0 ) )
|
|
self:addElement( f12_local12 )
|
|
local f12_local14 = LUI.UIElement.new()
|
|
f12_local14:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
left = 17,
|
|
right = 0,
|
|
height = CoD.TextSettings.SmallFont.Height,
|
|
alpha = 0
|
|
} )
|
|
f12_local14:animateToState( "default" )
|
|
f12_local14:registerAnimationState( "locked", {
|
|
alpha = 0.15
|
|
} )
|
|
f12_local14:registerAnimationState( "locked_focused", {
|
|
alpha = 0.5
|
|
} )
|
|
f12_local14:registerAnimationState( "locked_unfocused", {
|
|
alpha = 0.15
|
|
} )
|
|
f12_local14:registerEventHandler( "locked", MBh.AnimateToState( "locked", 0 ) )
|
|
f12_local14:registerEventHandler( "unlocked", MBh.AnimateToState( "default", 0 ) )
|
|
f12_local14:registerEventHandler( "button_lock_focused", function ( element, event )
|
|
element:animateToState( "locked_focused" )
|
|
local f20_local0 = element:getFirstChild()
|
|
f20_local0:processEvent( event )
|
|
end )
|
|
f12_local14:registerEventHandler( "button_lock_unfocused", function ( element, event )
|
|
element:animateToState( "locked_unfocused" )
|
|
local f21_local0 = element:getFirstChild()
|
|
f21_local0:processEvent( event )
|
|
end )
|
|
self:addElement( f12_local14 )
|
|
local f12_local15 = LUI.UIImage.new()
|
|
f12_local15:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = 0,
|
|
width = 16,
|
|
height = 16,
|
|
material = RegisterMaterial( "icon_unlock_active" )
|
|
} )
|
|
f12_local15:animateToState( "default" )
|
|
f12_local15:registerAnimationState( "focused_locked", CoD.ColorizeState( {
|
|
r = Colors.black.r,
|
|
g = Colors.black.g,
|
|
b = Colors.black.b,
|
|
a = 1
|
|
}, {} ) )
|
|
f12_local15:registerAnimationState( "unfocused_locked", CoD.ColorizeState( {
|
|
r = Colors.white.r,
|
|
g = Colors.white.g,
|
|
b = Colors.white.b,
|
|
a = 1
|
|
}, {} ) )
|
|
f12_local15:registerEventHandler( "button_lock_focused", function ( element, event )
|
|
local f22_local0 = MBh.AnimateToState( "focused_locked", 0 )
|
|
f22_local0( element )
|
|
end )
|
|
f12_local15:registerEventHandler( "button_lock_unfocused", function ( element, event )
|
|
local f23_local0 = MBh.AnimateToState( "unfocused_locked", 0 )
|
|
f23_local0( element )
|
|
end )
|
|
f12_local14:addElement( f12_local15 )
|
|
return self
|
|
end
|
|
|
|
function abilities_row( f24_arg0 )
|
|
local f24_local0 = Cac.GetAbilityRef( f24_arg0 )
|
|
local f24_local1 = {
|
|
type = "UIImage",
|
|
id = "ability_gradient",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_ability[f24_local0], {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
height = 30,
|
|
material = RegisterMaterial( "box_white_gradient_top" ),
|
|
alpha = 0.15
|
|
} )
|
|
}
|
|
}
|
|
local f24_local2 = {
|
|
type = "UIImage",
|
|
id = "ability_triangle",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_ability[f24_local0], {
|
|
material = RegisterMaterial( "widg_triangle" ),
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = 20,
|
|
width = 20,
|
|
alpha = 0.5
|
|
} )
|
|
}
|
|
}
|
|
local f24_local3 = {
|
|
type = "UIText",
|
|
id = "row_name",
|
|
properties = {
|
|
text = Cac.GetAbilityName( f24_local0 )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.white, {
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 40,
|
|
right = 0,
|
|
top = -CoD.TextSettings.NormalFont.Height / 2,
|
|
bottom = CoD.TextSettings.NormalFont.Height / 2,
|
|
alpha = 0.5
|
|
} )
|
|
},
|
|
handlers = {
|
|
menu_create = function ( f25_arg0, f25_arg1 )
|
|
local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 )
|
|
if MatchRules.AllowCustomClasses( f25_local0.classLocation ) then
|
|
local f25_local1, f25_local2 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", f24_local0 )
|
|
if f25_local1 and f25_local2 then
|
|
local self = LUI.UIImage.new()
|
|
self.id = "restrict_icon" .. f24_local0
|
|
self:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = -32,
|
|
bottom = 2,
|
|
width = 28,
|
|
height = 28,
|
|
material = RegisterMaterial( "icon_new_3" ),
|
|
alpha = 1
|
|
} )
|
|
self:animateToState( "default" )
|
|
f25_arg0:addElement( self )
|
|
end
|
|
end
|
|
end
|
|
}
|
|
}
|
|
local f24_local4 = {
|
|
type = "UIHorizontalList",
|
|
id = "row_buttons",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 195,
|
|
right = 0,
|
|
top = 3,
|
|
bottom = -4,
|
|
spacing = 30
|
|
}
|
|
},
|
|
children = {}
|
|
}
|
|
for f24_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do
|
|
local f24_local8 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f24_arg0 ), f24_local5 )
|
|
local f24_local9 = Cac.GetPerkCost( f24_local8 )
|
|
if f24_local9 == "" or f24_local9 == nil then
|
|
f24_local9 = "1"
|
|
end
|
|
f24_local4.children[#f24_local4.children + 1] = {
|
|
type = "cac_ability_alt_button",
|
|
id = "cac_ability_alt_button_" .. f24_arg0 .. "_" .. f24_local5,
|
|
audio = {
|
|
button_over = CoD.SFX.SubMenuMouseOver
|
|
},
|
|
properties = {
|
|
muteAction = true,
|
|
abilityCategoryNumber = f24_arg0,
|
|
columnNumber = f24_local5,
|
|
ability_cost = f24_local9,
|
|
purchase_cost = Cac.GetItemCost( f24_local8 ),
|
|
slotRef = f24_local8
|
|
}
|
|
}
|
|
end
|
|
return {
|
|
type = "UIElement",
|
|
id = "abilities_row_" .. f24_arg0,
|
|
focusable = true,
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 63
|
|
}
|
|
},
|
|
children = {
|
|
f24_local1,
|
|
f24_local2,
|
|
f24_local3,
|
|
f24_local4
|
|
},
|
|
handlers = {
|
|
menu_create = function ( f26_arg0, f26_arg1 )
|
|
f26_arg0:setHandleMouse( true )
|
|
end
|
|
,
|
|
popup_active = function ( f27_arg0, f27_arg1 )
|
|
f27_arg0:setHandleMouse( false )
|
|
end
|
|
,
|
|
popup_inactive = function ( f28_arg0, f28_arg1 )
|
|
f28_arg0:setHandleMouse( true )
|
|
end
|
|
|
|
}
|
|
}
|
|
end
|
|
|
|
function abilities_grid()
|
|
local f29_local0 = {
|
|
type = "UIVerticalList",
|
|
id = "abilities_grid",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 2,
|
|
right = -2,
|
|
top = GenericTitleBarDims.TitleBarHeight + 2,
|
|
bottom = 0
|
|
}
|
|
},
|
|
children = {}
|
|
}
|
|
for f29_local4, f29_local5 in ipairs( abilityTypes ) do
|
|
f29_local0.children[#f29_local0.children + 1] = abilities_row( f29_local5 )
|
|
end
|
|
return {
|
|
type = "UIElement",
|
|
id = "abilities_grid_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 450,
|
|
top = 100,
|
|
width = 730,
|
|
height = 476
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_drop_shadow",
|
|
properties = {
|
|
offset_shadow = 0
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0,
|
|
alpha = Cac.Swatches.Alphas.cac_panel_background_shadow
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "generic_menu_titlebar",
|
|
id = "window_title",
|
|
properties = {
|
|
font = CoD.TextSettings.BoldFont,
|
|
title_bar_text = Engine.Localize( "@MENU_ABILITIES_CAPS" ),
|
|
title_bar_alignment = LUI.Alignment.Left,
|
|
title_bar_text_indent = 36
|
|
}
|
|
},
|
|
{
|
|
type = "generic_menu_background",
|
|
id = "window_background"
|
|
},
|
|
f29_local0
|
|
}
|
|
}
|
|
end
|
|
|
|
local f0_local6 = function ()
|
|
local f30_local0 = 740
|
|
local f30_local1 = 16
|
|
local f30_local2 = 16
|
|
local f30_local3 = 32
|
|
local f30_local4 = Engine.Localize( "@LUA_MENU_UNLOCK_COLON" )
|
|
local f30_local5, f30_local6, f30_local7, f30_local8 = GetTextDimensions( f30_local4, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height )
|
|
local f30_local9 = f30_local7 - f30_local5
|
|
local f30_local10 = 16
|
|
local f30_local11 = 16
|
|
local f30_local12 = 32
|
|
local f30_local13 = Engine.Localize( "@LUA_MENU_PURCHASE_COLON" )
|
|
local f30_local14, f30_local15, f30_local16, f30_local17 = GetTextDimensions( f30_local13, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height )
|
|
local f30_local18 = f30_local16 - f30_local14
|
|
local f30_local19 = 30
|
|
local f30_local20 = 12
|
|
local f30_local21 = 19
|
|
local f30_local22 = f30_local0 - f30_local2 - f30_local3 - f30_local9 - f30_local11 - f30_local12 - f30_local18 - f30_local19 - f30_local21
|
|
local self = LUI.UIElement.new()
|
|
self.id = "ability_description_id"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 570,
|
|
left = 450,
|
|
height = 65,
|
|
width = f30_local0
|
|
} )
|
|
self:animateToState( "default" )
|
|
local f30_local24 = LUI.UIHorizontalList.new()
|
|
f30_local24.id = "perk_title_row_hl"
|
|
f30_local24:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = true,
|
|
top = f30_local20,
|
|
left = f30_local21,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
f30_local24:animateToState( "default" )
|
|
local f30_local25 = LUI.UIText.new()
|
|
f30_local25.id = "perk_name"
|
|
f30_local25:setText( "" )
|
|
f30_local25:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
width = f30_local22,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.BoldFont.Font
|
|
} )
|
|
f30_local25:animateToState( "default" )
|
|
f30_local25:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
element:setText( event.title )
|
|
end )
|
|
local f30_local26 = LUI.UIText.new()
|
|
f30_local26.id = "rank_unlock_text"
|
|
f30_local26:setText( f30_local4 )
|
|
f30_local26:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
width = f30_local9,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alpha = 0,
|
|
red = Colors.secondary_text_color.r,
|
|
green = Colors.secondary_text_color.g,
|
|
blue = Colors.secondary_text_color.b
|
|
} )
|
|
f30_local26:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local26:animateToState( "default" )
|
|
f30_local26:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
local f30_local27 = LUI.UIImage.new()
|
|
f30_local27.id = "rank_unlock_image"
|
|
f30_local27:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = -f30_local1 * 0.5,
|
|
left = -f30_local2 * 0.5,
|
|
height = f30_local1,
|
|
width = f30_local2,
|
|
material = RegisterMaterial( "white" ),
|
|
alpha = 0
|
|
} )
|
|
f30_local27:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local27:animateToState( "default" )
|
|
f30_local27:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
CoD.SetMaterial( element, RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, event.item_level - 1, RankIconTable.Cols.Standard ) ) )
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
local f30_local28 = LUI.UIText.new()
|
|
f30_local28.id = "rank_unlock_num"
|
|
f30_local28:setText( "" )
|
|
f30_local28:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
width = f30_local3,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alpha = 0
|
|
} )
|
|
f30_local28:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local28:animateToState( "default" )
|
|
f30_local28:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
element:setText( event.item_level )
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
local f30_local29 = LUI.UIElement.new()
|
|
f30_local29.id = "spacer"
|
|
f30_local29:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = true,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
width = f30_local19
|
|
} )
|
|
f30_local29:animateToState( "default" )
|
|
local f30_local30 = LUI.UIText.new()
|
|
f30_local30.id = "purchase_unlock_text"
|
|
f30_local30:setText( f30_local13 )
|
|
f30_local30:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
width = f30_local18,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alpha = 0,
|
|
red = Colors.secondary_text_color.r,
|
|
green = Colors.secondary_text_color.g,
|
|
blue = Colors.secondary_text_color.b
|
|
} )
|
|
f30_local30:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local30:animateToState( "default" )
|
|
f30_local30:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
local f30_local31 = LUI.UIImage.new()
|
|
f30_local31.id = "purchase_unlock_image"
|
|
f30_local31:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = -f30_local10 * 0.5,
|
|
left = -f30_local11 * 0.5,
|
|
height = f30_local10,
|
|
width = f30_local11,
|
|
material = RegisterMaterial( "icon_unlock_token_active" ),
|
|
alpha = 0
|
|
} )
|
|
f30_local31:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local31:animateToState( "default" )
|
|
f30_local31:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
local f30_local32 = LUI.UIText.new()
|
|
f30_local32.id = "purchase_unlock_num"
|
|
f30_local32:setText( "" )
|
|
f30_local32:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
left = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
width = f30_local12,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alpha = 0
|
|
} )
|
|
f30_local32:registerAnimationState( "locked", {
|
|
alpha = 1
|
|
} )
|
|
f30_local32:animateToState( "default" )
|
|
f30_local32:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.is_unlocked == false then
|
|
element:setText( event.purchase_cost )
|
|
element:animateToState( "locked", 0 )
|
|
else
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
f30_local24:addElement( f30_local25 )
|
|
f30_local24:addElement( f30_local26 )
|
|
f30_local24:addElement( f30_local27 )
|
|
f30_local24:addElement( f30_local28 )
|
|
f30_local24:addElement( f30_local29 )
|
|
f30_local24:addElement( f30_local30 )
|
|
f30_local24:addElement( f30_local31 )
|
|
f30_local24:addElement( f30_local32 )
|
|
local f30_local33 = LUI.UIText.new()
|
|
f30_local33.id = "perk_desc"
|
|
f30_local33:setText( "" )
|
|
f30_local33:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = true,
|
|
top = 34,
|
|
left = 19,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
alignment = LUI.Alignment.Left,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
red = Colors.secondary_text_color.r,
|
|
green = Colors.secondary_text_color.g,
|
|
blue = Colors.secondary_text_color.b
|
|
} )
|
|
f30_local33:animateToState( "default" )
|
|
f30_local33:registerEventHandler( "current_ability_changed", function ( element, event )
|
|
if event.description then
|
|
element:setText( event.description )
|
|
end
|
|
end )
|
|
self:addElement( f30_local24 )
|
|
self:addElement( f30_local33 )
|
|
return self
|
|
end
|
|
|
|
function ResetAbilities( f39_arg0, f39_arg1 )
|
|
Engine.PlaySound( CoD.SFX.MouseClick )
|
|
local f39_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f39_arg0 )
|
|
local f39_local1 = f39_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked"
|
|
Cac.ResetAbilities( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, f39_local1, f39_local0.strikePackage )
|
|
if f39_local0.strikePackage then
|
|
f39_local0.ks[1] = "none"
|
|
f39_local0.ks[2] = "none"
|
|
f39_local0.ks[3] = "none"
|
|
f39_local0.firstKsNone = 1
|
|
Cac.ResetKillstreak( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, "specialistStreaks" )
|
|
end
|
|
f39_local0.sparePoints = (f39_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot )) - Cac.CountSpentPoints( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, f39_local1 )
|
|
local f39_local2 = f39_arg0:getParent()
|
|
f39_local2:processEvent( {
|
|
name = "button_check",
|
|
controller = f39_arg1.controller
|
|
} )
|
|
f39_local2 = f39_arg0:getParent()
|
|
f39_local2:processEvent( {
|
|
name = "button_update",
|
|
reset = true,
|
|
controller = f39_arg1.controller
|
|
} )
|
|
f39_arg0:dispatchEventToRoot( {
|
|
name = "update_cac_info_panel",
|
|
controller = f39_arg1.controller,
|
|
dispatchChildren = true,
|
|
immediate = true
|
|
} )
|
|
f39_arg0:dispatchEventToRoot( {
|
|
name = f39_local0.strikePackage and "refresh_specialist_abilities_recap" or "refresh_abilities_recap",
|
|
controller = f39_arg1.controller,
|
|
specialistType = f39_local0.strikePackage,
|
|
selected = true,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function AddResetHelper( f40_arg0, f40_arg1 )
|
|
local f40_local0 = f40_arg0:getParent()
|
|
f40_local0:processEvent( {
|
|
name = "add_button_helper_text",
|
|
button_ref = "button_alt1",
|
|
helper_text = Engine.Localize( "@LUA_MENU_RESET" ),
|
|
side = "left",
|
|
clickable = true
|
|
} )
|
|
end
|
|
|
|
function MainClose( f41_arg0, f41_arg1 )
|
|
local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f41_arg0 )
|
|
local f41_local1 = f41_local0.strikePackage and "" or Engine.Localize( "@LUA_MENU_CLEAR" )
|
|
local f41_local2 = f41_arg0:getParent()
|
|
f41_local2:processEvent( {
|
|
name = "add_button_helper_text",
|
|
button_ref = "button_alt1",
|
|
helper_text = f41_local1,
|
|
side = "left",
|
|
clickable = true
|
|
} )
|
|
end
|
|
|
|
function MainCreate( f42_arg0, f42_arg1 )
|
|
local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_arg0 )
|
|
local f42_local1 = f42_local0.strikePackage
|
|
if not f42_local1 then
|
|
f42_local1 = f42_arg0.properties.strikePackage
|
|
end
|
|
f42_local0.strikePackage = f42_local1
|
|
if f42_local0.strikePackage then
|
|
f42_local0.ks = {}
|
|
f42_local0.ks[1] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak1 )
|
|
f42_local0.ks[2] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak2 )
|
|
f42_local0.ks[3] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak3 )
|
|
f42_local0.firstKsNone = #f42_local0.ks + 1
|
|
for f42_local1 = #f42_local0.ks, 1, -1 do
|
|
if f42_local0.ks[f42_local1] == "none" then
|
|
f42_local0.firstKsNone = f42_local1
|
|
end
|
|
end
|
|
end
|
|
AddResetHelper( f42_arg0, f42_arg1 )
|
|
f42_local1 = f42_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked"
|
|
f42_arg0:processEvent( {
|
|
name = "button_check",
|
|
controller = f42_arg1.controller
|
|
} )
|
|
f42_local0.sparePoints = (f42_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot )) - Cac.CountSpentPoints( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, f42_local1 )
|
|
f42_arg0:processEvent( {
|
|
name = "button_update",
|
|
controller = f42_arg1.controller
|
|
} )
|
|
f42_arg0:dispatchEventToRoot( {
|
|
name = f42_local0.strikePackage and "refresh_specialist_abilities_recap" or "refresh_abilities_recap",
|
|
dispatchChildren = true,
|
|
controller = f42_arg1.controller,
|
|
specialistType = f42_local0.strikePackage,
|
|
selected = true,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function cac_ability_alt_main()
|
|
return {
|
|
type = "UIElement",
|
|
id = "cac_ability_alt_main",
|
|
properties = {
|
|
squadLocation = "privateMatchSquadMembers",
|
|
squadMemberIndex = 0,
|
|
slot = 0,
|
|
classLocation = "loadouts",
|
|
strikePackage = false
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
menu_create = MainCreate,
|
|
menu_close = MainClose
|
|
},
|
|
children = {
|
|
abilities_grid(),
|
|
{
|
|
type = "cac_ability_description",
|
|
id = "cac_ability_description_id"
|
|
},
|
|
{
|
|
type = "generic_back_button",
|
|
handlers = {
|
|
button_secondary = function ( f44_arg0, f44_arg1 )
|
|
local f44_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_arg0 )
|
|
if f44_local0.strikePackage then
|
|
f44_arg0:dispatchEventToRoot( {
|
|
name = "show_character_image",
|
|
immediate = true
|
|
} )
|
|
end
|
|
if f44_local0.openMenuOnClose then
|
|
LUI.FlowManager.RequestPopupMenu( f44_arg0, f44_local0.openMenuOnClose.menu, true, f44_arg1.controller, true, f44_local0.openMenuOnClose )
|
|
else
|
|
LUI.FlowManager.RequestLeaveMenu( f44_arg0, true )
|
|
if Cac.IsAbilityPickedBySlotName( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) and Cac.GetAttachment( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, 0, 2 ) == "none" and not f44_local0.strikePackage then
|
|
f44_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info",
|
|
selection_id = "edit_weapon_primary_attach3",
|
|
controller = f44_arg1.controller,
|
|
squadLocation = f44_local0.squadLocation,
|
|
squadMemberIndex = f44_local0.squadMemberIndex,
|
|
classLocation = f44_local0.classLocation,
|
|
slot = f44_local0.slot
|
|
} )
|
|
f44_arg0:dispatchEventToRoot( {
|
|
name = "third_attach_focus",
|
|
immediate = true
|
|
} )
|
|
elseif Cac.IsAbilityPickedBySlotName( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, 1 ) ), true ) and not f44_local0.strikePackage then
|
|
f44_arg0:dispatchEventToRoot( {
|
|
name = "update_selection_info",
|
|
selection_id = "edit_weapon_secondary",
|
|
controller = f44_arg1.controller,
|
|
squadLocation = f44_local0.squadLocation,
|
|
squadMemberIndex = f44_local0.squadMemberIndex,
|
|
classLocation = f44_local0.classLocation,
|
|
slot = f44_local0.slot
|
|
} )
|
|
f44_arg0:dispatchEventToRoot( {
|
|
name = "second_primary_focus",
|
|
immediate = true
|
|
} )
|
|
end
|
|
end
|
|
end
|
|
|
|
}
|
|
},
|
|
{
|
|
type = "UIBindButton",
|
|
id = "reset_abilities",
|
|
handlers = {
|
|
button_alt1 = ResetAbilities
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "cac_ability_alt_main", cac_ability_alt_main )
|
|
LUI.MenuBuilder.registerType( "cac_ability_alt_button", cac_ability_alt_button )
|
|
LUI.MenuBuilder.registerDef( "cac_purchase_ability_popup", cac_purchase_ability_popup )
|
|
LUI.MenuBuilder.registerDef( "cac_cant_purchase_ability_popup", cac_cant_purchase_ability_popup )
|
|
LUI.MenuBuilder.registerType( "cac_ability_description", f0_local6 )
|
|
LockTable( _M )
|