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

523 lines
12 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = 0
f0_local1 = function ( f1_arg0 )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = -20,
height = 0,
width = 512,
alpha = 0,
alignment = LUI.Alignment.Right,
spacing = 0
} )
self.id = "obitItemElemId"
self:registerAnimationState( "opening", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = -20,
height = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
width = 512,
alpha = 1
} )
self:registerAnimationState( "active", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = -20,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 512,
alpha = 0.5
} )
self:animateToState( "default", 0 )
self:registerEventHandler( "menu_create", MBh.AnimateSequenceAndClose( {
{
"default",
0
},
{
"opening",
75
},
{
"active",
75
},
{
"active",
5000
},
{
"default",
250
}
} ) )
self:registerEventHandler( "menu_close", MBh.AnimateSequenceAndClose( {
{
"active",
0
},
{
"default",
250
}
} ) )
return self
end
f0_local2 = function ( f2_arg0 )
local self = LUI.UIHorizontalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alignment = LUI.Alignment.Right,
spacing = 0
} )
self.id = "obitItemHLId"
self:animateToState( "default", 0 )
return self
end
local f0_local3 = function ( f3_arg0 )
local f3_local0 = Game.GetPlayerName( f3_arg0.victim )
local self = LUI.UIText.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = 200,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
self.id = "obitVictimTextId"
self:setText( f3_local0 )
self:setTextStyle( CoD.TextStyle.Shadowed )
self:animateToState( "default", 0 )
local f3_local2, f3_local3, f3_local4, f3_local5 = GetTextDimensions( f3_local0, CoD.TextSettings.HudEuroMedSmallFont.Font, CoD.TextSettings.HudEuroMedSmallFont.Height )
local f3_local6 = f3_local4 - f3_local2
self:registerAnimationState( "me", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = f3_local6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
self:registerAnimationState( "friendly", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = f3_local6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
self:registerAnimationState( "enemy", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = f3_local6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b
} )
local f3_local7 = Game.GetPlayerTeam()
if MLG.IsMLGSpectator() then
f3_local7 = Game.GetLastMLGSpectateTeam()
elseif f3_local7 == Teams.spectator then
f3_local7 = Game.GetPlayerTeam( Game.GetPlayerstateClientnum() )
end
if Game.GetPlayerTeam( f3_arg0.victim ) == f3_local7 then
if Game.GetPlayerClientnum() == f3_arg0.victim then
self:animateToState( "me", 0 )
elseif GameX.gameModeIsFFA() then
self:animateToState( "enemy", 0 )
else
self:animateToState( "friendly", 0 )
end
else
self:animateToState( "enemy", 0 )
end
return self
end
local f0_local4 = function ( f4_arg0 )
local f4_local0 = Game.GetPlayerName( f4_arg0.attacker )
local self = LUI.UIText.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = 200,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
self.id = "obitAttackerTextId"
self:setText( f4_local0 )
self:setTextStyle( CoD.TextStyle.Shadowed )
self:animateToState( "default", 0 )
local f4_local2, f4_local3, f4_local4, f4_local5 = GetTextDimensions( f4_local0, CoD.TextSettings.HudEuroMedSmallFont.Font, CoD.TextSettings.HudEuroMedSmallFont.Height )
local f4_local6 = f4_local4 - f4_local2
self:registerAnimationState( "friendly", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = f4_local6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
self:registerAnimationState( "enemy", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = 0,
width = f4_local6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b
} )
local f4_local7 = Game.GetPlayerTeam()
if MLG.IsMLGSpectator() then
f4_local7 = Game.GetLastMLGSpectateTeam()
elseif f4_local7 == Teams.spectator then
f4_local7 = Game.GetPlayerTeam( Game.GetPlayerstateClientnum() )
end
if Game.GetPlayerTeam( f4_arg0.attacker ) == f4_local7 then
if Game.GetPlayerClientnum() == f4_arg0.attacker then
self:animateToState( "default", 0 )
elseif GameX.gameModeIsFFA() then
self:animateToState( "enemy", 0 )
else
self:animateToState( "friendly", 0 )
end
else
self:animateToState( "enemy", 0 )
end
return self
end
local f0_local5 = function ( menu, controller )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
right = 0,
width = 5
} )
self.id = "obitSpacer" .. controller
self:animateToState( "default", 0 )
return self
end
local f0_local6 = function ( f6_arg0 )
local f6_local0 = CoD.TextSettings.HudEuroBigFont.Height * Engine.GetMaterialAspectRatio( f6_arg0.icon )
local self = LUI.UIImage.new( {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = -CoD.TextSettings.HudEuroBigFont.Height / 2,
bottom = CoD.TextSettings.HudEuroBigFont.Height / 2,
right = 0,
width = f6_local0,
material = f6_arg0.icon
} )
self.id = "obitWeaponImageId"
if f6_arg0.flip then
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = -CoD.TextSettings.HudEuroBigFont.Height / 2,
bottom = CoD.TextSettings.HudEuroBigFont.Height / 2,
right = 0,
width = -f6_local0,
material = f6_arg0.icon
} )
end
self:animateToState( "default", 0 )
return self
end
local f0_local7 = function ( f7_arg0 )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = 0,
height = 0,
width = 512,
alpha = 0,
alignment = LUI.Alignment.Right,
spacing = 0
} )
self.id = "connectTextElemId"
self:registerAnimationState( "opening", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
width = 512,
alpha = 1
} )
self:registerAnimationState( "active", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 512,
alpha = 0.5
} )
self:animateToState( "default", 0 )
self:registerEventHandler( "menu_create", MBh.AnimateSequenceAndClose( {
{
"default",
0
},
{
"opening",
75
},
{
"active",
75
},
{
"active",
5000
},
{
"default",
250
}
} ) )
self:registerEventHandler( "menu_close", MBh.AnimateSequenceAndClose( {
{
"active",
0
},
{
"default",
250
}
} ) )
local f7_local1 = LUI.UIText.new( {
topAnchor = true,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
right = -20,
width = 512,
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
f7_local1.id = "connectTextId"
f7_local1:setText( f7_arg0.message )
f7_local1:setTextStyle( CoD.TextStyle.Shadowed )
self:addElement( f7_local1 )
return self
end
local f0_local8 = function ( f8_arg0, f8_arg1 )
local f8_local0 = nil
if f8_arg1.name == "obituary" then
local f8_local1
if f8_arg1.attacker == nil or f8_arg1.attacker == f8_arg1.victim then
f8_local1 = false
else
f8_local1 = true
end
local f8_local2 = ""
if f8_local1 then
f8_local2 = Game.GetPlayerName( f8_arg1.attacker )
end
local f8_local3 = Game.GetPlayerName( f8_arg1.victim )
f8_local0 = f0_local1( f8_arg1 )
local f8_local4 = f0_local2( f8_arg1 )
f8_local0:addElement( f8_local4 )
f8_local4:addElement( f0_local3( f8_arg1 ) )
f8_local4:addElement( f0_local5( f8_arg1, 1 ) )
f8_local4:addElement( f0_local6( f8_arg1 ) )
f8_local4:addElement( f0_local5( f8_arg1, 2 ) )
if f8_local1 then
f8_local4:addElement( f0_local4( f8_arg1 ) )
end
elseif f8_arg1.bold ~= nil and f8_arg1.bold == false and f8_arg1.message ~= nil then
f8_local0 = f0_local7( f8_arg1 )
end
if f8_local0 ~= nil then
f8_local0:processEvent( {
name = "menu_create"
} )
f8_local0.id = "obitElemId" .. f0_local0
f0_local0 = f0_local0 + 1
local f8_local1 = f8_arg0:getFirstChild()
if f8_local1 then
LUI.UIElement.addElementBefore( f8_local0, f8_local1 )
else
LUI.UIElement.addElement( f8_arg0, f8_local0 )
end
end
local f8_local1 = f8_arg0:getNumChildren()
local f8_local2 = f8_arg0:getLastChild()
if f8_local2 and f8_local1 > 4 then
f8_local2:processEvent( {
name = "menu_close"
} )
f8_local1 = f8_local1 - 1
while f8_local1 > 4 do
local f8_local3 = f8_local2:getPreviousSibling()
if f8_local3 then
f8_local3:processEvent( {
name = "menu_close"
} )
end
f8_local1 = f8_local1 - 1
end
end
end
function obituaryHudDef()
local self = LUI.UIElement.new()
self.id = "obituaryHudId"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 60,
right = 0,
height = 256,
width = 256,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "inactive", {
alpha = 0
} )
local f9_local1 = LUI.UIVerticalList.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
spacing = 3,
alignment = MLG.IsMLGSpectator() and LUI.Alignment.Bottom or nil
} )
f9_local1.id = "obituaryVLId"
f9_local1:registerAnimationState( "showrival", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 15,
left = 0,
bottom = 0,
right = 0,
spacing = 3
} )
f9_local1:animateToState( "default", 0 )
f9_local1:registerEventHandler( "obituary", f0_local8 )
f9_local1:registerEventHandler( "game_message", f0_local8 )
f9_local1:registerEventHandler( "open_rival_info", MBh.AnimateSequence( {
{
"default",
0
},
{
"showrival",
62.5
}
} ) )
f9_local1:registerEventHandler( "close_rival_info", MBh.AnimateSequence( {
{
"showrival",
0
},
{
"showrival",
187.5
},
{
"default",
62.5
}
} ) )
self:addElement( f9_local1 )
return self
end
LUI.MenuBuilder.registerType( "obituaryHudDef", obituaryHudDef )
LockTable( _M )