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

1221 lines
33 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = 250
f0_local1 = 500
f0_local2 = 325
local f0_local3 = 2
local f0_local4 = 20
local f0_local5 = 20
local f0_local6 = 100
local f0_local7 = 7
local f0_local8 = f0_local4 + f0_local5
local f0_local9 = Engine.Localize( "@LUA_MENU_EMPTY" )
local f0_local10 = Engine.Localize( "@LUA_MENU_MAX" )
local f0_local11 = Engine.Localize( "@LUA_MENU_S_FOR_SECONDS" )
local f0_local12 = Engine.Localize( "@LUA_MENU_M_FOR_MINUTES" )
local f0_local13 = function ( f1_arg0, f1_arg1 )
local f1_local0 = {
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_local1 = {
score = {
"LUA_MENU_SCORE",
"score"
},
dm_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
cranked_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
sotf_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
kills = {
"LUA_MENU_K_FOR_KILLS_CAPS",
"kills"
},
deaths = {
"LUA_MENU_D_FOR_DEATHS_CAPS",
"deaths"
},
revives = {
"LUA_MENU_R_FOR_REVIVES_CAPS",
"assists"
},
assists = {
"LUA_MENU_A_FOR_ASSISTS_CAPS",
"assists"
},
rescues = {
"LUA_MENU_R_FOR_RESCUES_CAPS",
"extrascore0"
},
captures = {
"LUA_MENU_C_FOR_CAPTURES_CAPS",
"extrascore0"
},
tags = {
"LUA_MENU_T_FOR_TAGS_CAPS",
"extrascore0"
},
time = {
"LUA_MENU_T_FOR_TIME_CAPS",
"time"
},
scores = {
"LUA_MENU_S_FOR_SCORES_CAPS",
"extrascore0"
},
plants = {
"LUA_MENU_P_FOR_PLANTS_CAPS",
"extrascore0"
},
crates = {
"LUA_MENU_C_FOR_CRATES_CAPS",
"extrascore0"
},
dm_streak = {
"PATCH_MENU_S_FOR_STREAK_CAPS",
"assists"
},
gun_knives = {
"PATCH_MENU_S_FOR_STABS_CAPS",
"assists"
}
}
local f1_local2 = {
default = {
{
50,
60
},
{
25,
33
},
{
25,
31
},
{
32,
40
}
},
horde = {
{
42,
60
},
{
42,
49
},
{
42,
49
}
}
}
local f1_local3
if f1_arg1 then
f1_local3 = f1_local0[f1_arg0 .. "_ffa"]
if not f1_local3 then
else
local f1_local4
if f1_arg1 then
f1_local4 = f1_local2[f1_arg0 .. "_ffa"]
if not f1_local4 then
else
local f1_local5 = {}
for f1_local9, f1_local10 in ipairs( f1_local3 ) do
f1_local5[f1_local9] = {
Engine.Localize( f1_local1[f1_local10][1] ),
f1_local1[f1_local10][2],
f1_local4[f1_local9][1],
f1_local4[f1_local9][2]
}
end
return f1_local5
end
end
f1_local4 = f1_local2[f1_arg0] or f1_local2.default
end
end
f1_local3 = f1_local0[f1_arg0] or f1_local0.default
end
local f0_local14 = function ( f2_arg0, f2_arg1, f2_arg2 )
local f2_local0 = f2_arg1 or GameX.GetGameMode()
if f2_arg2 or GameX.gameModeIsFFA( f2_local0 ) then
f2_arg0.slots[Teams.free] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.free, f2_local0 )
else
f2_arg0.slots[Teams.allies] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.allies, f2_local0 )
f2_arg0.slots[Teams.axis] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.axis, f2_local0 )
end
end
local f0_local15 = function ( f3_arg0, f3_arg1 )
if f3_arg0.current_state ~= "active" then
f3_arg0:animateToState( "active", 0 )
f3_arg0:processEvent( {
name = "scorelist_turn_on"
} )
f3_arg0.current_state = "active"
elseif f3_arg0.current_state ~= "default" then
f3_arg0:animateToState( "default", 0 )
f3_arg0.current_state = "default"
end
end
local f0_local16 = function ( f4_arg0, f4_arg1, f4_arg2 )
if f4_arg0 and f4_arg0.current_state ~= f4_arg1 then
f4_arg0:animateToState( f4_arg1, f4_arg2 )
f4_arg0.current_state = f4_arg1
return true
else
return false
end
end
function GetRowState( f5_arg0, f5_arg1, f5_arg2, f5_arg3 )
if f5_arg3 == "sr" then
if f5_arg2.extrascore1 == 1 then
return "downed"
elseif f5_arg2.extrascore1 == 2 then
return "dead"
end
elseif f5_arg3 == "infect" and f5_arg2.extrascore1 == 1 then
if f5_arg0 == f5_arg1 then
return "highlight"
else
return "downed"
end
end
if f5_arg2.isDead == true then
return "dead"
elseif f5_arg0 == f5_arg1 then
return "highlight"
elseif f5_arg0 % 2 == 0 then
return "bar_b"
end
return "default"
end
local f0_local17 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4 )
local f6_local0 = RegisterMaterial( "waypoint_dogtags_friendlys" )
local f6_local1 = RegisterMaterial( "waypoint_dogtags" )
local f6_local2 = RegisterMaterial( "killiconsuicide" )
if f6_arg0 == "dead" then
return f6_local2
elseif f6_arg4 == "sr" and f6_arg0 == "downed" then
if f6_arg2 then
return f6_local1
else
return f6_local0
end
end
local f6_local3 = f6_arg3.rankIcon
if f6_arg3.rank and f6_arg3.prestige and f6_arg3.prestige > 0 then
f6_local3 = RegisterMaterial( Rank.GetRankIcon( f6_arg3.rank, f6_arg3.prestige or 0 ) )
end
return f6_local3
end
local f0_local18 = function ( f7_arg0 )
local f7_local0 = f7_arg0.name
if Engine.IsConsoleGame() and string.sub( f7_local0, 1, 1 ) == "[" then
local f7_local1 = string.find( f7_local0, "]" )
if f7_local1 and f7_local1 < 7 then
local f7_local2 = string.sub( f7_local0, 1, f7_local1 )
f7_local0 = string.sub( f7_local0, f7_local1 + 1 )
end
end
return f7_local0
end
local f0_local19 = function ( f8_arg0, f8_arg1, f8_arg2, f8_arg3, f8_arg4, f8_arg5, f8_arg6 )
local f8_local0 = f8_arg1:getChildById( "scoreRowBg" )
local f8_local1 = f8_arg1:getChildById( "rowList" )
local f8_local2 = f8_arg1.properties
local f8_local3 = "default"
if f8_arg5 ~= nil then
f8_arg1.clientNum = f8_arg5.client
f0_local16( f8_arg1, "filled", 250 )
f8_local3 = GetRowState( f8_arg2, f8_arg3, f8_arg5, f8_arg6 )
local f8_local4 = f0_local17( f8_local3, f8_arg3, f8_arg4, f8_arg5, f8_arg6 )
if f8_local2.rankIcon ~= f8_local4 then
local f8_local5 = f8_local1:getChildById( "rankIcon" )
local f8_local6 = 1
if MLG.IsMLGSpectator() then
f8_local6 = 0
end
CoD.SetMaterial( f8_local5, f8_local4, f8_local6 )
f8_local2.rankIcon = f8_local4
end
local f8_local5 = f8_arg5.rank + 1 .. ""
if MLG.IsMLGSpectator() then
f8_local5 = ""
end
if f8_local2.rankNumber ~= f8_local5 then
local f8_local6 = f8_local1:getChildById( "rankNumber" )
f8_local6:setText( f8_local5 )
f8_local2.rankNumber = f8_local5
end
if MLG.IsMLGSpectator() and f8_local2.adrenaline ~= f8_arg5.adrenaline then
local f8_local6 = f8_local1:getChildById( "adrenaline" )
if f8_local6 then
f8_local6:setText( f8_arg5.adrenaline )
end
f8_local2.adrenaline = f8_arg5.adrenaline
end
local f8_local6 = f0_local18( f8_arg5 )
if f8_local2.gamertag ~= f8_local6 then
local f8_local7 = f8_local1:getChildById( "gamertag" )
f8_local7:setText( f8_local6 )
f8_local2.gamertag = f8_local6
end
for f8_local11, f8_local12 in ipairs( f8_arg0.cols ) do
local f8_local13 = f8_arg5[f8_local12[2]] .. ""
if f8_local2[f8_local12[2]] ~= f8_local13 then
local f8_local10 = f8_local1:getChildById( f8_local12[2] )
f8_local10:setText( f8_local13 )
f8_local2[f8_local12[2]] = f8_local13
end
end
if MLG.IsMLGSpectator() then
f8_local7 = Game.GetOmnvar( "ui_bomb_carrier" )
f8_local8 = f8_arg5.client
if f8_local8 then
f8_local8 = f8_arg5.client == f8_local7
end
f8_local9 = f8_arg1:getFirstDescendentById( "bombIcon" )
if f8_local9 then
f8_local12 = f8_local9
f8_local11 = f8_local9.animateToState
local f8_local13
if f8_local8 then
f8_local13 = "visible"
if not f8_local13 then
else
f8_local11( f8_local12, f8_local13 )
end
end
f8_local13 = "default"
end
end
elseif f0_local16( f8_arg1, "default", 250 ) then
f8_arg1.clientNum = nil
local f8_local4 = f8_local1:getChildById( "rankIcon" )
local f8_local5 = RegisterMaterial( "specialty_null" )
CoD.SetMaterial( f8_local4, f8_local5 )
f8_local2.rankIcon = f8_local5
local f8_local6 = f8_local1:getChildById( "rankNumber" )
f8_local6:setText( "" )
f8_local2.rankNumber = ""
local f8_local7 = f8_local1:getChildById( "gamertag" )
f8_local7:setText( f0_local9 )
f8_local2.gamertag = f0_local9
for f8_local12, f8_local13 in ipairs( f8_arg0.cols ) do
local f8_local10 = f8_local1:getChildById( f8_local13[2] )
f8_local10:setText( "" )
f8_local2[f8_local13[2]] = ""
end
if MLG.IsMLGSpectator() then
f8_local8 = f8_local1:getFirstDescendentById( "bombIcon" )
if f8_local8 then
f8_local8:animateToState( "default" )
end
end
end
local f8_local4 = f8_local2.isMe
local f8_local5 = f8_arg2 == f8_arg3
local f8_local6 = f8_local2.isInFocus
if not f8_local6 then
f8_local6 = false
end
local f8_local7 = f8_arg1:isInFocus()
if f8_local4 ~= f8_local5 or f8_local6 ~= f8_local7 then
if f8_local5 or f8_local7 then
f8_local1:processEvent( {
name = "go_black"
} )
else
f8_local1:processEvent( {
name = "go_white"
} )
end
f8_local2.isMe = f8_local5
f8_local2.isInFocus = f8_local7
end
if f8_local7 and f8_local3 ~= "dead" then
f0_local16( f8_local0, "focus", 0 )
else
f0_local16( f8_local0, f8_local3, 250 )
end
end
local f0_local20 = nil
local f0_local21 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 )
local f9_local0 = f9_arg0.slots[f9_arg2]
if f9_arg3 < f9_local0 then
for f9_local1 = f9_local0, f9_arg3 + 1, -1 do
f9_arg1:removeElement( f9_arg1:getChildById( f9_arg2 .. f9_local1 ) )
end
if f9_arg2 == "listRowOpFor" and f9_arg3 == 0 then
f0_local16( f9_arg1:getChildById( "scoreHeaderOpFor" ), "hidden", 0 )
end
elseif f9_local0 < f9_arg3 then
if not f9_arg1:getChildById( f9_arg2 .. f9_local0 ) and f9_arg2 == "listRow" then
local f9_local1 = f9_arg1:getChildById( "scoreHeader" )
end
if f9_arg2 == "listRowOpFor" and f9_local0 == 0 then
f0_local16( f9_arg1:getChildById( "scoreHeaderOpFor" ), "default", 0 )
end
local f9_local2 = MLG.IsMLGSpectator()
for f9_local3 = f9_arg3, f9_local0 + 1, -1 do
local f9_local6 = f0_local20( f9_arg0 )
f9_local6.id = f9_arg2 .. f9_local3
if not f9_local1 and f9_arg2 == "listRowOpFor" then
f9_arg1:addElement( f9_local6 )
local f9_local1 = f9_local6
end
f9_local6:addElementAfter( f9_local1 )
if f9_local2 then
f9_arg1:updateNavigation()
end
end
end
f9_arg0.slots[f9_arg2] = f9_arg3
end
local f0_local22 = function ( f10_arg0, f10_arg1 )
if f10_arg0.current_state ~= "active" and not MLG.IsMLGSpectator() then
return
end
local f10_local0 = f10_arg0:getChildById( "scorelistRows" )
local f10_local1 = GameX.GetGameMode()
local f10_local2 = GameX.gameModeIsFFA( f10_local1 )
f0_local14( f10_arg0, f10_local1, f10_local2 )
f10_arg0:processEvent( {
name = "update_player_team",
immediate = true
} )
if f10_local2 then
local f10_local3 = Game.GetPlayerTeam()
local f10_local4 = Game.GetPlayerScoreRanking()
if f10_local3 ~= Teams.free then
f10_local4 = nil
end
f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[Teams.free] )
for f10_local5 = 1, f10_arg0.slots.listRow, 1 do
f0_local19( f10_arg0, f10_local0:getChildById( "listRow" .. f10_local5 ), f10_local5, f10_local4, f10_local4 ~= f10_local5, GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, f10_local5, f10_local1, false ), f10_local1 )
end
else
local f10_local3 = Game.GetPlayerTeam()
local f10_local4 = Game.GetPlayerScoreRanking()
if f10_local3 ~= Teams.axis and f10_local3 ~= Teams.allies then
f10_local3 = Teams.allies
f10_local4 = nil
end
local f10_local5 = GameX.GetPlayerOpposingTeam( f10_local3 )
if f10_local1 == "infect" then
f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[Teams.allies] )
f0_local21( f10_arg0, f10_local0, "listRowOpFor", f10_arg0.slots[Teams.axis] )
for f10_local6 = 1, f10_arg0.slots.listRow, 1 do
local f10_local9 = f10_local0:getChildById( "listRow" .. f10_local6 )
local f10_local10 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.allies, f10_local6, f10_local1, false )
local f10_local11 = f10_local3 ~= Teams.allies
if not f10_local11 then
local f10_local12 = f10_local4
end
f0_local19( f10_arg0, f10_local9, f10_local6, f10_local12 or nil, f10_local11, f10_local10, f10_local1 )
end
for f10_local6 = 1, f10_arg0.slots.listRowOpFor, 1 do
local f10_local9 = f10_local0:getChildById( "listRowOpFor" .. f10_local6 )
local f10_local10 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.axis, f10_local6, f10_local1, false )
local f10_local11 = f10_local3 ~= Teams.axis
if not f10_local11 then
local f10_local13 = f10_local4
end
f0_local19( f10_arg0, f10_local9, f10_local6, f10_local13 or nil, f10_local11, f10_local10, f10_local1 )
end
else
f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[f10_local3] )
f0_local21( f10_arg0, f10_local0, "listRowOpFor", f10_arg0.slots[f10_local5] )
for f10_local6 = 1, f10_arg0.slots.listRow, 1 do
f0_local19( f10_arg0, f10_local0:getChildById( "listRow" .. f10_local6 ), f10_local6, f10_local4, false, GameX.GetPlayerScoreInfoAtRankForGameMode( f10_local3, f10_local6, f10_local1, false ), f10_local1 )
end
for f10_local6 = 1, f10_arg0.slots.listRowOpFor, 1 do
f0_local19( f10_arg0, f10_local0:getChildById( "listRowOpFor" .. f10_local6 ), f10_local6, nil, true, GameX.GetPlayerScoreInfoAtRankForGameMode( f10_local5, f10_local6, f10_local1, false ), f10_local1 )
end
end
end
end
local f0_local23 = function ( f11_arg0, f11_arg1 )
if f11_arg0.current_state ~= "default" and f11_arg0.current_state ~= nil then
f11_arg0:processEvent( {
name = "scorelist_turn_on"
} )
end
end
local f0_local24 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 )
local self = LUI.UIText.new( {
topAnchor = true,
leftAnchor = true,
top = f12_arg4 or 0,
left = 0,
width = f12_arg2,
height = f12_arg3.Height,
font = f12_arg3.Font,
alignment = LUI.Alignment.Right,
red = 1,
green = 1,
blue = 1,
alpha = 1
} )
self.id = f12_arg1
self:setText( f12_arg0 )
self:registerAnimationState( "black_text", {
red = 0,
green = 0,
blue = 0,
alpha = 1
} )
self:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) )
self:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) )
return self
end
local f0_local25 = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3 )
local self = LUI.UIText.new( {
topAnchor = true,
leftAnchor = true,
top = 8,
left = 0,
width = f13_arg2,
height = f13_arg3.Height - 1,
font = f13_arg3.Font,
alignment = LUI.Alignment.Right,
alpha = 0.75,
[1] = color
} )
self.id = f13_arg1
self:setText( f13_arg0 )
return self
end
local f0_local26 = function ( f14_arg0 )
return LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
left = 0,
width = f14_arg0
} )
end
f0_local20 = function ( f15_arg0, f15_arg1 )
local f15_local0 = RegisterMaterial( "hud_scoreboard_bar" )
local f15_local1 = RegisterMaterial( "hud_scoreboard_bar_a" )
local f15_local2 = RegisterMaterial( "hud_scoreboard_bar_b" )
local f15_local3 = RegisterMaterial( "hud_scoreboard_dead_yellow" )
local f15_local4 = RegisterMaterial( "hud_scoreboard_dead_red" )
local f15_local5 = RegisterMaterial( "hud_scoreboard_highlight_you" )
local f15_local6 = f15_arg1 or {
rankIcon = RegisterMaterial( "specialty_null" ),
rankNumber = "",
gamertag = f0_local9,
current_state = "default"
}
local f15_local7 = LUI.UIElement.new
if MLG.IsMLGSpectator() then
f15_local7 = LUI.UIButton.new
end
local f15_local8 = f15_local7( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
height = 20,
alpha = 0.25
} )
f15_local8.id = "scoreRow"
f15_local8.properties = f15_local6
f15_local8:registerAnimationState( "filled", {
alpha = 1
} )
local self = LUI.UIImage.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = f15_local1,
alpha = 0.75
} )
self.id = "scoreRowBg"
self:registerAnimationState( "bar_a", {
material = f15_local1,
alpha = 1
} )
self:registerAnimationState( "bar_b", {
material = f15_local2,
alpha = 0.4
} )
self:registerAnimationState( "downed", {
material = f15_local3,
alpha = 0.65
} )
self:registerAnimationState( "dead", {
material = f15_local4,
alpha = 0.65
} )
self:registerAnimationState( "highlight", {
material = f15_local5,
alpha = 1
} )
if MLG.IsMLGSpectator() then
self:registerAnimationState( "focus", CoD.ColorizeState( Colors.frontend_hilite, {
material = f15_local0,
alpha = 1
} ) )
self:registerEventHandler( "button_over", function ( element, event )
f0_local16( element, "focus", 0 )
f15_local8:processEvent( {
name = "go_black"
} )
f15_local8.properties.isInFocus = true
MLG.HighlightClientNum( f15_local8.clientNum or -1 )
end )
self:registerEventHandler( "button_up", function ( element, event )
f0_local22( f15_arg0, {} )
f15_local8.properties.isInFocus = false
MLG.HighlightClientNum( -1 )
end )
self:registerEventHandler( "button_action", function ( element, event )
if not f15_local8.clientNum then
return
else
f15_arg0:dispatchEventToRoot( {
name = "scoreboard_player_action",
clientNum = f15_local8.clientNum
} )
end
end )
local f15_local10 = LUI.UIHorizontalList.new( {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
right = -2,
top = 4,
width = 64,
height = 16,
alignment = LUI.Alignment.Right
} )
f15_local8:addElement( f15_local10 )
local f15_local11 = LUI.UIImage.new( CoD.ColorizeState( Colors.frontend_hilite, {
material = RegisterMaterial( "alien_dpad_arrow_right" ),
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
right = 0,
top = 0,
width = 0,
height = 16
} ) )
f15_local11.id = "MLGCursor"
f15_local11:registerAnimationState( "visible", {
width = 8
} )
f15_local11:registerEventHandler( "button_over", MBh.AnimateToState( "visible" ) )
f15_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f15_local10:addElement( f15_local11 )
local f15_local12 = LUI.UIImage.new()
f15_local12.id = "MLGTag"
f15_local12:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
right = 0,
top = 0,
width = 0,
height = 16
} )
f15_local12:animateToState( "default" )
f15_local12:registerAnimationState( "visible", {
width = 32
} )
f15_local12:registerEventHandler( "highlight_scoreboard_row_by_clientnum", function ( element, event )
if not f15_local8.clientNum then
return
end
local f19_local0 = element
local f19_local1 = element.animateToState
local f19_local2 = f15_local8.clientNum
local f19_local3 = event.clientNum
f19_local1( f19_local0, REG6 and "visible" or "default" )
if f15_local8.clientNum == event.clientNum then
element:dispatchEventToRoot( {
name = "update_mlg_prev_next",
followRow = f15_local8
} )
end
end )
f15_local10:addElement( f15_local12 )
local f15_local13 = LUI.UIImage.new()
f15_local13.id = "bombIcon"
f15_local13:registerAnimationState( "default", {
material = RegisterMaterial( "hud_suitcase_bomb" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
right = 0,
top = 0,
width = 0,
height = 16
} )
f15_local13:animateToState( "default" )
f15_local13:registerAnimationState( "visible", {
width = 16
} )
f15_local13:registerOmnvarHandler( "ui_bomb_carrier", function ( f20_arg0, f20_arg1 )
local f20_local0 = f20_arg0:getParent()
local f20_local1 = f20_arg0
local f20_local2 = f20_arg0.animateToState
local f20_local3 = f20_local0.clientNum
local f20_local4 = f20_arg1.value
f20_local2( f20_local1, REG7 and "visible" or "default" )
end )
f15_local10:addElement( f15_local13 )
end
f15_local8:addElement( self )
local f15_local10 = LUI.UIHorizontalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = 0
} )
f15_local10.id = "rowList"
f15_local8:addElement( f15_local10 )
local f15_local11 = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
if MLG.IsMLGSpectator() then
local f15_local12 = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = 7
} )
f15_local12.id = "mlgSpacer"
f15_local10:addElement( f15_local12 )
local f15_local13 = LUI.UIText.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local8,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f15_local13.id = "adrenaline"
f15_local13:setText( 0 )
f15_local13:registerAnimationState( "black_text", f15_local11 )
f15_local13:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) )
f15_local13:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) )
f15_local10:addElement( f15_local13 )
end
local f15_local12 = f0_local4
if MLG.IsMLGSpectator() then
f15_local12 = 0
end
local f15_local13 = LUI.UIImage.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
right = f15_local12,
material = f15_local6.rankIcon
} )
f15_local13.id = "rankIcon"
f15_local10:addElement( f15_local13 )
f15_local12 = f0_local5 + 7
if MLG.IsMLGSpectator() then
f15_local12 = 0
end
local f15_local14 = LUI.UIText.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 7,
left = 0,
bottom = 7 + CoD.TextSettings.HudEuroMedTinyFont.Height,
right = f15_local12,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
red = 1,
green = 1,
blue = 1,
alpha = 1
} )
f15_local14.id = "rankNumber"
f15_local14:setText( f15_local6.rankNumber )
f15_local14:registerAnimationState( "black_text", f15_local11 )
f15_local14:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) )
f15_local14:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) )
f15_local10:addElement( f15_local14 )
local f15_local15 = LUI.UIMarqueeText.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local6 + 10,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
red = 1,
green = 1,
blue = 1,
alpha = 1
} )
f15_local15.id = "gamertag"
f15_local15:setText( f15_local6.gamertag )
f15_local15:registerEventHandler( "go_black", function ( element, event )
element:SetColor( 0, 0, 0, 1 )
end )
f15_local15:registerEventHandler( "go_white", function ( element, event )
element:SetColor( 1, 1, 1, 1 )
end )
f15_local10:addElement( f15_local15 )
for f15_local20, f15_local21 in ipairs( f15_arg0.cols ) do
local f15_local22 = f15_local21[2]
local f15_local19 = f15_local6[f15_local21[2]]
if not f15_local19 then
f15_local19 = ""
end
f15_local6[f15_local22] = f15_local19
f15_local10:addElement( f0_local24( f15_local6[f15_local21[2]], f15_local21[2], f15_local21[4], CoD.TextSettings.HudEuroMedSmallFont ) )
end
return f15_local8
end
local f0_local27 = function ( f23_arg0, f23_arg1 )
local f23_local0 = RegisterMaterial( "hud_scoreboard_header" )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5
} )
self:registerAnimationState( "hidden", {
alpha = 0
} )
self:addElement( LUI.UIImage.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 5,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
material = f23_local0
} ) )
if MLG.IsMLGSpectator() then
if f23_arg1 then
local f23_local2 = LUI.UIText.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
left = 15,
width = 220,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
alpha = 1,
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
f23_local2:registerAnimationState( "orange_text", {
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alpha = 1
} )
f23_local2:setText( GameX.GetLocalizedTeamName( f23_arg1 ) )
f23_local2:registerEventHandler( "update_player_team", function ( element, event )
local f24_local0 = Game.GetLastMLGSpectateTeam()
if f24_local0 ~= Teams.axis and f24_local0 ~= Teams.allies then
f24_local0 = Teams.allies
end
if element.activeMLGTeam ~= f24_local0 then
if f24_local0 == Teams.allies then
element:animateToState( "orange_text" )
else
element:animateToState( "default" )
end
element.activeMLGTeam = f24_local0
end
end )
self:addElement( f23_local2 )
end
else
local f23_local2 = LUI.UIText.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 8,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
right = -5,
width = 200,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 1
} )
f23_local2:setText( Engine.Localize( "@LUA_MENU_OPPOSING_TEAM_CAPS" ) )
self:addElement( f23_local2 )
end
return self
end
local f0_local28 = function ( f25_arg0, f25_arg1 )
local f25_local0 = RegisterMaterial( "hud_scoreboard_header" )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5
} )
self:addElement( LUI.UIImage.new( {
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 5,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
material = f25_local0
} ) )
local f25_local2 = LUI.UIHorizontalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = f0_local7
} )
f25_local2.id = "scoreHeaderRowList"
self:addElement( f25_local2 )
local f25_local3 = 0
if MLG.IsMLGSpectator() and f25_arg1 then
local f25_local4 = 135
f25_local3 = f25_local4 + 8 + f0_local7 * 2
f25_local2:addElement( f0_local26( 8 ) )
local f25_local5 = LUI.UIMarqueeText.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
left = 0,
width = f25_local4,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b,
alpha = 1
} )
f25_local5:setText( GameX.GetLocalizedTeamName( f25_arg1 ) )
f25_local5:registerEventHandler( "update_player_team", function ( element, event )
local f26_local0 = Game.GetLastMLGSpectateTeam()
if f26_local0 ~= Teams.axis and f26_local0 ~= Teams.allies then
f26_local0 = Teams.allies
end
if element.activeMLGTeam ~= f26_local0 then
if f26_local0 == Teams.allies then
element:SetColor( Colors.cyan.r, Colors.cyan.g, Colors.cyan.b )
else
element:SetColor( Colors.orange.r, Colors.orange.g, Colors.orange.b )
end
element.activeMLGTeam = f26_local0
end
end )
f25_local2:addElement( f25_local5 )
end
f25_local2:addElement( f0_local26( f0_local4 + f0_local5 + f0_local6 + f0_local7 * 3 - f25_local3 ) )
for f25_local8, f25_local9 in ipairs( f25_arg0.cols ) do
f25_local2:addElement( f0_local25( f25_local9[1], f25_local9[2], f25_local9[3], CoD.TextSettings.HudEuroMedSmallFont ) )
end
return self
end
LUI.MenuBuilder.registerType( "scorelistHudDef", function ()
local f27_local0 = {
topAnchor = true,
rightAnchor = true,
top = 0,
height = f0_local1,
right = -10,
width = 0,
alpha = 0
}
local self = LUI.UIElement.new( f27_local0 )
self.id = "scorelistHud"
self:registerAnimationState( "active", LUI.MenuBuilder.AnimStateBasedOn( f27_local0, {
width = f0_local2,
alpha = 1
} ) )
self:registerAnimationState( "opening", LUI.MenuBuilder.AnimStateBasedOn( f27_local0, {
width = f0_local2 + 40,
alpha = 0.25
} ) )
self:registerEventHandler( "toggle_scoreboard", f0_local15 )
self:registerEventHandler( "keybind", function ( element, event )
if event.command == "togglescores" or event.command == "+scores" then
f0_local15( element, event )
end
end )
self:registerEventHandler( "scorelist_refresh", f0_local22 )
self:registerEventHandler( "hud_on", f0_local23 )
self:registerEventHandler( "scorelist_turn_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
f0_local0 / 2
},
{
"active",
f0_local0 / 2
}
} ) )
local f27_local2 = LUI.UITimer.new( 250, "scorelist_refresh", "hud" )
f27_local2.id = "scoreRefreshTimer"
self:addElement( f27_local2 )
local f27_local3 = LUI.UIVerticalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = f0_local3,
alpha = 1
} )
f27_local3.id = "scorelistRows"
if MLG.IsMLGSpectator() then
f27_local3:registerEventHandler( "gamepad_button", function ( element, event )
if event.button ~= "primary" and event.qualifier ~= ButtonQualifiers.DPad then
return
elseif not LUI.FlowManager.AnyActiveMenusInStack( Engine.GetLuiRoot() ) then
return LUI.UIElement.GamepadButton( element, event )
else
end
end )
f27_local3:registerEventHandler( "focus_scoreboard", function ( element, event )
element:processEvent( {
name = "gain_focus"
} )
end )
f27_local3:registerEventHandler( "unfocus_scoreboard", function ( element, event )
element:processEvent( {
name = "lose_focus"
} )
end )
end
self:addElement( f27_local3 )
local f27_local4 = GameX.GetGameMode()
local f27_local5 = GameX.gameModeIsFFA( f27_local4 )
local f27_local6 = self
f27_local6.slots = {}
f0_local14( f27_local6, f27_local4, f27_local5 )
f27_local6.cols = f0_local13( f27_local4, f27_local5 )
if f27_local5 then
local f27_local7 = f0_local28( self )
f27_local7.id = "scoreHeader"
f27_local3:addElement( f27_local7 )
for f27_local8 = 1, f27_local6.slots[Teams.free], 1 do
local f27_local11 = f0_local20( self )
f27_local11.id = "listRow" .. f27_local8
f27_local3:addElement( f27_local11 )
end
f27_local6.slots.listRow = f27_local6.slots[Teams.free]
elseif f27_local4 == "infect" then
local f27_local7 = f0_local28( self )
f27_local7.id = "scoreHeader"
f27_local3:addElement( f27_local7 )
for f27_local8 = 1, f27_local6.slots[Teams.allies], 1 do
local f27_local11 = f0_local20( self )
f27_local11.id = "listRow" .. f27_local8
f27_local3:addElement( f27_local11 )
end
f27_local6.slots.listRow = f27_local6.slots[Teams.allies]
for f27_local8 = 1, f27_local6.slots[Teams.axis], 1 do
local f27_local11 = f0_local20( self )
f27_local11.id = "listRowOpFor" .. f27_local8
f27_local3:addElement( f27_local11 )
end
f27_local6.slots.listRowOpFor = f27_local6.slots[Teams.axis]
else
local f27_local7 = Game.GetPlayerTeam()
if f27_local7 ~= Teams.axis and f27_local7 ~= Teams.allies then
f27_local7 = Teams.allies
end
local f27_local8 = GameX.GetPlayerOpposingTeam( f27_local7 )
local f27_local9 = f0_local28( self, f27_local7 )
f27_local9.id = "scoreHeader"
f27_local3:addElement( f27_local9, f27_local7 )
for f27_local10 = 1, f27_local6.slots[f27_local7], 1 do
local f27_local13 = f0_local20( self )
f27_local13.id = "listRow" .. f27_local10
f27_local3:addElement( f27_local13 )
end
f27_local6.slots.listRow = f27_local6.slots[f27_local7]
local f27_local10 = f0_local27( self, f27_local8 )
f27_local10.id = "scoreHeaderOpFor"
f27_local3:addElement( f27_local10 )
if f27_local6.slots[f27_local8] == 0 then
f0_local16( f27_local10, "hidden", 0 )
end
for f27_local12 = 1, f27_local6.slots[f27_local8], 1 do
local f27_local15 = f0_local20( self )
f27_local15.id = "listRowOpFor" .. f27_local12
f27_local3:addElement( f27_local15 )
end
f27_local6.slots.listRowOpFor = f27_local6.slots[f27_local8]
end
return self
end )
LockTable( _M )