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

1346 lines
34 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = {
white = {
1,
1,
1,
1
},
gray = {
0.5,
0.5,
0.5,
1
},
black = {
0,
0,
0,
1
}
}
f0_local1 = function ( f1_arg0 )
local f1_local0 = GameX.gameModeIsFFA( f1_arg0 )
local f1_local1 = {
default = {
"score",
"kills",
"deaths",
"assists"
},
war = {
"score",
"kills",
"deaths",
"assists"
},
dom = {
"score",
"kills",
"deaths",
"captures"
},
sd = {
"score",
"kills",
"deaths",
"plants"
},
conf = {
"score",
"kills",
"deaths",
"tags"
},
dm = {
"dm_score",
"kills",
"deaths",
"dm_streak"
},
sr = {
"score",
"kills",
"deaths",
"rescues"
},
blitz = {
"score",
"kills",
"deaths",
"captures"
},
cranked = {
"score",
"kills",
"deaths",
"assists"
},
cranked_ffa = {
"cranked_ffa_score",
"kills",
"deaths",
"assists"
},
sotf = {
"score",
"kills",
"deaths",
"assists"
},
sotf_ffa = {
"sotf_ffa_score",
"kills",
"deaths",
"dm_streak"
},
infect = {
"score",
"kills",
"deaths",
"time"
},
grind = {
"score",
"kills",
"deaths",
"scores"
},
horde = {
"kills",
"revives",
"crates"
},
gun = {
"score",
"kills",
"deaths",
"gun_knives"
},
siege = {
"score",
"kills",
"deaths",
"captures"
}
}
local f1_local2 = {
score = {
"LUA_MENU_SCORE",
"score"
},
kills = {
"LUA_MENU_KILLS",
"kills"
},
deaths = {
"LUA_MENU_DEATHS",
"deaths"
},
assists = {
"LUA_MENU_ASSISTS",
"assists"
},
cranked_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
sotf_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
dm_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
rescues = {
"LUA_MENU_RESCUES",
"extrascore0"
},
captures = {
"LUA_MENU_CAPTURES",
"extrascore0"
},
tags = {
"LUA_MENU_TAGS",
"extrascore0"
},
time = {
"LUA_MENU_TIME",
"extrascore0"
},
scores = {
"LUA_MENU_SCORES",
"extrascore0"
},
plants = {
"LUA_MENU_PLANTS",
"extrascore0"
},
revives = {
"LUA_MENU_REVIVES",
"assists"
},
crates = {
"LUA_MENU_CRATES",
"extrascore0"
},
dm_streak = {
"MENU_STREAK",
"assists"
},
gun_knives = {
"PATCH_MENU_STABS",
"assists"
}
}
local f1_local3
if f1_local0 then
f1_local3 = f1_local1[f1_arg0 .. "_ffa"]
if not f1_local3 then
else
local f1_local4 = {}
for f1_local8, f1_local9 in ipairs( f1_local3 ) do
f1_local4[f1_local8] = {
Engine.Localize( f1_local2[f1_local9][1] ),
f1_local2[f1_local9][2]
}
end
return f1_local4
end
end
f1_local3 = f1_local1[f1_arg0] or f1_local1.default
end
f0_local2 = function ()
return {
blueBacking = RegisterMaterial( "scoreboard_team_blue" ),
orngBacking = RegisterMaterial( "scoreboard_team_orng" ),
emptyBacking = RegisterMaterial( "scoreboard_team_empty" ),
talkingIcon = RegisterMaterial( "scoreboard_mic_talk_wht" ),
mutedIcon = RegisterMaterial( "scoreboard_mic_mute_wht" )
}
end
local f0_local3 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 )
local f3_local0 = LUI.UIImage.new
local f3_local1 = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
width = f3_arg0,
height = f3_arg1,
material = f3_arg2
}
local f3_local2
if f3_arg3 then
f3_local2 = f3_arg3[1]
if not f3_local2 then
else
f3_local1.red = f3_local2
if f3_arg3 then
f3_local2 = f3_arg3[2]
if not f3_local2 then
else
f3_local1.green = f3_local2
if f3_arg3 then
f3_local2 = f3_arg3[3]
if not f3_local2 then
else
f3_local1.blue = f3_local2
if f3_arg3 then
f3_local2 = f3_arg3[4]
if not f3_local2 then
else
f3_local1.alpha = f3_local2
f3_local1.alpha = 1
f3_local0 = f3_local0( f3_local1 )
f3_local0:animateToState( "default", 0 )
return f3_local0
end
end
f3_local2 = 1
end
end
f3_local2 = 1
end
end
f3_local2 = 1
end
end
f3_local2 = 1
end
local f0_local4 = function ( f4_arg0, f4_arg1, f4_arg2 )
local self = LUI.UIImage.new( {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
left = 8,
width = 28,
height = 28,
bottom = 10,
material = f4_arg1,
alpha = 0
} )
self:registerAnimationState( "talking", {
material = f4_arg1,
alpha = 1
} )
self:registerAnimationState( "muted", {
material = f4_arg2,
alpha = 1
} )
self:animateToState( "default", 0 )
local f4_local1 = LUI.UIElement.new()
f4_local1:setupUIIntWatch( "ClientVoiceStatus", f4_arg0 )
f4_local1:registerEventHandler( "int_watch_alert", function ( element, event )
if event.newValue == 2 then
local f5_local0 = element:getParent()
f5_local0:animateToState( "muted", 0 )
elseif event.newValue == 1 then
local f5_local0 = element:getParent()
f5_local0:animateToState( "talking", 0 )
else
local f5_local0 = element:getParent()
f5_local0:animateToState( "default", 0 )
end
end )
self:addElement( f4_local1 )
return self
end
local f0_local5 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3 )
local f6_local0 = LUI.UIImage.new
local f6_local1 = {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = 0,
left = 0,
width = f6_arg0,
height = f6_arg1,
material = f6_arg2
}
local f6_local2
if f6_arg3 then
f6_local2 = f6_arg3[1]
if not f6_local2 then
else
f6_local1.red = f6_local2
if f6_arg3 then
f6_local2 = f6_arg3[2]
if not f6_local2 then
else
f6_local1.green = f6_local2
if f6_arg3 then
f6_local2 = f6_arg3[3]
if not f6_local2 then
else
f6_local1.blue = f6_local2
if f6_arg3 then
f6_local2 = f6_arg3[4]
if not f6_local2 then
else
f6_local1.alpha = f6_local2
f6_local1.alpha = 1
f6_local0 = f6_local0( f6_local1 )
f6_local0:animateToState( "default", 0 )
return f6_local0
end
end
f6_local2 = 1
end
end
f6_local2 = 1
end
end
f6_local2 = 1
end
end
f6_local2 = 1
end
local f0_local6 = function ( menu, controller )
local self = LUI.UIImage.new( {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
bottom = 0,
left = -37,
width = 78,
height = 78,
material = menu,
alpha = 1
} )
self:animateToState( "default", 0 )
local f7_local1 = LUI.UIImage.new( {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = controller,
alpha = 1
} )
f7_local1:animateToState( "default", 0 )
self:addElement( f7_local1 )
return self
end
local f0_local7 = function ()
local f8_local0 = 5
if Engine.GetDvarString( "ui_mapname" ) == "mp_shipment_ns" then
f8_local0 = 0
end
local self = LUI.UIElement.new( {
worldBlur = f8_local0
} )
self:setupWorldBlur()
return self
end
local f0_local8 = function ( f9_arg0, f9_arg1, f9_arg2 )
local f9_local0 = {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
left = 0,
width = f9_arg2,
bottom = 0,
height = CoD.TextSettings.HudEuroNormalFont.Height,
font = CoD.TextSettings.HudEuroNormalFont.Font
}
local f9_local1
if f9_arg1 then
f9_local1 = f9_arg1[1]
if not f9_local1 then
else
f9_local0.red = f9_local1
if f9_arg1 then
f9_local1 = f9_arg1[2]
if not f9_local1 then
else
f9_local0.green = f9_local1
if f9_arg1 then
f9_local1 = f9_arg1[3]
if not f9_local1 then
else
f9_local0.blue = f9_local1
if f9_arg1 then
f9_local1 = f9_arg1[4]
if not f9_local1 then
else
f9_local0.alpha = f9_local1
f9_arg0:registerAnimationState( "default", f9_local0 )
f9_arg0:animateToState( "default" )
end
end
f9_local1 = 1
end
end
f9_local1 = 1
end
end
f9_local1 = 1
end
end
f9_local1 = 1
end
local f0_local9 = function ( f10_arg0, f10_arg1, f10_arg2 )
local f10_local0, f10_local1, f10_local2, f10_local3 = GetTextDimensions( f10_arg0, f10_arg1.Font, f10_arg1.Height )
local f10_local4 = f10_local2 - f10_local0
local f10_local5 = LUI.UIText.new
local f10_local6 = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 0,
width = f10_local4,
height = f10_arg1.Height,
font = f10_arg1.Font
}
local f10_local7
if f10_arg2 then
f10_local7 = f10_arg2[1]
if not f10_local7 then
else
f10_local6.red = f10_local7
if f10_arg2 then
f10_local7 = f10_arg2[2]
if not f10_local7 then
else
f10_local6.green = f10_local7
if f10_arg2 then
f10_local7 = f10_arg2[3]
if not f10_local7 then
else
f10_local6.blue = f10_local7
if f10_arg2 then
f10_local7 = f10_arg2[4]
if not f10_local7 then
else
f10_local6.alpha = f10_local7
f10_local6.alignment = LUI.Alignment.None
f10_local5 = f10_local5( f10_local6 )
f10_local5.m_textStyle = CoD.TextStyle.ShadowedMore
f10_local5:setText( f10_arg0 )
return f10_local5
end
end
f10_local7 = 1
end
end
f10_local7 = 1
end
end
f10_local7 = 1
end
end
f10_local7 = 1
end
local f0_local10 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 )
if not f11_arg3 then
f11_arg3 = {}
end
local f11_local0 = f11_arg3 and f11_arg3.width
if not f11_local0 then
local f11_local1, f11_local2, f11_local3, f11_local4 = GetTextDimensions( f11_arg0, f11_arg1.Font, f11_arg1.Height )
f11_local0 = f11_local3 - f11_local1
end
local f11_local1 = nil
if f11_arg3.marquee then
f11_local1 = LUI.UIMarqueeText.new
else
f11_local1 = LUI.UIText.new
end
local f11_local2 = f11_local1
local f11_local3 = {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false
}
local f11_local4
if f11_arg3 then
f11_local4 = f11_arg3.x
if not f11_local4 then
else
f11_local3.left = f11_local4
f11_local3.width = f11_local0
if f11_arg3 then
f11_local4 = f11_arg3.y
if not f11_local4 then
else
f11_local3.bottom = f11_local4
f11_local3.height = f11_arg1.Height
f11_local3.font = f11_arg1.Font
if f11_arg2 then
f11_local4 = f11_arg2[1]
if not f11_local4 then
else
f11_local3.red = f11_local4
if f11_arg2 then
f11_local4 = f11_arg2[2]
if not f11_local4 then
else
f11_local3.green = f11_local4
if f11_arg2 then
f11_local4 = f11_arg2[3]
if not f11_local4 then
else
f11_local3.blue = f11_local4
if f11_arg2 then
f11_local4 = f11_arg2[4]
if not f11_local4 then
else
f11_local3.alpha = f11_local4
if f11_arg3 then
f11_local4 = f11_arg3.alignment
if not f11_local4 then
else
f11_local3.alignment = f11_local4
f11_local2 = f11_local2( f11_local3 )
f11_local2:setText( f11_arg0 )
f11_local2:animateToState( "default", 0 )
return f11_local2
end
end
f11_local4 = LUI.Alignment.None
end
end
f11_local4 = 1
end
end
f11_local4 = 1
end
end
f11_local4 = 1
end
end
f11_local4 = 1
end
end
f11_local4 = -3
end
end
f11_local4 = 0
end
local f0_local11 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3 )
local self = LUI.UIHorizontalList.new( {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
left = 0,
width = f12_arg2,
bottom = 0,
height = CoD.TextSettings.HudEuroNormalFont.Height + 3,
spacing = 32
} )
self:animateToState( "default", 0 )
local f12_local1 = LUI.UIElement.new()
f0_local8( f12_local1, nil, 15 )
self:addElement( f12_local1 )
if f12_arg3 == "horde" then
self:addElement( f0_local10( Engine.Localize( "@LUA_MENU_SAFEGUARD_SCOREBOARD_HEADER", Game.GetOmnvar( "ui_horde_round_number" ) ), CoD.TextSettings.HudEuroNormalFont, f0_local0.white ) )
else
if f12_arg0 then
self:addElement( f0_local10( f12_arg0, CoD.TextSettings.HudEuroNormalFont, f0_local0.white ) )
else
self:addElement( LUI.UIElement.new( {
bottomAnchor = true,
leftAnchor = true,
bottom = 0,
left = 0,
width = 32
} ) )
end
self:addElement( f0_local10( "[" .. f12_arg1 .. "]", CoD.TextSettings.HudEuroNormalFont, f0_local0.gray ) )
end
return self
end
local f0_local12 = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4 )
local f13_local0 = nil
if f13_arg0 == Teams.allies then
f13_local0 = {
iconMat = RegisterMaterial( "scoreboard_heading_icons_ghost" ),
name = GameX.GetLocalizedTeamName( Teams.allies )
}
elseif f13_arg0 == Teams.axis then
f13_local0 = {
iconMat = RegisterMaterial( "scoreboard_heading_icons_fed" ),
name = GameX.GetLocalizedTeamName( Teams.axis )
}
else
assert( f13_arg0 == Teams.free )
f13_local0 = {
iconMat = nil,
name = nil
}
end
if f13_arg4 then
if f13_arg4 == f13_arg0 then
f13_local0.name = Engine.Localize( "LUA_MENU_TEAM_WON", f13_local0.name )
else
f13_local0.name = Engine.Localize( "LUA_MENU_TEAM_LOST", f13_local0.name )
end
end
if f13_arg0 == f13_arg1 then
f13_local0.highlightMat = RegisterMaterial( "scoreboard_heading_icons_blue_hlt" )
else
f13_local0.highlightMat = RegisterMaterial( "scoreboard_heading_icons_orng_hlt" )
end
local f13_local1 = Game.GetNumPlayersOnTeam( f13_arg0 )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
width = 891,
height = 78,
alpha = 1
} )
self:addElement( f0_local5( 891, 38, RegisterMaterial( "scoreboard_heading" ) ) )
if f13_local0.iconMat then
self:addElement( f0_local6( f13_local0.iconMat, f13_local0.highlightMat ) )
end
local f13_local3 = LUI.UIHorizontalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
width = 891,
spacing = 0,
alpha = 1
} )
f13_local3:animateToState( "default", 0 )
self:addElement( f13_local3 )
f13_local3:addElement( f0_local11( f13_local0.name, f13_local1, 445.5, f13_arg2 ) )
local f13_local4 = {
width = 445.5 / #f13_arg3,
alignment = LUI.Alignment.Center
}
for f13_local8, f13_local9 in ipairs( f13_arg3 ) do
f13_local3:addElement( f0_local10( f13_local9[1] or "FAIL", CoD.TextSettings.HudEuroNormalFont, f0_local0.gray, f13_local4 ) )
end
return self
end
local f0_local13 = function ( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 )
local f14_local0, f14_local1, f14_local2 = nil
local f14_local3 = GameX.GetPlayerScoreInfoAtRankForGameMode( f14_arg0, f14_arg2, f14_arg6, true )
if not f14_local3 then
f14_local0 = f0_local3( 891, 34, f14_arg5.emptyBacking )
else
local f14_local4, f14_local5 = nil
f14_local0 = f0_local3( 891, 34, f14_arg4 )
if f14_arg3 == f14_arg2 then
f14_local0:addElement( f0_local3( 891, 34, RegisterMaterial( "scoreboard_team_player" ) ) )
f14_local1 = RegisterMaterial( "scoreboard_mic_talk_blk" )
f14_local2 = RegisterMaterial( "scoreboard_mic_mute_blk" )
f14_local4 = f0_local0.black
f14_local5 = f0_local0.black
if f14_local3.prestige and f14_local3.prestige > 0 then
f14_local5 = f0_local0.white
end
else
f14_local1 = f14_arg5.talkingIcon
f14_local2 = f14_arg5.mutedIcon
f14_local4 = f0_local0.white
f14_local5 = f0_local0.white
end
local self = LUI.UIHorizontalList.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
width = 891,
spacing = 0,
alpha = 1
} )
self:animateToState( "default", 0 )
f14_local0:addElement( self )
local f14_local7 = 445.5
local f14_local8 = {
45,
65,
f14_local7,
[3] = f14_local8[3] - f14_local8[1] - f14_local8[2]
}
local f14_local9 = LUI.UIElement.new()
f0_local8( f14_local9, nil, f14_local8[1] )
f14_local9:addElement( f0_local4( f14_local3.client, f14_local1, f14_local2 ) )
self:addElement( f14_local9 )
local f14_local10 = LUI.UIElement.new()
f0_local8( f14_local10, nil, f14_local8[2] )
local f14_local11 = f14_local3.rankIcon
if f14_local3.rank and f14_local3.prestige and f14_local3.prestige > 0 then
f14_local11 = RegisterMaterial( Rank.GetRankIcon( f14_local3.rank, f14_local3.prestige or 0 ) )
end
f14_local10:addElement( LUI.UIImage.new( {
leftAnchor = true,
bottomAnchor = true,
topAnchor = false,
rightAnchor = false,
left = 0,
bottom = -3,
width = 25,
height = 25,
material = f14_local11,
red = f14_local5[1],
green = f14_local5[2],
blue = f14_local5[3],
alpha = f14_local5[4]
} ) )
f14_local10:addElement( f0_local10( f14_local3.rank + 1, CoD.TextSettings.HudEuroMedSmallFont, f14_local4, {
x = 28,
y = -1
} ) )
self:addElement( f14_local10 )
self:addElement( f0_local10( f14_local3.name, CoD.TextSettings.HudEuroNormalFont, f14_local4, {
width = f14_local8[3],
marquee = true,
alignment = LUI.Alignment.Left
} ) )
local f14_local12 = {
width = f14_local7 / #f14_arg1,
alignment = LUI.Alignment.Center
}
for f14_local17, f14_local18 in ipairs( f14_arg1 ) do
local f14_local16 = f14_local3[f14_local18[2]]
if f14_arg6 == "infect" and f14_local18[2] == "extrascore0" then
f14_local16 = CoD.FormatInfectedTime( f14_local16, true )
end
self:addElement( f0_local10( f14_local16 or "FAIL", CoD.TextSettings.HudEuroNormalFont, f14_local4, f14_local12 ) )
end
end
return f14_local0
end
local f0_local14 = function ()
local f15_local0 = MBh.AnimateLoop( {
{
"shifted",
500,
true,
true
},
{
"default",
500,
true,
true
}
} )
return function ( f16_arg0, f16_arg1 )
if f16_arg0.animstate ~= "show" then
f15_local0( f16_arg0, f16_arg1 )
f16_arg0.animstate = "show"
end
end
end
local f0_local15 = function ()
local f17_local0 = MBh.AnimateToState( "hidden", 100 )
return function ( f18_arg0, f18_arg1 )
if f18_arg0.animstate ~= "hide" then
f17_local0( f18_arg0, f18_arg1 )
f18_arg0.animstate = "hide"
end
end
end
local f0_local16 = function ( f19_arg0 )
local f19_local0 = {
material = RegisterMaterial( "widg_margin_arrow_top" ),
topAnchor = true,
top = f19_arg0,
width = 64,
height = 32,
alpha = 1
}
local self = LUI.UIImage.new()
self:registerAnimationState( "default", f19_local0 )
self:registerAnimationState( "shifted", LUI.MenuBuilder.AnimStateBasedOn( f19_local0, {
topAnchor = true,
top = f19_local0.top + 5
} ) )
self:registerAnimationState( "hidden", LUI.MenuBuilder.AnimStateBasedOn( f19_local0, {
alpha = 0
} ) )
self:animateToState( "hidden", 0 )
self:registerEventHandler( "show_up_scroll_arrow", f0_local14() )
self:registerEventHandler( "hide_up_scroll_arrow", f0_local15() )
self:setPriority( 10 )
self.id = "arrow_up"
return self
end
local f0_local17 = function ( f20_arg0 )
local f20_local0 = {
material = RegisterMaterial( "widg_margin_arrow_bot" ),
bottomAnchor = true,
bottom = f20_arg0 + 4,
width = 64,
height = 32,
alpha = 1
}
local self = LUI.UIImage.new()
self:registerAnimationState( "default", f20_local0 )
self:registerAnimationState( "shifted", LUI.MenuBuilder.AnimStateBasedOn( f20_local0, {
bottomAnchor = true,
bottom = f20_local0.bottom - 5
} ) )
self:registerAnimationState( "hidden", LUI.MenuBuilder.AnimStateBasedOn( f20_local0, {
alpha = 0
} ) )
self:animateToState( "hidden", 0 )
self:registerEventHandler( "show_down_scroll_arrow", f0_local14() )
self:registerEventHandler( "hide_down_scroll_arrow", f0_local15() )
self:setPriority( 10 )
self.id = "arrow_down"
return self
end
local f0_local18 = function ( f21_arg0, f21_arg1 )
local f21_local0 = {
name = "gamepad_button",
button = f21_arg0,
down = f21_arg1
}
return function ( f22_arg0, f22_arg1 )
if f21_arg1 ~= f22_arg0.down then
local f22_local0 = f22_arg0:getParent()
f22_local0:dispatchEventToRoot( f21_local0 )
f22_arg0.down = f21_arg1
end
end
end
local f0_local19 = function ( f23_arg0, f23_arg1 )
if not f23_arg1.interrupted then
local f23_local0 = f23_arg0:getParent()
f23_local0 = f23_local0:getChildById( "main_vlist_wrapper" )
if f23_local0.isWaitingOnDelayedStop then
f23_local0:cancelAnimateToState()
end
end
f23_arg0.isAnimating = false
end
local f0_local20 = function ( f24_arg0, f24_arg1 )
if not f24_arg0.scrollEnabled then
return
elseif f24_arg1.button ~= "down" and f24_arg1.button ~= "up" then
return
end
local f24_local0 = f24_arg0:getChildById( "main_vlist_wrapper" )
local f24_local1 = f24_arg0:getChildById( "pc_delayed_stop" )
if not f24_arg1.down then
if f24_local1.isAnimating then
f24_local0.isWaitingOnDelayedStop = true
else
f24_local0:cancelAnimateToState()
end
else
if f24_local1.isAnimating then
f24_local1:cancelAnimateToState()
f24_local1:animateToState( "delay", 100 )
f24_local1.isAnimating = true
f24_local0.isWaitingOnDelayedStop = false
return
end
local f24_local2, f24_local3, f24_local4, f24_local5 = f24_local0:getCurrentGlobalRect()
local f24_local6, f24_local7, f24_local8, f24_local9 = f24_arg0:getCurrentGlobalRect()
local f24_local10 = f24_arg1.button and -1 or 1
local f24_local11 = 1
f24_local0:cancelAnimateToState()
if f24_local11 > 0 then
local f24_local12, f24_local13 = nil
if f24_local10 > 0 then
f24_local12 = f24_arg0.properties.upperY + f24_local7 - f24_local3
f24_local13 = "top"
f24_arg0:dispatchEventToChildren( {
name = "show_down_scroll_arrow"
} )
if f24_local12 == 0 then
f24_arg0:dispatchEventToChildren( {
name = "hide_up_scroll_arrow"
} )
return
end
else
f24_local12 = f24_arg0.properties.lowerY + f24_local7 - f24_local3
f24_local13 = "bottom"
f24_arg0:dispatchEventToChildren( {
name = "show_up_scroll_arrow"
} )
if f24_local12 == 0 then
f24_arg0:dispatchEventToChildren( {
name = "hide_down_scroll_arrow"
} )
return
end
end
f24_local0:animateToState( f24_local13, math.abs( f24_local12 ) * 1000 / 600 * f24_local11 )
f24_local1:cancelAnimateToState()
f24_local1:animateToState( "delay", 50 )
f24_local1.isAnimating = true
f24_local0.isWaitingOnDelayedStop = false
end
end
end
local f0_local21 = function ( f25_arg0, f25_arg1 )
if not f25_arg0.scrollEnabled then
return
end
local f25_local0 = f25_arg0:getChildById( "main_vlist_wrapper" )
local f25_local1, f25_local2, f25_local3, f25_local4 = f25_local0:getCurrentGlobalRect()
local f25_local5, f25_local6, f25_local7, f25_local8 = f25_arg0:getCurrentGlobalRect()
local f25_local9 = math.sin( math.rad( f25_arg1.leftStickDirection ) ) * f25_arg1.leftStickMagnitude + math.sin( math.rad( f25_arg1.rightStickDirection ) ) * f25_arg1.rightStickMagnitude
local f25_local10 = LUI.clamp( (math.abs( f25_local9 ) - 0.3) / 0.7, 0, 1 )
f25_local0:cancelAnimateToState()
if f25_local10 > 0 then
local f25_local11, f25_local12 = nil
if f25_local9 > 0 then
f25_local11 = f25_arg0.properties.upperY + f25_local6 - f25_local2
f25_local12 = "top"
f25_arg0:dispatchEventToChildren( {
name = "show_down_scroll_arrow"
} )
if f25_local11 == 0 then
f25_arg0:dispatchEventToChildren( {
name = "hide_up_scroll_arrow"
} )
return
end
else
f25_local11 = f25_arg0.properties.lowerY + f25_local6 - f25_local2
f25_local12 = "bottom"
f25_arg0:dispatchEventToChildren( {
name = "show_up_scroll_arrow"
} )
if f25_local11 == 0 then
f25_arg0:dispatchEventToChildren( {
name = "hide_down_scroll_arrow"
} )
return
end
end
f25_local0:animateToState( f25_local12, math.abs( f25_local11 ) * 1000 / 600 * f25_local10 )
end
end
local f0_local22 = function ( f26_arg0, f26_arg1 )
local f26_local0 = f26_arg0:getChildById( "main_vlist_wrapper" )
local f26_local1, f26_local2, f26_local3, f26_local4 = f26_local0:getCurrentGlobalRect()
local f26_local5, f26_local6, f26_local7, f26_local8 = f26_arg0:getCurrentGlobalRect()
local f26_local9 = f26_local8 - f26_local6
local f26_local10 = f26_local4 - f26_local2
if f26_local10 <= f26_local9 then
return
else
f26_arg0:dispatchEventToChildren( {
name = "show_down_scroll_arrow"
} )
local f26_local11 = {
topAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottomAnchor = false,
width = f26_local3 - f26_local1,
height = f26_local10
}
f26_arg0.properties = f26_arg0.properties or {}
f26_arg0.properties.upperY = 0
f26_arg0.properties.lowerY = f26_local9 - f26_local10
f26_local0:registerAnimationState( "top", LUI.MenuBuilder.AnimStateBasedOn( f26_local11, {
top = f26_arg0.properties.upperY
} ) )
f26_local0:registerAnimationState( "bottom", LUI.MenuBuilder.AnimStateBasedOn( f26_local11, {
top = f26_arg0.properties.lowerY
} ) )
f26_local0:registerEventHandler( "transition_complete_top", function ( element, event )
if not event.interrupted then
f26_arg0:dispatchEventToChildren( {
name = "hide_up_scroll_arrow"
} )
end
end )
f26_local0:registerEventHandler( "transition_complete_bottom", function ( element, event )
if not event.interrupted then
f26_arg0:dispatchEventToChildren( {
name = "hide_down_scroll_arrow"
} )
end
end )
f26_arg0.scrollEnabled = true
end
end
local f0_local23 = function ( f29_arg0, f29_arg1 )
local f29_local0, f29_local1, f29_local2, f29_local3 = f29_arg0:getCurrentGlobalRect()
if f29_local0 then
local f29_local4 = f29_arg0:getParent()
f29_local4:animateToState( "visible", 200 )
else
f29_arg0:animateToState( "resized", 1 )
end
end
local f0_local24 = function ( f30_arg0, f30_arg1 )
local f30_local0, f30_local1, f30_local2, f30_local3 = f30_arg0:getCurrentGlobalRect()
if f30_local0 then
local f30_local4 = f30_arg0:getParent()
f30_local4:registerAnimationState( "resized", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 0,
width = (f30_local2 - f30_local0) * f30_arg0.scaleRatio,
height = (f30_local3 - f30_local1) * f30_arg0.scaleRatio
} )
f30_local4:animateToState( "resized", 0 )
f30_local4:animateToState( "resized", 1 )
f30_local4:registerEventHandler( "transition_complete_resized", f0_local23 )
else
f30_arg0:animateToState( "resized", 1 )
end
end
local f0_local25 = function ( f31_arg0, f31_arg1 )
local f31_local0, f31_local1, f31_local2, f31_local3 = f31_arg0:getCurrentGlobalRect()
if f31_local0 then
local f31_local4 = LUI.UIVerticalList.getHeightOfChildren( f31_arg0, 1 )
local f31_local5 = 1033
local f31_local6 = GameX.GetScreenWidth() * SliderBounds.HorzMargin.Min
if f31_local6 < f31_local5 then
f31_arg0.scaleRatio = f31_local6 / f31_local5
else
f31_arg0.scaleRatio = 1
end
f31_arg0:registerAnimationState( "resized", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
width = 891,
height = f31_local4,
scale = f31_arg0.scaleRatio - 1,
spacing = 1
} )
f31_arg0:animateToState( "resized", 0 )
f31_arg0:animateToState( "resized", 1 )
f31_arg0:registerEventHandler( "transition_complete_resized", f0_local24 )
else
f31_arg0:animateToState( "start", 1 )
end
end
LUI.MenuBuilder.registerType( "scoreboard", function ()
Engine.SetLuiInUse( true )
local self = LUI.UIElement.new()
self.id = "scoreboard_id"
local f32_local1 = {}
f32_local1 = GameX.GetSafeZoneSize()
local f32_local2 = {}
f32_local2 = GameX.GetAdjustedSafeZoneSize()
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
left = f32_local1[1],
top = f32_local1[2],
right = f32_local1[3],
bottom = f32_local1[4],
alpha = 0
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "visible", {
alpha = 1
} )
self:registerEventHandler( "transition_complete_visible", f0_local22 )
if Engine.IsConsoleGame() then
self:registerEventHandler( "gamepad_sticks", f0_local21 )
else
LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() )
self:registerEventHandler( "gamepad_button", f0_local20 )
local f32_local3 = LUI.UIElement.new()
f32_local3.id = "pc_delayed_stop"
f32_local3:registerAnimationState( "delay", {} )
f32_local3:registerEventHandler( "transition_complete_delay", f0_local19 )
self:addElement( f32_local3 )
local f32_local4 = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = -f32_local1[1],
top = -f32_local1[2],
right = -f32_local1[3],
height = 75
} )
f32_local4.handleMouseMove = true
f32_local4:registerEventHandler( "mouseenter", f0_local18( "up", true ) )
f32_local4:registerEventHandler( "mouseleave", f0_local18( "up", false ) )
self:addElement( f32_local4 )
local f32_local5 = LUI.UIElement.new( {
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = -f32_local1[1],
right = -f32_local1[3],
bottom = -f32_local1[4],
height = 75
} )
f32_local5.handleMouseMove = true
f32_local5:registerEventHandler( "mouseenter", f0_local18( "down", true ) )
f32_local5:registerEventHandler( "mouseleave", f0_local18( "down", false ) )
self:addElement( f32_local5 )
end
self:addElement( f0_local7() )
self:addElement( f0_local16( f32_local2[2] - f32_local1[2] ) )
self:addElement( f0_local17( f32_local2[4] - f32_local1[4] ) )
local f32_local6 = LUI.UIElement.new( {
topAnchor = true,
top = 0
} )
f32_local6.id = "main_vlist_wrapper"
self:addElement( f32_local6 )
local f32_local3 = {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
width = 891,
height = 1000,
spacing = 1
}
local f32_local4 = LUI.UIVerticalList.new( f32_local3 )
f32_local4:registerAnimationState( "start", f32_local3 )
f32_local4:registerEventHandler( "transition_complete_start", f0_local25 )
f32_local4:animateToState( "start", 1 )
f32_local4.id = "main_vlist"
f32_local6:addElement( f32_local4 )
local f32_local5 = GameX.GetGameMode()
local f32_local7 = f0_local1( f32_local5 )
local f32_local8 = GameX.gameModeIsFFA( f32_local5 )
local f32_local9 = Game.GetPlayerTeam()
local f32_local10 = Game.GetPlayerScoreRanking()
local f32_local11 = f0_local2()
local f32_local12 = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
height = 10
} )
f32_local4:addElement( f32_local12 )
f32_local12:addElement( f0_local9( Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f32_local5, GameTypesTable.Cols.Name ) ), CoD.TextSettings.ExtraBigFont, f0_local0.white ) )
if f32_local5 == "infect" then
if f32_local9 ~= Teams.axis and f32_local9 ~= Teams.allies then
f32_local9 = Teams.allies
f32_local10 = nil
end
local f32_local13 = GameX.GetPlayerOpposingTeam( f32_local9 )
f32_local4:addElement( f0_local12( Teams.free, nil, f32_local5, f32_local7 ) )
local f32_local14 = {}
if f32_local9 == Teams.allies then
f32_local14.allies = {
backing = f32_local11.blueBacking,
rank = f32_local10
}
f32_local14.axis = {
backing = f32_local11.orngBacking
}
else
f32_local14.allies = {
backing = f32_local11.orngBacking
}
f32_local14.axis = {
backing = f32_local11.blueBacking,
rank = f32_local10
}
end
local f32_local15 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.allies, f32_local5 )
if f32_local15 > 0 then
for f32_local16 = 1, f32_local15, 1 do
f32_local4:addElement( f0_local13( Teams.allies, f32_local7, f32_local16, f32_local14.allies.rank, f32_local14.allies.backing, f32_local11, f32_local5 ) )
end
end
local f32_local16 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.axis, f32_local5 )
if f32_local16 > 0 then
for f32_local17 = 1, f32_local16, 1 do
f32_local4:addElement( f0_local13( Teams.axis, f32_local7, f32_local17, f32_local14.axis.rank, f32_local14.axis.backing, f32_local11, f32_local5 ) )
end
end
elseif not f32_local8 then
if f32_local9 ~= Teams.axis and f32_local9 ~= Teams.allies then
f32_local9 = Teams.allies
f32_local10 = nil
end
local f32_local13 = Game.GetTeamScore( Teams.allies ) or 0
local f32_local20 = Game.GetTeamScore( Teams.axis ) or 0
local f32_local14 = nil
if f32_local20 < f32_local13 then
f32_local14 = Teams.allies
elseif f32_local13 < f32_local20 then
f32_local14 = Teams.axis
end
local f32_local15 = GameX.GetPlayerOpposingTeam( f32_local9 )
local f32_local16 = GameX.GetNumPlayerSlotsForFinalScoreboard( f32_local9, f32_local5 )
if f32_local16 > 0 then
f32_local4:addElement( f0_local12( f32_local9, f32_local9, f32_local5, f32_local7, f32_local14 ) )
for f32_local18 = 1, f32_local16, 1 do
f32_local4:addElement( f0_local13( f32_local9, f32_local7, f32_local18, f32_local10, f32_local11.blueBacking, f32_local11, f32_local5 ) )
end
end
local f32_local17 = GameX.GetNumPlayerSlotsForFinalScoreboard( f32_local15, f32_local5 )
if f32_local16 > 0 and f32_local17 > 0 then
f32_local4:addElement( LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
height = 5
} ) )
end
if f32_local17 > 0 then
f32_local4:addElement( f0_local12( f32_local15, f32_local9, f32_local5, f32_local7, f32_local14 ) )
for f32_local19 = 1, f32_local17, 1 do
f32_local4:addElement( f0_local13( f32_local15, f32_local7, f32_local19, nil, f32_local11.orngBacking, f32_local11, f32_local5 ) )
end
end
else
if f32_local9 ~= Teams.free then
f32_local10 = nil
end
f32_local4:addElement( f0_local12( Teams.free, nil, f32_local5, f32_local7 ) )
local f32_local20 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.free, f32_local5 )
for f32_local14 = 1, f32_local20, 1 do
local f32_local18
if f32_local14 == f32_local10 then
f32_local18 = f32_local11.blueBacking
if not f32_local18 then
else
f32_local4:addElement( f0_local13( Teams.free, f32_local7, f32_local14, f32_local10, f32_local18, f32_local11, f32_local5 ) )
end
end
f32_local18 = f32_local11.orngBacking
end
end
return self
end )
LockTable( _M )