907 lines
24 KiB
Lua
907 lines
24 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 not f1_arg1 then
|
|
f1_arg1 = Game.GetPlayerWeaponName()
|
|
end
|
|
if f1_arg0.current_weaponName ~= f1_arg1 then
|
|
f1_arg0.current_weaponName = f1_arg1
|
|
f1_arg0.current_showAmmo = false
|
|
if f1_arg1 == "none" then
|
|
f1_arg0.current_showAmmo = false
|
|
return false
|
|
end
|
|
local f1_local0 = string.find( f1_arg1, "_" )
|
|
local f1_local1 = string.sub( f1_arg1, 1, f1_local0 - 1 )
|
|
if f1_local1 == "iw5" or f1_local1 == "iw6" then
|
|
f1_local1 = string.sub( f1_arg1, 1, string.find( f1_arg1, "_", f1_local0 + 1 ) - 1 )
|
|
end
|
|
if CoD.WeaponListPrimary[f1_local1] ~= nil or CoD.WeaponListSecondary[f1_local1] ~= nil then
|
|
f1_arg0.current_showAmmo = true
|
|
return true
|
|
else
|
|
f1_arg0.current_showAmmo = false
|
|
return false
|
|
end
|
|
else
|
|
return f1_arg0.current_showAmmo
|
|
end
|
|
end
|
|
|
|
f0_local1 = function ( f2_arg0, f2_arg1 )
|
|
if f2_arg1.weapon_name ~= nil and f2_arg1.weapon_name ~= f2_arg0.previous_weapon_name then
|
|
if f2_arg1.display_name then
|
|
f2_arg0:setText( f2_arg1.display_name )
|
|
end
|
|
local f2_local0 = MBh.AnimateSequence( {
|
|
{
|
|
"default",
|
|
0
|
|
},
|
|
{
|
|
"slide_in",
|
|
250
|
|
},
|
|
{
|
|
"slide_in",
|
|
1200
|
|
},
|
|
{
|
|
"blink_off",
|
|
50
|
|
},
|
|
{
|
|
"blink_off",
|
|
50
|
|
},
|
|
{
|
|
"blink_on",
|
|
0
|
|
},
|
|
{
|
|
"blink_on",
|
|
50
|
|
},
|
|
{
|
|
"blink_off",
|
|
50
|
|
},
|
|
{
|
|
"blink_off",
|
|
50
|
|
},
|
|
{
|
|
"blink_on",
|
|
0
|
|
},
|
|
{
|
|
"blink_on",
|
|
50
|
|
},
|
|
{
|
|
"blink_off",
|
|
150
|
|
}
|
|
} )
|
|
f2_local0( f2_arg0 )
|
|
f2_arg0.previous_weapon_name = f2_arg1.weapon_name
|
|
end
|
|
end
|
|
|
|
f0_local2 = function ( f3_arg0, f3_arg1 )
|
|
local f3_local0 = f3_arg1.weapon_name
|
|
if not f3_local0 then
|
|
f3_local0 = Game.GetPlayerWeaponName()
|
|
end
|
|
if f3_arg0.weaponNameRight ~= f3_local0 then
|
|
f3_arg0.weaponNameRight = f3_local0
|
|
if f0_local0( f3_arg0, f3_local0 ) then
|
|
if f3_arg0.current_state ~= "active" then
|
|
f3_arg0:animateToState( "active", 0 )
|
|
f3_arg0.current_state = "active"
|
|
end
|
|
elseif f3_arg0.current_state ~= "default" then
|
|
f3_arg0:animateToState( "default", 0 )
|
|
f3_arg0.current_state = "default"
|
|
end
|
|
end
|
|
end
|
|
|
|
local f0_local3 = function ( f4_arg0, f4_arg1 )
|
|
if GameX.GetGameMode() == "horde" then
|
|
f0_local2( f4_arg0, f4_arg1 )
|
|
end
|
|
end
|
|
|
|
local f0_local4 = function ( f5_arg0, f5_arg1 )
|
|
local f5_local0 = f5_arg1.weapon_name
|
|
if not f5_local0 then
|
|
f5_local0 = Game.GetPlayerWeaponName()
|
|
if not string.find( f5_local0, "akimbo" ) then
|
|
return
|
|
end
|
|
end
|
|
if f5_arg0.weaponNameLeft ~= f5_local0 then
|
|
f5_arg0.weaponNameLeft = f5_local0
|
|
if string.find( f5_local0, "akimbo" ) ~= nil then
|
|
if f5_arg0.current_state ~= "active" then
|
|
f5_arg0:animateToState( "active", 0 )
|
|
f5_arg0.current_state = "active"
|
|
end
|
|
elseif f5_arg0.current_state ~= "default" then
|
|
f5_arg0:animateToState( "default", 0 )
|
|
f5_arg0.current_state = "default"
|
|
end
|
|
end
|
|
end
|
|
|
|
local f0_local5 = function ( f6_arg0, f6_arg1 )
|
|
local f6_local0
|
|
if Game.IsWeaponAltModeUsable() == 0 or f6_arg1.weapon_name == "none" then
|
|
f6_local0 = false
|
|
else
|
|
f6_local0 = true
|
|
end
|
|
if f6_local0 then
|
|
local f6_local1 = Game.GetWeaponAltModeMaterial()
|
|
if not f6_local1 then
|
|
return
|
|
end
|
|
f6_arg0:registerAnimationState( "alt_mode_on", {
|
|
topAnchor = f6_arg0.properties.tAnchor,
|
|
leftAnchor = f6_arg0.properties.lAnchor,
|
|
bottomAnchor = f6_arg0.properties.bAnchor,
|
|
rightAnchor = f6_arg0.properties.rAnchor,
|
|
bottom = f6_arg0.properties.b or 0,
|
|
height = f6_arg0.properties.h or 0,
|
|
right = f6_arg0.properties.r or 0,
|
|
width = f6_arg0.properties.w or 0,
|
|
red = f6_arg0.properties.color and f6_arg0.properties.color[1] or 1,
|
|
green = f6_arg0.properties.color and f6_arg0.properties.color[2] or 1,
|
|
blue = f6_arg0.properties.color and f6_arg0.properties.color[3] or 1,
|
|
alpha = 1,
|
|
material = RegisterMaterial( f6_local1 )
|
|
} )
|
|
f6_arg0:animateToState( "alt_mode_on", 100 )
|
|
else
|
|
f6_arg0:animateToState( "default", 0 )
|
|
end
|
|
end
|
|
|
|
local f0_local6 = function ( f7_arg0, f7_arg1 )
|
|
local f7_local0 = Game.GetPlayerWeaponName()
|
|
if f0_local0( f7_arg0, f7_local0 ) then
|
|
local f7_local1 = Game.GetPlayerStockAmmo()
|
|
local f7_local2 = Game.GetPlayerMaxClipAmmo()
|
|
local f7_local3 = Game.GetPlayerClipAmmo( 1 )
|
|
local f7_local4 = Game.GetPlayerClipAmmo( 2 )
|
|
local f7_local5 = 0.33
|
|
local f7_local6 = ""
|
|
local f7_local7 = "default"
|
|
local f7_local8 = string.find( f7_local0, "akimbo" ) ~= nil
|
|
if not (f7_local8 ~= false or f7_local3 ~= 0 or f7_local1 ~= 0) or f7_local8 == true and f7_local3 == 0 and f7_local4 == 0 and f7_local1 == 0 then
|
|
f7_local6 = Engine.Localize( "@WEAPON_NO_AMMO" )
|
|
f7_local7 = "no_ammo"
|
|
elseif f7_local3 <= f7_local2 * f7_local5 or f7_local8 and f7_local4 <= f7_local2 * f7_local5 then
|
|
if f7_local1 == 0 then
|
|
f7_local6 = Engine.Localize( "@PLATFORM_LOW_AMMO_NO_RELOAD" )
|
|
f7_local7 = "low_ammo"
|
|
elseif f7_local3 ~= 0 or f7_local8 and f7_local4 ~= 0 then
|
|
if false == Engine.IsConsoleGame() and 1 == Engine.IsGamepadEnabled() then
|
|
f7_local6 = Engine.Localize( "@PLATFORM_RELOAD_GAMEPAD" )
|
|
else
|
|
f7_local6 = Engine.Localize( "@PLATFORM_RELOAD" )
|
|
end
|
|
f7_local7 = "reload"
|
|
end
|
|
end
|
|
if f7_local7 == "default" and f7_arg0.current_state ~= f7_local7 then
|
|
f7_arg0:animateToState( f7_local7, 0 )
|
|
f7_arg0:setText( f7_local6 )
|
|
elseif f7_local7 == "reload" and f7_arg0.current_state ~= f7_local7 then
|
|
f7_arg0:animateToState( f7_local7, 250 )
|
|
f7_arg0:setText( f7_local6 )
|
|
elseif f7_local7 == "low_ammo" and f7_arg0.current_state ~= f7_local7 then
|
|
f7_arg0:processEvent( {
|
|
name = "low_ammo_flashing_red"
|
|
} )
|
|
f7_arg0:setText( f7_local6 )
|
|
elseif f7_local7 == "no_ammo" and f7_arg0.current_state ~= f7_local7 then
|
|
f7_arg0:animateToState( f7_local7, 250 )
|
|
f7_arg0:setText( f7_local6 )
|
|
end
|
|
f7_arg0.current_state = f7_local7
|
|
elseif f7_arg0.current_state ~= "default" then
|
|
f7_arg0:animateToState( "default", 0 )
|
|
f7_arg0:setText( "" )
|
|
f7_arg0.current_state = "default"
|
|
end
|
|
end
|
|
|
|
local f0_local7 = function ( f8_arg0, f8_arg1 )
|
|
local f8_local0 = f8_arg0:getChildById( "weapon_info_grind_text" )
|
|
f8_local0:setText( f8_arg1.value )
|
|
end
|
|
|
|
local f0_local8 = function ( f9_arg0, f9_arg1 )
|
|
f0_local7( f9_arg0, {
|
|
value = Game.GetOmnvar( "ui_grind_tags" )
|
|
} )
|
|
end
|
|
|
|
local f0_local9 = function ( f10_arg0 )
|
|
local self = LUI.UIElement.new()
|
|
self.id = f10_arg0.id
|
|
self:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = f10_arg0.bottom,
|
|
right = f10_arg0.right,
|
|
height = f10_arg0.height,
|
|
width = f10_arg0.width,
|
|
alpha = 0
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
self:registerAnimationState( "active", {
|
|
alpha = 1
|
|
} )
|
|
self:registerEventHandler( "weapon_change", f10_arg0.eventFunc )
|
|
self:registerEventHandler( "playerstate_client_changed", f10_arg0.eventFunc )
|
|
local f10_local1 = LUI.UIImage.new()
|
|
f10_local1.id = f10_arg0.bg.id
|
|
f10_local1:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = f10_arg0.bg.bottom or 0,
|
|
right = f10_arg0.bg.right or 0,
|
|
height = f10_arg0.bg.height or 0,
|
|
width = f10_arg0.bg.width or 0,
|
|
material = f10_arg0.bg.material
|
|
} )
|
|
f10_local1:animateToState( "default", 0 )
|
|
local f10_local2 = LUI.UIHorizontalList.new()
|
|
f10_local2.id = f10_arg0.hl.id or nil
|
|
f10_local2:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = f10_arg0.hl.bottom or 0,
|
|
right = f10_arg0.hl.right or 0,
|
|
height = f10_arg0.hl.height or 0,
|
|
alignment = LUI.Alignment.Right
|
|
} )
|
|
f10_local2:animateToState( "default", 0 )
|
|
if f10_arg0.startcap ~= nil then
|
|
local f10_local3 = LUI.UIImage.new()
|
|
f10_local3.id = "start_cap"
|
|
f10_local3:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = f10_arg0.imageHeight,
|
|
width = f10_arg0.startcap.width,
|
|
material = RegisterMaterial( f10_arg0.startcap.material )
|
|
} )
|
|
f10_local3:animateToState( "default", 0 )
|
|
f10_local2:addElement( f10_local3 )
|
|
end
|
|
local f10_local3 = LUI.UIImage.new()
|
|
f10_local3.id = "middle"
|
|
f10_local3:setupUIScorebar( f10_arg0.dataSource )
|
|
f10_local3.m_maxWidth = f10_arg0.maxWidth - (f10_arg0.startcap and f10_arg0.startcap.width or 0) - (f10_arg0.endcap and f10_arg0.endcap.width or 0)
|
|
f10_local3:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = f10_arg0.imageHeight,
|
|
material = RegisterMaterial( f10_arg0.material )
|
|
} )
|
|
f10_local3:animateToState( "default", 0 )
|
|
f10_local2:addElement( f10_local3 )
|
|
if f10_arg0.endcap ~= nil then
|
|
local f10_local4 = LUI.UIImage.new()
|
|
f10_local4.id = "end_cap"
|
|
f10_local4:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = f10_arg0.imageHeight,
|
|
width = f10_arg0.endcap.width,
|
|
material = RegisterMaterial( f10_arg0.endcap.material )
|
|
} )
|
|
f10_local4:animateToState( "default", 0 )
|
|
f10_local2:addElement( f10_local4 )
|
|
end
|
|
local f10_local4 = LUI.UIText.new()
|
|
f10_local4.id = f10_arg0.text.id
|
|
f10_local4:setupUIBindText( f10_arg0.dataSource )
|
|
f10_local4:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = f10_arg0.text.bottom or 0,
|
|
right = f10_arg0.text.right or 0,
|
|
height = CoD.TextSettings.HudDigitalSmallFont.Height,
|
|
font = CoD.TextSettings.HudDigitalSmallFont.Font,
|
|
alignment = LUI.Alignment.Right,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alpha = 1
|
|
} )
|
|
f10_local4:animateToState( "default", 0 )
|
|
self:addElement( f10_local1 )
|
|
self:addElement( f10_local2 )
|
|
self:addElement( f10_local4 )
|
|
return self
|
|
end
|
|
|
|
local f0_local10 = function ()
|
|
local f11_local0 = RegisterMaterial( "hud_ammo_line" )
|
|
local f11_local1 = RegisterMaterial( "hud_ammobar_back" )
|
|
local f11_local2 = 128
|
|
local f11_local3 = 24
|
|
local f11_local4 = 24
|
|
local self = LUI.UIElement.new()
|
|
self.id = "weaaponHudId"
|
|
self:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -31,
|
|
right = -20,
|
|
height = 100,
|
|
width = 400
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
local f11_local6 = LUI.UIText.new()
|
|
f11_local6.id = "weaponInfoWeaponName"
|
|
f11_local6:setText( "" )
|
|
f11_local6:setTextStyle( CoD.TextStyle.Shadowed )
|
|
f11_local6:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = -500,
|
|
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
|
|
width = 400,
|
|
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
|
|
alignment = LUI.Alignment.Right,
|
|
alpha = 0
|
|
} )
|
|
f11_local6:animateToState( "default", 0 )
|
|
f11_local6:registerAnimationState( "slide_in", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = -240,
|
|
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
|
|
width = 400,
|
|
alpha = 1
|
|
} )
|
|
f11_local6:registerAnimationState( "blink_off", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = -240,
|
|
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
|
|
width = 400,
|
|
alpha = 0
|
|
} )
|
|
f11_local6:registerAnimationState( "blink_on", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = -240,
|
|
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
|
|
width = 400,
|
|
alpha = 1
|
|
} )
|
|
f11_local6:registerEventHandler( "weapon_change", f0_local1 )
|
|
f11_local6:registerEventHandler( "playerstate_client_changed", f0_local1 )
|
|
local f11_local7 = LUI.UIElement.new()
|
|
f11_local7.id = "weaponInfoClipAmmo"
|
|
f11_local7:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = CoD.TextSettings.HudDigitalSmallFont.Height,
|
|
width = 256
|
|
} )
|
|
f11_local7:animateToState( "default", 0 )
|
|
local f11_local8 = LUI.UIImage.new()
|
|
f11_local8.id = "clip_ammo_line"
|
|
f11_local8:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = 32,
|
|
width = 256,
|
|
material = f11_local0
|
|
} )
|
|
f11_local8:animateToState( "default", 0 )
|
|
local f11_local9 = LUI.UIVerticalList.new()
|
|
f11_local9.id = "weaponInfoClipAmmoList"
|
|
f11_local9:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -1,
|
|
right = 0,
|
|
height = 32,
|
|
width = 256,
|
|
spacing = 0,
|
|
alignment = LUI.Alignment.Bottom
|
|
} )
|
|
f11_local9:animateToState( "default", 0 )
|
|
local f11_local10 = f0_local9( {
|
|
id = "clipAmmoRightContainer",
|
|
dataSource = "ClipAmmoRight",
|
|
material = "hud_clip_bar",
|
|
maxWidth = f11_local2,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = f11_local4,
|
|
width = f11_local2,
|
|
imageHeight = f11_local4,
|
|
eventFunc = f0_local2,
|
|
bg = {
|
|
id = "clipAmmoBgRight",
|
|
bottom = 1,
|
|
right = 0,
|
|
height = 32,
|
|
width = 256,
|
|
material = f11_local1
|
|
},
|
|
hl = {
|
|
id = "clipAmmoBarRight",
|
|
bottom = 0,
|
|
right = -90,
|
|
height = f11_local4,
|
|
width = f11_local2
|
|
},
|
|
endcap = {
|
|
material = "hud_clip_bar_cap",
|
|
width = f11_local3
|
|
},
|
|
text = {
|
|
id = "clipAmmoTextRight",
|
|
bottom = -5,
|
|
right = -90
|
|
}
|
|
} )
|
|
local f11_local11 = 20
|
|
local f11_local12 = f0_local9( {
|
|
id = "clipAmmoLeftContainer",
|
|
dataSource = "ClipAmmoLeft",
|
|
material = "hud_clip_bar",
|
|
maxWidth = f11_local2 - f11_local11,
|
|
bottom = 0,
|
|
right = f11_local11,
|
|
height = f11_local4,
|
|
width = f11_local2 - f11_local11,
|
|
imageHeight = f11_local4,
|
|
eventFunc = f0_local4,
|
|
bg = {
|
|
id = "clipAmmoBgLeft",
|
|
bottom = 1,
|
|
right = 0,
|
|
height = 32,
|
|
width = 256,
|
|
material = f11_local1
|
|
},
|
|
hl = {
|
|
id = "clipAmmoBarLeft",
|
|
bottom = 0,
|
|
right = -90 - f11_local11,
|
|
height = f11_local4,
|
|
width = f11_local2 - f11_local11
|
|
},
|
|
endcap = {
|
|
material = "hud_clip_bar_cap",
|
|
width = f11_local3
|
|
},
|
|
text = {
|
|
id = "clipAmmoTextLeft",
|
|
bottom = -5,
|
|
right = -90 - f11_local11
|
|
}
|
|
} )
|
|
f11_local10:registerEventHandler( "menu_create", f0_local3 )
|
|
f11_local9:addElement( f11_local10 )
|
|
f11_local9:addElement( f11_local12 )
|
|
f11_local7:addElement( f11_local8 )
|
|
f11_local7:addElement( f11_local9 )
|
|
local f11_local13 = LUI.UIElement.new()
|
|
f11_local13.id = "weaponInfoStockAmmo"
|
|
f11_local13:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -2,
|
|
right = -35,
|
|
height = CoD.TextSettings.HudDigitalBigFont.Height,
|
|
width = 50,
|
|
alpha = 0
|
|
} )
|
|
f11_local13:animateToState( "default", 0 )
|
|
f11_local13:registerAnimationState( "active", {
|
|
alpha = 1
|
|
} )
|
|
f11_local13:registerEventHandler( "weapon_change", f0_local2 )
|
|
f11_local13:registerEventHandler( "playerstate_client_changed", f0_local2 )
|
|
f11_local13:registerEventHandler( "menu_create", f0_local3 )
|
|
local f11_local14 = LUI.UIText.new()
|
|
f11_local14.id = "weaponInfoStockAmmoBg"
|
|
f11_local14:setText( "888" )
|
|
f11_local14:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
height = CoD.TextSettings.HudDigitalBigFont.Height,
|
|
font = CoD.TextSettings.HudDigitalBigFont.Font,
|
|
alignment = LUI.Alignment.Right,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alpha = 0.25
|
|
} )
|
|
f11_local14:animateToState( "default", 0 )
|
|
local f11_local15 = LUI.UIText.new()
|
|
f11_local15.id = "weaponInfoStockAmmoText"
|
|
f11_local15:setupUIBindText( "StockAmmo" )
|
|
f11_local15:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
height = CoD.TextSettings.HudDigitalBigFont.Height,
|
|
font = CoD.TextSettings.HudDigitalBigFont.Font,
|
|
alignment = LUI.Alignment.Right,
|
|
red = 1,
|
|
green = 1,
|
|
blue = 1,
|
|
alpha = 1
|
|
} )
|
|
f11_local15:animateToState( "default", 0 )
|
|
f11_local13:addElement( f11_local14 )
|
|
f11_local13:addElement( f11_local15 )
|
|
self:addElement( f11_local6 )
|
|
self:addElement( f11_local7 )
|
|
self:addElement( f11_local13 )
|
|
return self
|
|
end
|
|
|
|
local f0_local11 = function ()
|
|
local f12_local0 = RegisterMaterial( "white" )
|
|
local self = LUI.UIHorizontalList.new()
|
|
self.id = "primaryGrenadeHud"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -10,
|
|
right = -60,
|
|
height = 20,
|
|
width = 20,
|
|
spacing = -10,
|
|
alignment = LUI.Alignment.Right
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
local f12_local2 = LUI.UIElement.new()
|
|
f12_local2:setupUIIntWatch( "FragAmmo" )
|
|
f12_local2.id = "grenade_ammo_watch"
|
|
f12_local2:registerEventHandler( "int_watch_alert", function ( element, event )
|
|
event.name = "grenade_count_update"
|
|
self:processEvent( event )
|
|
end )
|
|
for f12_local3 = 1, 5, 1 do
|
|
local f12_local6 = f12_local3
|
|
local f12_local7 = LUI.UIImage.new()
|
|
f12_local7:setupUIBindImage( "FragMaterial" )
|
|
f12_local7.id = "grenade_" .. f12_local6
|
|
f12_local7:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
bottomAnchor = true,
|
|
top = 0,
|
|
left = 0,
|
|
bottom = 0,
|
|
right = 0,
|
|
material = f12_local0,
|
|
alpha = 0
|
|
} )
|
|
f12_local7:animateToState( "default", 0 )
|
|
f12_local7:registerAnimationState( "active", {
|
|
alpha = 1
|
|
} )
|
|
f12_local7:registerEventHandler( "grenade_count_update", function ( element, event )
|
|
if event.oldValue < f12_local6 and f12_local6 <= event.newValue then
|
|
f12_local7:animateToState( "active", 250 )
|
|
elseif f12_local6 <= event.oldValue and event.newValue < f12_local6 then
|
|
f12_local7:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
self:addElement( f12_local7 )
|
|
end
|
|
self:addElement( f12_local2 )
|
|
return self
|
|
end
|
|
|
|
local f0_local12 = function ()
|
|
local f15_local0 = RegisterMaterial( "white" )
|
|
local self = LUI.UIHorizontalList.new()
|
|
self.id = "secondaryGrenadeHud"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -10,
|
|
right = -120,
|
|
height = 20,
|
|
width = 20,
|
|
spacing = -12,
|
|
alignment = LUI.Alignment.Right
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
local f15_local2 = LUI.UIElement.new()
|
|
f15_local2:setupUIIntWatch( "FlashAmmo" )
|
|
f15_local2.id = "tactical_ammo_watch"
|
|
f15_local2:registerEventHandler( "int_watch_alert", function ( element, event )
|
|
event.name = "tactical_count_update"
|
|
self:processEvent( event )
|
|
end )
|
|
for f15_local3 = 1, 5, 1 do
|
|
local f15_local6 = f15_local3
|
|
local f15_local7 = LUI.UIImage.new()
|
|
f15_local7:setupUIBindImage( "FlashMaterial" )
|
|
f15_local7.id = "tactical_" .. f15_local6
|
|
f15_local7:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
bottomAnchor = true,
|
|
top = 0,
|
|
left = 0,
|
|
bottom = 0,
|
|
right = 0,
|
|
material = f15_local0,
|
|
alpha = 0
|
|
} )
|
|
f15_local7:animateToState( "default", 0 )
|
|
f15_local7:registerAnimationState( "active", {
|
|
alpha = 1
|
|
} )
|
|
f15_local7:registerEventHandler( "tactical_count_update", function ( element, event )
|
|
if event.oldValue < f15_local6 and f15_local6 <= event.newValue then
|
|
f15_local7:animateToState( "active", 250 )
|
|
elseif f15_local6 <= event.oldValue and event.newValue < f15_local6 then
|
|
f15_local7:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
self:addElement( f15_local7 )
|
|
end
|
|
self:addElement( f15_local2 )
|
|
return self
|
|
end
|
|
|
|
local f0_local13 = function ()
|
|
local f18_local0 = RegisterMaterial( "white" )
|
|
local f18_local1 = RegisterMaterial( "hud_dpad_arrow_left" )
|
|
local self = LUI.UIHorizontalList.new()
|
|
self.id = "weaponInfoAltMode"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -10,
|
|
right = -150,
|
|
height = 25,
|
|
width = 100,
|
|
spacing = 0,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
local f18_local3 = LUI.UIImage.new()
|
|
f18_local3.id = "weaponInfoAltModeIcon"
|
|
f18_local3.properties = {
|
|
tAnchor = false,
|
|
lAnchor = false,
|
|
bAnchor = true,
|
|
rAnchor = true,
|
|
b = 0,
|
|
h = 25,
|
|
r = 0,
|
|
w = 25
|
|
}
|
|
f18_local3:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
height = 25,
|
|
right = 0,
|
|
width = 25,
|
|
alpha = 0,
|
|
material = f18_local0
|
|
} )
|
|
f18_local3:animateToState( "default", 0 )
|
|
f18_local3:registerEventHandler( "weapon_change", f0_local5 )
|
|
f18_local3:registerEventHandler( "playerstate_client_changed", f0_local5 )
|
|
local f18_local4 = LUI.UIText.new()
|
|
f18_local4.id = "weaponInfoAltModeNum"
|
|
f18_local4:setupUIBindText( "AltModeAmmo" )
|
|
f18_local4:setTextStyle( CoD.TextStyle.Shadowed )
|
|
f18_local4:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
height = CoD.TextSettings.HudDigitalSmallFont.Height,
|
|
right = 0,
|
|
width = 15,
|
|
font = CoD.TextSettings.HudDigitalSmallFont.Font,
|
|
alpha = 1
|
|
} )
|
|
f18_local4:animateToState( "default", 0 )
|
|
self:addElement( f18_local3 )
|
|
self:addElement( f18_local4 )
|
|
return self
|
|
end
|
|
|
|
local f0_local14 = function ()
|
|
local self = LUI.UIText.new()
|
|
self.id = "lowAmmoWarningHud"
|
|
self:setText( "" )
|
|
self:setTextStyle( CoD.TextStyle.Shadowed )
|
|
local f19_local1 = {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = false,
|
|
rightAnchor = false,
|
|
bottom = 140,
|
|
left = -200,
|
|
height = CoD.TextSettings.HudEuroNormalFont.Height,
|
|
width = 400,
|
|
font = CoD.TextSettings.HudEuroNormalFont.Font,
|
|
alignment = LUI.Alignment.Center,
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 0
|
|
}
|
|
if Engine.UsingSplitscreenUpscaling() then
|
|
f19_local1.bottom = 90
|
|
end
|
|
self:registerAnimationState( "default", f19_local1 )
|
|
self:animateToState( "default", 0 )
|
|
self:registerAnimationState( "reload", {
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b,
|
|
alpha = 1
|
|
} )
|
|
self:registerAnimationState( "low_ammo_on", {
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = 1
|
|
} )
|
|
self:registerAnimationState( "low_ammo_off", {
|
|
red = Colors.yellow.r,
|
|
green = Colors.yellow.g,
|
|
blue = Colors.yellow.b,
|
|
alpha = 1
|
|
} )
|
|
self:registerAnimationState( "no_ammo", {
|
|
red = Colors.red.r,
|
|
green = Colors.red.g,
|
|
blue = Colors.red.b,
|
|
alpha = 1
|
|
} )
|
|
self:registerEventHandler( "hud_refresh", f0_local6 )
|
|
self:registerEventHandler( "low_ammo_flashing_red", MBh.AnimateLoop( {
|
|
{
|
|
"low_ammo_on",
|
|
500
|
|
},
|
|
{
|
|
"low_ammo_off",
|
|
0
|
|
}
|
|
} ) )
|
|
return self
|
|
end
|
|
|
|
local f0_local15 = function ()
|
|
local f20_local0 = RegisterMaterial( "tags_hud_icon_1" )
|
|
local self = LUI.UIElement.new()
|
|
self.id = "weapon_info_grind_element"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
leftAnchor = false,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = -90,
|
|
right = -100,
|
|
height = 64,
|
|
width = 64
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
self:registerOmnvarHandler( "ui_grind_tags", f0_local7 )
|
|
self:registerEventHandler( "playerstate_client_changed", f0_local8 )
|
|
local f20_local2 = LUI.UIImage.new()
|
|
f20_local2.id = "weapon_info_grind_icon"
|
|
f20_local2:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
material = f20_local0
|
|
} )
|
|
f20_local2:animateToState( "default", 0 )
|
|
local f20_local3 = LUI.UIText.new()
|
|
f20_local3.id = "weapon_info_grind_text"
|
|
f20_local3:setText( "999" )
|
|
f20_local3:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = false,
|
|
rightAnchor = true,
|
|
top = 20,
|
|
height = CoD.TextSettings.HudDigitalNormalFont.Height,
|
|
font = CoD.TextSettings.HudDigitalNormalFont.Font,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0
|
|
} )
|
|
f20_local3:animateToState( "default", 0 )
|
|
self:addElement( f20_local2 )
|
|
self:addElement( f20_local3 )
|
|
return self
|
|
end
|
|
|
|
LUI.MenuBuilder.registerType( "weaponInfoHudDef", function ()
|
|
local self = LUI.UIElement.new()
|
|
self.id = "weaponInfoHud"
|
|
self:registerAnimationState( "default", {
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
bottom = 0,
|
|
right = 0,
|
|
height = 300,
|
|
width = 600
|
|
} )
|
|
self:animateToState( "default", 0 )
|
|
if not GameX.IsHardcoreMode() then
|
|
self:addElement( f0_local10() )
|
|
self:addElement( f0_local11() )
|
|
self:addElement( f0_local12() )
|
|
self:addElement( f0_local13() )
|
|
self:addElement( LUI.MenuBuilder.buildItems( {
|
|
type = "killstreakInfoHudDef"
|
|
}, self.properties, self ) )
|
|
if GameX.GetGameMode() == "grind" then
|
|
self:addElement( f0_local15() )
|
|
end
|
|
else
|
|
self:addElement( LUI.MenuBuilder.buildItems( {
|
|
type = "killstreakInfoHudDef"
|
|
}, self.properties, self ) )
|
|
end
|
|
return self
|
|
end )
|
|
LUI.MenuBuilder.registerType( "lowAmmoWarningHudDef", f0_local14 )
|
|
LockTable( _M )
|