496 lines
13 KiB
Lua
496 lines
13 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
f0_local0 = {
|
|
OutcomeTextTop = 90,
|
|
TeamInfoMargin = 5,
|
|
SeparatorTop = 280,
|
|
SeparatorHeight = 1,
|
|
SeparatorAlpha = 0.15,
|
|
VersusTextTop = 126
|
|
}
|
|
f0_local1 = {
|
|
Top = 125,
|
|
Height = 164,
|
|
Width = 360,
|
|
Spacing = 10,
|
|
TitleBGColor = {
|
|
r = 0.1,
|
|
g = 0.1,
|
|
b = 0.1
|
|
},
|
|
TitleBGHeight = 25,
|
|
TitleBGTextMargin = 2
|
|
}
|
|
f0_local2 = {
|
|
Height = 25,
|
|
HorizontalTextMargin = 15,
|
|
VerticalTextMargin = 2,
|
|
ValueAreaWidth = 125,
|
|
SplitImageWidth = 32,
|
|
ValueAreaBorder = 2,
|
|
PrimaryColor = {
|
|
r = 0.1,
|
|
g = 0.1,
|
|
b = 0.1
|
|
},
|
|
ValueAreaColor = {
|
|
r = 0.4,
|
|
g = 0.4,
|
|
b = 0.4
|
|
}
|
|
}
|
|
function MatchSummaryCreate( f1_arg0, f1_arg1 )
|
|
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
|
|
local f1_local1 = f1_arg1.controller or f1_local0.exclusiveController
|
|
local f1_local2 = SvS.GetCachedPostMatchData()
|
|
f1_arg0:processEvent( {
|
|
name = "aar_set_subtitle_text",
|
|
new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name ), Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "map" ) ) ) )
|
|
} )
|
|
local f1_local3 = SvS.GetReportOutcomeKeyFromWinLoss( Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "win" ), Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "loss" ) )
|
|
f1_arg0:processEvent( {
|
|
name = "set_outcome_text",
|
|
text = SvS.GetReportOutcomeText( f1_local3, Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "endReasonTextIndex" ) ),
|
|
outcomeKey = f1_local3
|
|
} )
|
|
local f1_local4 = Engine.GetClientMatchData( "alliesScore" ) or 0
|
|
local f1_local5 = Engine.GetClientMatchData( "axisScore" ) or 0
|
|
local f1_local6 = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "clientMatchIndex" ) or -1
|
|
local f1_local7, f1_local8 = nil
|
|
if f1_local6 ~= -1 then
|
|
if (Engine.GetClientMatchData( "players", f1_local6, "team" ) or "allies") == "allies" then
|
|
f1_local7 = f1_local4
|
|
f1_local8 = f1_local5
|
|
else
|
|
f1_local7 = f1_local5
|
|
f1_local8 = f1_local4
|
|
end
|
|
else
|
|
f1_local7 = 0
|
|
f1_local8 = 0
|
|
DebugPrint( "[WARNING] AARSquadSummary: Attempting to view scoreboard, but clientMatchIndex value is invalid" )
|
|
end
|
|
local f1_local9 = f1_arg0:getFirstDescendentById( "aar_squad_summary_your_team_info" )
|
|
local f1_local10 = f1_arg0:getFirstDescendentById( "aar_squad_summary_enemy_team_info" )
|
|
f1_local9:processEvent( {
|
|
name = "set_team_score_text",
|
|
text = f1_local7
|
|
} )
|
|
f1_local10:processEvent( {
|
|
name = "set_team_score_text",
|
|
text = f1_local8
|
|
} )
|
|
f1_local10:processEvent( {
|
|
name = "update_playercard",
|
|
gamertag = f1_local2.enemyName,
|
|
clantag = f1_local2.enemyPlayercard.clantag,
|
|
rank = f1_local2.enemyPlayercard.rank,
|
|
prestige = f1_local2.enemyPlayercard.prestige,
|
|
background = f1_local2.enemyPlayercard.background,
|
|
patchEmblem = f1_local2.enemyPlayercard.patch
|
|
} )
|
|
local f1_local11 = Cac.GetLocalRankedPlayercardInfo( f1_local1 )
|
|
f1_local11.name = "update_playercard"
|
|
f1_local11.patchEmblem = f1_local11.patch
|
|
f1_local9:processEvent( f1_local11 )
|
|
end
|
|
|
|
function CreateScoreBar( f2_arg0 )
|
|
local f2_local0, f2_local1, f2_local2, f2_local3, f2_local4, f2_local5 = nil
|
|
if not f2_arg0 then
|
|
f2_local0 = LUI.Alignment.Left
|
|
f2_local1 = LUI.Alignment.Right
|
|
f2_local2 = f0_local1.Width - f0_local2.ValueAreaWidth - f0_local2.SplitImageWidth
|
|
f2_local3 = f0_local1.Width - f0_local2.ValueAreaWidth
|
|
f2_local4 = f2_local3
|
|
f2_local5 = f2_local4 + f0_local2.ValueAreaWidth - f0_local2.ValueAreaBorder
|
|
else
|
|
f2_local0 = LUI.Alignment.Right
|
|
f2_local1 = LUI.Alignment.Left
|
|
f2_local2 = f0_local2.ValueAreaWidth + f0_local2.SplitImageWidth
|
|
f2_local3 = f0_local2.ValueAreaWidth
|
|
f2_local4 = f0_local2.ValueAreaBorder
|
|
f2_local5 = f2_local4 + f0_local2.ValueAreaWidth + f0_local2.ValueAreaBorder
|
|
end
|
|
return {
|
|
type = "UIImage",
|
|
id = "team_info_score_bar_bg",
|
|
states = {
|
|
default = CoD.ColorizeState( f0_local2.PrimaryColor, {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = f0_local2.Height
|
|
} )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "team_info_score_bar_value_bg",
|
|
states = {
|
|
default = CoD.ColorizeState( f0_local2.ValueAreaColor, {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f2_local4,
|
|
right = f2_local4 + f0_local2.ValueAreaWidth,
|
|
top = f0_local2.ValueAreaBorder,
|
|
bottom = f0_local2.Height - f0_local2.ValueAreaBorder
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "team_info_score_bar_split_image",
|
|
states = {
|
|
default = CoD.ColorizeState( f0_local2.ValueAreaColor, {
|
|
material = RegisterMaterial( "box_stat_cap" ),
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f2_local2,
|
|
right = f2_local3,
|
|
top = f0_local2.ValueAreaBorder,
|
|
bottom = f0_local2.Height - f0_local2.ValueAreaBorder
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "team_info_score_bar_label_text",
|
|
properties = {
|
|
text = Engine.Localize( "LUA_MENU_SCORE_CAPS" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.primary_text_color, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f0_local2.HorizontalTextMargin,
|
|
right = -f0_local2.HorizontalTextMargin,
|
|
top = f0_local2.VerticalTextMargin,
|
|
bottom = f0_local2.VerticalTextMargin + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = f2_local0
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "team_info_score_bar_value_text",
|
|
handlers = {
|
|
set_team_score_text = function ( f3_arg0, f3_arg1 )
|
|
f3_arg0:setText( f3_arg1.text )
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.primary_text_color, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f0_local2.HorizontalTextMargin,
|
|
right = -f0_local2.HorizontalTextMargin,
|
|
top = f0_local2.VerticalTextMargin,
|
|
bottom = f0_local2.VerticalTextMargin + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = f2_local1
|
|
} )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function aar_squad_summary_main()
|
|
return {
|
|
type = "UIElement",
|
|
id = "aar_squad_summary_main_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -395,
|
|
right = 395,
|
|
top = -170,
|
|
bottom = 170
|
|
}
|
|
},
|
|
properties = {
|
|
page_idx = 1,
|
|
num_pages = 3
|
|
},
|
|
handlers = {
|
|
menu_create = MatchSummaryCreate,
|
|
element_refresh = MatchSummaryCreate
|
|
},
|
|
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",
|
|
id = "aar_title_bar_id",
|
|
properties = {
|
|
title_bar_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY" ),
|
|
subtitle_text = "",
|
|
subtitle_banner_width = 300
|
|
}
|
|
},
|
|
{
|
|
type = "aar_dots",
|
|
id = "AARSummaryDotsID",
|
|
properties = {
|
|
num_dots = MBh.Property( "num_pages" ),
|
|
curr_dot = MBh.Property( "page_idx" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "aar_squad_summary_outcome_text",
|
|
properties = {
|
|
textStyle = CoD.TextStyle.Outlined
|
|
},
|
|
handlers = {
|
|
set_outcome_text = function ( f5_arg0, f5_arg1 )
|
|
f5_arg0:setText( f5_arg1.text )
|
|
f5_arg0:animateToState( f5_arg1.outcomeKey )
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = f0_local0.OutcomeTextTop,
|
|
bottom = f0_local0.OutcomeTextTop + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
alignment = LUI.Alignment.Center
|
|
},
|
|
Victory = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Victory.textColor, {} ),
|
|
Defeat = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Defeat.textColor, {} ),
|
|
Draw = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Draw.textColor, {} )
|
|
}
|
|
},
|
|
{
|
|
type = "aar_squad_summary_team_info",
|
|
id = "aar_squad_summary_your_team_info",
|
|
handlers = {
|
|
set_your_team_info = function ( f6_arg0, f6_arg1 )
|
|
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f0_local0.TeamInfoMargin,
|
|
right = f0_local0.TeamInfoMargin + f0_local1.Width,
|
|
top = f0_local1.Top,
|
|
bottom = f0_local1.Top + f0_local1.Height,
|
|
spacing = f0_local1.Spacing
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "aar_squad_summary_team_info",
|
|
id = "aar_squad_summary_enemy_team_info",
|
|
properties = {
|
|
isEnemy = true
|
|
},
|
|
handlers = {
|
|
set_your_team_info = function ( f7_arg0, f7_arg1 )
|
|
|
|
end
|
|
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = -f0_local0.TeamInfoMargin - f0_local1.Width,
|
|
right = -f0_local0.TeamInfoMargin,
|
|
top = f0_local1.Top,
|
|
bottom = f0_local1.Top + f0_local1.Height,
|
|
spacing = f0_local1.Spacing
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "aar_squad_summary_vs_text",
|
|
properties = {
|
|
text = Engine.Localize( "LUA_MENU_VERSUS" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = f0_local0.VersusTextTop,
|
|
bottom = f0_local0.VersusTextTop + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
alignment = LUI.Alignment.Center
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "aar_footer_bar",
|
|
id = "oink_3"
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function TeamInfoChildrenFeeder( f8_arg0 )
|
|
local f8_local0 = f8_arg0.exclusiveController
|
|
local f8_local1 = SvS.GetCachedPostMatchData()
|
|
local f8_local2 = f8_arg0.isEnemy
|
|
if not f8_local0 then
|
|
f8_local0 = Engine.GetFirstActiveController()
|
|
DebugPrint( "[WARNING] AARSquadSummary: using controller index 0, this is only ok if you are editing a menu" )
|
|
end
|
|
local f8_local3, f8_local4 = nil
|
|
if f8_local2 then
|
|
f8_local3 = f8_local1.enemySquadName or ""
|
|
else
|
|
f8_local3 = Squad.GetPlayerSquadName( f8_local0 ) or ""
|
|
end
|
|
local f8_local5 = {
|
|
[#f8_local5 + 1] = {
|
|
type = "UIImage",
|
|
id = "team_info_title_bg",
|
|
states = {
|
|
default = CoD.ColorizeState( f0_local1.TitleBGColor, {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = f0_local1.TitleBGHeight
|
|
} )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "team_info_title_text",
|
|
properties = {
|
|
text = Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( f8_local3 ) )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.primary_text_color, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = f0_local1.TitleBGTextMargin,
|
|
bottom = f0_local1.TitleBGTextMargin + CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
alignment = LUI.Alignment.Center
|
|
} )
|
|
}
|
|
}
|
|
}
|
|
},
|
|
[#f8_local5 + 1] = {
|
|
type = "playercard",
|
|
id = "team_info_playercard",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = -13,
|
|
left = -13,
|
|
height = 90,
|
|
width = 100,
|
|
scale = -0.17
|
|
}
|
|
}
|
|
},
|
|
[#f8_local5 + 1] = CreateScoreBar( f8_arg0.isEnemy )
|
|
}
|
|
return f8_local5
|
|
end
|
|
|
|
function aar_squad_summary_team_info()
|
|
return {
|
|
type = "UIVerticalList",
|
|
id = "team_info_list",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
spacing = 10
|
|
}
|
|
},
|
|
childrenFeeder = TeamInfoChildrenFeeder
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "aar_squad_summary_main", aar_squad_summary_main )
|
|
LUI.MenuBuilder.registerDef( "aar_squad_summary_team_info", aar_squad_summary_team_info )
|
|
LockTable( _M )
|