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

3390 lines
89 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
DebugPrint( "Registering " .. _NAME )
OPERATIONS_LIST_WIDTH = 480
function RequestOperationListPopup( f1_arg0, f1_arg1, f1_arg2, f1_arg3 )
f1_arg0:dispatchEventToRoot( {
name = "hide_groups",
immediate = true,
dispatchChildren = true
} )
f1_arg0:dispatchEventToRoot( {
name = "hide_tracked_ops",
immediate = true
} )
f1_arg0:dispatchEventToRoot( {
name = "show_widget"
} )
f1_arg0:dispatchEventToRoot( {
name = "update_operations_title",
string = f1_arg2
} )
f1_arg0:dispatchEventToRoot( {
name = "setup_operation_list_button_helpers"
} )
LUI.FlowManager.RequestPopupMenu( f1_arg0, "operations_selection_popup", true, f1_arg1, false, f1_arg3 )
end
function OpenOperationGroup( f2_arg0, f2_arg1, f2_arg2, f2_arg3 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
f2_local0.currentGroupRef = f2_arg3
f2_local0.isWeaponGroup = false
f2_local0.currentWeaponClass = nil
f2_local0.currentWeaponRef = nil
RequestOperationListPopup( f2_arg0, f2_arg1, f2_arg2, {
groupRef = f2_arg3
} )
end
function OpenWeaponOperations( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 )
local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
f3_local0.isWeaponGroup = true
f3_local0.currentWeaponClass = f3_arg3
f3_local0.currentWeaponRef = f3_arg4
f3_local0.currentGroupRef = nil
RequestOperationListPopup( f3_arg0, f3_arg1, f3_arg2 )
end
function OnWeaponTypesPopupClosed( f4_arg0, f4_arg1 )
f4_arg0:dispatchEventToRoot( {
name = "show_tracked_ops",
controller = f4_arg1.controller
} )
f4_arg0:dispatchEventToRoot( {
name = "show_widget"
} )
end
function GetWeaponClassPopupData()
local f5_local0 = Cac.GetWeaponTypes( true )
local f5_local1 = {}
for f5_local5, f5_local6 in ipairs( f5_local0 ) do
if f5_local6 ~= "weapon_knifefast" then
f5_local1[#f5_local1 + 1] = f5_local6
end
end
return {
customTop = 15,
customLeft = 135,
customRight = 0,
customBottom = 0,
titleBarText = Engine.Localize( "@MPUI_PRIMARY_WEAPON_CAPS" ),
noNewIcons = true,
OnMenuBack = OnWeaponTypesPopupClosed,
buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponCategoryName, OpenWeaponPopup, f5_local1, nil, Cac.GetItemClassDescriptions, nil, nil, nil, nil, "cac_edit_popup_main", nil, true )
}
end
function OpenWeaponTypesPopup( f6_arg0, f6_arg1 )
f6_arg0:dispatchEventToRoot( {
name = "hide_tracked_ops",
controller = f6_arg1.controller
} )
f6_arg0:dispatchEventToRoot( {
name = "hide_widget"
} )
LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_edit_popup_main", true, f6_arg1.controller, false, GetWeaponClassPopupData() )
end
function OpenWeaponPopup( f7_arg0, f7_arg1 )
local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 )
if f7_arg0.properties.itemType == "weapon_riot" then
OpenWeaponOperationsPopup( f7_arg0, {
controller = f7_arg1.controller,
weaponClass = "weapon_riot",
weaponName = "iw6_riotshield"
} )
return
else
local f7_local1 = GetWeaponClassPopupData()
f7_local1.menu = "cac_edit_popup_main"
LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_edit_popup_main_second", true, f7_arg1.controller, true, {
itemIndex = f7_local0.itemIndex,
weaponClass = f7_local0.currentHighlightedType,
customTop = 15,
customLeft = 135,
customRight = 0,
customBottom = 0,
titleBarText = Cac.GetWeaponCategoryNameCaps( f7_arg0.properties.itemType ),
noNewIcons = true,
buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponName, OpenWeaponOperationsPopup, Cac.GetWeaponList( f7_arg0.properties.itemType, f7_arg1.controller ), nil, Cac.GetWeaponDesc, nil, nil, nil, nil, "cac_edit_popup_main_second", nil, true ),
editPopupOpenMenuOnClose = f7_local1
} )
end
end
function OpenWeaponOperationsPopup( f8_arg0, f8_arg1 )
local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_popup_main_second" )
local f8_local1 = f8_arg1.weaponName or f8_local0.currentHighlightedType
local f8_local2 = f8_arg1.weaponClass or f8_local0.weaponClass
Cac.UpdateCamoGoldChallenge( f8_arg1.controller, f8_local1, true )
OpenWeaponOperations( f8_arg0, f8_arg1.controller, Cac.GetWeaponName( f8_local1 ), f8_local2, f8_local1 )
f8_arg0:dispatchEventToRoot( {
name = "hide_cac_edit_popup",
controller = f8_arg1.controller,
immediate = true
} )
end
function GroupButtonsFeeder( f9_arg0 )
local f9_local0 = f9_arg0.exclusiveController
local f9_local1 = nil
f9_local1 = GetAllOpGroupRefs()
local f9_local2 = {}
for f9_local6, f9_local7 in ipairs( f9_local1 ) do
f9_local2[#f9_local2 + 1] = {
type = "UIGenericButton",
id = f9_local7 .. "_id",
properties = {
text = Engine.Localize( GetFieldForOperationsGroup( f9_local7, OperationGroups.Cols.Name ) ),
groupRef = f9_local7,
groupDescText = Engine.Localize( GetFieldForOperationsGroup( f9_local7, OperationGroups.Cols.Desc ) ),
additional_handlers = {
button_over = function ( f10_arg0, f10_arg1 )
local f10_local0 = f10_arg0:getParent()
f10_local0:processEvent( {
name = "set_button_info_text",
groupDescText = f10_arg0.properties.groupDescText
} )
f10_arg0:dispatchEventToRoot( {
name = "notify_category_focused",
groupRef = f10_arg0.properties.groupRef
} )
end,
button_up = function ( f11_arg0, f11_arg1 )
f11_arg0:dispatchEventToRoot( {
name = "notify_category_focused",
groupRef = nil,
immediate = true
} )
end
}
},
handlers = {
button_action = function ( f12_arg0, f12_arg1 )
if f12_arg0.properties.groupRef == "weapon_ops" then
OpenWeaponTypesPopup( f12_arg0, f12_arg1 )
else
OpenOperationGroup( f12_arg0, f12_arg1.controller, f12_arg0.properties.text, f12_arg0.properties.groupRef, false )
end
end
}
}
end
f9_local2[#f9_local2 + 1] = {
type = "button_desc_text",
id = "operations_main_menu_desc_id",
handlers = {
set_button_info_text = function ( f13_arg0, f13_arg1 )
if f13_arg1.groupDescText then
f13_arg1.text = f13_arg1.groupDescText
f13_arg0:dispatchEventToChildren( f13_arg1 )
end
end
}
}
return f9_local2
end
function SetupMainMenuButtonHelpers( f14_arg0, f14_arg1 )
f14_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = "",
side = "left",
clickable = false,
immediate = true,
priority = 1
} )
f14_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderl",
button_ref2 = "",
helper_text = "",
side = "left",
clickable = true,
immediate = true,
priority = 2
} )
f14_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderr",
button_ref2 = "",
helper_text = "",
side = "left",
clickable = true,
immediate = true,
priority = 3
} )
end
function SetupSortButtonHelper( f15_arg0, f15_arg1 )
f15_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderr",
button_ref2 = "",
helper_text = Engine.Localize( "@LUA_MENU_MP_OP_SORT_PREFIX", OperationUtilsCache.SortTypeNames[OperationUtilsCache.CurrentSortType] ),
side = "left",
clickable = true,
immediate = true,
priority = 3
} )
end
function SetupOperationListMenuButtonHelpers( f16_arg0, f16_arg1 )
local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f16_arg0 )
if f16_arg1.showTrackHelper then
if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then
f16_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = Engine.Localize( "@LUA_MENU_TRACK_OPS" ),
side = "left",
clickable = false,
immediate = true,
priority = 1
} )
end
else
f16_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = "",
side = "left",
clickable = false,
immediate = true,
priority = 1
} )
end
f16_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_shoulderl",
button_ref2 = "",
helper_text = Engine.Localize( "@LUA_MENU_TOP" ),
side = "left",
clickable = true,
immediate = true,
priority = 2
} )
f16_arg0:processEvent( {
name = "setup_sort_type_button_helper"
} )
end
function GetTrackedOpsButton( f17_arg0, f17_arg1, f17_arg2, f17_arg3 )
local f17_local0 = {
name = "",
progressText = "",
progressValue = 0,
desc = "",
category = "",
groupRef = ""
}
if f17_arg2 ~= "" then
local f17_local1 = GetOperationData( f17_arg0, f17_arg2 )
local f17_local2 = getGroupRefForOperation( f17_arg2 )
local f17_local3 = Engine.Localize( GetFieldForOperationsGroup( f17_local2, OperationGroups.Cols.Name ) )
f17_local0.name = f17_local1.Name
f17_local0.progressText = f17_local1.ProgressText
f17_local0.progressValue = f17_local1.PercentProgress
f17_local0.desc = f17_local1.Desc
f17_local0.category = f17_local3
f17_local0.groupRef = f17_local2
end
return {
type = "popup_track_op_button",
id = "tracked_op_button_" .. f17_arg1,
properties = {
controller = f17_arg0,
index = f17_arg1 - 1,
text = f17_local0.name,
progressText = f17_local0.progressText,
progressValue = f17_local0.progressValue,
desc = f17_local0.desc,
progressBarWidth = 450,
number = f17_arg1,
category = f17_local0.category,
trackOpsPopup = f17_arg3 or false,
groupRef = f17_local0.groupRef
},
disabled = not f17_arg3
}
end
function TrackedOpsPanelFeeder( f18_arg0 )
local f18_local0 = f18_arg0.exclusiveController
local f18_local1 = {
[#f18_local1 + 1] = {
type = "UIElement",
id = "spacer",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
height = 20
}
}
}
}
for f18_local2 = 1, MaxTrackedOperations, 1 do
f18_local1[#f18_local1 + 1] = GetTrackedOpsButton( f18_local0, f18_local2, GetTrackedOp( f18_local0, f18_local2 - 1 ) )
end
return f18_local1
end
function operations_main_menu()
return {
type = "UIElement",
id = "operations_main_menu",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
properties = {
currency = "200"
},
handlers = {
menu_create = function ( f20_arg0, f20_arg1 )
assert( f20_arg0.properties.exclusiveController )
local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 )
f20_local0.controller = f20_arg0.properties.exclusiveController
end
},
children = {
{
type = "UIImage",
id = "main_background",
states = {
default = {
material = RegisterMaterial( "bkgd_cas" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
}
}
},
{
type = "generic_menu_title",
id = "menu_title_text",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ),
additional_handlers = {
update_operations_title = function ( f21_arg0, f21_arg1 )
if f21_arg1.string then
f21_arg0:processEvent( {
name = "update_header_text",
string = f21_arg1.string
} )
end
end
}
}
},
{
type = "button_helper_text_main",
id = "button_helper_text_id",
handlers = {
menu_create = function ( f22_arg0, f22_arg1 )
local f22_local0 = LUI.ButtonHelperText.CommonEvents.addBackButton
f22_local0.ignorePopups = true
f22_arg0:processEvent( f22_local0 )
SetupMainMenuButtonHelpers( f22_arg0, f22_arg1 )
end
,
setup_main_menu_button_helpers = SetupMainMenuButtonHelpers,
setup_operation_list_button_helpers = SetupOperationListMenuButtonHelpers,
setup_sort_type_button_helper = SetupSortButtonHelper
}
},
{
type = "online_friends_widget",
id = "online_friends_widget_id",
properties = {
ignorePopups = true
}
},
{
type = "cac_edit_currency",
id = "cac_edit_currency_id"
},
{
type = "UIElement",
id = "left_panel_id",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
children = {
{
type = "UIImage",
id = "vlist_background",
states = {
default = {
material = RegisterMaterial( "gradient_top" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 100,
right = 100 + OPERATIONS_LIST_WIDTH,
top = 120,
bottom = -72,
red = 0,
green = 0,
blue = 0,
alpha = 0
},
visible = {
alpha = 0.15
}
},
handlers = {
hide_groups = MBh.AnimateToState( "visible", 0 ),
show_groups = MBh.AnimateToState( "default", 0 )
}
},
{
type = "UIVerticalList",
id = "group_options_list",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right,
alignment = LUI.Alignment.Top,
alpha = 1,
spacing = 1
},
hidden = {
alpha = 0
}
},
childrenFeeder = GroupButtonsFeeder,
handlers = {
hide_groups = MBh.AnimateToState( "hidden", 0 ),
show_groups = MBh.AnimateToState( "default", 0 )
}
}
}
},
{
type = "operations_info_panel"
},
{
type = "UIElement",
id = "tracked_operations_panel",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom,
left = -700,
right = -150,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
hide_tracked_ops = MBh.AnimateToState( "hidden", 0 ),
show_tracked_ops = MBh.AnimateToState( "default", 0 )
},
children = {
{
type = "UIVerticalList",
id = "tracked_operations_layout_list",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "generic_menu_titlebar",
id = "tracked_operations_title",
properties = {
font = CoD.TextSettings.BoldFont,
title_bar_text = Engine.Localize( "LUA_MENU_MP_TRACKED_OPS" ),
title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth,
title_bar_alignment = LUI.Alignment.Left
}
},
{
type = "generic_menu_background_withfade",
id = "bkgd",
properties = {
top_offset = 0,
fade_height = defaultHeight,
hide_shadow = true
},
children = {
{
type = "UIVerticalList",
id = "tracked_operations_ops_vlist",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
childrenFeeder = TrackedOpsPanelFeeder
}
}
}
}
}
}
},
{
type = "UIBindButton",
id = "bind_button_id",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
end
function operation_button( f23_arg0, f23_arg1, f23_arg2 )
local f23_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f23_local1 = 48
local f23_local2 = 5
local f23_local3 = 10
local f23_local4 = -18
local f23_local5 = 28
local f23_local6 = 9
local f23_local7 = f23_arg1.controller
local f23_local8 = f23_arg1.groupRef
local f23_local9 = f23_arg1.opIdx
local f23_local10 = nil
if f23_local0.isWeaponGroup then
f23_local10 = GetOperationForWeaponFromCache( f23_local7, f23_local0.currentWeaponClass, f23_local0.currentWeaponRef, f23_local9 )
else
f23_local10 = GetCachedOpForGroup( f23_local7, f23_local8, f23_local9 )
end
local f23_local11 = IsOpTracked( f23_local7, f23_local10 )
local f23_local12 = GetCachedOperationData( f23_local7, f23_local10 )
local f23_local13 = f23_local12.Name or "Active OP"
local f23_local14 = f23_local12.ProgressText or "0/0"
local f23_local15 = f23_local12.PercentProgress or 0.5
local f23_local16
if f23_local11 then
f23_local16 = 1
if not f23_local16 then
else
local f23_local17
if f23_local11 then
f23_local17 = 0
if not f23_local17 then
else
local self = LUI.UIButton.new()
self.id = "operation_button_id"
self.properties = {
Name = f23_local13,
ProgressText = f23_local14,
Progress = f23_local15,
ShowActiveOverlay = f23_local16,
FooterAlpha = f23_local17,
opIdx = f23_local9
}
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 32,
right = -12,
top = 0,
bottom = f23_local1
} )
self:animateToState( "default" )
local f23_local19 = LUI.UIImage.new()
f23_local19.id = "bnt_bkg_id"
f23_local19:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0
} )
f23_local19:registerAnimationState( "dimmed", {
alpha = 0.5
} )
f23_local19:registerAnimationState( "focus", {
alpha = 0.8
} )
f23_local19:animateToState( "default", 0 )
f23_local19:registerEventHandler( "button_over", MBh.AnimateLoop( {
{
"focus",
0,
true,
true
},
{
"focus",
350,
true,
true
},
{
"dimmed",
750,
true,
true
},
{
"focus",
750,
true,
true
}
} ) )
f23_local19:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
self:addElement( f23_local19 )
local f23_local20 = LUI.UIMarqueeText.new()
f23_local20.id = "op_name_id"
f23_local20.properties = {
groupRef = f23_local8,
opIdx = f23_local9,
controller = f23_local7
}
f23_local20:registerAnimationState( "default", {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f23_local3,
right = -140,
top = f23_local2,
bottom = f23_local2 + CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1,
alpha = 1
} )
f23_local20:registerAnimationState( "hilight", {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f23_local3,
right = -140,
top = f23_local2,
bottom = f23_local2 + CoD.TextSettings.NormalFont.Height,
alpha = 1
} )
f23_local20:registerEventHandler( "button_over", function ( element, event )
element:SetColor( Colors.grey_2.r, Colors.grey_2.g, Colors.grey_2.b )
local f24_local0 = element.properties.controller
local f24_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f24_local2 = nil
if f24_local1.isWeaponGroup then
f24_local2 = GetOperationForWeaponFromCache( f24_local0, f24_local1.currentWeaponClass, f24_local1.currentWeaponRef, element.properties.opIdx )
else
f24_local2 = GetCachedOpForGroup( f24_local0, element.properties.groupRef, element.properties.opIdx )
end
element:dispatchEventToRoot( {
name = "setup_operation_list_button_helpers",
showTrackHelper = not IsOpTracked( f24_local0, f24_local2 )
} )
end )
f23_local20:registerEventHandler( "button_up", function ( element, event )
local f25_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f25_local1 = nil
if f25_local0.isWeaponGroup then
f25_local1 = GetOperationForWeaponFromCache( f23_local7, f25_local0.currentWeaponClass, f25_local0.currentWeaponRef, element.properties.opIdx )
else
f25_local1 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx )
end
if IsOpTracked( f23_local7, f25_local1 ) then
element:animateToState( "hilight" )
element:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b )
else
element:SetColor( Colors.white.r, Colors.white.g, Colors.white.b )
element:animateToState( "default" )
end
end )
f23_local20:registerEventHandler( "refresh_available_ops", function ( element, event )
local f26_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f26_local1 = nil
if f26_local0.isWeaponGroup then
f26_local1 = GetOperationForWeaponFromCache( f23_local7, f26_local0.currentWeaponClass, f26_local0.currentWeaponRef, element.properties.opIdx )
else
f26_local1 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx )
end
local f26_local2 = GetCachedOperationData( event.controller, f26_local1 )
element:setText( f26_local2.Name )
if IsOpTracked( f23_local7, f26_local1 ) then
if element:isParentInFocus() then
element:SetColor( Colors.grey_2.r, Colors.grey_2.g, Colors.grey_2.b )
else
element:animateToState( "hilight" )
element:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b )
end
else
element:animateToState( "default" )
element:SetColor( Colors.white.r, Colors.white.g, Colors.white.b )
end
end )
f23_local20:setText( f23_local13 )
if f23_local16 == 1 then
f23_local20:animateToState( "hilight" )
else
f23_local20:animateToState( "default" )
end
self:addElement( f23_local20 )
local f23_local21 = LUI.UIText.new()
f23_local21.id = "prog_text_id"
f23_local21.properties = {
groupRef = f23_local8,
opIdx = f23_local9,
weaponClass = f23_local0.currentWeaponClass,
weaponRef = f23_local0.currentWeaponRef
}
f23_local21:registerAnimationState( "default", {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = f23_local4,
top = 5,
bottom = 5 + CoD.TextSettings.NormalFont.Height,
red = 0.7,
green = 0.7,
blue = 0.7,
alpha = 1
} )
f23_local21:registerAnimationState( "focus", {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = f23_local4,
top = 5,
bottom = 5 + CoD.TextSettings.NormalFont.Height,
red = 0.2,
green = 0.2,
blue = 0.2,
alpha = 1
} )
f23_local21:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f23_local21:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f23_local21:registerEventHandler( "refresh_operations_progress", function ( element, event )
local f27_local0 = nil
if f23_local0.isWeaponGroup then
f27_local0 = GetOperationForWeaponFromCache( event.controller, element.properties.weaponClass, element.properties.weaponRef, element.properties.opIdx )
else
f27_local0 = GetCachedOpForGroup( event.controller, element.properties.groupRef, element.properties.opIdx )
end
local f27_local1 = GetCachedOperationData( event.controller, f27_local0 )
element:setText( f27_local1.ProgressText )
end )
f23_local21:setText( f23_local14 )
f23_local21:animateToState( "default" )
self:addElement( f23_local21 )
local f23_local22 = operation_progress_bar( nil, {
width = OPERATIONS_LIST_WIDTH - f23_local3 + f23_local4,
progress = f23_local15,
groupRef = f23_local8,
opIdx = f23_local9,
weaponClass = f23_local0.currentWeaponClass,
weaponRef = f23_local0.currentWeaponRef
} )
f23_local22:registerAnimationState( "positioned", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f23_local3,
right = f23_local4,
top = f23_local5,
bottom = f23_local5 + f23_local6
} )
f23_local22:registerEventHandler( "refresh_operations_progress", function ( element, event )
local f28_local0 = nil
if f23_local0.isWeaponGroup then
f28_local0 = GetOperationForWeaponFromCache( event.controller, element.properties.weaponClass, element.properties.weaponRef, element.properties.opIdx )
else
f28_local0 = GetCachedOpForGroup( event.controller, element.properties.groupRef, element.properties.opIdx )
end
local f28_local1 = GetCachedOperationData( event.controller, f28_local0 )
element:updateProgressBar( f28_local1.PercentProgress, 1000 )
end )
f23_local22:animateToState( "positioned" )
self:addElement( f23_local22 )
local f23_local23 = 0
self:addElement( HairlineBorderType( "bottom", 0.5, 0.5, 0.5, 0.4 ) )
local f23_local24 = LUI.UIElement.new()
f23_local24.id = "current_selection_overlay_container"
f23_local24.properties = {
groupRef = f23_local8,
opIdx = f23_local9
}
f23_local24:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1
} )
f23_local24:registerEventHandler( "refresh_available_ops", function ( element, event )
local f29_local0 = nil
if f23_local0.isWeaponGroup then
f29_local0 = GetOperationForWeaponFromCache( f23_local7, f23_local0.currentWeaponClass, f23_local0.currentWeaponRef, element.properties.opIdx )
else
f29_local0 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx )
end
local f29_local1 = IsOpTracked( event.controller, f29_local0 )
local f29_local2 = element:getChildById( "current_selection_overlay" )
if f29_local1 and not f29_local2 then
AddOverlay( element, f23_local23 )
elseif not f29_local1 and f29_local2 then
element:closeChildren()
end
end )
f23_local24:animateToState( "default" )
self:addElement( f23_local24 )
if f23_local16 == 1 then
AddOverlay( f23_local24, f23_local23 )
end
return self
end
end
f23_local17 = 0.5
end
end
f23_local16 = 0
end
function AddOverlay( menu, controller )
local self = LUI.UIImage.new()
local f30_local1 = "current_selection_overlay"
self:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 0.08
} )
self.id = f30_local1
self:animateToState( "default" )
menu:addElement( self )
f30_local1 = LUI.UIImage.new()
local f30_local2 = "overlay_yellow_block"
f30_local1:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
width = 8,
right = -5,
top = 5,
bottom = -5,
red = Colors.frontend_hilite.r,
green = Colors.frontend_hilite.g,
blue = Colors.frontend_hilite.b,
alpha = 1
} )
f30_local1.id = f30_local2
f30_local1:animateToState( "default" )
menu:addElement( f30_local1 )
f30_local2 = HairlineBorderType( "left", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 )
local f30_local3 = HairlineBorderType( "right", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 )
local f30_local4 = HairlineBorderType( "top", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 )
local f30_local5 = HairlineBorderType( "bottom", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 )
menu:addElement( f30_local2 )
menu:addElement( f30_local3 )
menu:addElement( f30_local4 )
menu:addElement( f30_local5 )
end
function GetOperationButton( f31_arg0, f31_arg1, f31_arg2 )
local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f31_local1, f31_local2 = nil
if f31_local0.isWeaponGroup then
f31_local1 = GetOperationForWeaponFromCache( f31_arg0, f31_local0.currentWeaponClass, f31_local0.currentWeaponRef, f31_arg2 )
else
f31_local1 = GetCachedOpForGroup( f31_arg0, f31_arg1, f31_arg2 )
end
return {
type = "operation_button",
id = "op_button_" .. f31_local1 .. "_id",
properties = {
controller = f31_arg0,
groupRef = f31_arg1,
opIdx = f31_arg2
},
handlers = {
button_action = function ( f32_arg0, f32_arg1 )
local f32_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f32_local1 = f32_arg0.properties.groupRef
local f32_local2 = f32_arg0.properties.opIdx
local f32_local3 = nil
if f32_local0.isWeaponGroup then
f32_local3 = GetOperationForWeaponFromCache( f32_arg0.properties.exclusiveController, f32_local0.currentWeaponClass, f32_local0.currentWeaponRef, f32_local2 )
else
f32_local3 = GetCachedOpForGroup( f32_arg0.properties.exclusiveController, f32_local1, f32_arg0.properties.opIdx )
end
if not IsOpTracked( f32_arg0.properties.exclusiveController, f32_local3 ) then
LUI.FlowManager.RequestPopupMenu( f32_arg0, "popup_track_op", true, f32_arg1.controller, false, {
newOp = f32_local3
} )
end
end
,
button_over = function ( f33_arg0, f33_arg1 )
local f33_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f33_local1 = f33_arg0.properties.groupRef
local f33_local2 = f33_arg0.properties.opIdx
local f33_local3 = nil
if f33_local0.isWeaponGroup then
f33_local3 = GetOperationForWeaponFromCache( f33_arg0.properties.exclusiveController, f33_local0.currentWeaponClass, f33_local0.currentWeaponRef, f33_local2 )
else
f33_local3 = GetCachedOpForGroup( f33_arg0.properties.exclusiveController, f33_local1, f33_arg0.properties.opIdx )
end
local f33_local4 = GetCachedOperationData( f33_arg0.properties.exclusiveController, f33_local3 )
f33_arg0:dispatchEventToRoot( {
name = "update_focused_op",
opRef = f33_local3
} )
f33_arg0:dispatchEventToRoot( {
name = "refresh_operation_info_panel",
opData = f33_local4,
immediate = true
} )
end
}
}
end
function OperationButtonsFeeder( f34_arg0 )
local f34_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
local f34_local1 = nil
if f34_local0.isWeaponGroup then
f34_local1 = GetWeaponOpsForClass( f34_local0.currentWeaponClass )
else
f34_local1 = GetCachedOpsInGroup( f34_arg0.exclusiveController, f34_arg0.groupRef )
end
local f34_local2 = {}
for f34_local6, f34_local7 in ipairs( f34_local1 ) do
f34_local2[#f34_local2 + 1] = GetOperationButton( f34_arg0.exclusiveController, f34_arg0.groupRef, f34_local6 )
end
return f34_local2
end
function exitSelectionPopup( f35_arg0, f35_arg1 )
local f35_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
if f35_local0.isWeaponGroup then
local f35_local1 = LUI.FlowManager.RequestRestoreMenu
local f35_local2 = f35_arg0
local f35_local3 = LUI.FlowManager.IsInStack
local f35_local4 = Engine.GetLuiRoot()
f35_local1( f35_local2, f35_local3( f35_local4.flowManager, "cac_edit_popup_main_second" ) and "cac_edit_popup_main_second" or "cac_edit_popup_main", true, f35_arg1.controller, true )
f35_arg0:dispatchEventToRoot( {
name = "show_cac_edit_popup",
controller = f35_arg1.controller,
immediate = true
} )
f35_arg0:dispatchEventToRoot( {
name = "hide_widget"
} )
else
LUI.FlowManager.RequestRestoreMenu( f35_arg0, "operations_main_menu", true, f35_arg1.controller, true )
f35_arg0:dispatchEventToRoot( {
name = "show_tracked_ops",
immediate = true
} )
end
f35_arg0:dispatchEventToRoot( {
name = "refresh_operation_info_panel",
immediate = true
} )
f35_arg0:dispatchEventToRoot( {
name = "show_groups",
immediate = true,
dispatchChildren = true
} )
f35_arg0:dispatchEventToRoot( {
name = "update_operations_title",
string = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" )
} )
f35_arg0:dispatchEventToRoot( {
name = "setup_main_menu_button_helpers"
} )
end
function CycleSortMethod( f36_arg0, f36_arg1 )
OperationUtilsCache.CurrentSortType = OperationUtilsCache.CurrentSortType + 1
if #OperationUtilsCache.SortTypes < OperationUtilsCache.CurrentSortType then
OperationUtilsCache.CurrentSortType = 1
end
f36_arg0:dispatchEventToRoot( {
name = "refresh_selection_popup",
controller = f36_arg1.controller
} )
f36_arg0:dispatchEventToRoot( {
name = "setup_sort_type_button_helper",
controller = f36_arg1.controller
} )
end
function JumpToTop( f37_arg0, f37_arg1 )
local f37_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" )
f37_arg0:dispatchEventToRoot( {
name = "refresh_selection_popup",
controller = f37_arg1.controller
} )
f37_arg0:dispatchEventToRoot( {
name = "reset_list_focus"
} )
Engine.PlaySound( CoD.SFX.ChangeScreen )
end
function operations_selection_popup()
return {
type = "UIStencil",
id = "operations_selection_popup_id",
properties = {
focusedOpRef = "",
sendScrollEvents = true,
scrollByChildHeight = true,
disableOutsideChildren = true
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 68,
right = 110 + OPERATIONS_LIST_WIDTH,
top = 125,
height = 490
}
},
handlers = {
update_focused_op = function ( f39_arg0, f39_arg1 )
f39_arg0.properties.focusedOpRef = f39_arg1.opRef
end
,
menu_create = function ( f40_arg0, f40_arg1 )
local f40_local0 = f40_arg0:getFirstDescendentById( "scroll_bar_id" )
f40_local0:setList( f40_arg0:getFirstDescendentById( "operations_selection_popup_list_id" ) )
end
,
refresh_selection_popup = function ( f41_arg0, f41_arg1 )
f41_arg0:processEvent( {
name = "menu_refresh",
controller = f41_arg1.controller
} )
end
},
children = {
{
type = "UIVerticalList",
id = "operations_selection_popup_list_id",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alignment = LUI.Alignment.Top,
spacing = 1
}
},
childrenFeeder = OperationButtonsFeeder,
handlers = {
reset_list_focus = function ( f42_arg0, f42_arg1 )
f42_arg0:processEvent( {
name = "lose_focus",
immediate = true
} )
f42_arg0:clearSavedState()
f42_arg0:processEvent( {
name = "gain_focus",
immediate = true
} )
end
}
},
{
type = "UIVerticalScrollbar",
id = "scroll_bar_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = 10,
alpha = scrollBarAlpha
}
}
},
{
type = "online_friends_widget",
states = {
default = {
scale = -1,
alpha = 0
}
}
},
{
type = "UIBindButton",
id = "bind_button_id",
handlers = {
button_secondary = exitSelectionPopup,
button_shoulderr = CycleSortMethod,
button_shoulderl = JumpToTop
}
}
}
}
end
function operation_progress_bar( f43_arg0, f43_arg1, f43_arg2 )
local f43_local0 = 9
local f43_local1 = 300
local f43_local2 = f43_arg1.progress or 0
local f43_local3 = f43_arg1.width or f43_local1
local f43_local4 = f43_arg1.groupRef or ""
local f43_local5 = f43_arg1.opIdx or 0
local self = LUI.UIElement.new()
self.id = "progress_bar_root_container"
self.properties = {
progress = f43_local2,
width = f43_local3,
groupRef = f43_local4,
opIdx = f43_local5
}
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = f43_local3,
top = 0,
bottom = f43_local0
} )
self:animateToState( "default" )
local f43_local7 = LUI.UIImage.new()
f43_local7.id = "background_id"
f43_local7:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 0.7,
green = 0.7,
blue = 0.7,
alpha = 1
} )
f43_local7:animateToState( "default" )
self:addElement( f43_local7 )
local f43_local8 = LUI.UIImage.new()
f43_local8.id = "forground_id"
f43_local8:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 1,
right = -1,
top = 1,
bottom = -1,
red = 0.1,
green = 0.1,
blue = 0.1,
alpha = 1
} )
f43_local8:animateToState( "default" )
self:addElement( f43_local8 )
if f43_local2 > 1 then
f43_local2 = 1
end
if f43_local2 < 0 then
f43_local2 = 0
end
local f43_local9 = f43_local3 * f43_local2
local f43_local10 = LUI.UIImage.new()
f43_local10.id = "fill_id"
f43_local10:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 0.7,
green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 0.7,
blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 0.7,
alpha = 1
} )
f43_local10:registerAnimationState( "fill", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f43_local9,
top = 0,
bottom = 0,
red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 0.7,
green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 0.7,
blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 0.7
} )
f43_local10:registerAnimationState( "focus", {
red = Colors.frontend_hilite.r,
green = Colors.frontend_hilite.g,
blue = Colors.frontend_hilite.b
} )
f43_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f43_local10:registerEventHandler( "button_up", MBh.AnimateToState( "fill" ) )
f43_local10:animateToState( "default" )
f43_local10:animateToState( "fill", 1000 )
self:addElement( f43_local10 )
self.updateProgressBar = function ( f44_arg0, f44_arg1, f44_arg2 )
f43_local10:registerAnimationState( "fill", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = math.min( f44_arg1, 1 ) * f44_arg0.properties.width,
top = 0,
bottom = 0,
red = 0.7,
green = 0.7,
blue = 0.7
} )
f43_local10:animateToState( "fill", f44_arg2 )
end
return self
end
function operations_info_panel()
return {
type = "UIVerticalList",
id = "operations_info_panel_id",
properties = {
name = "OPERATION NAME",
desc = "Some text about how to complete Airborne operation.",
progress_text = "20/25",
progress_percent = 0.8,
reward_xp = "2500 xp",
reward_currency = "1",
image = RegisterMaterial( "white" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 650,
right = 1050,
top = 120,
bottom = 490,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
refresh_operation_info_panel = function ( f46_arg0, f46_arg1 )
if f46_arg1.opData then
f46_arg0:animateToState( "visible", 0 )
f46_arg0:dispatchEventToChildren( f46_arg1 )
else
f46_arg0:animateToState( "default", 0 )
end
end
},
children = {
{
type = "generic_menu_titlebar",
id = "info_panel_header_id",
properties = {
font = CoD.TextSettings.BoldFont,
title_bar_text = MBh.Property( "name" ),
title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth,
title_bar_alignment = LUI.Alignment.Left,
marquee = true
},
handlers = {
refresh_operation_info_panel = function ( f47_arg0, f47_arg1 )
local f47_local0 = f47_arg0:getChildById( "title" )
if f47_local0 then
f47_local0:setText( f47_arg1.opData.Name )
end
end
}
},
{
type = "operations_info_panel_desc",
id = "info_panel_desc_id",
properties = {
text = MBh.Property( "desc" )
}
},
{
type = "operations_info_panel_sub_header",
id = "info_panel_sub_header_1_id",
properties = {
text = Engine.Localize( "@LUA_MENU_PROGRESS" ),
show_completed_text = true
}
},
{
type = "operations_info_panel_progress",
id = "progress_widget_id",
properties = {
progressText = "0/0",
progressPercent = 0.5
}
},
{
type = "operations_info_panel_sub_header",
id = "info_panel_sub_header_2_id",
properties = {
text = Engine.Localize( "@LUA_MENU_REWARD" )
}
},
{
type = "operations_info_panel_rewards",
id = "info_panel_rewards_widget_id",
properties = {
reward_xp = "5000 xp",
reward_currency = "2"
}
}
}
}
end
function operations_info_panel_header()
return {
type = "UIElement",
properties = {
text = Engine.Localize( "@LUA_MENU_TITLE" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 24
}
},
children = {
{
type = "UIImage",
id = "info_pane_header_bg_lt",
states = {
default = {
material = RegisterMaterial( "box_titlebar_angle_lt" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 20,
top = 0,
bottom = 0,
alpha = 0.5
}
}
},
{
type = "UIImage",
id = "info_pane_header_bg_mid",
states = {
default = {
material = RegisterMaterial( "box_titlebar_angle_mid" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 20,
right = -20,
top = 0,
bottom = 0,
alpha = 0.5
}
}
},
{
type = "UIImage",
id = "info_pane_header_bg_rt",
states = {
default = {
material = RegisterMaterial( "box_titlebar_angle_lt" ),
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -20,
top = 0,
bottom = 0,
alpha = 0.5
}
}
},
{
type = "UIText",
id = "info_pane_header_text",
properties = {
text = MBh.Property( "text" )
},
states = {
default = {
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 10,
right = 0,
top = -0.5 * CoD.TextSettings.BoldFont.Height,
bottom = 0.5 * CoD.TextSettings.BoldFont.Height,
red = 0.8,
green = 0.8,
blue = 0.8
}
},
handlers = {
refresh_operation_info_panel = function ( f49_arg0, f49_arg1 )
f49_arg0:setText( f49_arg1.opData.Name )
end
}
}
}
}
end
function operations_info_panel_sub_header()
local f50_local0 = 10
return {
type = "UIElement",
properties = {
text = "sub header",
show_completed_text = false
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 25
}
},
children = {
{
type = "generic_menu_background",
id = "bkg",
properties = {
top_offset = 0,
fill_color = {
red = 1,
green = 1,
blue = 1
},
fill_alpha = 0.2,
show_completed_text = MBh.Property( "show_completed_text" )
}
},
{
type = "UIText",
id = "info_pane_header_text",
properties = {
text = MBh.Property( "text" )
},
states = {
default = {
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = f50_local0,
right = -f50_local0,
top = -CoD.TextSettings.BoldFont.Height / 2,
bottom = CoD.TextSettings.BoldFont.Height / 2,
red = 0.7,
green = 0.7,
blue = 0.7
}
}
},
{
type = "UIText",
id = "info_pane_completed_text",
properties = {
text = "",
show_completed_text = MBh.Property( "show_completed_text" )
},
states = {
default = {
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Right,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = f50_local0,
right = -f50_local0,
top = -CoD.TextSettings.BoldFont.Height / 2,
bottom = CoD.TextSettings.BoldFont.Height / 2,
red = Colors.frontend_hilite.r,
green = Colors.frontend_hilite.g,
blue = Colors.frontend_hilite.b
}
},
handlers = {
refresh_operation_info_panel = function ( f51_arg0, f51_arg1 )
if f51_arg0.properties.show_completed_text and f51_arg1.opData and f51_arg1.opData.Completed then
if f51_arg1.opData.PercentProgress < 1 then
f51_arg0:setText( Engine.Localize( "@LUA_MENU_PREVIOUSLY_COMPLETED" ) )
else
f51_arg0:setText( Engine.Localize( "@LUA_MENU_COMPLETED" ) )
end
else
f51_arg0:setText( "" )
end
end
}
}
}
}
end
function operations_info_panel_desc()
local f52_local0 = 10
local f52_local1 = 5
return {
type = "UIElement",
properties = {
text = "desc"
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 55
}
},
children = {
{
type = "generic_menu_background",
id = "bkg",
properties = {
top_offset = 0
}
},
{
type = "UIText",
id = "info_pane_header_text",
properties = {
text = MBh.Property( "text" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f52_local0,
right = -f52_local0,
top = f52_local1,
bottom = f52_local1 + CoD.TextSettings.NormalFont.Height,
red = 0.7,
green = 0.7,
blue = 0.7
}
},
handlers = {
refresh_operation_info_panel = function ( f53_arg0, f53_arg1 )
f53_arg0:setText( f53_arg1.opData.Desc )
end
}
}
}
}
end
function operations_info_panel_progress()
local f54_local0 = 50
local f54_local1 = 10
local f54_local2 = 85
local f54_local3 = 9
local f54_local4 = 380
return {
type = "UIElement",
id = "progress_widget_id",
properties = {
progressText = "0/0",
progressPercent = 0
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = f54_local0
}
},
children = {
{
type = "generic_menu_background",
id = "bkg",
properties = {
top_offset = 0
}
},
{
type = "UIText",
id = "progress_text_id",
properties = {
text = MBh.Property( "progressText" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = f54_local1,
right = 0,
top = -8 - CoD.TextSettings.NormalFont.Height / 2,
bottom = -8 + CoD.TextSettings.NormalFont.Height / 2,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
refresh_operation_info_panel = function ( f55_arg0, f55_arg1 )
f55_arg0:setText( f55_arg1.opData.Progress .. "/" .. f55_arg1.opData.MaxProgress )
end
}
},
{
type = "operation_progress_bar",
id = "btn_progress_bar",
properties = {
progress = MBh.Property( "progressPercent" ),
width = f54_local4
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = f54_local1,
right = f54_local1 + f54_local4,
top = 10 - f54_local3 / 2,
bottom = 10 + f54_local3 / 2
}
},
handlers = {
refresh_operation_info_panel = function ( f56_arg0, f56_arg1 )
f56_arg0:updateProgressBar( f56_arg1.opData.PercentProgress, 100 )
end
}
}
}
}
end
function squadPointsRewardsFeeder( f57_arg0 )
local f57_local0 = 16
local f57_local1 = 16
local f57_local2 = {}
local f57_local3, f57_local4, f57_local5, f57_local6 = GetTextDimensions( Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
f57_local2[#f57_local2 + 1] = {
type = "UIText",
id = "currency_text_id",
properties = {
text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = 0,
width = f57_local5 - f57_local3 + 3,
height = CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
}
}
f57_local2[#f57_local2 + 1] = {
type = "UIImage",
id = "space_0_id",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
material = RegisterMaterial( "white" ),
left = 0,
top = 0,
width = 8,
bottom = 0,
alpha = 0
}
}
}
f57_local2[#f57_local2 + 1] = {
type = "UIImage",
id = "token",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
material = RegisterMaterial( "icon_unlock_token_active" ),
left = 0,
top = (CoD.TextSettings.NormalFont.Height - f57_local1) / 2,
width = f57_local0,
height = f57_local1
}
}
}
f57_local2[#f57_local2 + 1] = {
type = "UIImage",
id = "space_1_id",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
material = RegisterMaterial( "white" ),
left = 0,
top = 0,
width = 8,
bottom = 0,
alpha = 0
}
}
}
f57_local2[#f57_local2 + 1] = {
type = "UIText",
id = "count",
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 110,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
refresh_operation_info_panel = function ( f58_arg0, f58_arg1 )
f58_arg0:setText( f58_arg1.opData.RewardCurrency )
end
}
}
return f57_local2
end
function operations_info_panel_rewards()
local f59_local0 = 190
local f59_local1 = 5
local f59_local2 = -250
local f59_local3 = 75
local f59_local4 = 55
local f59_local5 = 24
local f59_local6 = -20
local f59_local7 = 45
local f59_local8 = -130
local f59_local9 = 130
local f59_local10 = 100
return {
type = "UIElement",
id = "rewards_widget_id",
properties = {
reward_xp = "2500 xp",
reward_currency = "Currency: 1",
reward_icon = RegisterMaterial( "white" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = f59_local0
}
},
children = {
{
type = "generic_menu_background_withfade",
id = "bkg",
properties = {
top_offset = 0,
fade_height = f59_local0 - 3,
hide_shadow = true
}
},
{
type = "UIVerticalList",
id = "rewards_list_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f59_local1,
right = -f59_local1,
top = 10
}
},
children = {
{
type = "UIText",
id = "reward_xp_text_id",
properties = {
text = MBh.Property( "reward_xp" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f59_local1,
right = 0,
top = 32,
bottom = 32 + CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
refresh_operation_info_panel = function ( f60_arg0, f60_arg1 )
f60_arg0:setText( f60_arg1.opData.RewardXP .. " " .. Engine.Localize( "@LUA_MENU_XP" ) )
end
}
},
{
type = "UIHorizontalList",
id = "squad_points_list_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f59_local1,
right = 0,
top = 10,
bottom = 10 + CoD.TextSettings.NormalFont.Height
}
},
childrenFeeder = squadPointsRewardsFeeder
},
{
type = "UIText",
id = "reward_item_text_id",
properties = {
text = ""
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f59_local1,
right = 0,
top = 32,
bottom = 32 + CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
refresh_operation_info_panel = function ( f61_arg0, f61_arg1 )
local f61_local0 = f61_arg1.opData
local f61_local1 = getUnlocksByChallenge( f61_local0.Ref, f61_local0.ActiveTier )
local f61_local2 = ""
for f61_local6, f61_local7 in ipairs( f61_local1 ) do
if f61_local7.type ~= "Patch" and isUnlockItem( f61_local7.type ) then
f61_local2 = f61_local2 .. Engine.Localize( "LUA_MENU_OPS_REWARD", getLocNameForUnlockType( f61_local7.type ), Engine.Localize( getNameForUnlockItem( f61_local7.type, f61_local7.item ) ) )
end
end
f61_arg0:setText( f61_local2 )
end
}
},
{
type = "UIElement",
id = "reward_icon_container",
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = f59_local8 * 0.5,
right = -f59_local8 * 0.5,
top = 0,
bottom = f59_local9,
alpha = 1
}
},
handlers = {},
children = {
{
type = "UIElement",
id = "reward_icon_bg",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
refresh_operation_info_panel = function ( f62_arg0, f62_arg1 )
if f62_arg1.opData.RewardImage and f62_arg1.opData.RewardType == "Camo" then
f62_arg0:animateToState( "default", 0 )
else
f62_arg0:animateToState( "hidden", 0 )
end
end
},
children = {
{
type = "UIImage",
id = "reward_icon_bg_outline1",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = -26,
width = 8,
top = -26,
height = 8
}
}
},
{
type = "UIImage",
id = "reward_icon_bg_outline2",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = 18,
width = 8,
top = -26,
height = 8
}
}
},
{
type = "UIImage",
id = "reward_icon_bg_outline3",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = -26,
width = 8,
top = 18,
height = 8
}
}
},
{
type = "UIImage",
id = "reward_icon_bg_outline4",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = 18,
width = 8,
top = 18,
height = 8
}
}
}
}
},
{
type = "UIImage",
id = "reward_icon",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
default_camo = {
leftAnchor = false,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = -25,
right = 25,
top = -25,
bottom = 25,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
refresh_operation_info_panel = function ( f63_arg0, f63_arg1 )
if f63_arg1.opData.RewardImage then
f63_arg0:setImage( f63_arg1.opData.RewardImage )
if f63_arg1.opData.RewardType == "Camo" then
f63_arg0:animateToState( "default_camo", 0 )
else
f63_arg0:animateToState( "default", 0 )
end
else
f63_arg0:animateToState( "hidden", 0 )
end
end
}
}
}
}
}
}
}
}
end
function RefreshOpsCompleted( f64_arg0, f64_arg1 )
local f64_local0 = OperationsTimeoutRewards[#OperationsTimeoutRewards].req
local f64_local1 = GetNumCompletedOps( f64_arg0.properties.exclusiveController )
local f64_local2 = f64_arg0:getChildById( "bonus_progress_text_id" )
f64_local2:setText( math.min( f64_local1, f64_local0 ) .. "/" .. f64_local0 )
local f64_local3 = f64_local1 / f64_local0
local f64_local4 = f64_arg0:getChildById( "bonus_progress_bar_id" )
f64_local4:updateProgressBar( f64_local3, 100 )
local f64_local5 = f64_arg0:getChildById( "ops_completed_list" )
f64_local5:closeChildren()
f64_local5:processEvent( {
name = "menu_refresh"
} )
end
function OpsCompletedFeeder( f65_arg0 )
local f65_local0 = GetNumCompletedOps( f65_arg0.exclusiveController )
local f65_local1 = {
{
req = OperationsTimeoutRewards[1].req,
xp_bonus = 5
},
{
req = OperationsTimeoutRewards[2].req,
xp_bonus = 5
},
{
req = OperationsTimeoutRewards[3].req,
xp_bonus = 5
},
{
req = OperationsTimeoutRewards[4].req,
xp_bonus = 5
},
{
req = OperationsTimeoutRewards[5].req,
xp_bonus = 5
}
}
local f65_local2 = {}
for f65_local3 = 1, #OperationsTimeoutRewards, 1 do
local f65_local6 = 0.7
local f65_local7 = 0.7
local f65_local8 = 0.7
if f65_local1[f65_local3].req <= f65_local0 then
f65_local6 = Colors.frontend_hilite.r
f65_local7 = Colors.frontend_hilite.g
f65_local8 = Colors.frontend_hilite.b
end
f65_local2[#f65_local2 + 1] = {
type = "operations_completed_info_tab",
id = "tab_" .. f65_local3,
properties = {
num_required = f65_local1[f65_local3].req,
xp_bonus = f65_local1[f65_local3].xp_bonus,
text_r = f65_local6,
text_g = f65_local7,
text_b = f65_local8
}
}
end
return f65_local2
end
function operations_completed_info()
local f66_local0 = 50
local f66_local1 = 10
local f66_local2 = 85
local f66_local3 = 9
local f66_local4 = OPERATIONS_LIST_WIDTH - 2 * f66_local1 - 15
return {
type = "UIElement",
id = "operations_completed_id",
properties = {
progressText = "0/5",
progressPercent = 0
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = f66_local0
}
},
children = {
{
type = "generic_menu_background",
id = "bkg",
properties = {
top_offset = 0
}
},
{
type = "UIText",
id = "bonus_progress_text_id",
properties = {
text = MBh.Property( "progressText" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = f66_local1,
right = 0,
top = -8 - CoD.TextSettings.NormalFont.Height / 2,
bottom = -8 + CoD.TextSettings.NormalFont.Height / 2,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
}
},
{
type = "UIHorizontalList",
id = "ops_completed_list",
states = {
default = {
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = f66_local1 + f66_local4 / #OperationsTimeoutRewards - 12,
width = f66_local4,
top = -8 - CoD.TextSettings.NormalFont.Height / 2,
bottom = -8 + CoD.TextSettings.NormalFont.Height / 2,
spacing = f66_local4 / #OperationsTimeoutRewards - 30
}
},
childrenFeeder = OpsCompletedFeeder
},
{
type = "operation_progress_bar",
id = "bonus_progress_bar_id",
properties = {
progress = MBh.Property( "progressPercent" ),
width = f66_local4
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = f66_local1,
right = f66_local1 + f66_local4,
top = 10 - f66_local3 / 2,
bottom = 10 + f66_local3 / 2
}
}
}
},
handlers = {
refresh_ops_completed = RefreshOpsCompleted,
menu_create = RefreshOpsCompleted
}
}
end
function operations_completed_info_tab()
local f67_local0 = 0
local f67_local1 = 4
local f67_local2 = 16
local f67_local3 = 16
return {
type = "UIHorizontalList",
id = "list_id",
properties = {
xp_bonus = MBh.Property( "xp_bonus" ),
text_r = MBh.Property( "text_r" ),
text_g = MBh.Property( "text_g" ),
text_b = MBh.Property( "text_b" )
},
states = {
default = {
alignment = LUI.Alignment.Right,
leftAnchor = false,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
right = f67_local2,
width = 30,
top = f67_local0 - CoD.TextSettings.NormalFont.Height,
bottom = f67_local0,
spacing = 0
}
},
children = {
{
type = "UIText",
id = "xp_bonus_text",
properties = {
text = MBh.Property( "xp_bonus" ),
text_r = MBh.Property( "text_r" ),
text_g = MBh.Property( "text_g" ),
text_b = MBh.Property( "text_b" )
},
states = {
default = {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 10,
top = 0,
bottom = 0,
red = MBh.Property( "text_r" ),
green = MBh.Property( "text_g" ),
blue = MBh.Property( "text_b" ),
alpha = 1
}
}
},
{
type = "UIImage",
id = "token",
states = {
default = {
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
material = RegisterMaterial( "icon_unlock_token_active" ),
left = 0,
top = (CoD.TextSettings.NormalFont.Height - f67_local3) / 2,
width = f67_local2,
height = f67_local3
}
}
}
}
}
end
function HairlineBorder( f68_arg0, f68_arg1, f68_arg2, f68_arg3, f68_arg4 )
local f68_local0 = nil
f68_local0 = f68_arg0 ~= "right"
local f68_local1 = nil
f68_local1 = f68_arg0 ~= "left"
local f68_local2 = nil
f68_local2 = f68_arg0 ~= "bottom"
local f68_local3 = nil
f68_local3 = f68_arg0 ~= "top"
local f68_local4
if f68_arg0 == "right" then
f68_local4 = -1
if not f68_local4 then
else
local f68_local5
if f68_arg0 == "left" then
f68_local5 = 1
if not f68_local5 then
else
local f68_local6
if f68_arg0 == "bottom" then
f68_local6 = -1
if not f68_local6 then
else
local f68_local7
if f68_arg0 == "top" then
f68_local7 = 1
if not f68_local7 then
else
return {
type = "UIImage",
id = f68_arg0 .. "_hairline",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = f68_local0,
rightAnchor = f68_local1,
topAnchor = f68_local2,
bottomAnchor = f68_local3,
left = f68_local4,
right = f68_local5,
top = f68_local6,
bottom = f68_local7,
red = f68_arg1,
green = f68_arg2,
blue = f68_arg3,
alpha = f68_arg4
}
}
}
end
end
f68_local7 = 0
end
end
f68_local6 = 0
end
end
f68_local5 = 0
end
end
f68_local4 = 0
end
function HairlineBorderType( f69_arg0, f69_arg1, f69_arg2, f69_arg3, f69_arg4 )
local f69_local0 = nil
f69_local0 = f69_arg0 ~= "right"
local f69_local1 = nil
f69_local1 = f69_arg0 ~= "left"
local f69_local2 = nil
f69_local2 = f69_arg0 ~= "bottom"
local f69_local3 = nil
f69_local3 = f69_arg0 ~= "top"
local f69_local4
if f69_arg0 == "right" then
f69_local4 = -1
if not f69_local4 then
else
local f69_local5
if f69_arg0 == "left" then
f69_local5 = 1
if not f69_local5 then
else
local f69_local6
if f69_arg0 == "bottom" then
f69_local6 = -1
if not f69_local6 then
else
local f69_local7
if f69_arg0 == "top" then
f69_local7 = 1
if not f69_local7 then
else
local self = LUI.UIImage.new()
self.id = f69_arg0 .. "_hairline"
self:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
leftAnchor = f69_local0,
rightAnchor = f69_local1,
topAnchor = f69_local2,
bottomAnchor = f69_local3,
left = f69_local4,
right = f69_local5,
top = f69_local6,
bottom = f69_local7,
red = f69_arg1,
green = f69_arg2,
blue = f69_arg3,
alpha = f69_arg4
} )
self:animateToState( "default" )
return self
end
end
f69_local7 = 0
end
end
f69_local6 = 0
end
end
f69_local5 = 0
end
end
f69_local4 = 0
end
function WidgetBackground( f70_arg0, f70_arg1, f70_arg2, f70_arg3 )
return {
type = "UIImage",
id = "bkg",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = f70_arg0 or 0,
green = f70_arg1 or 0,
blue = f70_arg2 or 0,
alpha = f70_arg3 or 0.1
}
}
}
end
function AddCostToPopup( f71_arg0, f71_arg1 )
local f71_local0 = f71_arg0:getChildById( "generic_selectionList_window_id" )
if not f71_local0 then
return
end
local f71_local1 = f71_local0:getChildById( "generic_selectionList_content_id" )
if not f71_local1 then
return
end
local f71_local2 = f71_local1:getChildById( "spacer" )
if f71_local2 then
f71_local2:registerAnimationState( "spaced", {
bottom = CoD.TextSettings.NormalFont.Height + 10
} )
f71_local2:animateToState( "spaced", 0 )
addCostTextToElement( f71_local2 )
end
end
function addCostTextToElement( f72_arg0 )
local self = LUI.UIHorizontalList.new()
local f72_local1 = "cost_text_hlist_id"
self:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -CoD.TextSettings.NormalFont.Height / 2,
bottom = CoD.TextSettings.NormalFont.Height / 2,
left = 0,
right = 0,
alignment = LUI.Alignment.Center
} )
self.id = f72_local1
self:animateToState( "default" )
f72_arg0:addElement( self )
f72_local1 = Engine.Localize( "@LUA_MENU_OPS_COST", CostOfNewOperations )
local f72_local2, f72_local3, f72_local4, f72_local5 = GetTextDimensions( f72_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
local f72_local6 = f72_local4 - f72_local2
local f72_local7 = LUI.UIText.new()
f72_local7.id = "costTextId"
f72_local7:registerAnimationState( "default", {
font = CoD.TextSettings.NormalFont.Font,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f72_local6,
top = 0,
bottom = 0,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
} )
f72_local7:animateToState( "default" )
f72_local7:setText( f72_local1 )
self:addElement( f72_local7 )
local f72_local8 = LUI.UIImage.new()
f72_local8.id = "spImageId"
f72_local8:registerAnimationState( "default", {
material = RegisterMaterial( "icon_unlock_token_active" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = CoD.TextSettings.NormalFont.Height,
top = 0,
bottom = 0
} )
f72_local8:animateToState( "default" )
self:addElement( f72_local8 )
end
function popup_confirm_you_cant_afford_new_ops()
return {
type = "generic_confirmation_popup",
id = "popup_confirm_new_ops",
properties = {
popup_title = Engine.Localize( "@MENU_NOTICE" ),
message_text = Engine.Localize( "@LUA_MENU_NOT_ENOUGH_SP_FOR_NEW_OPS" )
},
handlers = {
menu_create = AddCostToPopup
}
}
end
function popup_confirm_new_ops()
return {
type = "generic_confirmation_popup",
id = "popup_confirm_new_ops",
properties = {
popup_title = Engine.Localize( "@MENU_NOTICE" ),
message_text = Engine.Localize( "@LUA_MENU_NEW_OPS_AVAILABLE" ),
confirmation_action = NewOpsHandleConfirmation,
dialog_top = -100,
dialog_bottom = 100
},
handlers = {
popup_back = function ( f75_arg0, f75_arg1 )
NewOpsHandleConfirmation( f75_arg0, f75_arg1 )
end
,
menu_create = function ( f76_arg0, f76_arg1 )
f76_arg0:dispatchEventToChildren( {
name = "update_message",
message_text = Engine.Localize( "@LUA_MENU_NEW_OPS_AVAILABLE" )
} )
end
}
}
end
function popup_confirm_new_ops_purchase()
return {
type = "generic_yesno_popup",
id = "popup_confirm_new_ops",
properties = {
popup_title = Engine.Localize( "@MENU_NOTICE" ),
message_text = Engine.Localize( "@LUA_MENU_CONFIRM_OPS_PURCHASE" ),
yes_action = HandlePurchaseOpsConfirmation,
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
no_text = Engine.Localize( "@LUA_MENU_NO" )
},
handlers = {
menu_create = AddCostToPopup
}
}
end
function TrackOperationOpListPopupChildrenFeeder( f78_arg0 )
local f78_local0 = f78_arg0.exclusiveController
local f78_local1 = {}
for f78_local2 = 1, MaxTrackedOperations, 1 do
f78_local1[#f78_local1 + 1] = GetTrackedOpsButton( f78_local0, f78_local2, GetTrackedOp( f78_local0, f78_local2 - 1 ), true )
end
return f78_local1
end
function TrackOperationPopupChildrenFeeder( f79_arg0 )
local f79_local0 = f79_arg0.exclusiveController
local f79_local1 = {
[#f79_local1 + 1] = {
type = "UIVerticalList",
id = "ops_list",
focusable = true,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
height = 400
}
},
childrenFeeder = TrackOperationOpListPopupChildrenFeeder
},
[#f79_local1 + 1] = {
type = "UIElement",
id = "tracked_op_desc_spacer",
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
height = 15
}
}
},
[#f79_local1 + 1] = {
type = "UIElement",
id = "tracked_op_desc_container",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
height = CoD.TextSettings.NormalFont.Height * 3
}
},
children = {
{
type = "UIText",
id = "tracked_op_category_text",
properties = {
text = ""
},
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = -250,
right = 250,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height
} )
},
handlers = {
refresh_tracked_op_desc = function ( f80_arg0, f80_arg1 )
if f80_arg1.categoryText and f80_arg1.categoryText ~= "" then
f80_arg0:setText( f80_arg1.categoryText )
end
end
}
},
{
type = "UIText",
id = "tracked_op_desc_text",
properties = {
text = ""
},
states = {
default = CoD.ColorizeState( Colors.generic_button_text_default_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = -250,
right = 250,
top = CoD.TextSettings.NormalFont.Height,
bottom = CoD.TextSettings.NormalFont.Height * 2
} )
},
handlers = {
refresh_tracked_op_desc = function ( f81_arg0, f81_arg1 )
f81_arg0:setText( f81_arg1.text )
end
}
}
}
}
}
return f79_local1
end
function popup_track_op()
return {
type = "generic_selectionList_popup",
id = "popup_track_op",
properties = {
popup_title = Engine.Localize( "@LUA_MENU_MP_SELECT_TRACK_SLOT" ),
popup_width = 550,
popup_childfeeder = TrackOperationPopupChildrenFeeder
}
}
end
function popup_track_op_button()
local f83_local0 = 40
local f83_local1 = 15
local f83_local2 = 35
local f83_local3 = 145
return {
type = "UIButton",
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = -250,
right = 250,
top = 0,
bottom = f83_local0
}
},
handlers = {
button_over = function ( f84_arg0, f84_arg1 )
f84_arg0:dispatchEventToRoot( {
name = "refresh_tracked_op_desc",
text = f84_arg0.properties.desc,
categoryText = f84_arg0.properties.category
} )
f84_arg0:dispatchEventToChildren( f84_arg0, f84_arg1 )
end
,
button_action = function ( f85_arg0, f85_arg1 )
if f85_arg0.properties.trackOpsPopup then
local f85_local0 = f85_arg0.properties.controller
local f85_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f85_arg0 )
local f85_local2 = f85_local1.newOp
SetTrackedOp( f85_local0, f85_arg0.properties.index, f85_local2 )
Engine.ExecNow( "uploadstats", f85_local0 )
f85_arg0:dispatchEventToRoot( {
name = "refresh_available_ops",
controller = f85_arg1.controller,
immediate = true
} )
local f85_local3 = GetCachedOperationData( f85_local0, f85_local2 )
f85_arg0:dispatchEventToRoot( {
name = "refresh_tracked_ops",
number = f85_arg0.properties.number,
controller = f85_local0,
opRef = f85_local2,
groupRef = getGroupRefForOperation( f85_local2 ),
opData = f85_local3,
text = f85_local3.Name,
progressText = f85_local3.ProgressText,
progressPercent = f85_local3.PercentProgress
} )
LUI.FlowManager.RequestLeaveMenu( f85_arg0 )
end
end
},
children = {
{
type = "UIElement",
properties = {
text = MBh.Property( "text" ),
progressValue = MBh.Property( "progressValue" ),
progressText = MBh.Property( "progressText" ),
index = MBh.Property( "index" ),
progressBarWidth = MBh.Property( "progressBarWidth" ),
number = MBh.Property( "number" ),
trackOpsPopup = MBh.Property( "trackOpsPopup" ),
groupRef = MBh.Property( "groupRef" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
children = {
{
type = "UIImage",
id = "popup_track_op_btn_bg",
states = {
default = CoD.ColorizeState( Colors.white, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0.05
} ),
focus = CoD.ColorizeState( Colors.white, {
alpha = 0.8
} ),
dimmed = CoD.ColorizeState( Colors.white, {
alpha = 0.5
} ),
category_hilite = CoD.ColorizeState( Colors.white, {
alpha = 0.2
} ),
category_hilite_dim = CoD.ColorizeState( Colors.white, {
alpha = 0.12
} )
},
handlers = {
button_over = MBh.AnimateLoop( {
{
"focus",
0,
true,
true
},
{
"focus",
350,
true,
true
},
{
"dimmed",
750,
true,
true
},
{
"focus",
750,
true,
true
}
} ),
button_up = MBh.AnimateToState( "default" ),
refresh_tracked_ops = function ( f86_arg0, f86_arg1 )
if f86_arg0.properties.number == f86_arg1.number then
f86_arg0.properties.groupRef = f86_arg1.groupRef
end
end
,
notify_category_focused = function ( f87_arg0, f87_arg1 )
if not f87_arg0.properties.trackOpsPopup then
if f87_arg0.properties.groupRef == f87_arg1.groupRef then
local f87_local0 = MBh.AnimateLoop( {
{
"category_hilite",
0,
true,
true
},
{
"category_hilite",
350,
true,
true
},
{
"category_hilite_dim",
750,
true,
true
},
{
"category_hilite",
750,
true,
true
}
} )
f87_local0( f87_arg0, f87_arg1 )
else
f87_arg0:animateToState( "default", 0 )
end
end
end
}
},
{
type = "UIMarqueeText",
id = "popup_track_op_btn_name_text",
properties = {
text = MBh.Property( "text" ),
index = MBh.Property( "index" ),
groupRef = MBh.Property( "groupRef" ),
number = MBh.Property( "number" ),
usingFocusColor = false
},
states = {
default = CoD.ColorizeState( Colors.generic_button_text_default_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = f83_local2,
right = -f83_local3,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height
} )
},
handlers = {
use_focused_color = function ( f88_arg0 )
if not f88_arg0.properties.usingFocusColor then
f88_arg0:SetColor( Colors.generic_button_text_focus_color.r, Colors.generic_button_text_focus_color.g, Colors.generic_button_text_focus_color.b, 1 )
f88_arg0.properties.usingFocusColor = true
end
end
,
use_default_color = function ( f89_arg0 )
if f89_arg0.properties.usingFocusColor then
f89_arg0:SetColor( Colors.generic_button_text_default_color.r, Colors.generic_button_text_default_color.g, Colors.generic_button_text_default_color.b, 1 )
f89_arg0.properties.usingFocusColor = false
end
end
,
button_over = function ( f90_arg0, f90_arg1 )
f90_arg0:processEvent( {
name = "use_focused_color"
} )
end
,
button_up = function ( f91_arg0, f91_arg1 )
f91_arg0:processEvent( {
name = "use_default_color"
} )
end
,
refresh_tracked_ops = function ( f92_arg0, f92_arg1 )
if f92_arg0.properties.number == f92_arg1.number then
f92_arg0.properties.groupRef = f92_arg1.groupRef
if f92_arg1.text then
f92_arg0:setText( f92_arg1.text )
f92_arg0:animateToState( "default" )
end
end
end
}
},
{
type = "UIText",
id = "popup_track_op_btn_progress_text",
properties = {
text = MBh.Property( "progressText" ),
index = MBh.Property( "index" ),
groupRef = MBh.Property( "groupRef" ),
number = MBh.Property( "number" )
},
states = {
default = CoD.ColorizeState( Colors.generic_button_text_default_color, {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
leftAnchor = false,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = -f83_local3,
right = -f83_local1,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height
} ),
focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} )
},
handlers = {
button_over = MBh.AnimateToState( "focus" ),
button_up = MBh.AnimateToState( "default" ),
refresh_tracked_ops = function ( f93_arg0, f93_arg1 )
if f93_arg0.properties.number == f93_arg1.number then
f93_arg0.properties.groupRef = f93_arg1.groupRef
if f93_arg1.progressText then
f93_arg0:setText( f93_arg1.progressText )
end
end
end
}
},
{
type = "operation_progress_bar",
id = "popup_track_op_btn_progress_bar",
properties = {
progress = MBh.Property( "progressValue" ),
width = MBh.Property( "progressBarWidth" ),
index = MBh.Property( "index" ),
groupRef = MBh.Property( "groupRef" ),
number = MBh.Property( "number" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = f83_local2,
right = -f83_local1,
top = -15,
height = 10,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
refresh_tracked_ops = function ( f94_arg0, f94_arg1 )
if f94_arg0.properties.number == f94_arg1.number then
f94_arg0.properties.groupRef = f94_arg1.groupRef
if f94_arg1.progressPercent then
f94_arg0:updateProgressBar( f94_arg1.progressPercent )
f94_arg0:animateToState( "default" )
end
end
end
,
notify_category_focused = function ( f95_arg0, f95_arg1 )
if not f95_arg0.properties.trackOpsPopup then
if f95_arg0.properties.groupRef == f95_arg1.groupRef then
f95_arg0:dispatchEventToChildren( {
name = "button_over"
} )
else
f95_arg0:dispatchEventToChildren( {
name = "button_up"
} )
end
end
end
}
},
{
type = "UIText",
id = "popup_track_op_btn_number",
properties = {
text = MBh.Property( "number" ),
groupRef = MBh.Property( "groupRef" ),
number = MBh.Property( "number" )
},
states = {
default = CoD.ColorizeState( Colors.generic_button_text_default_color, {
leftAnchor = true,
rightAnchor = false,
topAnchor = false,
bottomAnchor = false,
left = 0,
right = f83_local2,
top = CoD.TextSettings.NormalFont.Height * -0.5,
bottom = CoD.TextSettings.NormalFont.Height * 0.5,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ),
focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} )
},
handlers = {
button_over = MBh.AnimateToState( "focus" ),
button_up = MBh.AnimateToState( "default" ),
refresh_tracked_ops = function ( f96_arg0, f96_arg1 )
if f96_arg0.properties.number == f96_arg1.number then
f96_arg0.properties.groupRef = f96_arg1.groupRef
end
end
}
},
{
type = "UIImage",
id = "popup_track_op_btn_spacer",
properties = {
groupRef = MBh.Property( "groupRef" ),
number = MBh.Property( "number" )
},
states = {
default = CoD.ColorizeState( Colors.white, {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = 0,
top = -1,
bottom = 0,
alpha = 0.15
} ),
focus = CoD.ColorizeState( Colors.black, {
alpha = 1
} )
},
handlers = {
button_over = MBh.AnimateToState( "focus" ),
button_up = MBh.AnimateToState( "default" ),
refresh_tracked_ops = function ( f97_arg0, f97_arg1 )
if f97_arg0.properties.number == f97_arg1.number then
f97_arg0.properties.groupRef = f97_arg1.groupRef
end
end
,
notify_category_focused = function ( f98_arg0, f98_arg1 )
if not f98_arg0.properties.trackOpsPopup then
if f98_arg0.properties.groupRef == f98_arg1.groupRef then
f98_arg0:animateToState( "focus", 0 )
else
f98_arg0:animateToState( "default", 0 )
end
end
end
}
}
}
}
}
}
end
LUI.MenuBuilder.registerDef( "operations_main_menu", operations_main_menu )
LUI.MenuBuilder.registerType( "operation_button", operation_button )
LUI.MenuBuilder.registerDef( "operations_selection_popup", operations_selection_popup )
LUI.MenuBuilder.registerType( "operation_progress_bar", operation_progress_bar )
LUI.MenuBuilder.registerDef( "operations_info_panel", operations_info_panel )
LUI.MenuBuilder.registerDef( "operations_info_panel_header", operations_info_panel_header )
LUI.MenuBuilder.registerDef( "operations_info_panel_sub_header", operations_info_panel_sub_header )
LUI.MenuBuilder.registerDef( "operations_info_panel_desc", operations_info_panel_desc )
LUI.MenuBuilder.registerDef( "operations_info_panel_progress", operations_info_panel_progress )
LUI.MenuBuilder.registerDef( "operations_info_panel_rewards", operations_info_panel_rewards )
LUI.MenuBuilder.registerDef( "operations_completed_info", operations_completed_info )
LUI.MenuBuilder.registerDef( "operations_completed_info_tab", operations_completed_info_tab )
LUI.MenuBuilder.registerDef( "popup_confirm_new_ops", popup_confirm_new_ops )
LUI.MenuBuilder.registerDef( "popup_confirm_new_ops_purchase", popup_confirm_new_ops_purchase )
LUI.MenuBuilder.registerDef( "popup_confirm_you_cant_afford_new_ops", popup_confirm_you_cant_afford_new_ops )
LUI.MenuBuilder.registerDef( "popup_track_op", popup_track_op )
LUI.MenuBuilder.registerDef( "popup_track_op_button", popup_track_op_button )
LockTable( _M )