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

2228 lines
63 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function IsPostGame()
return Engine.GetDvarString( "ui_game_state" ) == "postgame"
end
Views = {
FirstPerson = 1,
ThirdPerson = 2,
Free = 3,
Max = 3
}
currentView = Views.Free
MLG.StartFollow = function ()
if lastValidFollowedClientNum and lastValidFollowedClientNum >= 0 then
MLG.FollowClientnum( lastValidFollowedClientNum )
else
MLG.FollowNext()
MLG.FollowPrev()
end
end
function ChangeView( f3_arg0, f3_arg1 )
if IsPostGame() then
return
elseif mapZoomMode == MapZoomModes.FullScreen then
return
end
f3_arg0:dispatchEventToRoot( {
name = "view_change",
immediate = true
} )
local f3_local0 = currentView
if f3_arg1 then
currentView = f3_arg1
else
currentView = 1 + currentView % Views.Max
end
knownState.userPreferences.view = currentView
if currentView == Views.FirstPerson then
MLG.SetThirdPerson( false )
elseif currentView == Views.ThirdPerson then
MLG.SetThirdPerson( true )
elseif currentView == Views.Free then
MLG.StopFollow()
if f3_local0 ~= currentView then
Engine.NotifyServer( "mlg_view_change", currentView )
end
end
if f3_local0 == Views.Free and currentView ~= Views.Free then
MLG.StartFollow()
end
if currentView == Views.Free then
f3_arg0:dispatchEventToRoot( {
name = "highlight_scoreboard_row_by_clientnum",
clientNum = nil,
immediate = true
} )
f3_arg0:dispatchEventToRoot( {
name = "cod_caster_view_free",
immediate = true
} )
else
f3_arg0:dispatchEventToRoot( {
name = "cod_caster_view_player",
immediate = true
} )
end
f3_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
immediate = true
} )
f3_arg0:dispatchEventToRoot( {
name = "update_mlg_hud_visibility",
immediate = true
} )
end
f0_local0 = function ( f4_arg0, f4_arg1 )
if f4_arg0:getParent() == nil or not f4_arg0.clientNum then
return nil
end
local f4_local0 = f4_arg0.navigation[f4_arg1]
while f4_local0 ~= f4_arg0 do
local f4_local1 = f4_local0.clientNum
if f4_local1 then
local f4_local2 = GameX.GetGameMode()
local f4_local3 = Game.GetPlayerScoreInfo( f4_local1 )
if f4_local3 then
local f4_local4 = LUI.mp_hud.ScorelistHud.GetRowState( nil, nil, f4_local3, f4_local2 )
if f4_local4 == "dead" or f4_local4 == "downed" or f4_local1 == f4_arg0.clientNum then
f4_local0 = f4_local0.navigation[f4_arg1]
end
end
f4_local0 = f4_local0.navigation[f4_arg1]
end
f4_local0 = f4_local0.navigation[f4_arg1]
end
return f4_local0.clientNum
end
function FollowPrev( f5_arg0, f5_arg1 )
if IsPostGame() then
return
elseif not f5_arg0.followRow then
MLG.FollowPrev()
else
local f5_local0 = f0_local0( f5_arg0.followRow, "up" )
if f5_local0 then
MLG.FollowClientnum( f5_local0 )
else
f5_arg0.followRow = nil
end
end
if currentView == Views.Free then
ChangeView( f5_arg0, Views.FirstPerson )
end
end
function FollowNext( f6_arg0, f6_arg1 )
if IsPostGame() then
return
elseif not f6_arg0.followRow then
MLG.FollowNext()
else
local f6_local0 = f0_local0( f6_arg0.followRow, "down" )
if f6_local0 then
MLG.FollowClientnum( f6_local0 )
else
f6_arg0.followRow = nil
end
end
if currentView == Views.Free then
ChangeView( f6_arg0, Views.FirstPerson )
end
end
function FollowClientNum( f7_arg0, f7_arg1 )
if IsPostGame() then
return
end
assert( f7_arg1.clientNum )
MLG.FollowClientnum( f7_arg1.clientNum )
if currentView == Views.Free then
ChangeView( f7_arg0, Views.FirstPerson )
end
end
function PresetCameraHandlerFactory( f8_arg0 )
return function ( f9_arg0, f9_arg1 )
if IsPostGame() then
return
end
ChangeView( f9_arg0, Views.Free )
if f9_arg1.qualifier ~= ButtonQualifiers.Keyboard and focusMode ~= FocusModes.Cameras then
return
elseif f9_arg1.qualifier ~= ButtonQualifiers.DPad and f9_arg1.qualifier ~= ButtonQualifiers.Keyboard then
return
end
local f9_local0 = assert
local f9_local1
if f8_arg0 < 0 or f8_arg0 > 3 then
f9_local1 = false
else
f9_local1 = true
end
f9_local0( f9_local1, "Invalid camera preset requested" )
MLG.SetCamera( f8_arg0 )
f9_arg0:dispatchEventToRoot( {
name = "select_camera_preset_" .. f8_arg0,
immediate = true
} )
end
end
function dpad_helper()
local f10_local0 = {
"up",
"right",
"down",
"left"
}
local self = nil
if CoD.UsingController() then
self = LUI.UIImage.new()
else
self = LUI.UIElement.new()
end
self.id = "DPadHelper"
self:registerAnimationState( "default", {
material = CoD.UsingController() and RegisterMaterial( "icon_hud_dpad" ) or nil,
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
bottom = -50,
height = 150,
left = 50,
width = 150
} )
self:animateToState( "default" )
for f10_local2 = 0, 3, 1 do
local f10_local5 = f10_local2
local f10_local6 = f10_local5 == 0
local f10_local7 = f10_local5 == 1
local f10_local8 = f10_local5 == 2
local f10_local9 = f10_local5 == 3
local f10_local10 = 60
local f10_local11 = 50
local f10_local12 = 48
local f10_local13 = 24
local f10_local14
if f10_local6 then
f10_local14 = f10_local11 - f10_local13
if not f10_local14 then
if f10_local8 then
f10_local14 = -f10_local11
if not f10_local14 then
else
local f10_local15
if f10_local9 then
f10_local15 = f10_local10 - f10_local12
if not f10_local15 then
if f10_local7 then
f10_local15 = -f10_local10
if not f10_local15 then
else
local f10_local16 = LUI.UIImage.new()
f10_local16.id = "camera_" .. f10_local5
f10_local16:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local14,
left = 3 + f10_local15,
width = f10_local12,
height = f10_local13,
alpha = 0.5
} )
f10_local16:registerAnimationState( "hilite", {
alpha = 1
} )
f10_local16:animateToState( "default" )
f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) )
f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) )
for f10_local17 = 0, 3, 1 do
local f10_local20 = f10_local17
f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event )
if f10_local5 == f10_local20 then
element:animateToState( "hilite" )
else
element:animateToState( "default" )
end
end )
end
self:addElement( f10_local16 )
if not CoD.UsingController() then
local f10_local17 = 80
local f10_local18 = 80
local f10_local19 = 26
local f10_local20 = 26
local f10_local21
if f10_local6 then
f10_local21 = f10_local18 - f10_local20
if not f10_local21 then
if f10_local8 then
f10_local21 = -f10_local18
if not f10_local21 then
else
local f10_local22
if f10_local9 then
f10_local22 = f10_local17 - f10_local19
if not f10_local22 then
if f10_local7 then
f10_local22 = -f10_local17
if not f10_local22 then
else
local f10_local23 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local21 - 2,
left = 3 + f10_local22,
width = f10_local19,
height = f10_local20
} )
f10_local23.id = "arrow" .. f10_local5
self:addElement( f10_local23 )
end
end
f10_local22 = -f10_local19 / 2
end
else
if f10_local7 then
f10_local22 = -f10_local17
if not f10_local22 then
else
local f10_local23 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local21 - 2,
left = 3 + f10_local22,
width = f10_local19,
height = f10_local20
} )
f10_local23.id = "arrow" .. f10_local5
self:addElement( f10_local23 )
end
end
f10_local22 = -f10_local19 / 2
end
local f10_local23 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local21 - 2,
left = 3 + f10_local22,
width = f10_local19,
height = f10_local20
} )
f10_local23.id = "arrow" .. f10_local5
self:addElement( f10_local23 )
end
end
f10_local21 = -f10_local20 / 2
end
else
if f10_local8 then
f10_local21 = -f10_local18
if not f10_local21 then
else
local f10_local22
if f10_local9 then
f10_local22 = f10_local17 - f10_local19
if not f10_local22 then
if f10_local7 then
f10_local22 = -f10_local17
if not f10_local22 then
else
local f10_local23 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local21 - 2,
left = 3 + f10_local22,
width = f10_local19,
height = f10_local20
} )
f10_local23.id = "arrow" .. f10_local5
self:addElement( f10_local23 )
end
end
f10_local22 = -f10_local19 / 2
end
else
if f10_local7 then
f10_local22 = -f10_local17
if not f10_local22 then
else
local f10_local23 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local21 - 2,
left = 3 + f10_local22,
width = f10_local19,
height = f10_local20
} )
f10_local23.id = "arrow" .. f10_local5
self:addElement( f10_local23 )
end
end
f10_local22 = -f10_local19 / 2
end
-- ERROR: Infinite loop detected
end
end
f10_local21 = -f10_local20 / 2
end
local f10_local22
if f10_local9 then
f10_local22 = f10_local17 - f10_local19
if not f10_local22 then
if f10_local7 then
f10_local22 = -f10_local17
if not f10_local22 then
else
-- ERROR: Infinite loop detected
end
end
f10_local22 = -f10_local19 / 2
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
end
f10_local15 = -f10_local12 / 2
end
else
if f10_local7 then
f10_local15 = -f10_local10
if not f10_local15 then
else
local f10_local16 = LUI.UIImage.new()
f10_local16.id = "camera_" .. f10_local5
f10_local16:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local14,
left = 3 + f10_local15,
width = f10_local12,
height = f10_local13,
alpha = 0.5
} )
f10_local16:registerAnimationState( "hilite", {
alpha = 1
} )
f10_local16:animateToState( "default" )
f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) )
f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) )
for f10_local17 = 0, 3, 1 do
local f10_local20 = f10_local17
f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event )
if f10_local5 == f10_local20 then
element:animateToState( "hilite" )
else
element:animateToState( "default" )
end
end )
end
self:addElement( f10_local16 )
if not CoD.UsingController() then
local f10_local17 = 80
local f10_local18 = 80
local f10_local19 = 26
local f10_local20 = 26
local f10_local21
if f10_local6 then
f10_local21 = f10_local18 - f10_local20
if not f10_local21 then
if f10_local8 then
f10_local21 = -f10_local18
if not f10_local21 then
else
local f10_local22
if f10_local9 then
f10_local22 = f10_local17 - f10_local19
if not f10_local22 then
-- ERROR: Infinite loop detected
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
f10_local21 = -f10_local20 / 2
end
else
if f10_local8 then
f10_local21 = -f10_local18
if not f10_local21 then
else
local f10_local22
if f10_local9 then
f10_local22 = f10_local17 - f10_local19
if not f10_local22 then
-- ERROR: Infinite loop detected
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
f10_local21 = -f10_local20 / 2
end
-- ERROR: Infinite loop detected
end
end
end
f10_local15 = -f10_local12 / 2
end
local f10_local16 = LUI.UIImage.new()
f10_local16.id = "camera_" .. f10_local5
f10_local16:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local14,
left = 3 + f10_local15,
width = f10_local12,
height = f10_local13,
alpha = 0.5
} )
f10_local16:registerAnimationState( "hilite", {
alpha = 1
} )
f10_local16:animateToState( "default" )
f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) )
f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) )
for f10_local17 = 0, 3, 1 do
local f10_local20 = f10_local17
f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event )
if f10_local5 == f10_local20 then
element:animateToState( "hilite" )
else
element:animateToState( "default" )
end
end )
end
self:addElement( f10_local16 )
if not CoD.UsingController() then
local f10_local17 = 80
local f10_local18 = 80
local f10_local19 = 26
local f10_local20 = 26
local f10_local21
if f10_local6 then
f10_local21 = f10_local18 - f10_local20
if not f10_local21 then
if f10_local8 then
f10_local21 = -f10_local18
if not f10_local21 then
else
-- ERROR: Infinite loop detected
end
end
f10_local21 = -f10_local20 / 2
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
end
f10_local14 = -f10_local13 / 2
end
else
if f10_local8 then
f10_local14 = -f10_local11
if not f10_local14 then
else
local f10_local15
if f10_local9 then
f10_local15 = f10_local10 - f10_local12
if not f10_local15 then
if f10_local7 then
f10_local15 = -f10_local10
if not f10_local15 then
else
local f10_local16 = LUI.UIImage.new()
f10_local16.id = "camera_" .. f10_local5
f10_local16:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local14,
left = 3 + f10_local15,
width = f10_local12,
height = f10_local13,
alpha = 0.5
} )
f10_local16:registerAnimationState( "hilite", {
alpha = 1
} )
f10_local16:animateToState( "default" )
f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) )
f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) )
for f10_local17 = 0, 3, 1 do
local f10_local20 = f10_local17
f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event )
if f10_local5 == f10_local20 then
element:animateToState( "hilite" )
else
element:animateToState( "default" )
end
end )
end
self:addElement( f10_local16 )
if not CoD.UsingController() then
local f10_local17 = 80
local f10_local18 = 80
local f10_local19 = 26
local f10_local20 = 26
local f10_local21
if f10_local6 then
f10_local21 = f10_local18 - f10_local20
if not f10_local21 then
-- ERROR: Infinite loop detected
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
end
f10_local15 = -f10_local12 / 2
end
else
if f10_local7 then
f10_local15 = -f10_local10
if not f10_local15 then
else
local f10_local16 = LUI.UIImage.new()
f10_local16.id = "camera_" .. f10_local5
f10_local16:registerAnimationState( "default", {
material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ),
topAnchor = f10_local6,
bottomAnchor = f10_local8,
leftAnchor = f10_local9,
rightAnchor = f10_local7,
top = f10_local14,
left = 3 + f10_local15,
width = f10_local12,
height = f10_local13,
alpha = 0.5
} )
f10_local16:registerAnimationState( "hilite", {
alpha = 1
} )
f10_local16:animateToState( "default" )
f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) )
f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) )
for f10_local17 = 0, 3, 1 do
local f10_local20 = f10_local17
f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event )
if f10_local5 == f10_local20 then
element:animateToState( "hilite" )
else
element:animateToState( "default" )
end
end )
end
self:addElement( f10_local16 )
if not CoD.UsingController() then
local f10_local17 = 80
local f10_local18 = 80
local f10_local19 = 26
local f10_local20 = 26
local f10_local21
if f10_local6 then
f10_local21 = f10_local18 - f10_local20
if not f10_local21 then
-- ERROR: Infinite loop detected
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
end
end
f10_local15 = -f10_local12 / 2
end
-- ERROR: Infinite loop detected
end
end
f10_local14 = -f10_local13 / 2
end
local f10_local15
if f10_local9 then
f10_local15 = f10_local10 - f10_local12
if not f10_local15 then
if f10_local7 then
f10_local15 = -f10_local10
if not f10_local15 then
else
-- ERROR: Infinite loop detected
end
end
f10_local15 = -f10_local12 / 2
end
else
-- ERROR: Infinite loop detected
end
-- ERROR: Infinite loop detected
end
return self
end
ScoreModes = {
LargeBoard = 1,
LargeBoardAllPlayers = 2,
Max = 2
}
scoreMode = ScoreModes.LargeBoard
function CycleScoreModes( f12_arg0 )
SetScoreMode( f12_arg0, 1 + scoreMode % ScoreModes.Max )
f12_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
immediate = true
} )
end
function SetScoreMode( f13_arg0, f13_arg1 )
local f13_local0 = f13_arg1 == ScoreModes.LargeBoardAllPlayers
scoreMode = f13_arg1
if not f13_local0 then
SetFocusMode( f13_arg0, FocusModes.Cameras )
end
f13_arg0:dispatchEventToRoot( {
name = "update_mlg_hud_visibility"
} )
end
function IsGameModeTeamBased()
return not GameX.gameModeIsFFA( GameX.GetGameMode() )
end
function UpdateLargeScoreboard( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg0:getChildById( "teamAImage" )
local f15_local1 = f15_arg0:getChildById( "teamBImage" )
if f15_arg0.oldTeam ~= Game.GetLastMLGSpectateTeam() then
if Game.GetLastMLGSpectateTeam() ~= Teams.axis then
local f15_local2 = MBh.AnimateLoop( {
{
"visible",
1000
},
{
"visible1",
1000
}
} )
f15_local2( f15_local0, {} )
f15_local1:animateToState( "default" )
else
f15_local0:animateToState( "default" )
local f15_local2 = MBh.AnimateLoop( {
{
"visible",
1000
},
{
"visible1",
1000
}
} )
f15_local2( f15_local1, {} )
end
f15_arg0.oldTeam = Game.GetLastMLGSpectateTeam()
end
end
function large_scoreboard()
local self = LUI.UIElement.new()
self.id = "large_scoreboard"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -10,
height = 60,
left = -160,
right = 160
} )
self:animateToState( "default" )
local f16_local1 = 360
local f16_local2 = 32
local f16_local3 = LUI.UIHorizontalList.new()
f16_local3.id = "modeBG"
f16_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 8,
height = f16_local2,
left = -f16_local1 / 2,
right = f16_local1 / 2
} )
f16_local3:animateToState( "default" )
self:addElement( f16_local3 )
local f16_local4 = LUI.UIImage.new()
f16_local4.id = "leftCap"
f16_local4:registerAnimationState( "default", {
material = RegisterMaterial( "box_white_gradient_fade_rt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f16_local2 * 2,
red = 0,
green = 0,
blue = 0,
alpha = 0.5
} )
f16_local4:animateToState( "default" )
f16_local3:addElement( f16_local4 )
local f16_local5 = LUI.UIImage.new()
f16_local5.id = "middle"
f16_local5:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f16_local1 - 4 * f16_local2,
red = 0,
green = 0,
blue = 0,
alpha = 0.5
} )
f16_local5:animateToState( "default" )
f16_local3:addElement( f16_local5 )
local f16_local6 = LUI.UIImage.new()
f16_local6.id = "rightCap"
f16_local6:registerAnimationState( "default", {
material = RegisterMaterial( "box_white_gradient_fade" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f16_local2 * 2,
red = 0,
green = 0,
blue = 0,
alpha = 0.5
} )
f16_local6:animateToState( "default" )
f16_local3:addElement( f16_local6 )
local f16_local7 = LUI.UIImage.new()
f16_local7.id = "scoreBG"
f16_local7:registerAnimationState( "default", {
material = RegisterMaterial( "box_mlg_bg" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 34,
height = 128,
left = -256,
right = 256
} )
f16_local7:animateToState( "default" )
self:addElement( f16_local7 )
local f16_local8 = nil
if IsGameModeTeamBased() then
f16_local8 = LUI.UIImage.new()
f16_local8.id = "countdownBG"
f16_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.black, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 47,
height = 27,
left = -48,
right = 48
} ) )
f16_local8:animateToState( "default" )
self:addElement( f16_local8 )
else
f16_local8 = LUI.UIElement.new()
f16_local8.id = "countdownBG"
f16_local8:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 11,
height = 27,
width = 96,
right = 0
} )
end
f16_local8:animateToState( "default" )
self:addElement( f16_local8 )
local f16_local9 = LUI.UICountdown.new()
f16_local9.id = "countdown"
f16_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.HudDigitalNormalFont.Font,
alignment = LUI.Alignment.Center,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
top = 1,
right = 0,
height = CoD.TextSettings.HudDigitalNormalFont.Height
} ) )
f16_local9:animateToState( "default" )
f16_local8:addElement( f16_local9 )
local f16_local10 = Engine.Localize( "@" .. Engine.TableLookup( "mp/mapNames.csv", 0, Engine.GetDvarString( "ui_mapname" ), 1 ) )
local f16_local11 = Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, GameX.GetGameMode(), GameTypesTable.Cols.Name ) )
local f16_local12 = "%04d"
local f16_local13 = LUI.UIText.new()
f16_local13.id = "mode"
f16_local13:setText( f16_local11 .. "-" .. f16_local10 )
if IsGameModeTeamBased() then
local f16_local14 = function ( f17_arg0 )
local self = LUI.UIImage.new()
self.id = "teamImageLogo_" .. f17_arg0
self:registerAnimationState( "default", {
material = RegisterMaterial( f17_arg0 ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
return self
end
f16_local13:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.SmallFont.Font,
alignment = LUI.Alignment.Center,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
top = 14,
right = 0,
height = CoD.TextSettings.SmallFont.Height
} ) )
f16_local13:animateToState( "default" )
self:addElement( f16_local13 )
local f16_local15 = LUI.UIImage.new()
f16_local15.id = "teamAImage"
f16_local15:registerAnimationState( "default", {
material = RegisterMaterial( "hud_round_end_orange" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 36,
height = 84,
left = 15,
width = 84,
alpha = 1,
red = 0.4,
green = 0.4,
blue = 0.4
} )
f16_local15:animateToState( "default" )
f16_local15:registerAnimationState( "visible", {
material = RegisterMaterial( "hud_round_end_blue" ),
red = 1,
green = 1,
blue = 1
} )
f16_local15:registerAnimationState( "visible1", {
material = RegisterMaterial( "hud_round_end_blue" ),
red = 0.6,
green = 0.6,
blue = 0.6
} )
self:addElement( f16_local15 )
f16_local15:addElement( f16_local14( "hud_round_end_ghost" ) )
local f16_local16 = LUI.UIImage.new()
f16_local16.id = "teamBImage"
f16_local16:registerAnimationState( "default", {
material = RegisterMaterial( "hud_round_end_orange" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 36,
height = 84,
width = 84,
right = -15,
alpha = 1,
red = 0.4,
green = 0.4,
blue = 0.4
} )
f16_local16:animateToState( "default" )
f16_local16:registerAnimationState( "visible", {
material = RegisterMaterial( "hud_round_end_blue" ),
red = 1,
green = 1,
blue = 1
} )
f16_local16:registerAnimationState( "visible1", {
material = RegisterMaterial( "hud_round_end_blue" ),
red = 0.6,
green = 0.6,
blue = 0.6
} )
self:addElement( f16_local16 )
f16_local16:addElement( f16_local14( "hud_round_end_fed" ) )
local f16_local17 = "%04d"
local f16_local18 = LUI.UIText.new()
f16_local18.id = "teamAScore"
f16_local18:setTextStyle( CoD.TextStyle.ShadowedMore )
f16_local18:setupUIBindText( "TeamScoreFriendly", f16_local17 )
f16_local18:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.HudDigitalBigFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = -45,
top = 44,
right = 0,
height = CoD.TextSettings.HudDigitalBigFont.Height
} ) )
f16_local18:animateToState( "default" )
self:addElement( f16_local18 )
local f16_local19 = LUI.UIText.new()
f16_local19.id = "teamBScore"
f16_local19:setTextStyle( CoD.TextStyle.ShadowedMore )
f16_local19:setupUIBindText( "TeamScoreEnemy", f16_local17 )
f16_local19:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.HudDigitalBigFont.Font,
alignment = LUI.Alignment.Right,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
top = 44,
right = 45,
height = CoD.TextSettings.HudDigitalBigFont.Height
} ) )
f16_local19:animateToState( "default" )
self:addElement( f16_local19 )
self:registerEventHandler( "spectate_team_change", UpdateLargeScoreboard )
UpdateLargeScoreboard( self, {} )
else
local f16_local14 = function ( menu, controller )
local self = LUI.UIText.new()
self.id = "imageText_" .. menu
self:registerAnimationState( "default", CoD.ColorizeState( controller, {
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 32,
bottom = 32 + CoD.TextSettings.BoldFont.Height,
left = -2,
right = 0
} ) )
self:animateToState( "default" )
self:setText( Engine.Localize( menu ) )
return self
end
f16_local13:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.SmallFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
top = 14,
right = 0,
height = CoD.TextSettings.SmallFont.Height
} ) )
f16_local13:animateToState( "default" )
self:addElement( f16_local13 )
local f16_local15 = LUI.UIImage.new()
f16_local15.id = "firstPlaceImage"
f16_local15:registerAnimationState( "default", {
material = RegisterMaterial( "hud_round_end_blue" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 36,
height = 84,
left = -60,
width = 84
} )
f16_local15:animateToState( "default" )
self:addElement( f16_local15 )
f16_local15:addElement( f16_local14( "LUA_MENU_1ST", Colors.white ) )
local f16_local16 = LUI.UIImage.new()
f16_local16.id = "secondPlaceImage"
f16_local16:registerAnimationState( "default", {
material = RegisterMaterial( "hud_round_end_blue" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 36,
height = 84,
left = 89,
width = 84
} )
f16_local16:animateToState( "default" )
self:addElement( f16_local16 )
f16_local16:addElement( f16_local14( "LUA_MENU_2ND", Colors.md_grey ) )
local f16_local17 = LUI.UIImage.new()
f16_local17.id = "thirdPlaceImage"
f16_local17:registerAnimationState( "default", {
material = RegisterMaterial( "hud_round_end_blue" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 36,
height = 84,
width = 84,
right = 0
} )
f16_local17:animateToState( "default" )
self:addElement( f16_local17 )
f16_local17:addElement( f16_local14( "LUA_MENU_3RD", Colors.grey_5 ) )
local f16_local18 = LUI.UIText.new()
f16_local18.id = "firstPlaceScore"
f16_local18:setTextStyle( CoD.TextStyle.ShadowedMore )
f16_local18:registerAnimationState( "default", CoD.ColorizeState( Colors.cyan, {
font = CoD.TextSettings.HudDigitalBigFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
left = 17,
top = 44,
width = 45,
height = CoD.TextSettings.HudDigitalBigFont.Height
} ) )
f16_local18:animateToState( "default" )
f16_local18:setText( string.format( f16_local12, 0 ) )
f16_local18:registerEventHandler( "timer_update", function ( element, event )
local f19_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 1, GameX.GetGameMode(), false )
if f19_local0 then
element:setText( string.format( f16_local12, f19_local0.score ) )
end
end )
self:addElement( f16_local18 )
local f16_local19 = LUI.UIText.new()
f16_local19.id = "secondPlaceScore"
f16_local19:setTextStyle( CoD.TextStyle.ShadowedMore )
f16_local19:registerAnimationState( "default", CoD.ColorizeState( Colors.md_grey, {
font = CoD.TextSettings.HudDigitalBigFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
left = 166,
top = 44,
width = 45,
height = CoD.TextSettings.HudDigitalBigFont.Height
} ) )
f16_local19:animateToState( "default" )
f16_local19:setText( string.format( f16_local12, 0 ) )
f16_local19:registerEventHandler( "timer_update", function ( element, event )
local f20_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 2, GameX.GetGameMode(), false )
if f20_local0 then
element:setText( string.format( f16_local12, f20_local0.score ) )
end
end )
self:addElement( f16_local19 )
local f16_local20 = LUI.UIText.new()
f16_local20.id = "thirdPlaceScore"
f16_local20:setTextStyle( CoD.TextStyle.ShadowedMore )
f16_local20:registerAnimationState( "default", CoD.ColorizeState( Colors.grey_5, {
font = CoD.TextSettings.HudDigitalBigFont.Font,
alignment = LUI.Alignment.Right,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
top = 44,
right = 60,
height = CoD.TextSettings.HudDigitalBigFont.Height
} ) )
f16_local20:animateToState( "default" )
f16_local20:setText( string.format( f16_local12, 0 ) )
f16_local20:registerEventHandler( "timer_update", function ( element, event )
local f21_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 3, GameX.GetGameMode(), false )
if f21_local0 then
element:setText( string.format( f16_local12, f21_local0.score ) )
end
end )
self:addElement( f16_local20 )
end
return self
end
function playercard()
local self = LUI.UIElement.new()
self.id = "playercard"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = -90,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f22_local1 = LUI.UIElement.new()
local f22_local2 = -235
local f22_local3 = LUI.UIImage.new( CoD.ColorizeState( Colors.black, {
material = RegisterMaterial( "box_white_gradient_fade" ),
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 9,
left = f22_local2 - 312,
height = 61,
width = 70,
alpha = 0
} ) )
f22_local3:registerAnimationState( "opening", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 9,
left = f22_local2 + 10,
height = 61,
width = 70,
alpha = 1
} )
f22_local3:registerAnimationState( "active", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 9,
left = f22_local2,
height = 61,
width = 70,
alpha = 1
} )
f22_local3:registerAnimationState( "closing", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 9,
left = f22_local2 - 20,
height = 61,
width = 70,
alpha = 1
} )
f22_local3:registerAnimationState( "closed", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 9,
left = f22_local2 + 85,
height = 61,
width = 70,
alpha = 0
} )
f22_local3.id = "teamIcon"
f22_local3:registerEventHandler( "refresh_playercard", function ( element, event )
local f23_local0 = Game.GetPlayerstateClientnum()
if f23_local0 ~= -1 and f22_local1.current_client_num ~= f23_local0 and Game.GetPlayerClientnum() ~= f23_local0 then
local f23_local1 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
150
},
{
"active",
150
},
{
"active",
4000
},
{
"closing",
150,
true,
true
},
{
"closed",
100,
true
}
} )
f23_local1( f22_local3, {} )
else
element:animateToState( "default" )
end
end )
self:addElement( f22_local3 )
local f22_local4 = LUI.UIImage.new( {
material = RegisterMaterial( "finalscore_icon_back_gray" ),
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
bottom = 7,
height = 75,
left = -36,
width = 75
} )
f22_local4.id = "teamIconSquare"
f22_local3:addElement( f22_local4 )
local f22_local5 = LUI.UIImage.new( {
material = RegisterMaterial( "hud_round_end_ghost" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
f22_local5:registerAnimationState( "federation", {
material = RegisterMaterial( "hud_round_end_fed" )
} )
f22_local5.id = "teamIconEmblem"
f22_local5:registerEventHandler( "refresh_playercard", function ( element, event )
if Game.GetLastMLGSpectateTeam() == Teams.axis then
element:animateToState( "federation" )
else
element:animateToState( "default" )
end
end )
f22_local4:addElement( f22_local5 )
local f22_local6 = LUI.UIImage.new()
f22_local6.id = "spectatorTeamNameBGId"
f22_local6:registerAnimationState( "default", {
material = RegisterMaterial( "gradient_bottom" ),
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = -68,
left = 40,
height = 17,
right = 76,
alpha = 0.7
} )
f22_local6:animateToState( "default", 0 )
f22_local1:addElement( f22_local6 )
local f22_local7 = LUI.UIText.new()
f22_local7.id = "spectatorTeamNameId"
f22_local7:setTextStyle( CoD.TextStyle.Shadowed )
f22_local7:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
top = -70,
left = 40,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
right = 60,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alpha = 1
} )
f22_local7:animateToState( "default", 0 )
f22_local7:registerEventHandler( "refresh_playercard", function ( element, event )
f22_local7:setText( GameX.GetLocalizedTeamName( Game.GetLastMLGSpectateTeam() ) )
end )
f22_local1:addElement( f22_local7 )
f22_local1.id = "spectatorPlayerCard"
f22_local1:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 0,
left = -512,
height = 64,
width = 256,
alpha = 0
} )
f22_local1:registerAnimationState( "opening", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 0,
left = -190,
height = 64,
width = 256,
alpha = 1
} )
f22_local1:registerAnimationState( "active", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
bottom = 0,
left = -200,
height = 64,
width = 256,
alpha = 1
} )
f22_local1:animateToState( "default", 0 )
f22_local1:addElement( LUI.mp_hud.PlayerCardHud.playerCardHudDef() )
self:addElement( f22_local1 )
self:registerEventHandler( "refresh_playercard", LUI.mp_hud.SpectatorHud.UpdateSpectator )
return self
end
FocusModes = {
Cameras = 1,
Scoreboard = 2,
Max = 2
}
focusMode = FocusModes.Cameras
followedClientNum = -1
lastValidFollowedClientNum = -1
function CycleFocus( f26_arg0, f26_arg1 )
SetFocusMode( f26_arg0, 1 + focusMode % FocusModes.Max )
f26_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
immediate = true
} )
end
function SetFocusMode( f27_arg0, f27_arg1 )
if f27_arg1 == focusMode then
return
end
focusMode = f27_arg1
if f27_arg1 ~= FocusModes.Scoreboard then
f27_arg0:dispatchEventToRoot( {
name = "unfocus_scoreboard",
immediate = true
} )
else
if scoreMode == ScoreModes.LargeBoard then
SetScoreMode( f27_arg0, ScoreModes.LargeBoardAllPlayers )
f27_arg0:dispatchEventToRoot( {
name = "toggle_scoreboard",
immediate = true
} )
end
f27_arg0:dispatchEventToRoot( {
name = "focus_scoreboard",
immediate = true
} )
end
end
function large_map()
local self = LUI.UIElement.new()
self.id = "largeMap"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f28_local1 = LUI.UIElement.new()
f28_local1:setupWorldBlur()
f28_local1.id = "blur"
f28_local1:registerAnimationState( "default", {
worldBlur = 0
} )
f28_local1:registerAnimationState( "visible", {
worldBlur = 10
} )
f28_local1:registerEventHandler( "hide_large_map", MBh.AnimateToState( "default", 150 ) )
f28_local1:registerEventHandler( "show_bigger_map", MBh.AnimateToState( "default", 150 ) )
f28_local1:registerEventHandler( "show_fullscreen_map", MBh.AnimateToState( "visible", 150 ) )
f28_local1:animateToState( "default" )
self:addElement( f28_local1 )
local f28_local2 = LUI.UIElement.new()
f28_local2:setupMinimap( CoD.CompassType.Full )
f28_local2:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
width = 536,
height = 280,
top = 0,
left = 0,
alpha = 0,
scale = -1
} )
f28_local2:registerAnimationState( "bigger", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
width = 320,
height = 320,
top = 10,
left = 20,
scale = 0,
alpha = 1
} )
f28_local2:registerAnimationState( "fullscreen", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
width = 1072,
height = 500,
scale = 0,
alpha = 1
} )
f28_local2:animateToState( "default" )
f28_local2:registerEventHandler( "hide_large_map", MBh.AnimateToState( "default", 150 ) )
f28_local2:registerEventHandler( "show_bigger_map", MBh.AnimateToState( "bigger", 150 ) )
f28_local2:registerEventHandler( "show_fullscreen_map", MBh.AnimateToState( "fullscreen", 150 ) )
f28_local2:registerEventHandler( "killcam_change", function ( element, event )
if event.value then
knownState.userPreferences.mapZoomMode = mapZoomMode
SetMapZoomMode( element, MapZoomModes.Standard )
end
end )
self:addElement( f28_local2 )
local f28_local3 = LUI.UIElement.new()
f28_local3:setupMinimapIcons( CoD.CompassType.Full )
f28_local3.properties = {
drawPlayer = true
}
f28_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
left = 0
} )
f28_local3:animateToState( "default" )
f28_local2:addElement( f28_local3 )
return self
end
MapZoomModes = {
Standard = 1,
Bigger = 2,
FullScreen = 3,
Max = 3
}
mapZoomMode = MapZoomModes.Standard
function CycleMapZoom( f30_arg0, f30_arg1 )
SetMapZoomMode( f30_arg0, 1 + mapZoomMode % MapZoomModes.Max )
f30_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
immediate = true
} )
end
function SetMapZoomMode( f31_arg0, f31_arg1 )
mapZoomMode = f31_arg1
if mapZoomMode == MapZoomModes.Standard then
f31_arg0:dispatchEventToRoot( {
name = "show_standard_map",
immediate = true
} )
f31_arg0:dispatchEventToRoot( {
name = "hide_large_map",
immediate = true
} )
else
f31_arg0:dispatchEventToRoot( {
name = "show_non_standard_map",
immediate = true
} )
if mapZoomMode == MapZoomModes.Bigger then
f31_arg0:dispatchEventToRoot( {
name = "show_bigger_map",
immediate = true
} )
elseif mapZoomMode == MapZoomModes.FullScreen then
f31_arg0:dispatchEventToRoot( {
name = "show_fullscreen_map",
immediate = true
} )
end
end
f31_arg0:dispatchEventToRoot( {
name = "update_mlg_hud_visibility"
} )
end
Overlays = {
All = 1,
ToolbarOff = 2,
None = 3,
Max = 3
}
currentOverlay = Overlays.All
function ToggleOverlays( f32_arg0 )
currentOverlay = 1 + currentOverlay % Overlays.Max
f32_arg0:dispatchEventToRoot( {
name = "update_mlg_hud_visibility"
} )
if currentOverlay ~= Overlays.ToolbarOff and currentOverlay ~= Overlays.None then
f32_arg0:dispatchEventToRoot( {
name = "update_button_helpers",
immediate = true
} )
end
end
function obituary()
local f33_local0 = LUI.mp_hud.ObituaryHud.obituaryHudDef()
f33_local0:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -44,
right = 20,
width = 256,
height = 256,
alpha = 1
} )
f33_local0.id = "mlg_obituary"
f33_local0:animateToState( "default" )
return f33_local0
end
function OpenPauseMenu( f34_arg0, f34_arg1 )
f34_arg0:dispatchEventToRoot( {
name = "toggle_pause"
} )
f34_arg0:dispatchEventToRoot( {
name = "update_mlg_hud_visibility"
} )
end
function UpdateButtonHelpers( f35_arg0 )
local f35_local0 = 1 + currentOverlay % Overlays.Max
local f35_local1 = nil
if f35_local0 == Overlays.All then
f35_local1 = "PATCH_MENU_MLG_SPECT_SHOW_ALL_HELP"
elseif f35_local0 == Overlays.ToolbarOff then
f35_local1 = "PATCH_MENU_MLG_SPECT_CAMERAS_ONLY"
else
f35_local1 = "PATCH_MENU_MLG_SPECT_HIDE_HELP"
end
if 1 == Engine.IsGamepadEnabled() then
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 0,
button_ref = "button_secondary",
helper_text = Engine.Localize( f35_local1 ),
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 6,
button_ref = "button_start",
helper_text = "",
side = "left"
} )
else
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 0,
button_ref = "button_start",
helper_text = Engine.Localize( f35_local1 ),
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 6,
button_ref = "button_secondary",
helper_text = "",
side = "left"
} )
end
local f35_local2 = Engine.Localize( "MENU_PLAYER" )
if 1 == Engine.IsGamepadEnabled() then
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_ins",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_page_up",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_shoulderl",
helper_text = f35_local2,
button_ref2 = "button_shoulderr",
side = "left"
} )
else
local f35_local3 = Engine.Localize( "LUA_MENU_MLG_SPECT_HIGHLIGHT_PLAYER" )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_shoulderl",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_ins",
button_ref2 = "button_del",
helper_text = f35_local3,
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 1,
button_ref = "button_page_up",
button_ref2 = "button_page_down",
helper_text = f35_local2,
side = "left"
} )
end
local f35_local3 = ""
if mapZoomMode ~= MapZoomModes.FullScreen then
local f35_local4 = 1 + currentView % Views.Max
if f35_local4 == Views.FirstPerson then
f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FIRST_PERSON" )
elseif f35_local4 == Views.ThirdPerson then
f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_THIRD_PERSON" )
else
f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FREE_CAM" )
end
end
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 2,
button_ref = "button_alt2",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 2,
button_ref = "button_alt2",
helper_text = f35_local3,
side = "left"
} )
local f35_local4 = ""
local f35_local5 = 1 + mapZoomMode % MapZoomModes.Max
if f35_local5 == MapZoomModes.Standard then
f35_local4 = "PATCH_MENU_MLG_SPECT_MINIMAP"
elseif f35_local5 == MapZoomModes.Bigger then
f35_local4 = "PATCH_MENU_MLG_SPECT_LARGE_MAP"
else
f35_local4 = "PATCH_MENU_MLG_SPECT_FULLSCREEN_MAP"
end
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 3,
button_ref = "button_left_trigger",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 3,
button_ref = "button_left_trigger",
helper_text = Engine.Localize( f35_local4 ),
side = "left"
} )
local f35_local6 = Engine.Localize( "PATCH_MENU_MLG_SPECT_SCOREBOARD" )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 4,
button_ref = "button_select",
helper_text = "",
side = "left"
} )
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 4,
button_ref = "button_select",
helper_text = f35_local6,
side = "left"
} )
if 1 == Engine.IsGamepadEnabled() then
local f35_local7 = 1 + focusMode % FocusModes.Max
local f35_local8 = nil
if f35_local7 == FocusModes.Cameras then
f35_local8 = Engine.Localize( "PATCH_MENU_MLG_SPECT_UNFOCUS_SCOREBOARD" )
else
f35_local8 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FOCUS_SCOREBOARD" )
end
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 5,
button_ref = "button_right_trigger",
helper_text = f35_local8,
side = "left"
} )
else
f35_arg0:processEvent( {
name = "add_button_helper_text",
priority = 5,
button_ref = "button_right_trigger",
helper_text = "",
side = "left"
} )
end
f35_arg0:dispatchEventToRoot( {
name = "refresh_button_helper"
} )
end
knownState = {
isKillCam = nil,
userPreferences = {}
}
function OnRoundStart( f36_arg0, f36_arg1 )
SetFocusMode( f36_arg0, FocusModes.Cameras )
currentView = Views.Free
local f36_local0 = knownState.userPreferences
if f36_local0.mapZoomMode then
SetMapZoomMode( f36_arg0, f36_local0.mapZoomMode )
end
if f36_local0.view then
ChangeView( f36_arg0, f36_local0.view )
end
end
function UpdateTimer( f37_arg0, f37_arg1 )
if Game.InKillCam() ~= knownState.isKillCam then
knownState.isKillCam = Game.InKillCam()
UpdateHUDVisibility( f37_arg0 )
f37_arg0:processEvent( {
name = "killcam_change",
value = knownState.isKillCam
} )
end
local f37_local0 = MLG.GetFollowedClientNum() or -1
if f37_local0 ~= followedClientNum then
followedClientNum = f37_local0
f37_arg0:dispatchEventToRoot( {
name = "refresh_playercard",
dispatchChildren = true
} )
if followedClientNum >= 0 then
f37_arg0:dispatchEventToRoot( {
name = "spectate_team_change",
immediate = true
} )
if not knownState.isKillCam then
lastValidFollowedClientNum = f37_local0
end
end
end
if followedClientNum >= 0 and currentView ~= Views.Free then
f37_arg0:dispatchEventToRoot( {
name = "highlight_scoreboard_row_by_clientnum",
clientNum = followedClientNum,
immediate = true
} )
else
f37_arg0:dispatchEventToRoot( {
name = "highlight_scoreboard_row_by_clientnum",
clientNum = nil,
immediate = true
} )
end
end
function UpdateHUDVisibility( f38_arg0 )
local f38_local0 = f38_arg0.hudContainer.hud.is_paused or knownState.isKillCam
local f38_local1 = {}
local f38_local2 = f38_arg0.largeScoreboard
local f38_local3
if f38_local0 then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
f38_local2 = f38_arg0.playercard
if f38_local0 or currentOverlay == Overlays.None or mapZoomMode == MapZoomModes.FullScreen then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
f38_local2 = f38_arg0.dpadHelper
if f38_local0 or currentOverlay == Overlays.None or currentView ~= Views.Free then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
f38_local2 = f38_arg0.buttonHelper
if f38_local0 or currentOverlay == Overlays.ToolbarOff or currentOverlay == Overlays.None then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
f38_local2 = f38_arg0.largeMap
if f38_local0 or mapZoomMode == MapZoomModes.Standard then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
f38_local2 = f38_arg0.obituary
if f38_local0 then
f38_local3 = "hidden"
if not f38_local3 then
else
f38_local1[f38_local2] = f38_local3
for f38_local9, f38_local10 in pairs( f38_local1 ) do
if f38_local9.currentState ~= f38_local10 then
local f38_local5 = f38_local9
local f38_local6 = f38_local9.animateToState
local f38_local7 = f38_local10
local f38_local8
if f38_local9 == f38_arg0.largeMap then
f38_local8 = 0
if not f38_local8 then
else
f38_local6( f38_local5, f38_local7, f38_local8 )
f38_local9.currentState = f38_local10
end
end
f38_local8 = 150
end
end
end
end
f38_local3 = "default"
end
end
f38_local3 = "default"
end
end
f38_local3 = "default"
end
end
f38_local3 = "default"
end
end
f38_local3 = "default"
end
end
f38_local3 = "default"
end
function addWidget( f39_arg0, f39_arg1, f39_arg2 )
local self = LUI.UIElement.new()
self.id = "wrapper_for_" .. f39_arg2.id
self:registerAnimationState( "hidden", {
alpha = 0
} )
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
} )
self:animateToState( "default" )
self:addElement( f39_arg2 )
if f39_arg1 then
f39_arg0.static:addElement( self )
else
f39_arg0.scalable:addElement( self )
end
return self
end
function MLGHud( f40_arg0 )
MLG.SetMLGActiveMenu()
local self = LUI.UIElement.new()
self.hudContainer = f40_arg0
self.id = "MLGHud"
self.addWidget = addWidget
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
self:registerEventHandler( "init_hud", OnRoundStart )
self:registerEventHandler( "update_mlg_hud_visibility", UpdateHUDVisibility )
self:registerEventHandler( "toggle_pause", function ()
self:dispatchEventToRoot( {
name = "update_mlg_hud_visibility"
} )
end )
self:registerEventHandler( "empty_menu_stack", function ( element, event )
MLG.SetMLGActiveMenu()
UpdateHUDVisibility( element, event )
UpdateButtonHelpers( self.buttonHelper )
end )
self:registerOmnvarHandler( "ui_pause_menu_show", UpdateHUDVisibility )
self:registerEventHandler( "show_non_standard_map", function ()
self.hudContainer.hud.noMap = true
end )
self:registerEventHandler( "show_standard_map", function ()
self.hudContainer.hud.noMap = nil
end )
self.scalable = LUI.UIElement.new()
self.scalable.id = "scalable"
self:addElement( self.scalable )
local f40_local1 = function ()
local f45_local0, f45_local1, f45_local2, f45_local3 = GameX.GetAdjustedSafeZoneSize()
local f45_local4 = 15
self.scalable:registerAnimationState( "current", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = f45_local0 + f45_local4,
top = f45_local1 + f45_local4,
right = f45_local2 - f45_local4,
bottom = f45_local3 - f45_local4
} )
self.scalable:animateToState( "current" )
end
self:registerEventHandler( "update_hud_margins", f40_local1 )
f40_local1()
self.static = LUI.UIElement.new()
self.static.id = "static"
self.static:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self.static:animateToState( "default" )
self:addElement( self.static )
self.playercard = self:addWidget( true, playercard() )
self.largeMap = self:addWidget( false, large_map() )
self.dpadHelper = self:addWidget( true, dpad_helper() )
self.largeScoreboard = self:addWidget( false, large_scoreboard() )
self.obituary = self:addWidget( false, obituary() )
self.timersHud = self:addWidget( true, LUI.MenuBuilder.buildItems( {
type = "timersHudDef"
}, {}, self ) )
self.buttonHelper = self:addWidget( true, LUI.MenuBuilder.buildItems( {
type = "button_helper_text_main",
properties = {
left_inset = 67,
spacing = 5
},
handlers = {
update_button_helpers = UpdateButtonHelpers
}
}, {}, self ) )
UpdateButtonHelpers( self.buttonHelper )
local f40_local2 = LUI.UIBindButton.new()
f40_local2:registerEventHandler( "gamepad_button", function ( element, event )
if Engine.GetLuiInUse() or knownState.isKillCam then
return false
end
LUI.UIBindButton.GamepadButton( element, event )
if event.down and (event.button == "page_up" or event.button == "page_down" or event.button == "ins" or event.button == "del") then
element:processEvent( {
name = event.button
} )
end
end )
f40_local2.id = "bind"
f40_local2:registerEventHandler( "button_up", PresetCameraHandlerFactory( 0 ) )
f40_local2:registerEventHandler( "button_right", PresetCameraHandlerFactory( 1 ) )
f40_local2:registerEventHandler( "button_down", PresetCameraHandlerFactory( 2 ) )
f40_local2:registerEventHandler( "button_left", PresetCameraHandlerFactory( 3 ) )
f40_local2:registerEventHandler( "button_secondary", ToggleOverlays )
f40_local2:registerEventHandler( "button_shoulderl", function ( element, event )
if event.qualifier == ButtonQualifiers.Gamepad then
FollowPrev( element, event )
end
end )
f40_local2:registerEventHandler( "button_shoulderr", function ( element, event )
if event.qualifier == ButtonQualifiers.Gamepad then
FollowNext( element, event )
end
end )
f40_local2:registerEventHandler( "button_right_stick", function ( element, event )
MLG.TogglePlayerOutlines()
end )
f40_local2:registerEventHandler( "page_up", FollowPrev )
f40_local2:registerEventHandler( "page_down", FollowNext )
f40_local2:registerEventHandler( "button_left_trigger", CycleMapZoom )
f40_local2:registerEventHandler( "button_right_trigger", CycleFocus )
f40_local2:registerEventHandler( "button_alt2", function ( element, event )
ChangeView( element, nil )
end )
f40_local2:registerEventHandler( "button_start", function ( element, event )
if event.qualifier == ButtonQualifiers.Gamepad then
OpenPauseMenu( element, event )
else
ToggleOverlays( element, event )
end
end )
f40_local2:registerEventHandler( "ins", function ( element, event )
if focusMode == FocusModes.Cameras then
SetFocusMode( self, FocusModes.Scoreboard )
end
self.hudContainer:processEvent( {
name = "gamepad_button",
button = "up",
down = true,
qualifier = "dpad"
} )
end )
f40_local2:registerEventHandler( "del", function ( element, event )
if focusMode == FocusModes.Cameras then
SetFocusMode( self, FocusModes.Scoreboard )
end
self.hudContainer:processEvent( {
name = "gamepad_button",
button = "down",
down = true,
qualifier = "dpad"
} )
end )
f40_local2:registerEventHandler( "scoreboard_player_action", FollowClientNum )
f40_local2:registerEventHandler( "keybind", function ( element, event )
if event.command == "togglescores" or event.command == "+scores" then
CycleScoreModes( element, event )
end
end )
f40_local2:registerEventHandler( "update_mlg_prev_next", function ( element, event )
element.followRow = event.followRow
end )
self:addElement( f40_local2 )
local f40_local3 = LUI.UITimer.new( 60, {
name = "timer_update",
dispatchChildren = true
}, nil, false, element, false )
f40_local3.id = "updateTimer"
self:addElement( f40_local3 )
self:registerEventHandler( "timer_update", UpdateTimer )
return self
end
LUI.MenuBuilder.registerType( "mlg_hud", MLGHud )
LockTable( _M )