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

397 lines
9.9 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function OperationProgressListRowFeeder( f1_arg0 )
local f1_local0 = {}
local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" )
local f1_local2 = f1_local1.controller
local f1_local3 = GetAllOpGroupRefs()
local f1_local4 = 250
local f1_local5 = 7
local f1_local6 = 30
for f1_local7 = 1, MaxTrackedOperations, 1 do
local f1_local10 = GetTrackedOp( f1_local2, f1_local7 - 1 )
if f1_local10 == "" then
DebugPrint( "Cannot Access Current Tracked Op" )
return {}
end
local f1_local11 = GetOperationData( f1_local2, f1_local10 )
local f1_local12 = f1_local11.Name
local f1_local13 = f1_local11.ProgressText
local f1_local14 = 0
local f1_local15 = f1_local11.MaxProgress
local f1_local16 = 0
local f1_local17 = f1_local11.Progress
local f1_local18 = 0
local f1_local19 = 0
if f1_local15 - f1_local14 > 0 then
f1_local18 = (f1_local16 - f1_local14) / (f1_local15 - f1_local14)
f1_local19 = (f1_local17 - f1_local14) / (f1_local15 - f1_local14)
end
f1_local19 = math.min( f1_local19, 1 )
f1_local18 = math.min( f1_local18, 1 )
local f1_local20 = {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f1_local6,
left = 0,
right = 0
}
}
}
local f1_local21 = {}
local f1_local22 = {
type = "UIMarqueeText",
id = "progress_item_desc_id",
properties = {
text = f1_local12
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 5,
bottom = CoD.TextSettings.NormalFont.Height + 5,
left = 6,
right = 275,
font = CoD.TextSettings.NormalFont.Font,
red = AAR.Swatch.title.r,
green = AAR.Swatch.title.g,
blue = AAR.Swatch.title.b,
alignment = LUI.Alignment.Left
}
}
}
local f1_local23 = {
type = "UIText",
id = "progress_item_max_val_id",
properties = {
text = f1_local13
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 5,
bottom = CoD.TextSettings.NormalFont.Height + 5,
left = 500,
right = 656,
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.NormalFont.Font,
red = AAR.Swatch.subtext.r,
green = AAR.Swatch.subtext.g,
blue = AAR.Swatch.subtext.b
}
}
}
local f1_local24 = {
type = "UIImage",
id = "progress_fill_meter_id",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 300,
right = 300 + f1_local4,
top = 11,
bottom = 11 + f1_local5,
red = 0,
green = 0,
blue = 0
}
}
}
local f1_local25 = {}
local f1_local26 = {
type = "UIImage",
id = "progress_meter_curr_fill",
states = {
default = {
material = RegisterMaterial( "btn_cas_fill_f" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = AAR.Swatch.colorpop.r + 0.1,
green = AAR.Swatch.colorpop.g + 0.1,
blue = AAR.Swatch.colorpop.b + 0.1
},
fill = {
material = RegisterMaterial( "btn_cas_fill_f" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f1_local19 * f1_local4,
top = 0,
bottom = 0,
red = AAR.Swatch.colorpop.r + 0.1,
green = AAR.Swatch.colorpop.g + 0.1,
blue = AAR.Swatch.colorpop.b + 0.1
}
},
handlers = {
element_refresh = function ( f2_arg0, f2_arg1 )
local f2_local0 = MBh.AnimateSequence( {
{
"default",
0
},
{
"default",
250
},
{
"fill",
250
}
} )
f2_local0( f2_arg0 )
end
}
}
local f1_local27 = {
type = "UIImage",
id = "progress_meter_prev_fill",
states = {
default = {
material = RegisterMaterial( "btn_cas_fill_f" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f1_local18 * f1_local4,
top = 0,
bottom = 0,
red = AAR.Swatch.progressborder.r,
green = AAR.Swatch.progressborder.g,
blue = AAR.Swatch.progressborder.b
}
}
}
local f1_local28 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f1_local29 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f1_local30 = LUI.mp_menus.Operations.HairlineBorder( "left", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f1_local31 = LUI.mp_menus.Operations.HairlineBorder( "right", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
f1_local24.children = f1_local26
f1_local25 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 )
if f1_local7 == MaxTrackedOperations then
f1_local26 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 )
if not f1_local26 then
else
f1_local21[1] = f1_local22
f1_local21[2] = f1_local23
f1_local21[3] = f1_local24
f1_local21[4] = f1_local25
f1_local21[5] = f1_local26
f1_local20.children = f1_local21
f1_local20.id = "progress_item_" .. f1_local7
f1_local0[#f1_local0 + 1] = f1_local20
end
end
f1_local26 = nil
end
return f1_local0
end
function mp_opprogress_vlist()
return {
type = "UIVerticalList",
id = "mp_opprogress_vlist_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = CoD.TextSettings.ExtraBigFont.Height + 40,
bottom = 0,
left = -331,
right = 331
}
},
childrenFeeder = OperationProgressListRowFeeder
}
end
function mp_opprogress_page()
return {
type = "UIElement",
id = "mp_opprogress_page_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIText",
id = "mp_opprogress_title",
properties = {
text = Engine.Localize( "@LUA_MENU_OPERATION_PROGRESS_CAPS" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 30,
bottom = CoD.TextSettings.ExtraBigFont.Height + 30,
left = -200,
right = 200,
alignment = LUI.Alignment.Center,
font = CoD.TextSettings.ExtraBigFont.Font,
red = AAR.Swatch.title.r,
green = AAR.Swatch.title.g,
blue = AAR.Swatch.title.b
}
}
},
{
type = "mp_opprogress_vlist"
}
}
}
end
function mp_opprogress_main()
return {
type = "UIElement",
id = "mp_opprogress_main_id",
properties = {
page_idx = 1,
num_pages = 3
},
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
width = AAR.Layout.Width,
height = AAR.Layout.Height
}
},
handlers = {
element_refresh = function ( f6_arg0, f6_arg1 )
local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" )
local f6_local1 = f6_local0.controller
local f6_local2 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f6_local1, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name )
local f6_local3 = Engine.GetPlayerDataEx( f6_local1, CoD.StatsGroup.Common, "round", "map" )
local f6_local4 = Squad.GetRealBaseNameFromLoadName( f6_local3 )
if f6_local3 ~= "" then
f6_arg0:processEvent( {
name = "aar_set_subtitle_text",
new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f6_local2, Engine.MarkLocalized( f6_local4 ) ),
dispatchChildren = true
} )
end
end
},
children = {
{
type = "generic_drop_shadow",
id = "description_drop_shadow1",
properties = {
offset_shadow = 0
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0.35
}
}
},
{
type = "generic_menu_background",
id = "aar_match_summary_main_bkg",
properties = {
fill_alpha = 1
}
},
{
type = "aar_title_bar",
properties = {
title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY" ),
subtitle_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ),
subtitle_banner_width = 300
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "mp_opprogress_page"
},
{
type = "aar_footer_bar",
id = "oink_1"
}
}
},
{
type = "aar_dots",
id = "AARSummaryDotsID",
properties = {
num_dots = MBh.Property( "num_pages" ),
curr_dot = MBh.Property( "page_idx" )
}
}
}
}
end
LUI.MenuBuilder.registerDef( "mp_opprogress_main", mp_opprogress_main )
LUI.MenuBuilder.registerDef( "mp_opprogress_page", mp_opprogress_page )
LUI.MenuBuilder.registerDef( "mp_opprogress_vlist", mp_opprogress_vlist )
LockTable( _M )