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

608 lines
14 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
end
f0_local1 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg1.controller
local f2_local1 = nil
local f2_local2 = -1
local f2_local3, f2_local4 = nil
for f2_local5 = 1, MaxTrackedOperations, 1 do
local f2_local8 = GetTrackedOp( f2_local0, f2_local5 - 1 )
if f2_local8 ~= "" then
local f2_local9 = GetOperationData( f2_local0, f2_local8 )
local f2_local10 = f2_local9.PercentProgress
local f2_local11 = f2_local10 >= 1
local f2_local12 = f2_local10 <= 0
if not f2_local11 and not f2_local12 and f2_local2 < f2_local10 then
f2_local1 = f2_local9
if f2_local11 then
local f2_local13 = 0
end
f2_local2 = f2_local13 or f2_local10
end
if f2_local11 and not f2_local3 then
f2_local3 = f2_local9
end
if f2_local12 and not f2_local4 then
f2_local4 = f2_local9
end
end
DebugPrint( "Cannot Access Current Active Op" )
end
local f2_local5 = nil
if f2_local1 then
f2_local5 = f2_local1
elseif f2_local3 then
f2_local5 = f2_local3
else
f2_local5 = f2_local4
end
local f2_local6 = nil
if f2_local5 then
f2_local6 = getGroupRefForOperation( f2_local5.Ref )
end
if not f2_local6 or not f2_local5 then
DebugPrint( "Error getting most-progressed operation." )
f2_arg0:processEvent( {
name = "hide_mini_aar_op_progress"
} )
return
end
local f2_local7 = Engine.Localize( GetFieldForOperationsGroup( f2_local6, OperationGroups.Cols.Name ) )
local f2_local14 = f2_local5.Name
local f2_local8 = f2_local5.ProgressText
local f2_local9 = 0
local f2_local10 = f2_local5.MaxProgress
local f2_local11 = 0
local f2_local12 = f2_local5.Progress
local f2_local15 = 0
local f2_local16 = 0
if f2_local10 - f2_local9 > 0 then
f2_local15 = (f2_local11 - f2_local9) / (f2_local10 - f2_local9)
f2_local16 = (f2_local12 - f2_local9) / (f2_local10 - f2_local9)
end
f2_arg0:processEvent( {
name = "update_operation_progress",
title_text = f2_local7,
desc_text = f2_local14,
progress_text = f2_local8,
prevPercent = math.min( f2_local15, 1 ),
currPercent = math.min( f2_local16, 1 )
} )
end
f0_local2 = function ()
local f3_local0 = 244
local f3_local1 = 7
local f3_local2 = {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 55,
left = 0,
right = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
expand_mini_aar = f0_local1,
hide_mini_aar_op_progress = MBh.AnimateToState( "hidden" )
}
}
local f3_local3 = {}
local f3_local4 = {
type = "UIText",
id = "progress_item_title_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 5,
bottom = CoD.TextSettings.NormalFont.Height + 5,
left = 6,
right = 400,
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
red = AAR.Swatch.subtext.r,
green = AAR.Swatch.subtext.g,
blue = AAR.Swatch.subtext.b
}
},
handlers = {
update_operation_progress = function ( f4_arg0, f4_arg1 )
f4_arg0:setText( f4_arg1.title_text )
end
}
}
local f3_local5 = {
type = "UIMarqueeText",
id = "progress_item_desc_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 28,
bottom = CoD.TextSettings.NormalFont.Height + 28,
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
}
},
handlers = {
update_operation_progress = function ( f5_arg0, f5_arg1 )
f5_arg0:setText( f5_arg1.desc_text )
end
}
}
local f3_local6 = {
type = "UIText",
id = "progress_item_max_val_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 5,
bottom = CoD.TextSettings.NormalFont.Height + 5,
left = 400,
right = 544,
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.NormalFont.Font,
red = AAR.Swatch.subtext.r,
green = AAR.Swatch.subtext.g,
blue = AAR.Swatch.subtext.b
}
},
handlers = {
update_operation_progress = function ( f6_arg0, f6_arg1 )
f6_arg0:setText( f6_arg1.progress_text )
end
}
}
local f3_local7 = {
type = "UIImage",
id = "progress_fill_meter_id",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 300,
right = 300 + f3_local0,
top = 34,
bottom = 34 + f3_local1,
red = 0,
green = 0,
blue = 0
}
}
}
local f3_local8 = {}
local f3_local9 = {
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
}
},
handlers = {
update_operation_progress = function ( f7_arg0, f7_arg1 )
f7_arg0:registerAnimationState( "fill", {
material = RegisterMaterial( "btn_cas_fill_f" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f7_arg1.currPercent * f3_local0,
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
} )
local f7_local0 = MBh.AnimateSequence( {
{
"default",
0
},
{
"default",
250
},
{
"fill",
250
}
} )
f7_local0( f7_arg0 )
end
}
}
local f3_local10 = {
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 = 0,
top = 0,
bottom = 0,
red = AAR.Swatch.progressborder.r,
green = AAR.Swatch.progressborder.g,
blue = AAR.Swatch.progressborder.b
}
},
handlers = {
update_operation_progress = function ( f8_arg0, f8_arg1 )
f8_arg0:registerAnimationState( "fill", {
material = RegisterMaterial( "btn_cas_fill_f" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f8_arg1.prevPercent * f3_local0,
top = 0,
bottom = 0,
red = AAR.Swatch.progressborder.r,
green = AAR.Swatch.progressborder.g,
blue = AAR.Swatch.progressborder.b
} )
f8_arg0:animateToState( "fill", 0 )
end
}
}
local f3_local11 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f3_local12 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f3_local13 = LUI.mp_menus.Operations.HairlineBorder( "left", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
local f3_local14 = LUI.mp_menus.Operations.HairlineBorder( "right", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 )
f3_local7.children = f3_local9
f3_local8 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 )
f3_local9 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 )
f3_local2.children = f3_local4
return f3_local2
end
local f0_local3 = function ( f9_arg0 )
assert( f9_arg0 )
local f9_local0 = ""
local f9_local1 = Engine.Localize( "@LUA_MENU_AAR_NEW_UNLOCKS" )
if f9_arg0 and f9_arg0 > 0 then
f9_local0 = f9_local1 .. " " .. f9_arg0
end
return f9_local0
end
function aar_mini_background()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Background, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = 0,
bottom = 0,
width = 200,
material = RegisterMaterial( "white" )
} )
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Background, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = 0,
bottom = 0,
right = -100,
width = 500,
material = RegisterMaterial( "box_white_gradient_fade_rt" )
} )
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Background, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = 0,
bottom = 0,
left = 100,
right = 500,
material = RegisterMaterial( "box_white_gradient_fade" )
} )
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 0,
bottom = 1,
right = 0,
width = 500,
material = RegisterMaterial( "box_white_gradient_fade_rt" )
} )
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 0,
bottom = 1,
left = 0,
width = 500,
material = RegisterMaterial( "box_white_gradient_fade" )
} )
}
}
}
}
end
function AARMiniChildrenFeeder( f11_arg0 )
local f11_local0 = {
[#f11_local0 + 1] = {
type = "aar_mini_background",
id = "aar_mini_background_id"
},
[#f11_local0 + 1] = {
type = "UIText",
id = "aar_mini_title_id",
properties = {
text = MBh.Property( "title_text" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 10,
bottom = 10 + CoD.TextSettings.ExtraBigFont.Height,
left = 0,
right = 0,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center
}
}
}
}
local f11_local1 = #f11_local0 + 1
local f11_local2 = {
type = "aar_xp_info_widget",
id = "aar_mini_xp_info_widget_id"
}
local f11_local3 = {}
local f11_local4
if Engine.GetDvarBool( "ui_opensummary" ) then
f11_local4 = true
else
f11_local4 = false
end
f11_local3.animate_progress = f11_local4
f11_local2.properties = f11_local3
f11_local2.states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 42,
left = -213,
right = 213,
height = 67,
material = RegisterMaterial( "white" ),
red = AAR.Swatch.background_2.r,
green = AAR.Swatch.background_2.g,
blue = AAR.Swatch.background_2.b
}
}
f11_local0[f11_local1] = f11_local2
f11_local0[#f11_local0 + 1] = {
type = "UIText",
id = "aar_mini_unlocks_message_id",
states = {
default = CoD.ColorizeState( Colors.frontend_hilite, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 112,
left = -213,
right = 213,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left
} )
},
handlers = {
expand_mini_aar = function ( f12_arg0, f12_arg1 )
if f12_arg1.num_unlocks and f12_arg1.num_unlocks > 0 then
f12_arg0:setText( f0_local3( f12_arg1.num_unlocks ) )
else
f12_arg0:setText( "" )
end
end
}
}
if not SvS.IsSvS() then
f11_local1 = #f11_local0 + 1
f11_local2 = {
type = "UIElement",
id = "aar_mini_operation_progress_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = 112 + CoD.TextSettings.NormalFont.Height,
bottom = 0,
left = -275,
right = 275
}
}
}
f11_local3 = {}
f11_local2.children = f0_local2()
f11_local0[f11_local1] = f11_local2
end
return f11_local0
end
function aar_mini()
return {
type = "UIElement",
id = "aar_mini_main",
properties = {
title_text = Engine.Localize( "@MENU_GAME_SUMMARY_CAPS" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 220,
left = 0,
right = 0
},
anim_in = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = SvS.IsSvS() and -240 or -310,
bottom = 0,
left = 0,
right = 0
},
anim_in_hold = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = SvS.IsSvS() and -240 or -290,
bottom = 0,
left = 0,
right = 0
},
anim_out = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 220,
left = 0,
right = 0
}
},
handlers = {
expand_mini_aar = MBh.AnimateSequence( {
{
"default",
500
},
{
"anim_in",
175
},
{
"anim_in_hold",
75
},
{
"anim_in_hold",
5000
},
{
"anim_out",
175
}
} )
},
childrenFeeder = AARMiniChildrenFeeder
}
end
LUI.MenuBuilder.registerDef( "aar_mini", aar_mini )
LUI.MenuBuilder.registerDef( "aar_mini_background", aar_mini_background )
LockTable( _M )