469 lines
13 KiB
Lua
469 lines
13 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
function CacWeaponPerformance( f1_arg0, f1_arg1 )
|
|
local f1_local0 = f1_arg0.properties
|
|
if f1_arg1 ~= "specialty_null" then
|
|
if f1_arg1 == "uav" then
|
|
f1_arg1 = "iw6_knifeonly" or f1_arg1
|
|
end
|
|
if f1_arg1 == "laser_designator" then
|
|
f1_arg1 = "iw6_pdw" or f1_arg1
|
|
end
|
|
local f1_local1 = f1_local0.CacWeaponPerformanceFunc( f1_local0.exclusiveController, Cac.StripSuffix( f1_arg1, "_mp" ) )
|
|
if f1_local0.isDecimal then
|
|
if f1_local0.isPercent then
|
|
f1_arg0:setText( string.format( "%3.2f", f1_local1 ) .. "%" )
|
|
else
|
|
f1_arg0:setText( string.format( "%3.2f", f1_local1 ) )
|
|
end
|
|
else
|
|
f1_arg0:setText( string.format( "%d", f1_local1 ) )
|
|
end
|
|
end
|
|
end
|
|
|
|
function CacViewingWeaponPerformance( f2_arg0, f2_arg1 )
|
|
if f2_arg1.viewingWeapon then
|
|
CacWeaponPerformance( f2_arg0, f2_arg1.viewingWeapon )
|
|
end
|
|
end
|
|
|
|
function CacEquippedWeaponPerformance( f3_arg0, f3_arg1 )
|
|
local f3_local0 = nil
|
|
if f3_arg1.selection_id == "edit_lethal" or f3_arg1.selection_id == "edit_tactical" then
|
|
f3_local0 = Cac.GetPerk( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex )
|
|
else
|
|
f3_local0 = Cac.GetWeapon( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex )
|
|
end
|
|
if f3_local0 then
|
|
CacWeaponPerformance( f3_arg0, f3_local0 )
|
|
end
|
|
end
|
|
|
|
function CacPerformanceStatCompare( f4_arg0, f4_arg1 )
|
|
local f4_local0 = nil
|
|
if f4_arg1.selection_id == "edit_lethal" or f4_arg1.selection_id == "edit_tactical" then
|
|
f4_local0 = Cac.GetPerk( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_arg1.weaponIndex )
|
|
else
|
|
f4_local0 = Cac.GetWeapon( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_arg1.weaponIndex )
|
|
end
|
|
if f4_arg1.viewingWeapon and f4_arg1.viewingWeapon ~= f4_local0 and f4_arg1.viewingWeapon ~= "specialty_null" then
|
|
f4_arg0:animateToState( "statcompare", 0 )
|
|
else
|
|
f4_arg0:animateToState( "statview", 0 )
|
|
end
|
|
end
|
|
|
|
function cac_weapon_info_pane_performance_stat()
|
|
return {
|
|
type = "UIElement",
|
|
properties = {
|
|
statTitle = "Empty",
|
|
isPercent = false,
|
|
isDecimal = false,
|
|
shadeAlpha = 1,
|
|
CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 25,
|
|
alpha = 1
|
|
},
|
|
hidden = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
refresh_info_pane = function ( f6_arg0, f6_arg1 )
|
|
f6_arg0:dispatchEventToChildren( f6_arg1 )
|
|
local f6_local0 = false
|
|
local f6_local1 = f6_arg0.properties.CacWeaponPerformanceFunc
|
|
local f6_local2 = nil
|
|
if f6_arg1.selection_id == "edit_weapon_primary" or f6_arg1.selection_id == "edit_weapon_secondary" then
|
|
local f6_local3 = f6_arg1.viewingWeapon
|
|
if not f6_local3 then
|
|
f6_local3 = Cac.GetWeapon( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex )
|
|
end
|
|
f6_local2 = Cac.GetWeaponClass( f6_local3 )
|
|
for f6_local7, f6_local8 in pairs( Cac.Weapons.weapon_riot ) do
|
|
if not f6_local0 then
|
|
f6_local0 = f6_local3 == f6_local8
|
|
end
|
|
end
|
|
end
|
|
if not (not f6_local0 or f6_local1 ~= Cac.GetPerformanceHeadshots and f6_local1 ~= Cac.GetPerformanceAccuracy) or f6_local2 == "weapon_projectile" and f6_local1 == Cac.GetPerformanceHeadshots then
|
|
f6_arg0:animateToState( "hidden" )
|
|
else
|
|
f6_arg0:animateToState( "default" )
|
|
end
|
|
end
|
|
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "performance_stat_outline",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.white, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
material = RegisterMaterial( "white" ),
|
|
alpha = MBh.Property( "shadeAlpha" )
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
properties = {
|
|
text = MBh.Property( "statTitle" )
|
|
},
|
|
states = {
|
|
default = {
|
|
alignment = LUI.Alignment.Left,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 10,
|
|
right = 180,
|
|
top = -0.5 * CoD.TextSettings.NormalFont.Height,
|
|
bottom = 0.5 * CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
red = Colors.window_title_text_color.r,
|
|
green = Colors.window_title_text_color.g,
|
|
blue = Colors.window_title_text_color.b
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
properties = {
|
|
text = "100.00",
|
|
isDecimal = MBh.Property( "isDecimal" ),
|
|
CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" ),
|
|
isPercent = MBh.Property( "isPercent" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_performance_header, {
|
|
alignment = LUI.Alignment.Right,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 200,
|
|
right = -110,
|
|
top = -0.5 * CoD.TextSettings.NormalFont.Height,
|
|
bottom = 0.5 * CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alpha = 0
|
|
} ),
|
|
statcompare = {
|
|
alpha = 1
|
|
},
|
|
statview = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
refresh_info_pane = MBh.DoMultiple( {
|
|
CacPerformanceStatCompare,
|
|
CacViewingWeaponPerformance
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
properties = {
|
|
text = "0",
|
|
isDecimal = MBh.Property( "isDecimal" ),
|
|
CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" ),
|
|
isPercent = MBh.Property( "isPercent" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_performance_header, {
|
|
alignment = LUI.Alignment.Right,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 299,
|
|
right = -10,
|
|
top = -0.5 * CoD.TextSettings.NormalFont.Height,
|
|
bottom = 0.5 * CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alpha = 0.5
|
|
} )
|
|
},
|
|
handlers = {
|
|
refresh_info_pane = CacEquippedWeaponPerformance
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function weapon_performance_stats()
|
|
return {
|
|
type = "UIVerticalList",
|
|
id = "cac_weapon_info_pane_performance_stats",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 20,
|
|
bottom = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "weapon_stats_info_1",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.KDR.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceKDR,
|
|
isDecimal = true
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "weapon_stats_info_2",
|
|
properties = {
|
|
shadeAlpha = 0,
|
|
statTitle = Cac.WeaponPerformanceTypes.Kills.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceKills
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "weapon_stats_info_3",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.Deaths.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceDeaths
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "weapon_stats_info_4",
|
|
properties = {
|
|
shadeAlpha = 0,
|
|
statTitle = Cac.WeaponPerformanceTypes.Accuracy.Title,
|
|
isPercent = true,
|
|
isDecimal = true,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceAccuracy
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "weapon_stats_info_5",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.Headshots.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceHeadshots
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function lethal_performance_stats()
|
|
return {
|
|
type = "UIVerticalList",
|
|
id = "cac_lethal_info_pane_performance_stats",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 20,
|
|
bottom = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "lethal_stats_info_1",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.Usage.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceShots
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "lethal_stats_info_2",
|
|
properties = {
|
|
shadeAlpha = 0,
|
|
statTitle = Cac.WeaponPerformanceTypes.Kills.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceKills
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "lethal_stats_info_3",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.Hits.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceHits
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function tactical_performance_stats()
|
|
return {
|
|
type = "UIVerticalList",
|
|
id = "cac_tactical_info_pane_performance_stats",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 20,
|
|
bottom = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "tactical_stats_info_1",
|
|
properties = {
|
|
shadeAlpha = 0,
|
|
statTitle = Cac.WeaponPerformanceTypes.Usage.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceShots
|
|
}
|
|
},
|
|
{
|
|
type = "cac_weapon_info_pane_performance_stat",
|
|
id = "tactical_stats_info_2",
|
|
properties = {
|
|
shadeAlpha = 0.1,
|
|
statTitle = Cac.WeaponPerformanceTypes.Hits.Title,
|
|
CacWeaponPerformanceFunc = Cac.GetPerformanceHits
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function cac_weapon_info_pane_performance_page( f10_arg0 )
|
|
return function ()
|
|
return {
|
|
type = "cac_basic_info_pane_page",
|
|
id = "cac_basic_info_pane_page_" .. f10_arg0,
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "text_header_shade_id",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.black, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 20,
|
|
material = RegisterMaterial( "white" ),
|
|
alpha = 0.2
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_VIEWING_CAPS" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_sub_popup_text, {
|
|
alignment = LUI.Alignment.Right,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = -110,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.SmallFont.Height,
|
|
font = CoD.TextSettings.SmallFont.Font,
|
|
alpha = 0
|
|
} ),
|
|
statcompare = {
|
|
alpha = 1
|
|
},
|
|
statview = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
refresh_info_pane = CacPerformanceStatCompare
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_EQUIPPED_CAPS" )
|
|
},
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.cac_sub_popup_text, {
|
|
alignment = LUI.Alignment.Right,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = -10,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.SmallFont.Height,
|
|
font = CoD.TextSettings.SmallFont.Font,
|
|
alpha = 1
|
|
} )
|
|
}
|
|
},
|
|
{
|
|
type = f10_arg0
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page", cac_weapon_info_pane_performance_page )
|
|
LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_stat", cac_weapon_info_pane_performance_stat )
|
|
LUI.MenuBuilder.registerDef( "weapon_performance_stats", weapon_performance_stats )
|
|
LUI.MenuBuilder.registerDef( "lethal_performance_stats", lethal_performance_stats )
|
|
LUI.MenuBuilder.registerDef( "tactical_performance_stats", tactical_performance_stats )
|
|
LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_weapon", cac_weapon_info_pane_performance_page( "weapon_performance_stats" ) )
|
|
LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_lethal", cac_weapon_info_pane_performance_page( "lethal_performance_stats" ) )
|
|
LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_tactical", cac_weapon_info_pane_performance_page( "tactical_performance_stats" ) )
|
|
LockTable( _M )
|