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

236 lines
5.7 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = RegisterMaterial( "voice_on" )
f0_local1 = function ()
local f1_local0 = {
type = "UIVerticalList",
id = "talkersVLId",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 32,
left = 0,
height = 256,
width = 256,
alignment = LUI.Alignment.Left,
spacing = 0
}
},
children = {}
}
for f1_local1 = 1, 4, 1 do
local f1_local4 = f1_local0.children
local f1_local5 = {
type = "UIElement",
id = "talkersChildrenContainerId" .. f1_local1,
states = {
default = {
topAnchor = true,
leftAnchor = true,
top = 0,
left = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 256,
alpha = 0
},
active = {
alpha = 1
}
},
handlers = {
talker_refresh = function ( f2_arg0, f2_arg1 )
assert( f2_arg1.original )
local f2_local0 = f2_arg1.original.newValue
if f2_local0 ~= -1 then
local f2_local1 = f2_arg0:getFirstChild()
f2_local1:setText( Game.GetPlayerName( f2_local0 ) )
if f2_arg0.current_state ~= "active" then
f2_arg0:animateToState( "active", 0 )
f2_arg0.current_state = "active"
end
elseif f2_arg0.current_state ~= "default" then
f2_arg0:animateToState( "default", 250 )
f2_arg0.current_state = "default"
end
end
}
}
local f1_local6 = {}
local f1_local7 = {
type = "UIText",
id = "talkersNameTextId" .. f1_local1,
properties = {
text = "",
textStyle = CoD.TextStyle.Shadowed
}
}
local f1_local8 = {}
local f1_local9 = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0
}
local f1_local10
if not Engine.IsAliensMode() then
f1_local10 = CoD.TextSettings.HudEuroMedSmallFont.Height
if not f1_local10 then
else
f1_local9.left = f1_local10
f1_local9.right = Engine.IsAliensMode() and -5 or nil
f1_local9.width = 200
f1_local9.height = CoD.TextSettings.HudEuroMedSmallFont.Height
f1_local9.font = CoD.TextSettings.HudEuroMedSmallFont.Font
f1_local9.alignment = Engine.IsAliensMode() and LUI.Alignment.Right or LUI.Alignment.Left
f1_local8.default = f1_local9
f1_local7.states = f1_local8
f1_local8 = {
type = "UIImage",
id = "talkersIconImageId" .. f1_local1
}
f1_local9 = {}
f1_local10 = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0
}
local f1_local11
if not Engine.IsAliensMode() then
f1_local11 = 0
if not f1_local11 then
else
f1_local10.left = f1_local11
f1_local10.right = Engine.IsAliensMode() and 0 or nil
f1_local10.height = CoD.TextSettings.HudEuroMedSmallFont.Height
f1_local10.width = CoD.TextSettings.HudEuroMedSmallFont.Height * (Engine.IsAliensMode() and -1 or 1)
f1_local10.material = f0_local0
f1_local9.default = f1_local10
f1_local8.states = f1_local9
f1_local9 = {
type = "UIIntWatch",
properties = {
dataSource = "Talker",
param1 = f1_local1 - 1
},
handlers = {
int_watch_alert = MBh.EmitEventToParent( "talker_refresh", {
saveOriginal = true
} )
}
}
f1_local6[1] = f1_local7
f1_local6[2] = f1_local8
f1_local6[3] = f1_local9
f1_local5.children = f1_local6
f1_local4[f1_local1] = f1_local5
end
end
f1_local11 = nil
end
end
f1_local10 = nil
end
return f1_local0
end
LUI.MenuBuilder.registerDef( "talkerHudDef", function ()
local f3_local0 = {
type = "UIElement",
id = "talkerHudId",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 10,
left = 295,
height = 256,
width = 256,
alpha = 1
},
inactive = {
alpha = 0
}
},
handlers = {
hud_off = MBh.AnimateToState( "inactive", 0 ),
hud_on = MBh.AnimateToState( "default", 0 )
}
}
local f3_local1 = {}
local f3_local2 = {
type = "UIImage",
id = "talkerPlayerImageId"
}
local f3_local3 = {}
local f3_local4 = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0
}
local f3_local5
if not Engine.IsAliensMode() then
f3_local5 = 0
if not f3_local5 then
else
f3_local4.left = f3_local5
f3_local4.right = Engine.IsAliensMode() and -11 or nil
f3_local4.height = 32
f3_local5 = Engine.IsAliensMode() and -1 or 1
local f3_local6 = 32 * f3_local5
f3_local4.width = f3_local5
f3_local4.material = f0_local0
f3_local4.alpha = 0
f3_local3.default = f3_local4
f3_local3.talking = {
alpha = 1
}
f3_local2.states = f3_local3
f3_local2.handlers = {
talking_refresh = function ( f4_arg0, f4_arg1 )
assert( f4_arg1.original )
if f4_arg1.original.newValue ~= 0 and f4_arg0.current_state ~= "talking" then
f4_arg0:animateToState( "talking", 0 )
f4_arg0.current_state = "talking"
elseif f4_arg1.original.newValue == 0 and f4_arg0.current_state ~= "default" then
f4_arg0:animateToState( "default", 150 )
f4_arg0.current_state = "default"
end
end
}
f3_local2.children = {
{
type = "UIIntWatch",
properties = {
dataSource = "Talking"
},
handlers = {
int_watch_alert = MBh.EmitEventToParent( "talking_refresh", {
saveOriginal = true
} )
}
}
}
f3_local3 = f0_local1()
f3_local0.children = f3_local2
return f3_local0
end
end
f3_local5 = nil
end )
LockTable( _M )