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

153 lines
3.5 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
if CoD.IsFireTeamMode() then
if Game.InKillCam() then
return
end
local f1_local0 = f1_arg0:getChildById( "tacticNameDef" )
if f1_arg0.current_state ~= "active" then
f1_arg0.current_state = "active"
f1_local0:animateToState( "default", 0 )
if Engine.GetDvarString( "ui_gametype" ) == "war" then
LUI.FlowManager.RequestAddMenu( f1_arg0, "mp_fire_team_menu_war", true, f1_arg1.controller, false )
else
LUI.FlowManager.RequestAddMenu( f1_arg0, "mp_fire_team_menu", true, f1_arg1.controller, false )
end
elseif f1_arg0.current_state ~= "default" then
f1_arg0.current_state = "default"
f1_local0:animateToState( "active", 0 )
end
end
end
f0_local1 = function ()
return {
type = "UITimer",
id = "fireTeamHudTimerId",
properties = {
event = "update_tickables",
group = "hud",
interval = 200
}
}
end
f0_local2 = function ()
return {
type = "UIText",
id = "botNameDef",
properties = {
text = ""
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
height = CoD.TextSettings.HudEuroBigFont.Height,
font = CoD.TextSettings.HudEuroBigFont.Font,
alignment = LUI.Alignment.Center,
red = 1,
green = 1,
blue = 1,
alpha = 0
},
active = MBh.BaseState( "default", {
alpha = 1
} )
}
}
end
local f0_local3 = function ()
return {
type = "UIText",
id = "tacticNameDef",
properties = {
text = Engine.Localize( FireTeam.tactic_name )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 200,
height = CoD.TextSettings.HudEuroBigFont.Height,
font = CoD.TextSettings.HudEuroBigFont.Font,
alignment = LUI.Alignment.Left,
red = 1,
green = 1,
blue = 1,
alpha = 0
},
active = MBh.BaseState( "default", {
alpha = 1
} )
}
}
end
local f0_local4 = function ( f5_arg0, f5_arg1 )
if CoD.IsFireTeamMode() then
local f5_local0 = f5_arg0:getChildById( "tacticNameDef" )
if f5_local0.properties.text ~= FireTeam.tactic_name then
f5_local0:setText( Engine.Localize( FireTeam.tactic_name ) )
f5_local0.properties.text = FireTeam.tactic_name
end
local f5_local1 = Game.GetPlayerstateClientnum()
if f5_arg0.client_num ~= f5_local1 and f5_local1 > 0 then
f5_arg0.client_num = f5_local1
local f5_local2 = Game.GetPlayerScoreInfo( f5_local1 )
local f5_local3 = f5_arg0:getChildById( "botNameDef" )
f5_local3:setText( f5_local2.name or "" )
end
end
end
local f0_local5 = function ( f6_arg0, f6_arg1 )
if CoD.IsFireTeamMode() then
local f6_local0 = f6_arg0:getChildById( "botNameDef" )
f6_local0:animateToState( "active", 0 )
end
end
LUI.MenuBuilder.registerDef( "fireTeamHudDef", function ()
local f7_local0 = {
type = "UIElement",
id = "fireTeamHud",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0
}
},
properties = {
client_num = -1
},
handlers = {
menu_create = f0_local5,
toggle_scoreboard = f0_local0,
update_tickables = f0_local4
}
}
local f7_local1 = {}
local f7_local2 = f0_local1()
local f7_local3 = f0_local2()
local f7_local4 = f0_local3()
f7_local0.children = f7_local2
return f7_local0
end )
LockTable( _M )