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

1141 lines
31 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = {
Settings = {
BARREL_ANIM_SPEED = 100,
FADED_ALPHA = 0.5
},
ReportWindow = {
Top = 100,
Bottom = -70,
Width = 370,
Height = 854
},
ScoreBar = {
Height = 26,
HorizontalTextMargin = 10,
VerticalTextMargin = 2,
ValueAreaWidth = 123,
SplitImageWidth = 32,
ValueAreaBorder = 2,
PrimaryColor = {
r = 0.1,
g = 0.1,
b = 0.1,
a = 0.8
},
ValueAreaColor = {
r = 0.4,
g = 0.4,
b = 0.4,
a = 0.6
}
},
VisibleWindowsIDs = {
Left = "squad_report_entry_window_1",
Center = "squad_report_entry_window_2",
Right = "squad_report_entry_window_3"
}
}
function InitReportWindow( f1_arg0, f1_arg1 )
RefreshReportWindow( f1_arg0, f1_arg1.controller, f1_arg1.reportIndex )
if f1_arg0.id == f0_local0.VisibleWindowsIDs.Center then
f1_arg0:dispatchEventToChildren( {
name = "squad_report_set_primary",
animSpeed = 0
} )
else
f1_arg0:dispatchEventToChildren( {
name = "squad_report_set_secondary",
animSpeed = 0
} )
end
end
function RefreshReportWindow( f2_arg0, f2_arg1, f2_arg2 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" )
f2_arg0.properties.reportIndex = f2_arg2
f2_arg0:processEvent( {
name = "squad_report_set_report_index",
reportIndex = f2_arg2,
maxIndex = f2_local0.reportCount
} )
if not f2_local0 or not f2_local0.reportData or #f2_local0.reportData == 0 then
return
end
local f2_local1 = f2_local0.reportData[f2_arg2]
f2_arg0.reportData = f2_local1
if f2_local1.enemySquadName then
f2_arg0:processEvent( {
name = "squad_report_set_squad_name",
enemyName = f2_local1.enemySquadName
} )
end
f2_arg0:processEvent( {
name = "squad_report_set_match_info",
mapName = f2_local1.mapName,
gametype = f2_local1.gametype,
timeText = f2_local1.timeString
} )
f2_arg0:processEvent( {
name = "update_playercard",
gamertag = f2_local1.enemyPlayercardProps.gamertag,
clantag = f2_local1.enemyPlayercardProps.clantag,
rank = f2_local1.enemyPlayercardProps.rank,
prestige = f2_local1.enemyPlayercardProps.prestige,
background = f2_local1.enemyPlayercardProps.background,
patchEmblem = f2_local1.enemyPlayercardProps.patchEmblem,
patchShape = f2_local1.enemyPlayercardProps.patchShape
} )
f2_arg0:processEvent( {
name = "squad_report_set_match_outcome",
reportData = f2_local1
} )
f2_arg0:processEvent( {
name = "set_score_value_text_your_score",
text = f2_local1.yourScore
} )
f2_arg0:processEvent( {
name = "set_score_value_text_enemy_score",
text = f2_local1.enemyScore
} )
f2_arg0:processEvent( {
name = "set_xp_text",
text = f2_local1.xpString,
didEarnXP = f2_local1.didEarnXP
} )
end
function RefreshReportData( f3_arg0 )
local f3_local0 = f3_arg0.controller
f3_arg0.reportData = {}
local f3_local1 = 0
local f3_local2 = nil
for f3_local3 = 0, SvS.Reports.MaxReports - 1, 1 do
f3_local2 = SvS.GetSquadReportData( f3_local0, f3_local3 )
if f3_local2 then
f3_local1 = f3_local1 + 1
f3_arg0.reportData[f3_local1] = f3_local2
end
end
return f3_local1
end
function SquadReportsCreate( f4_arg0, f4_arg1 )
local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 )
local f4_local1 = f4_local0.controller
Squad.UpdateReportPlayerCardCache( f4_local1 )
f4_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton )
local f4_local2 = f4_arg0:getFirstDescendentById( "reports_list" )
f4_local0.barrelList = f4_local2
f4_local2:setupForAnimation( squad_reports_entry, {}, true )
f4_local0.reportCount = RefreshReportData( f4_local0 )
if f4_local0.reportCount == 0 then
f4_arg0:dispatchEventToChildren( {
name = "hide_squad_reports_list",
[1] = f4_arg1.controller
} )
return
end
f4_arg0:dispatchEventToChildren( {
name = "init_report_1",
controller = f4_local1,
reportIndex = f4_local0.reportCount
} )
f4_arg0:dispatchEventToChildren( {
name = "init_report_2",
controller = f4_local1,
reportIndex = 1
} )
local f4_local3 = f4_arg0
local f4_local4 = f4_arg0.dispatchEventToChildren
local f4_local5 = {
name = "init_report_3",
controller = f4_local1
}
local f4_local6
if f4_local0.reportCount > 1 then
f4_local6 = 2
if not f4_local6 then
else
f4_local5.reportIndex = f4_local6
f4_local4( f4_local3, f4_local5 )
if CanChallenge() then
f4_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize( "LUA_MENU_CHALLENGE" ),
side = "left",
clickable = true
} )
end
end
end
f4_local6 = 1
end
function HandleDataRefresh( f5_arg0, f5_arg1 )
local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 )
if f5_local0.reportCount == 0 then
return
else
f5_local0.reportCount = RefreshReportData( f5_local0 )
f5_arg0:processEvent( {
name = "refresh_report_window",
controller = f5_local0.controller
} )
LUI.FlowManager.RequestPopupMenu( f5_arg0, "updating_squad_reports", true, f5_local0.controller )
end
end
function SetReportWindowAsPrimary( f6_arg0, f6_arg1 )
f6_arg0:animateToState( "default", f6_arg1.animSpeed or 0, true, true )
end
function SetReportWindowAsSecondary( f7_arg0, f7_arg1 )
f7_arg0:animateToState( "faded", f7_arg1.animSpeed or 0, true, true )
end
function OnBarrelAnimStart( f8_arg0, f8_arg1 )
local f8_local0 = f8_arg1.barrelList:getCurrentIndex()
local f8_local1 = false
if not (not f8_arg1.movingRight or f8_arg0.id ~= f0_local0.VisibleWindowsIDs.Left) or f8_arg1.movingLeft and f8_arg0.id == f0_local0.VisibleWindowsIDs.Right then
f8_local1 = true
end
local f8_local2 = f8_arg0
local f8_local3 = f8_arg0.dispatchEventToChildren
local f8_local4 = {}
local f8_local5
if f8_local1 then
f8_local5 = "squad_report_set_primary"
if not f8_local5 then
else
f8_local4.name = f8_local5
f8_local4.animSpeed = f0_local0.Settings.BARREL_ANIM_SPEED
f8_local3( f8_local2, f8_local4 )
end
end
f8_local5 = "squad_report_set_secondary"
end
function OnBarrelAnimFinished( f9_arg0, f9_arg1 )
if f9_arg0.id == f0_local0.VisibleWindowsIDs.Center then
f9_arg0:dispatchEventToChildren( {
name = "squad_report_set_primary",
animSpeed = 0
} )
else
f9_arg0:dispatchEventToChildren( {
name = "squad_report_set_secondary",
animSpeed = 0
} )
end
end
function OnBarrelIndexUpdate( f10_arg0, f10_arg1 )
local f10_local0 = f10_arg1.controller
if not f10_local0 then
f10_local0 = Engine.GetFirstActiveController()
end
local f10_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" )
if not f10_local1 or not f10_local1.reportCount or f10_local1.reportCount == 0 then
return
else
RefreshReportWindow( f10_arg0, f10_local0, ConvertBarrelIndex( f10_arg1.index, f10_local1.reportCount ) )
end
end
function ConvertBarrelIndex( f11_arg0, f11_arg1 )
return f11_arg0 % f11_arg1 + 1
end
function OnBarrelScrollStart( f12_arg0 )
Engine.PlaySound( CoD.SFX.CharacterSlide )
end
function CanChallenge()
local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" )
if not f13_local0 or not f13_local0.reportCount or f13_local0.reportCount < 1 then
return
elseif Engine.InLobby() or Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() then
return false
elseif f13_local0.fromSquadsModeMenu or f13_local0.fromLiveLobby then
return false
else
return true
end
end
function ChallengeSquad( f14_arg0, f14_arg1 )
local f14_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" )
if not CanChallenge() then
return
elseif IsFirstTimeFlowRequired( f14_arg1.controller ) then
LUI.FlowManager.RequestAddMenu( f14_arg0, "cac_member_select_main", true, f14_arg1.controller, false, {
next_screen = "cac_edit_main",
squad_location = "squadMembers",
class_location = "loadouts",
findMatch = true
} )
return
elseif f14_local0.fromSquadsModeMenu then
return
end
local f14_local1, f14_local2 = Squad.ChallengePlayer( f14_arg1.controller, f14_local0.reportData[f14_arg0.properties.reportIndex].reportIndex )
if f14_local1 == -1 or f14_local2 == -1 then
return
elseif Playlist.DoAction( f14_local1, f14_local2, false, false ) then
local f14_local3 = false
local f14_local4 = false
local f14_local5 = {}
Squad.StartMatch( f14_arg1.controller, false )
Engine.SetDvarBool( "squad_find_match", true )
if SvS.GetCurrentSquadModeInfo() ~= SvS.SquadModes.SquadAssault then
SvS.SetCurrentSquadModeInfo( SvS.SquadModes.SquadAssault )
end
LUI.FlowManager.RequestAddMenu( f14_arg0, "menu_xboxlive_lobby", f14_local4, f14_arg1.controller, f14_local3, f14_local5 )
end
end
function BuildScoreBar( f15_arg0, f15_arg1 )
local f15_local0 = f0_local0.ScoreBar
local self = LUI.UIElement.new()
self.id = "squad_report_score_bar_bg_" .. f15_arg0
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
height = f15_local0.Height
} )
self:animateToState( "default", 0 )
local f15_local2 = LUI.UIImage.new()
f15_local2:registerAnimationState( "default", CoD.ColorizeState( Colors.black, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = -112,
alpha = 0.15
} ) )
f15_local2:animateToState( "default", 0 )
self:addElement( f15_local2 )
local f15_local3 = LUI.UIImage.new()
f15_local3:registerAnimationState( "default", CoD.ColorizeState( Colors.black, {
material = RegisterMaterial( "box_stat_cap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -112,
right = -80,
zRot = 180,
alpha = 0.15
} ) )
f15_local3:animateToState( "default", 0 )
self:addElement( f15_local3 )
local f15_local4 = LUI.UIImage.new()
f15_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "box_stat_cap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -112,
right = -80,
alpha = 0.05
} ) )
f15_local4:animateToState( "default", 0 )
self:addElement( f15_local4 )
local f15_local5 = LUI.UIImage.new()
f15_local5.id = "squad_report_score_bar_value_area_bg"
f15_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -80,
right = 0,
alpha = 0.05
} ) )
f15_local5:animateToState( "default", 0 )
self:addElement( f15_local5 )
local f15_local6 = LUI.UIMarqueeText.new()
f15_local6.id = "squad_report_score_bar_title_text"
f15_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = f15_local0.HorizontalTextMargin,
right = -112,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left
} ) )
f15_local6:animateToState( "default", 0 )
f15_local6:setText( f15_arg1 )
self:addElement( f15_local6 )
local f15_local7 = LUI.UIText.new()
f15_local7.id = "squad_report_score_bar_value_text"
f15_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
leftAnchor = false,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = -112,
right = -f15_local0.HorizontalTextMargin,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right
} ) )
f15_local7:animateToState( "default", 0 )
f15_local7:registerEventHandler( "set_score_value_text_" .. f15_arg0, function ( element, event )
element:setText( event.text )
end )
self:addElement( f15_local7 )
return self
end
function BuildSquadWindowBase( f17_arg0, f17_arg1 )
if not f17_arg0 then
f17_arg0 = {}
end
local f17_local0 = f17_arg0.reportIndex or 0
local self = LUI.UIElement.new()
self.id = "squad_reports_entry"
if not f17_arg1 then
f17_arg1 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f0_local0.ReportWindow.Width
}
end
self:registerAnimationState( "default", f17_arg1 )
self:registerAnimationState( "hidden", {
alpha = 0
} )
self.properties = {
reportIndex = f17_local0
}
self:registerEventHandler( "barrel_index_update", OnBarrelIndexUpdate )
self:registerEventHandler( "on_scroll_func", OnBarrelScrollStart )
self:registerEventHandler( "barrel_anim_start", OnBarrelAnimStart )
self:registerEventHandler( "barrel_default_state", OnBarrelAnimFinished )
self:registerEventHandler( "barrel_list_button_alt1", ChallengeSquad )
self:registerEventHandler( "refresh_report_window", function ( element, event )
if element.properties.reportIndex then
RefreshReportWindow( element, event.controller, element.properties.reportIndex )
end
end )
self:animateToState( "default", 0 )
local f17_local2 = LUI.MenuGenerics.generic_menu_background( {}, {
fill_alpha = 1,
hide_bottom = true
} )
f17_local2:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
height = GenericTitleBarDims.TitleBarHeight
} )
f17_local2:animateToState( "default" )
self:addElement( f17_local2 )
local f17_local3 = LUI.MenuGenerics.generic_menu_background_withfade( {}, {
fill_alpha = 1,
top_offset = Cac.Layout.InfoPane.header_height - 1
} )
f17_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
f17_local3:animateToState( "default" )
self:addElement( f17_local3 )
local f17_local4 = LUI.UIVerticalList.new()
f17_local4.id = "squad_report_outer_list"
f17_local4:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = Cac.Layout.InfoPane.header_height + 4,
bottom = 0,
spacing = 10
} )
f17_local4:animateToState( "default", 0 )
self:addElement( f17_local4 )
local f17_local5 = LUI.UIText.new()
f17_local5.id = "title_text"
f17_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.window_title_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 0,
right = 0,
height = CoD.TextSettings.ExtraBigFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center
} ) )
f17_local5:setTextStyle( CoD.TextStyle.Outlined )
for f17_local9, f17_local10 in ipairs( SvS.Reports.MatchOutcomeArray ) do
f17_local5:registerAnimationState( f17_local10, CoD.ColorizeState( SvS.Reports.MatchOutcomeColors[f17_local10].textColor, {} ) )
end
f17_local5:registerEventHandler( "squad_report_set_match_outcome", function ( element, event )
local f19_local0 = event.reportData
element:setText( SvS.GetReportOutcomeText( f19_local0.matchOutcome ) )
element:animateToState( f19_local0.matchOutcome )
end )
if f17_arg0.titleText then
f17_local5:setText( f17_arg0.titleText )
end
f17_local5:animateToState( "default", 0 )
f17_local2:addElement( f17_local5 )
return self, f17_local4
end
function squad_reports_entry( f20_arg0, f20_arg1 )
if not f20_arg1 then
f20_arg1 = {}
end
local f20_local0, f20_local1 = BuildSquadWindowBase( f20_arg1 )
local self = LUI.UIText.new()
self.id = "squad_name_text"
self:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center
} ) )
self:registerEventHandler( "squad_report_set_squad_name", function ( element, event )
element:setText( Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( event.enemyName ) ) )
end )
self:animateToState( "default", 0 )
f20_local1:addElement( self )
local f20_local3 = LUI.Playercard.new( nil, {}, 0 )
f20_local3.id = "playercard_id"
f20_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -5,
left = 0,
height = 90,
width = 100,
alpha = 1,
scale = -0.19
} )
f20_local3:registerEventHandler( "refresh_report_playercard", function ( element, event )
local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
if not f22_local0 or f22_local0.reportCount == 0 then
return
end
local f22_local1 = f22_local0.reportData[f20_arg1.reportIndex]
local f22_local2 = Squad.GetReportPlayercard( f22_local0.controller, f22_local1.reportIndex )
if f22_local2 then
local f22_local3 = {
name = "update_playercard",
gamertag = f22_local1.enemyPlayercardProps.gamertag,
clantag = f22_local1.enemyPlayercardProps.clantag,
rank = f22_local2.rank,
prestige = f22_local2.prestige,
background = f22_local2.background,
patchEmblem = f22_local2.patchEmblem
}
element:processEvent( f22_local3 )
f22_local1.enemyPlayercardProps = f22_local3
end
end )
f20_local3:animateToState( "default", 0 )
f20_local1:addElement( f20_local3 )
if f20_arg1.reportIndex then
local f20_local4 = LUI.UITimer.new( 250, "refresh_report_playercard", "report_playercards" )
f20_local4.id = "playercard_refresh_timer_id"
f20_local3:addElement( f20_local4 )
end
local f20_local4 = LUI.UIText.new()
f20_local4.id = "squad_report_xp_text"
f20_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.yellow, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f20_local4:registerAnimationState( "color_yellow", CoD.ColorizeState( Colors.yellow, {} ) )
f20_local4:registerAnimationState( "color_normal", CoD.ColorizeState( Colors.primary_text_color, {} ) )
f20_local4:registerEventHandler( "set_xp_text", function ( element, event )
if event.didEarnXP then
element:animateToState( "color_yellow" )
else
element:animateToState( "color_normal" )
end
element:setText( event.text or "" )
end )
f20_local4:animateToState( "default", 0 )
f20_local1:addElement( f20_local4 )
local f20_local5 = LUI.UIElement.new()
f20_local5.id = "match_info_container"
f20_local5:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 10,
right = -10,
top = 0,
bottom = 369
} )
f20_local5:animateToState( "default", 0 )
f20_local1:addElement( f20_local5 )
local f20_local6 = LUI.UIImage.new()
f20_local6.id = "match_info_background"
f20_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "box_white_gradient_top" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0.05
} ) )
f20_local6:animateToState( "default", 0 )
f20_local5:addElement( f20_local6 )
local f20_local7 = LUI.UIVerticalList.new()
f20_local7.id = "match_info_list"
f20_local7:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 10,
right = -10,
top = 7,
bottom = 0,
spacing = 6
} )
f20_local7:animateToState( "default", 0 )
f20_local5:addElement( f20_local7 )
local f20_local8 = LUI.UIText.new()
f20_local8.id = "match_info_map_text"
f20_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f20_local8:registerEventHandler( "squad_report_set_match_info", function ( element, event )
local f24_local0 = ""
local f24_local1 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, event.gametype, GameTypesTable.Cols.Name )
if f24_local1 and f24_local1 ~= "" then
element:setText( Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f24_local1, Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( event.mapName ) ) ) )
end
end )
f20_local8:animateToState( "default", 0 )
f20_local7:addElement( f20_local8 )
local f20_local9 = LUI.UIText.new()
f20_local9.id = "match_info_time_text"
f20_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f20_local9:registerEventHandler( "squad_report_set_match_info", function ( element, event )
element:setText( event.timeText or "" )
end )
f20_local9:animateToState( "default", 0 )
f20_local7:addElement( f20_local9 )
f20_local7:addElement( BuildScoreBar( "your_score", Engine.Localize( "LUA_MENU_YOUR_SQUAD_SCORE" ) ) )
f20_local7:addElement( BuildScoreBar( "enemy_score", Engine.Localize( "LUA_MENU_ENEMY_SQUAD_SCORE" ) ) )
local f20_local10 = LUI.UIImage.new()
f20_local10.id = "match_info_map_image"
f20_local10:registerAnimationState( "default", {
material = RegisterMaterial( "preview_mp_snow" ),
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 3,
right = 327,
top = 0,
bottom = 184,
red = 1,
blue = 1,
green = 1,
alpha = 1
} )
f20_local10:registerEventHandler( "squad_report_set_match_info", function ( element, event )
CoD.SetMaterial( element, RegisterMaterial( "preview_" .. event.mapName ) )
end )
f20_local10:animateToState( "default", 0 )
f20_local7:addElement( f20_local10 )
local f20_local11 = LUI.UIText.new()
f20_local11.id = "count_text"
f20_local11:registerAnimationState( "default", CoD.ColorizeState( {
r = 0.6,
b = 0.6,
g = 0.6
}, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f20_local11:registerEventHandler( "squad_report_set_report_index", function ( element, event )
element:setText( Engine.Localize( "LUA_MENU_REPORT_COUNT_FORMAT", event.reportIndex or 0, event.maxIndex or 0 ) )
end )
f20_local11:animateToState( "default", 0 )
f20_local7:addElement( f20_local11 )
local f20_local12 = LUI.UIImage.new()
f20_local12.id = "squad_reports_fade_overlay"
f20_local12:registerAnimationState( "default", CoD.ColorizeState( {
r = 0,
b = 0,
g = 0
}, {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0
} ) )
f20_local12:registerAnimationState( "faded", {
alpha = f0_local0.Settings.FADED_ALPHA
} )
f20_local12:registerEventHandler( "squad_report_set_primary", SetReportWindowAsPrimary )
f20_local12:registerEventHandler( "squad_report_set_secondary", SetReportWindowAsSecondary )
f20_local12:animateToState( "default", 0 )
f20_local0:addElement( f20_local12 )
return f20_local0
end
function squad_reports_empty_entry( f28_arg0, f28_arg1 )
if not f28_arg1 then
f28_arg1 = {}
end
local f28_local0 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 640 - f0_local0.ReportWindow.Width / 2,
right = -640 + f0_local0.ReportWindow.Width / 2,
top = f0_local0.ReportWindow.Top,
bottom = f0_local0.ReportWindow.Bottom,
alpha = 1
}
f28_arg1.titleText = Engine.Localize( "LUA_MENU_NO_REPORTS_TITLE" )
local f28_local1, f28_local2 = BuildSquadWindowBase( f28_arg1, f28_local0 )
local self = LUI.UIElement.new()
self.id = "squad_report_no_reports_spacer_1"
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
height = 200
} )
self:animateToState( "default", 0 )
f28_local2:addElement( self )
local f28_local4 = LUI.UIText.new()
f28_local4.id = "squad_report_no_reports_text"
f28_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 10,
right = -10,
top = 0,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ) )
f28_local4:setText( Engine.Localize( "LUA_MENU_NO_REPORTS_DESC" ) )
f28_local4:animateToState( "default", 0 )
f28_local2:addElement( f28_local4 )
f28_local1:animateToState( "hidden", 0 )
return f28_local1
end
function SquadReportsFeeder( f29_arg0 )
local f29_local0 = {
[#f29_local0 + 1] = {
type = "squad_reports_entry",
id = f0_local0.VisibleWindowsIDs.Left,
properties = {
reportIndex = 1
},
handlers = {
init_report_1 = InitReportWindow
}
},
[#f29_local0 + 1] = {
type = "squad_reports_entry",
id = f0_local0.VisibleWindowsIDs.Center,
properties = {
reportIndex = 2
},
handlers = {
init_report_2 = InitReportWindow
}
},
[#f29_local0 + 1] = {
type = "squad_reports_entry",
id = f0_local0.VisibleWindowsIDs.Right,
properties = {
reportIndex = 3
},
handlers = {
init_report_3 = InitReportWindow
}
}
}
return f29_local0
end
function squad_reports_menu()
return {
type = "UIElement",
id = "squad_reports_menu",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = SquadReportsCreate,
squad_reports_refresh_data = HandleDataRefresh
},
children = {
{
type = "generic_menu_title",
id = "squad_reports_title_text_id",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" )
}
},
{
type = "UIBarrelList",
id = "reports_list",
focusable = true,
properties = {
spacing = 56,
anim_speed = f0_local0.Settings.BARREL_ANIM_SPEED
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f0_local0.ReportWindow.Top,
bottom = f0_local0.ReportWindow.Bottom,
left = 28,
right = 0,
alignemnt = LUI.Alignment.Center
},
hidden = {
alpha = 0
}
},
handlers = {
hide_squad_reports_list = function ( f31_arg0, f31_arg1 )
f31_arg0:animateToState( "hidden", 0 )
end
},
childrenFeeder = SquadReportsFeeder
},
{
type = "squad_reports_empty_entry",
id = "squad_reports_empty_entry_window",
handlers = {
hide_squad_reports_list = function ( f32_arg0, f32_arg1 )
f32_arg0:animateToState( "default", 0 )
end
}
},
{
type = "UIButton",
id = "squad_reports_left_arrow",
requireFocusType = FocusType.MouseOver,
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 100,
bottom = 130,
left = 420,
right = 445
},
shifted = MBh.BaseState( "default", {
left = 415,
right = 440
} ),
hidden = {
alpha = 0
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"shifted",
500,
true,
true
},
{
"default",
500,
true,
true
}
} ),
button_action = function ( f33_arg0, f33_arg1 )
local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 )
if f33_local0.barrelList then
f33_local0.barrelList:decrement()
end
end
,
hide_squad_reports_list = function ( f34_arg0, f34_arg1 )
f34_arg0:animateToState( "hidden", 0 )
f34_arg0:processEvent( {
name = "disable"
} )
f34_arg0.m_ignoreMouseFocus = true
end
},
children = {
{
type = "UIImage",
id = "squad_reports_left_arrow_image",
states = {
default = {
material = RegisterMaterial( "widg_margin_arrow_lt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.5
},
over = {
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
button_over = MBh.AnimateToState( "over" ),
button_up = MBh.AnimateToState( "default" ),
hide_squad_reports_list = function ( f35_arg0, f35_arg1 )
f35_arg0:animateToState( "hidden", 0 )
end
}
}
}
},
{
type = "UIButton",
id = "squad_reports_right_arrow",
requireFocusType = FocusType.MouseOver,
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 100,
bottom = 130,
left = 835,
right = 860
},
shifted = MBh.BaseState( "default", {
left = 840,
right = 865
} ),
hidden = {
alpha = 0
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"shifted",
500,
true,
true
},
{
"default",
500,
true,
true
}
} ),
button_action = function ( f36_arg0, f36_arg1 )
local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f36_arg0 )
if f36_local0.barrelList then
f36_local0.barrelList:increment()
end
end
,
hide_squad_reports_list = function ( f37_arg0, f37_arg1 )
f37_arg0:animateToState( "hidden", 0 )
f37_arg0:processEvent( {
name = "disable"
} )
f37_arg0.m_ignoreMouseFocus = true
end
},
children = {
{
type = "UIImage",
id = "squad_reports_right_arrow_image",
states = {
default = {
material = RegisterMaterial( "widg_margin_arrow_rt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.5
},
over = {
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
button_over = MBh.AnimateToState( "over" ),
button_up = MBh.AnimateToState( "default" ),
hide_squad_reports_list = function ( f38_arg0, f38_arg1 )
f38_arg0:animateToState( "hidden", 0 )
end
}
}
}
},
{
type = "button_helper_text_main",
id = "squad_reports_button_helper_text_id"
},
{
type = "online_friends_widget",
id = "squad_reports_friends_widget_id"
},
{
type = "generic_back_button"
}
}
}
end
LUI.MenuBuilder.registerDef( "squad_reports_menu", squad_reports_menu )
LUI.MenuBuilder.registerType( "squad_reports_entry", squad_reports_entry )
LUI.MenuBuilder.registerType( "squad_reports_empty_entry", squad_reports_empty_entry )
LockTable( _M )