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

390 lines
8.5 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = 1250
f0_local1 = 100
f0_local2 = function ( f1_arg0, f1_arg1 )
if f1_arg1.value == -1 then
return
elseif Game.InKillCam() and not MLG.IsMLGSpectator() then
return
end
local f1_local0 = f1_arg0:getChildById( "pointsBgImage" )
local f1_local1 = f1_arg0:getChildById( "pointsContainer" )
local f1_local2 = f1_local1:getChildById( "pointsValueText" )
local f1_local3 = f1_arg0:getChildById( "ghostedPointsContainer" )
local f1_local4 = f1_local3:getChildById( "ghostedPointsValueText" )
if f1_arg1.value >= 0 then
f1_local2:setText( "+" .. f1_arg1.value )
f1_local4:setText( "+" .. f1_arg1.value )
else
f1_local2:setText( "-" .. f1_arg1.value )
f1_local4:setText( "-" .. f1_arg1.value )
end
local f1_local5 = MBh.AnimateSequence( {
{
"opening",
0
},
{
"active",
f0_local1
},
{
"active",
f0_local0
},
{
"default",
50
},
{
"default",
50
},
{
"active",
0
},
{
"active",
50
},
{
"default",
50
},
{
"default",
50
},
{
"active",
0
},
{
"active",
50
},
{
"default",
150
}
} )
f1_local5( f1_local1 )
f1_local5 = MBh.AnimateSequence( {
{
"default",
0
},
{
"default",
f0_local1
},
{
"active",
0
},
{
"closing",
350
}
} )
f1_local5( f1_local3 )
f1_local5 = MBh.AnimateSequence( {
{
"default",
0
},
{
"default",
f0_local1
},
{
"active",
0
},
{
"closing",
250
}
} )
f1_local5( f1_local0 )
end
local f0_local3 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg0:getChildById( "pointsBgImage" )
local f2_local1 = f2_arg0:getChildById( "pointsContainer" )
local f2_local2 = f2_arg0:getChildById( "ghostedPointsContainer" )
f2_local1:animateToState( "default" )
f2_local2:animateToState( "closing" )
f2_local0:animateToState( "closing" )
end
local f0_local4 = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg0:getChildById( "pointsDescText" )
if Game.InKillCam() and not MLG.IsMLGSpectator() then
return
end
f3_local0:setText( Engine.Localize( "@" .. Engine.TableLookupByRow( XPEventTable.File, f3_arg1.value, XPEventTable.Cols.Name ) ) )
local f3_local1 = MBh.AnimateSequence( {
{
"opening",
0
},
{
"opening",
f0_local1
},
{
"active",
150
},
{
"active",
f0_local0
},
{
"closing",
100
}
} )
f3_local1( f3_local0 )
f3_local1 = Engine.TableLookupByRow( XPEventTable.File, f3_arg1.value, XPEventTable.Cols.Sound )
if f3_local1 and f3_local1 ~= "null" then
Engine.PlaySound( f3_local1 )
end
end
local f0_local5 = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg0:getChildById( "pointsDescText" )
f4_local0:animateToState( "closing" )
end
LUI.MenuBuilder.registerType( "pointsPopupHudDef", function ()
local f5_local0 = RegisterMaterial( "pointflash" )
local self = LUI.UIElement.new()
self.id = "pointsPopupHud"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -85,
left = 25,
bottom = CoD.TextSettings.HudEuroNormalFont.Height - 85,
right = 57
} )
self:animateToState( "default", 0 )
self:registerOmnvarHandler( "ui_points_popup", f0_local2 )
self:registerOmnvarHandler( "ui_points_popup_desc", f0_local4 )
if MLG.IsMLGSpectator() then
self:registerEventHandler( "playerstate_client_changed", function ( element, event )
f0_local3( element, event )
f0_local5( element, event )
end )
end
local f5_local2 = LUI.UIImage.new()
f5_local2.id = "pointsBgImage"
f5_local2:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -128,
left = -128,
bottom = 128,
right = 128,
material = f5_local0,
alpha = 0
} )
f5_local2:animateToState( "default", 0 )
f5_local2:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -128,
left = -128,
bottom = 128,
right = 128,
material = f5_local0,
alpha = 1
} )
f5_local2:registerAnimationState( "closing", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 256,
left = -640,
bottom = -256,
right = 640,
material = f5_local0,
alpha = 0
} )
local f5_local3 = CoD.TextSettings.HudEuroNormalFont.Height * 0.5
local f5_local4 = 128
local f5_local5 = LUI.UIElement.new()
f5_local5.id = "pointsContainer"
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3,
left = -f5_local4,
bottom = f5_local3,
right = f5_local4,
alpha = 0
} )
f5_local5:animateToState( "default", 0 )
f5_local5:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 * 10,
left = -f5_local4 * 10,
bottom = f5_local3 * 10,
right = f5_local4 * 10,
alpha = 0
} )
f5_local5:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3,
left = -f5_local4,
bottom = f5_local3,
right = f5_local4,
alpha = 1
} )
local f5_local6 = LUI.UIText.new()
f5_local6.id = "pointsValueText"
f5_local6:setText( "" )
f5_local6:setTextStyle( CoD.TextStyle.Shadowed )
f5_local6:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
f5_local6:animateToState( "default", 0 )
f5_local5:addElement( f5_local6 )
local f5_local7 = LUI.UIElement.new()
f5_local7.id = "ghostedPointsContainer"
f5_local7:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3,
left = -f5_local4,
bottom = f5_local3,
right = f5_local4,
alpha = 0
} )
f5_local7:animateToState( "default", 0 )
f5_local7:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3,
left = -f5_local4,
bottom = f5_local3,
right = f5_local4,
alpha = 0.75
} )
f5_local7:registerAnimationState( "closing", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 * 2,
left = -f5_local4 * 2,
bottom = f5_local3 * 2,
right = f5_local4 * 2,
alpha = 0
} )
local f5_local8 = LUI.UIText.new()
f5_local8.id = "ghostedPointsValueText"
f5_local8:setText( "" )
f5_local8:setTextStyle( CoD.TextStyle.Shadowed )
f5_local8:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center
} )
f5_local8:animateToState( "default", 0 )
f5_local7:addElement( f5_local8 )
local f5_local9 = LUI.UIText.new()
f5_local9.id = "pointsDescText"
f5_local9:setText( "" )
f5_local9:setTextStyle( CoD.TextStyle.Shadowed )
f5_local9:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 + 20,
left = -f5_local4,
bottom = f5_local3 + 20,
right = f5_local4,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center,
alpha = 0
} )
f5_local9:animateToState( "default", 0 )
f5_local9:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 + 20,
left = -f5_local4 - 100,
bottom = f5_local3 + 20,
right = f5_local4 - 100,
alpha = 0
} )
f5_local9:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 + 20,
left = -f5_local4,
bottom = f5_local3 + 20,
right = f5_local4,
alpha = 1
} )
f5_local9:registerAnimationState( "closing", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local3 + 20,
left = -f5_local4 + 100,
bottom = f5_local3 + 20,
right = f5_local4 + 100,
alpha = 0
} )
self:addElement( f5_local2 )
self:addElement( f5_local7 )
self:addElement( f5_local5 )
self:addElement( f5_local9 )
return self
end )
LockTable( _M )