This commit is contained in:
6arelyFuture 2024-09-12 17:25:45 +02:00
commit b4b2350b88
Signed by: Future
GPG Key ID: F2000F181A4F7C85
224 changed files with 172565 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.luac

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# IW6 LUI
This repo contains the IW6 LUI dump.

232
lui/actionscontrols.dec.lua Normal file
View File

@ -0,0 +1,232 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function GetDisplay( f1_arg0 )
return Engine.GetBinding( f1_arg0 )
end
function bindKey( f2_arg0 )
Engine.BindKey( f2_arg0 )
end
function OptionsWindowRefresh( f3_arg0, f3_arg1 )
if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then
f3_arg0:processEvent( {
name = "menu_refresh"
} )
f3_arg0:processEvent( {
name = "refresh_content"
} )
end
end
function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 )
f4_arg0:dispatchEventToRoot( {
name = "options_window_refresh",
source_input = f4_arg1.name,
immediate = true
} )
end
function SinglePlayerDisableFunction( f5_arg0, f5_arg1 )
return not Engine.IsMultiplayer()
end
function ControlBindFactory( f6_arg0, f6_arg1, f6_arg2 )
return {
type = "UIGenericButton",
id = "bind_" .. f6_arg0,
disabledFunc = f6_arg2 or function ()
return false
end
,
properties = {
variant = GenericButtonSettings.Variants.Info,
button_text = Engine.Localize( f6_arg0 ),
button_display_func = function ( f8_arg0, f8_arg1 )
return GetDisplay( f6_arg1 )
end
,
button_action_func = function ( f9_arg0, f9_arg1 )
Engine.BindKey( f6_arg1 )
OptionsWindowTriggerRefresh( f9_arg0, f9_arg1 )
end
},
handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" ),
key_bound = OptionsWindowTriggerRefresh
}
}
end
function OptionFactoryProfileData( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5 )
local f10_local0 = Engine.GetProfileData( f10_arg0 )
local f10_local1 = 1
for f10_local5, f10_local6 in pairs( f10_arg3 ) do
if f10_local6.value == f10_local0 then
f10_local1 = f10_local5
break
end
end
f10_local2 = function ( f11_arg0, f11_arg1 )
Engine.ExecNow( f10_arg1 )
Engine.ExecNow( "profile_menuDvarsFinish" )
OptionsWindowTriggerRefresh( f11_arg0, f11_arg1 )
end
f10_local3 = {
type = "UIGenericButton",
id = "option_" .. f10_arg0,
disabledFunc = f10_arg4 or function ()
return false
end
}
f10_local4 = {
variant = GenericButtonSettings.Variants.Select
}
if f10_arg5 then
local f10_local7 = f10_arg2
end
f10_local4.button_text = f10_local7 or Engine.Localize( f10_arg2 )
f10_local4.button_display_func = function ( f13_arg0, f13_arg1 )
return Engine.Localize( f10_arg3[f10_local1].text )
end
f10_local4.button_left_func = function ( f14_arg0, f14_arg1 )
f10_local1 = 1 + (#f10_arg3 + f10_local1 - 1 - 1) % #f10_arg3
f10_local2( f14_arg0, f14_arg1 )
end
f10_local4.button_right_func = function ( f15_arg0, f15_arg1 )
f10_local1 = 1 + (f10_local1 - 1 + 1) % #f10_arg3
f10_local2( f15_arg0, f15_arg1 )
end
f10_local3.properties = f10_local4
f10_local3.handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" )
}
return f10_local3
end
function OptionsFeeder( f16_arg0 )
local f16_local0 = {}
Engine.ExecNow( "profile_menuDvarsSetup" )
f16_local0[#f16_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "@LUA_MENU_LEAN_TOGGLE", {
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
} )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FIRE_WEAPON", "+attack" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_AIM_DOWN_THE_SIGHT", "+toggleads_throw" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_HOLD_AIM_DOWN_SIGHT", "+speed_throw" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_RELOAD_WEAPON", "+reload" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_SWITCH_WEAPON", "weapnext" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@PLATFORM_MELEEZOOM", "+melee_zoom" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_USE", "+activate" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FRAG_EQUIPMENT", "+frag" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_THROW_SPECIAL_GRENADE", "+smoke" )
if SinglePlayerDisableFunction() then
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_WEAPON_ATTACHMENT", "+actionslot 3" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_INVENTORY_KILLSTREAK", "+actionslot 4" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_NVG_WATCH", "+actionslot 1" )
else
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_1", "+actionslot 4" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_2", "+actionslot 5" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_3", "+actionslot 6" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_4", "+actionslot 7" )
f16_local0[#f16_local0 + 1] = ControlBindFactory( Engine.IsAliensMode() and "ALIENS_UPGRADE_ABILITIES" or "@PLATFORM_UI_SHOW_SCORES", "togglescores" )
end
return f16_local0
end
function OptionsMainCreate( f17_arg0, f17_arg1 )
f17_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function actions_controls_vlist()
return {
type = "UIScrollingVerticalList",
childrenFeeder = OptionsFeeder,
properties = {
use_arrows = true,
sendScrollEvents = true,
exclusiveController = MBh.Property( "exclusiveController" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = OptionsListDims.menu_top,
bottom = OptionsListDims.menu_bottom,
left = OptionsListDims.menu_left,
right = OptionsListDims.menu_right
}
},
handlers = {
options_window_refresh = OptionsWindowRefresh
}
}
end
function actions_controls()
return {
type = "UIElement",
id = "actions_controls_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
menu_close = function ( f20_arg0, f20_arg1 )
Engine.Exec( "updategamerprofile" )
end
},
children = {
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_ACTIONS" )
}
},
{
type = "actions_controls_vlist",
id = "actions_cotnrols_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIBindButton",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
end
LUI.MenuBuilder.registerDef( "actions_controls_vlist", actions_controls_vlist )
LUI.MenuBuilder.registerDef( "actions_controls", actions_controls )
LockTable( _M )

685
lui/advancedvideo.dec.lua Normal file
View File

@ -0,0 +1,685 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function BackButtonAction( f1_arg0, f1_arg1 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
f1_arg0:dispatchEventToRoot( {
name = "check_show_apply",
immediate = true
} )
if f1_local0.showApplySettings then
if Engine.ShowLowTextureResolutionWarning() then
if f1_local0.vidRestart then
LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_restart_popmenu", false, f1_arg1.controller, false )
else
LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_popmenu", false, f1_arg1.controller, false )
end
elseif f1_local0.vidRestart then
LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_restart_popmenu", false, f1_arg1.controller, false )
else
LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_popmenu", false, f1_arg1.controller, false )
end
end
LUI.FlowManager.RequestLeaveMenu( f1_arg0 )
end
function PicmipDisabledFunc()
return Engine.GetDvarInt( "ui_r_picmip_manual" ) == 0
end
f0_local0 = nil
function NVidiaButtonOver( f3_arg0, f3_arg1 )
f0_local0 = f3_arg0.id
f3_arg0:dispatchEventToRoot( {
name = "show_nvidia_subtitle",
immediate = true
} )
end
function NVidiaButtonUp( f4_arg0, f4_arg1 )
if f0_local0 == f4_arg0.id then
f0_local0 = nil
f4_arg0:dispatchEventToRoot( {
name = "hide_nvidia_subtitle",
immediate = true
} )
end
end
function OptionsWindowRefresh( f5_arg0, f5_arg1 )
if f5_arg1.source_input == "button_action" or f5_arg1.source_input == "key_bound" or f5_arg1.source_input == "button_right" or f5_arg1.source_input == "button_left" then
f5_arg0:processEvent( {
name = "menu_refresh"
} )
f5_arg0:processEvent( {
name = "refresh_content"
} )
end
end
function OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 )
f6_arg0:dispatchEventToRoot( {
name = "options_window_refresh",
source_input = f6_arg1.name,
immediate = true
} )
end
function GetFOV( f7_arg0 )
return (Engine.GetDvarFloat( "ui_cg_fov" ) - f7_arg0.Min) / (f7_arg0.Max - f7_arg0.Min)
end
function SliderChange( f8_arg0, f8_arg1, f8_arg2, f8_arg3 )
Engine.SetDvarFloat( f8_arg3, math.min( f8_arg1, math.max( f8_arg0, Engine.GetDvarFloat( f8_arg3 ) + f8_arg2 ) ) )
end
function OptionFactory( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8, f9_arg9, f9_arg10, f9_arg11 )
local f9_local0 = nil
local f9_local1 = 1
local f9_local2 = Engine.GetDvarType( f9_arg0 )
local f9_local3 = nil
if f9_arg9 then
f9_local3 = {
variant = GenericButtonSettings.Variants.Slider,
button_text = Engine.Localize( f9_arg1 ),
button_display_func = function ( f10_arg0, f10_arg1 )
return f9_arg11( f9_arg10 )
end,
button_left_func = function ( f11_arg0, f11_arg1 )
SliderChange( f9_arg10.Min, f9_arg10.Max, -f9_arg10.Step, f9_arg0 )
end,
button_right_func = function ( f12_arg0, f12_arg1 )
SliderChange( f9_arg10.Min, f9_arg10.Max, f9_arg10.Step, f9_arg0 )
end
}
else
if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then
f9_local0 = Engine.GetDvarString( f9_arg0 )
elseif f9_local2 == DvarTypeTable.DvarInt then
f9_local0 = Engine.GetDvarInt( f9_arg0 )
elseif f9_local2 == DvarTypeTable.DvarBool then
f9_local0 = Engine.GetDvarBool( f9_arg0 )
end
for f9_local7, f9_local8 in pairs( f9_arg2 ) do
if f9_local8.value == f9_local0 then
f9_local1 = f9_local7
break
end
end
f9_local4 = function ( f13_arg0, f13_arg1 )
if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then
Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value )
elseif f9_local2 == DvarTypeTable.DvarInt then
Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value )
elseif f9_local2 == DvarTypeTable.DvarBool then
Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value )
end
OptionsWindowTriggerRefresh( f13_arg0, f13_arg1 )
end
f9_local3 = {
variant = GenericButtonSettings.Variants.Select,
button_text = Engine.Localize( f9_arg1 ),
button_display_func = function ( f14_arg0, f14_arg1 )
return f9_arg6 and f9_arg2[f9_local1].text or Engine.Localize( f9_arg2[f9_local1].text )
end,
button_left_func = function ( f15_arg0, f15_arg1 )
f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2
f9_local4( f15_arg0, f15_arg1 )
end,
button_right_func = function ( f16_arg0, f16_arg1 )
f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2
f9_local4( f16_arg0, f16_arg1 )
end,
button_over_func = f9_arg7,
button_up_func = f9_arg8
}
end
return {
type = "UIGenericButton",
id = "option_" .. f9_arg0,
disabledFunc = f9_arg4 or function ()
return false
end
,
states = {
default = {
alpha = 1
},
invisible = {
alpha = 0
}
},
properties = f9_local3,
handlers = {
check_show_apply = function ( f18_arg0, f18_arg1 )
if f9_arg3 then
if f9_arg9 then
local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 )
if Engine.GetDvarFloat( f9_arg3 ) ~= Engine.GetDvarFloat( f9_arg0 ) then
f18_local0.showApplySettings = true
if f9_arg5 then
f18_local0.vidRestart = true
end
end
else
local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 )
local f18_local1 = nil
local f18_local2 = Engine.GetDvarType( f9_arg3 )
if f18_local2 == DvarTypeTable.DvarString or f18_local2 == DvarTypeTable.DvarEnum then
f18_local1 = Engine.GetDvarString( f9_arg3 )
elseif f18_local2 == DvarTypeTable.DvarInt then
f18_local1 = tostring( Engine.GetDvarInt( f9_arg3 ) )
elseif f18_local2 == DvarTypeTable.DvarBool then
if Engine.GetDvarBool( f9_arg3 ) then
local f18_local3 = "1"
end
f18_local1 = f18_local3 or "0"
elseif f18_local2 == DvarTypeTable.DvarFloat then
f18_local1 = tostring( Engine.GetDvarFloat( f9_arg3 ) )
end
if f18_local1 ~= f9_arg2[f9_local1].value then
f18_local0.showApplySettings = true
if f9_arg5 then
f18_local0.vidRestart = true
end
end
end
end
end
}
}
end
function OptionsFeeder( f19_arg0 )
local f19_local0 = {
[#f19_local0 + 1] = OptionFactory( "ui_r_aspectratio", "@MENU_ASPECT_RATIO", {
{
text = "@MENU_AUTO",
value = "auto"
},
{
text = "@MENU_STANDARD_4_3",
value = "standard"
},
{
text = "@MENU_WIDE_16_10",
value = "wide 16:10"
},
{
text = "MENU_WIDE_16_9",
value = "wide 16:9"
}
}, "r_aspectratio", nil, true )
}
local f19_local1 = {}
for f19_local5, f19_local6 in pairs( Engine.GetDvarEnumList( "r_displayRefresh" ) ) do
f19_local1[#f19_local1 + 1] = {
text = f19_local6,
value = f19_local6
}
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_displayRefresh", "@MENU_SCREEN_REFRESH_RATE", f19_local1, "r_displayRefresh", nil, true, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_vsync", "@MENU_SYNC_EVERY_FRAME", {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}, "r_vsync", nil, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_imageQuality", "@PLATFORM_UI_IMAGE_QUALITY", {
{
text = "@MENU_VERY_LOW",
value = "1"
},
{
text = "@MENU_LOW",
value = "2"
},
{
text = "@MENU_NORMAL",
value = "3"
},
{
text = "@MENU_HIGH",
value = "4"
},
{
text = "@MENU_EXTRA",
value = "0"
}
}, "r_imageQuality", nil, true )
if Engine.IsMultiplayer() then
f19_local2 = {}
f19_local3 = SliderBounds.FOV.Max - SliderBounds.FOV.Min
for f19_local4 = 0, f19_local3, 1 do
local f19_local7 = tostring( SliderBounds.FOV.Min + f19_local4 )
f19_local2[f19_local4 + 1] = {
text = Engine.MarkLocalized( f19_local7 ),
value = f19_local7
}
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_cg_fov", "@MENU_FOV", f19_local2, "cg_fov", nil, false, true, function ( f20_arg0, f20_arg1 )
f20_arg0:dispatchEventToRoot( {
name = "show_fov_subtitle",
immediate = true
} )
end, function ( f21_arg0, f21_arg1 )
f21_arg0:dispatchEventToRoot( {
name = "hide_fov_subtitle",
immediate = true
} )
end, false, false, false )
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_dof_enable", "@MENU_DOF", {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}, "r_dof_enable", nil, false )
if Engine.HBAOAvailable() then
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", {
{
text = "@MENU_OFF",
value = "0_Off"
},
{
text = "@PLATFORM_LOW_QUALITY",
value = "1_Low"
},
{
text = "@PLATFORM_HIGH_QUALITY",
value = "2_High"
},
{
text = "@PLATFORM_HBAO",
value = "3_HBAO"
}
}, "r_ssao", nil, true )
else
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", {
{
text = "@MENU_OFF",
value = "0_Off"
},
{
text = "@PLATFORM_LOW_QUALITY",
value = "1_Low"
},
{
text = "@PLATFORM_HIGH_QUALITY",
value = "2_High"
}
}, "r_ssao", nil, true )
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_tessellation", "@MENU_TESSELLATION", {
{
text = "@MENU_OFF",
value = "0_Off"
},
{
text = "@MENU_NORMAL",
value = "1_Near"
},
{
text = "@MENU_EXTRA",
value = "2_All"
}
}, "r_tessellation", nil, false )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_texFilterAnisoMin", "@LUA_MENU_ANISOTROPIC_FILTERING", {
{
text = "@MENU_LOW",
value = "1"
},
{
text = "@MENU_NORMAL",
value = "8"
},
{
text = "@MENU_HIGH",
value = "16"
}
}, "r_texFilterAnisoMin", nil, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_mbEnableA", "@MENU_MOTION_BLUR", {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}, "r_mbEnableA", nil, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_distortion", "@MENU_DISTORTION", {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}, "r_distortion", nil, false )
if Engine.TXAAAvailable() then
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", {
{
text = "@MENU_OFF",
value = "Off"
},
{
text = "@MENU_FXAA",
value = "FXAA"
},
{
text = "@MENU_2X_MSAA",
value = "2xMSAA"
},
{
text = "@MENU_4X_MSAA",
value = "4xMSAA"
},
{
text = "@MENU_SMAA",
value = "SMAA"
},
{
text = "@MENU_2X_TXAA",
value = "2xTXAA"
},
{
text = "@MENU_4X_TXAA",
value = "4xTXAA"
}
}, "r_aaMode", nil, true )
else
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", {
{
text = "@MENU_OFF",
value = "Off"
},
{
text = "@MENU_FXAA",
value = "FXAA"
},
{
text = "@MENU_2X_MSAA",
value = "2xMSAA"
},
{
text = "@MENU_4X_MSAA",
value = "4xMSAA"
},
{
text = "@MENU_SMAA",
value = "SMAA"
}
}, "r_aaMode", nil, true )
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_sm_enable", "@MENU_SHADOWS", {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}, "sm_enable", nil, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_manual", "@MENU_TEXTURE_QUALITY", {
{
text = "@MENU_AUTOMATIC",
value = "0"
},
{
text = "@MENU_MANUAL",
value = "1"
}
}, "r_picmip_manual", nil, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip", "@MENU_TEXTURE_RESOLUTION", {
{
text = "@MENU_LOW",
value = "3"
},
{
text = "@MENU_NORMAL",
value = "2"
},
{
text = "@MENU_HIGH",
value = "1"
},
{
text = "@MENU_EXTRA",
value = "0"
}
}, "r_picmip", PicmipDisabledFunc, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_bump", "@MENU_NORMAL_MAP_RESOLUTION", {
{
text = "@MENU_LOW",
value = "3"
},
{
text = "@MENU_NORMAL",
value = "2"
},
{
text = "@MENU_HIGH",
value = "1"
},
{
text = "@MENU_EXTRA",
value = "0"
}
}, "r_picmip_bump", PicmipDisabledFunc, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_spec", "@MENU_SPECULAR_MAP_RESOLUTION", {
{
text = "@MENU_LOW",
value = "3"
},
{
text = "@MENU_NORMAL",
value = "2"
},
{
text = "@MENU_HIGH",
value = "1"
},
{
text = "@MENU_EXTRA",
value = "0"
}
}, "r_picmip_spec", PicmipDisabledFunc, true )
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_water", "@MENU_WATER_MAP_RESOLUTION", {
{
text = "@MENU_LOW",
value = "1"
},
{
text = "@MENU_HIGH",
value = "0"
}
}, "r_picmip_water", PicmipDisabledFunc, true )
if Engine.FurShaderAvailable() then
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_fur_shader", "@MENU_FUR_SHADER", {
{
text = "@MENU_OFF",
value = "0"
},
{
text = "@MENU_LOW",
value = "1"
},
{
text = "@MENU_HIGH",
value = "2"
}
}, "r_fur_shader", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp )
end
if Engine.APEXTurbulenceAvailable() then
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_apex_turbulence", "@MENU_APEX_TURBULENCE", {
{
text = "@MENU_ON",
value = "1"
},
{
text = "@MENU_OFF",
value = "0"
}
}, "r_apex_turbulence", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp )
end
return f19_local0
end
function OptionsMainCreate( f22_arg0, f22_arg1 )
Engine.ExecNow( "profile_menuDvarsSetup" )
f22_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function OptionsMainClose( f23_arg0, f23_arg1 )
Engine.ExecNow( "profile_menuDvarsFinish" )
if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then
Engine.SetDvarString( "r_lodScaleSkinned", "4" )
Engine.SetDvarString( "r_lodBiasSkinned", "-200" )
Engine.SetDvarString( "r_lodBiasRigid", "-100" )
end
if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then
Engine.SetDvarString( "r_lodScaleSkinned", "1" )
Engine.SetDvarString( "r_lodBiasSkinned", "0" )
Engine.SetDvarString( "r_lodBiasRigid", "0" )
end
end
function advanced_video_vlist()
return {
type = "UIScrollingVerticalList",
childrenFeeder = OptionsFeeder,
properties = {
use_arrows = true,
sendScrollEvents = true,
exclusiveController = MBh.Property( "exclusiveController" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = OptionsListDims.menu_top,
bottom = OptionsListDims.menu_bottom,
left = OptionsListDims.menu_left,
right = OptionsListDims.menu_right
}
}
}
end
function advanced_video()
return {
type = "UIElement",
id = "advanced_video_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
menu_close = OptionsMainClose,
options_window_refresh = OptionsWindowRefresh
},
children = {
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" )
}
},
{
type = "advanced_video_vlist",
id = "advanced_video_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIMarqueeText",
id = "nvidia_option_subtitle",
properties = {
text = Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height,
bottom = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height + CoD.TextSettings.TinyFont.Height,
left = 10,
right = OptionsListDims.menu_right - 110,
font = CoD.TextSettings.TinyFont.Font,
alignment = LUI.Alignment.Right,
red = 0.7,
green = 0.7,
blue = 0.7,
alpha = 0
},
show_me = {
alpha = 1
},
hide_me = {
alpha = 0
}
},
handlers = {
show_nvidia_subtitle = function ( f26_arg0, f26_arg1 )
f26_arg0:setText( Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) )
f26_arg0:animateToState( "show_me", 0 )
end
,
hide_nvidia_subtitle = function ( f27_arg0, f27_arg1 )
f27_arg0:animateToState( "hide_me", 0 )
end
,
show_fov_subtitle = function ( f28_arg0, f28_arg1 )
f28_arg0:setText( Engine.Localize( "@LUA_MENU_MP_FOV_OPTION_SUB" ) )
f28_arg0:animateToState( "show_me", 0 )
end
,
hide_fov_subtitle = function ( f29_arg0, f29_arg1 )
f29_arg0:animateToState( "hide_me", 0 )
end
}
},
{
type = "UIBindButton",
id = "back_button",
handlers = {
button_secondary = BackButtonAction
}
}
}
}
end
LUI.MenuBuilder.registerDef( "advanced_video_vlist", advanced_video_vlist )
LUI.MenuBuilder.registerDef( "advanced_video", advanced_video )
LockTable( _M )

View File

@ -0,0 +1,285 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
DebugPrint( "Registering " .. _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
f1_local0.ContinueMessageVisible = false
if f1_arg0.properties.linkTo == "controls" then
f1_local0.ContinueMessageVisible = true
f1_arg0:dispatchEventToRoot( {
name = "continue_message_visible"
} )
end
f1_local0.OriginalVertMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" )
f1_local0.OriginalHorzMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" )
f1_local0.VertMarginMinAmount = SliderBounds.VertMargin.Min
f1_local0.VertMarginMaxAmount = SliderBounds.VertMargin.Max
f1_local0.VertMarginIncrement = SliderBounds.VertMargin.Step
f1_local0.HorzMarginMinAmount = SliderBounds.HorzMargin.Min
f1_local0.HorzMarginMaxAmount = SliderBounds.HorzMargin.Max
f1_local0.HorzMarginIncrement = SliderBounds.HorzMargin.Step
f1_arg0:dispatchEventToChildren( {
name = "vertical_margin_over"
} )
f1_arg0:dispatchEventToChildren( {
name = "horizontal_margin_over"
} )
end
f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 )
local f2_local1 = math.min( f2_arg2, math.max( f2_arg1, Engine.GetDvarFloat( f2_arg4 ) + f2_arg3 ) )
Engine.SetDvarFloat( f2_arg4, f2_local1 )
Engine.ExecNow( "profile_menuDvarsFinish" )
f2_arg0:dispatchEventToRoot( {
name = "margin_updated"
} )
if f2_local1 <= f2_arg1 or f2_arg2 <= f2_local1 then
Engine.PlaySound( CoD.SFX.DenyAdjustSafeArea )
else
Engine.PlaySound( CoD.SFX.AdjustSafeArea )
end
if f2_local0.ContinueMessageVisible == false and f2_local1 ~= f2_arg5 then
f2_local0.ContinueMessageVisible = true
f2_arg0:dispatchEventToRoot( {
name = "continue_message_visible"
} )
end
end
f0_local2 = function ( f3_arg0, f3_arg1 )
local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 )
if f3_local0.ContinueMessageVisible then
local f3_local1 = LUI.FlowManager.RequestAddMenu
local f3_local2 = f3_arg0
local f3_local3 = f3_arg0.properties.linkTo
local f3_local4 = f3_arg0:getParent()
f3_local1( f3_local2, f3_local3, f3_local4.properties.continueExclusive, f3_arg1.controller, true, {
focusSafeArea = true
} )
end
end
function boot_screen_margins()
return {
type = "UIElement",
id = "boot_screen_margins_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = f0_local0
},
properties = {
linkTo = "main_menu",
continueExclusive = false
},
children = {
{
type = "margins_guide"
},
{
type = "UIText",
id = "boot_screen_margins_title_txt_id",
properties = {
text = Engine.Localize( "@MENU_HUD_MARGINS_CAPS" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 60,
bottom = 60 + CoD.TextSettings.ExtraBigFont.Height,
left = 100,
right = 0,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Left
}
}
},
{
type = "UIText",
id = "boot_screen_margins_instruction_txt1_id",
properties = {
text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 210,
bottom = 210 + CoD.TextSettings.NormalFont.Height,
left = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
},
{
type = "UIText",
id = "boot_screen_margins_instruction_txt2_id",
properties = {
text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_DESC" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 210 + CoD.TextSettings.NormalFont.Height,
bottom = 210 + 2 * CoD.TextSettings.NormalFont.Height,
left = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
},
{
type = "UIText",
id = "boot_screen_margins_instruction_txt3_id",
properties = {
text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST1" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -1.2 * CoD.TextSettings.BoldFont.Height,
bottom = 0,
left = 0,
right = 0,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
},
{
type = "UIText",
id = "boot_screen_margins_instruction_txt4_id",
properties = {
text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST2" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 1.2 * CoD.TextSettings.BoldFont.Height,
left = 0,
right = 0,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
},
{
type = "UIButton",
id = "boot_screen_margins_continue_btn_id",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = -1 * (CoD.TextSettings.BoldFont.Height + 105),
bottom = -100,
left = -200,
right = 200,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
button_action = f0_local2,
continue_message_visible = MBh.AnimateToState( "visible", 0 )
},
children = {
{
type = "UIText",
properties = {
text = Engine.Localize( "@PLATFORM_UI_PRESS_TO_CONTINUE" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
}
}
}
}
},
{
type = "UIBindButton",
id = "boot_screen_margins_bind_btn_id",
handlers = {
button_up = function ( f5_arg0, f5_arg1 )
local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 )
f0_local1( f5_arg0, f5_local0.VertMarginMinAmount, f5_local0.VertMarginMaxAmount, f5_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f5_local0.OriginalVertMargin )
end
,
button_down = function ( f6_arg0, f6_arg1 )
local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 )
f0_local1( f6_arg0, f6_local0.VertMarginMinAmount, f6_local0.VertMarginMaxAmount, -f6_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f6_local0.OriginalVertMargin )
end
,
button_left = function ( f7_arg0, f7_arg1 )
local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 )
f0_local1( f7_arg0, f7_local0.HorzMarginMinAmount, f7_local0.HorzMarginMaxAmount, -f7_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f7_local0.OriginalHorzMargin )
end
,
button_right = function ( f8_arg0, f8_arg1 )
local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 )
f0_local1( f8_arg0, f8_local0.HorzMarginMinAmount, f8_local0.HorzMarginMaxAmount, f8_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f8_local0.OriginalHorzMargin )
end
}
}
}
}
end
LUI.MenuBuilder.registerDef( "boot_screen_margins", boot_screen_margins )
LockTable( _M )

View File

@ -0,0 +1,75 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( "Registering " .. _NAME )
LUI.ButtonDescText = {}
LUI.ButtonDescText.new = function ( f1_arg0, f1_arg1 )
if not f1_arg1 then
f1_arg1 = {}
end
local f1_local0 = f1_arg1.lines or 2
local self = LUI.UIElement.new()
self.id = "generic_button_desc_text_id"
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = f1_local0 * CoD.TextSettings.SmallFont.Height
} )
self:animateToState( "default" )
local f1_local2 = LUI.UIImage.new()
f1_local2.id = "left_bullet_point"
f1_local2:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 3,
left = 100,
height = 13,
width = 5,
alpha = 0.6
} )
f1_local2:animateToState( "default" )
self:addElement( f1_local2 )
local f1_local3 = LUI.UIMarqueeText.new()
f1_local3.id = "desc_text"
f1_local3:SetUseTextWrapping( true )
f1_local3:SetTextHeight( CoD.TextSettings.SmallFont.Height )
f1_local3:registerAnimationState( "default", {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.SmallFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f1_local0 * CoD.TextSettings.SmallFont.Height,
left = 111,
right = -23,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b,
alpha = 1
} )
f1_local3:animateToState( "default" )
f1_local3:registerEventHandler( "set_button_info_text", function ( element, event )
if event.text then
element:setText( event.text )
end
end )
self:addElement( f1_local3 )
return self
end
LUI.ButtonDescText.build = function ( f3_arg0, f3_arg1, f3_arg2 )
return LUI.ButtonDescText.new( f3_arg0, f3_arg1 )
end
LUI.MenuBuilder.registerType( "button_desc_text", LUI.ButtonDescText.build )
LockTable( _M )

View File

@ -0,0 +1,686 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( "Registering " .. _NAME )
CommonEvents = {
addBackButton = {
name = "add_button_helper_text",
button_ref = "button_secondary",
helper_text = Engine.Localize( "@LUA_MENU_BACK" ),
side = "left",
clickable = true,
priority = -1000
},
addActionButton = {
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = Engine.Localize( "@MENU_CONTINUE" ),
side = "left",
clickable = true,
priority = -1000
},
addFriendsButton = {
name = "add_button_helper_text",
button_ref = "button_alt2",
helper_text = Engine.Localize( "@LUA_MENU_FRIENDS" ),
side = "right",
clickable = true,
width = 190,
priority = -1000
},
removeFriendsButton = {
name = "add_button_helper_text",
button_ref = "button_alt2",
helper_text = ""
},
addGameSummaryButton = {
name = "add_button_helper_text",
button_ref = "button_select",
helper_text = Engine.Localize( "@LUA_MENU_MATCH_SUMMARY" ),
side = "left",
clickable = true
},
addAcceptButton = {
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize( "@LUA_MENU_ACCEPT" ),
side = "left",
clickable = true,
priority = -1000
},
addDeclineButton = {
name = "add_button_helper_text",
button_ref = "button_secondary",
helper_text = Engine.Localize( "@LUA_MENU_DECLINE" ),
side = "left",
clickable = true,
priority = -1000
},
addLeftButton = {
name = "add_button_helper_text",
button_ref = "button_shoulderl",
helper_text = Engine.Localize( "@LUA_MENU_PREV_PAGE" ),
side = "left",
clickable = true,
priority = -1000
},
addRightButton = {
name = "add_button_helper_text",
button_ref = "button_shoulderr",
helper_text = Engine.Localize( "@LUA_MENU_NEXT_PAGE" ),
side = "left",
clickable = true,
priority = -1000
}
}
function AddHelperTextObject( f1_arg0, f1_arg1 )
assert( f1_arg1.button_ref )
assert( f1_arg1.helper_text )
local f1_local0 = nil
if f1_arg1.side and f1_arg1.side == "left" then
f1_local0 = f1_arg0:getChildById( "left_button_helper_list_id" )
else
f1_local0 = f1_arg0:getChildById( "right_button_helper_list_id" )
end
assert( f1_local0 )
local f1_local1 = f1_arg1.button_ref .. "_id"
local f1_local2 = f1_local0:getChildById( f1_local1 )
if f1_local2 and f1_arg1.helper_text ~= f1_local2.currentText then
f1_local2:close()
f1_local2 = nil
end
if not f1_local2 and f1_arg1.helper_text ~= "" then
local f1_local3 = helper_text_item( ButtonMap[f1_arg1.button_ref], f1_arg1.helper_text, f1_arg1.button_ref2 and ButtonMap[f1_arg1.button_ref2] or nil, f1_arg1.width, f1_arg1.priority, f1_arg1.ignorePopups or false, f1_arg1.customEvent or nil, f1_arg1.customEventTarget or nil, f1_arg1.useAnimIntro or nil, f1_arg1.flash or nil )
f1_local3.id = f1_local1
if f1_arg1.clickable == true and ButtonMap[f1_arg1.button_ref] then
f1_local3.triggers_event = f1_arg1.button_ref
end
if Engine.IsConsoleGame() then
f1_local3:makeNotFocusable()
end
f1_local0:addElement( f1_local3 )
end
return true
end
function ClearHelperTextObjects( f2_arg0, f2_arg1 )
if not f2_arg1.side then
DebugPrint( "WARNING: clear_button_helper_text event sent without specifying the desired side. Ignoring..." )
return
end
local f2_local0 = nil
if f2_arg1.side == "left" then
f2_local0 = f2_arg0:getChildById( "left_button_helper_list_id" )
else
f2_local0 = f2_arg0:getChildById( "right_button_helper_list_id" )
end
assert( f2_local0 )
f2_local0:closeChildren()
return true
end
function sendButtonEvent( f3_arg0, f3_arg1 )
if f3_arg0.triggers_event and f3_arg1.mouse == true then
local f3_local0 = {
name = "gamepad_button",
immediate = true,
down = true
}
assert( ButtonMap[f3_arg0.triggers_event].raw_button )
f3_local0.button = ButtonMap[f3_arg0.triggers_event].raw_button
f3_local0.controller = f3_arg1.controller
f3_arg0:dispatchEventToRoot( f3_local0 )
end
end
function sendCustomEvent( f4_arg0, f4_arg1 )
customEvent = f4_arg1.customEvent
eventTarget = f4_arg1.eventTarget
eventTarget:processEvent( customEvent )
end
function getButtonPosition( f5_arg0, f5_arg1, f5_arg2 )
local f5_local0 = Engine.IsConsoleGame()
if not f5_local0 then
f5_local0 = Engine.IsGamepadEnabled() == 1
end
local f5_local1
if f5_local0 then
f5_local1 = 32
if not f5_local1 then
else
local f5_local2, f5_local3 = nil
if f5_arg0 then
if f5_local0 and f5_arg0.string then
f5_local2 = Engine.Localize( f5_arg0.string ) .. " "
if f5_arg1 and f5_arg1.string then
f5_local3 = " " .. Engine.Localize( f5_arg1.string )
end
elseif f5_arg0.keyboard_string then
f5_local2 = Engine.Localize( f5_arg0.keyboard_string ) .. " "
if f5_arg1 and f5_arg1.keyboard_string then
f5_local3 = " " .. Engine.Localize( f5_arg1.keyboard_string )
end
end
end
return f5_local2, f5_local3, f5_local1
end
end
f5_local1 = f5_arg2.Height
end
function getButtonWidth( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5, f6_arg6, f6_arg7 )
local f6_local0 = f6_arg7
local f6_local1 = 0
local f6_local2 = 0
local f6_local3 = 0
local f6_local4, f6_local5, f6_local6, f6_local7 = nil
if f6_arg0 then
local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg3, f6_arg6.Font, f6_arg5 )
f6_local7 = f6_local11
f6_local6 = f6_local10
f6_local5 = f6_local9
f6_local1 = f6_local6 - f6_local8
end
local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg2, f6_arg6.Font, f6_arg6.Height )
f6_local7 = f6_local11
f6_local6 = f6_local10
f6_local5 = f6_local9
f6_local3 = f6_local6 - f6_local8
if f6_arg1 then
f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg4, f6_arg6.Font, f6_arg5 )
f6_local7 = f6_local11
f6_local6 = f6_local10
f6_local5 = f6_local9
f6_local2 = f6_local6 - f6_local8
end
if not f6_arg7 then
f6_local0 = 20 + f6_local1 + f6_local3 + f6_local2
end
return f6_local0, f6_local1, f6_local2, f6_local3
end
function helper_text_item( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7, f7_arg8, f7_arg9 )
local f7_local0 = CoD.TextSettings.SmallFont
local f7_local1, f7_local2, f7_local3 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 )
local f7_local4, f7_local5, f7_local6, f7_local7 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f7_local1, f7_local2, f7_local3, f7_local0, f7_arg3 )
local self = LUI.UIButton.new()
self.id = "helper_text_item"
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f7_local4,
top = 0,
bottom = 0
} )
self:animateToState( "default" )
self.m_disableNavigation = true
self.m_requireFocusType = FocusType.MouseOver
if f7_arg6 then
assert( f7_arg7 )
self:registerEventHandler( "button_action", function ( element, event )
f7_arg7:processEvent( f7_arg6 )
end )
else
self:registerEventHandler( "button_action", sendButtonEvent )
end
self:registerEventHandler( "rebind", function ( element, event )
if event.buttonLeft and event.buttonLeft == f7_arg0 then
element.m_ignoreMouseFocus = nil
end
end )
self:registerEventHandler( "refresh_button_helper", function ( element, event )
local f10_local0, f10_local1, f10_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 )
local f10_local3 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f10_local0, f10_local1, f10_local2, f7_local0, f7_arg3 )
element:registerAnimationState( "refreshed", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f7_local4,
top = 0,
bottom = 0
} )
element:animateToState( "refreshed" )
end )
if f7_arg5 then
self:registerEventHandler( "popup_active", nil )
self:registerEventHandler( "popup_inactive", nil )
end
if f7_local1 then
local f7_local9 = LUI.UIText.new()
f7_local9.id = "left"
f7_local9:setText( f7_local1 )
f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
font = f7_local0.Font,
alignment = LUI.Alignment.Left,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = -f7_local3 / 2,
bottom = f7_local3 / 2
} ) )
f7_local9:animateToState( "default" )
f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event )
local f11_local0, f11_local1, f11_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 )
element:setText( f11_local0 )
element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
font = f7_local0.Font,
alignment = LUI.Alignment.Left,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = -f11_local2 / 2,
bottom = f11_local2 / 2
} ) )
element:animateToState( "default" )
end )
self:addElement( f7_local9 )
end
local f7_local9 = LUI.UIText.new()
f7_local9.properties = {}
f7_local9.id = "helper_text_text"
f7_local9:setText( f7_arg1 )
f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f7_local5,
right = 0,
top = -f7_local0.Height / 2,
bottom = f7_local0.Height / 2,
font = f7_local0.Font,
alignment = LUI.Alignment.Left
} ) )
f7_local9:registerAnimationState( "anim_intro", CoD.ColorizeState( Colors.cac_label_text, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 0,
font = f7_local0.Font,
alignment = LUI.Alignment.Left
} ) )
f7_local9:registerAnimationState( "over", CoD.ColorizeState( Colors.white ) )
f7_local9.properties.animLoop = MBh.AnimateLoop( {
{
"default",
500
},
{
"flash",
500
}
} )
if f7_arg8 then
f7_local9:animateToState( "anim_intro" )
else
f7_local9:animateToState( "default" )
end
if f7_arg9 then
f7_local9:registerAnimationState( "flash", CoD.ColorizeState( Colors.frontend_hilite ) )
f7_local9.properties:animLoop()
end
local f7_local10 = f7_local9
local f7_local11 = f7_local9.registerEventHandler
local f7_local12 = "button_up"
local f7_local13
if f7_arg9 then
f7_local13 = f7_local9.properties.animLoop
if not f7_local13 then
else
f7_local11( f7_local10, f7_local12, f7_local13 )
f7_local9:registerEventHandler( "button_over", MBh.AnimateToState( "over" ) )
f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event )
local f12_local0, f12_local1, f12_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 )
local f12_local3, f12_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f12_local0, f12_local1, f12_local2, f7_local0, f7_arg3 )
element:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f12_local4,
right = 0,
top = -f7_local0.Height / 2,
bottom = f7_local0.Height / 2,
font = f7_local0.Font,
alignment = LUI.Alignment.Left
} ) )
element:animateToState( "default" )
end )
self.currentText = f7_arg1
self:addElement( f7_local9 )
if f7_local2 then
f7_local11 = LUI.UIText.new()
f7_local11.id = "right"
f7_local11:setText( f7_local2 )
f7_local11:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
font = f7_local0.Font,
alignment = LUI.Alignment.Left,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f7_local5 + f7_local7,
right = 0,
top = -f7_local3 / 2,
bottom = f7_local3 / 2
} ) )
f7_local11:registerEventHandler( "refresh_button_helper", function ( element, event )
local f13_local0, f13_local1, f13_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 )
local f13_local3, f13_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f13_local0, f13_local1, f13_local2, f7_local0, f7_arg3 )
element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
font = f7_local0.Font,
alignment = LUI.Alignment.Left,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f13_local4 + f7_local7,
right = 0,
top = -f13_local2 / 2,
bottom = f13_local2 / 2
} ) )
element:animateToState( "default" )
end )
f7_local11:animateToState( "default" )
self:addElement( f7_local11 )
end
if f7_arg4 then
self:setPriority( f7_arg4 )
end
return self
end
end
f7_local13 = MBh.AnimateToState( "default" )
end
function button_helper_text_main()
return {
type = "UIElement",
id = "button_helper_text_main_id",
properties = {
left_inset = 100,
right_inset = -75,
top_margin = GenericFooterDims.TopMargin_WithBackground,
bottom_margin = -35,
height = GenericFooterDims.Height,
spacing = 12,
background_alpha = 1,
hideAlienBar = false
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = 0,
top = MBh.Property( "top_margin" ),
bottom = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
show_button_helper_text = MBh.AnimateToState( "default" ),
hide_button_helper_text = MBh.AnimateToState( "hidden" )
},
children = {
{
type = "UIImage",
id = "black_bar",
states = {
default = {
leftAnchor = true,
topAnchor = false,
rightAnchor = true,
bottomAnchor = true,
left = 0,
top = 0,
right = 0,
height = 300,
red = 0,
green = 0,
blue = 0,
alpha = MBh.Property( "background_alpha" ),
material = RegisterMaterial( "white" )
}
}
},
{
type = "UIImage",
id = "button_helper_background_id",
properties = {
background_alpha = MBh.Property( "background_alpha" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -25,
height = 128,
left = 0,
right = 0,
material = RegisterMaterial( "bkgd_title_bar" ),
zRot = 180,
alpha = MBh.Property( "background_alpha" )
}
}
},
{
type = "UIImage",
id = "button_helper_background_alien_id",
properties = {
hideAlienBar = MBh.Property( "hideAlienBar" ),
background_alpha = MBh.Property( "background_alpha" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -8,
bottom = 22,
left = 0,
right = 0,
material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_header_footer" ) or RegisterMaterial( "white" ),
alpha = 0
},
show = {
alpha = MBh.Property( "background_alpha" )
}
},
handlers = {
menu_create = function ( f15_arg0, f15_arg1 )
if Engine.IsAliensMode() and not f15_arg0.properties.hideAlienBar then
f15_arg0:animateToState( "show", 0 )
end
end
}
},
{
type = "UIText",
id = "build_number_text",
properties = {
text = Engine.GetBuildNumber(),
background_alpha = MBh.Property( "background_alpha" )
},
states = {
default = CoD.ColorizeState( Colors.build_number, {
leftAnchor = false,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = -70,
bottom = -22,
height = CoD.TextSettings.TinyFont.Height,
font = CoD.TextSettings.TinyFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0
} ),
visible = {
alpha = MBh.Property( "background_alpha" )
}
},
handlers = {
menu_create = function ( f16_arg0, f16_arg1 )
if Engine.InFrontend() and Engine.IsMultiplayer() then
f16_arg0:animateToState( "visible" )
end
end
}
},
{
type = "UIText",
id = "ds_text",
properties = {
text = "",
background_alpha = MBh.Property( "background_alpha" )
},
states = {
default = CoD.ColorizeState( Colors.build_number, {
leftAnchor = false,
rightAnchor = true,
topAnchor = false,
bottomAnchor = true,
left = 0,
right = -70,
bottom = -10,
height = CoD.TextSettings.TinyFont.Height,
font = CoD.TextSettings.TinyFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0
} ),
visible = {
alpha = MBh.Property( "background_alpha" )
}
},
handlers = {
menu_create = MBh.EmitEvent( "update_ds_text" ),
update_ds_text = function ( f17_arg0, f17_arg1 )
if Engine.GetDvarBool( "ds_info_enable" ) then
f17_arg0:animateToState( "visible" )
f17_arg0:setText( Engine.GetDvarString( "ds_info" ) or "" )
else
f17_arg0:animateToState( "default" )
end
end
},
children = {
{
type = "UITimer",
id = "ds_text_refresh_timer",
properties = {
event = {
name = "update_ds_text"
},
interval = 1000
}
}
}
},
{
type = "UIElement",
id = "container",
properties = {
height = MBh.Property( "height" ),
spacing = MBh.Property( "spacing" ),
left_inset = MBh.Property( "left_inset" ),
right_inset = MBh.Property( "right_inset" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 10,
height = MBh.Property( "height" )
}
},
children = {
{
type = "UIHorizontalList",
id = "left_button_helper_list_id",
properties = {
spacing = MBh.Property( "spacing" ),
left_inset = MBh.Property( "left_inset" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = MBh.Property( "left_inset" ),
right = 0,
top = 0,
bottom = 0,
alignment = LUI.Alignment.Left,
spacing = MBh.Property( "spacing" )
}
}
},
{
type = "UIHorizontalList",
id = "right_button_helper_list_id",
properties = {
spacing = MBh.Property( "spacing" ),
right_inset = MBh.Property( "right_inset" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = MBh.Property( "right_inset" ),
top = 0,
bottom = 0,
alignment = LUI.Alignment.Right,
spacing = MBh.Property( "spacing" )
}
}
}
},
handlers = {
add_button_helper_text = AddHelperTextObject,
clear_button_helper_text = ClearHelperTextObjects
}
}
}
}
end
LUI.MenuBuilder.registerDef( "button_helper_text_main", button_helper_text_main )
LockTable( _M )

159
lui/chatcontrols.dec.lua Normal file
View File

@ -0,0 +1,159 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function GetDisplay( f1_arg0 )
return Engine.GetBinding( f1_arg0 )
end
function bindKey( f2_arg0 )
Engine.BindKey( f2_arg0 )
end
function OptionsWindowRefresh( f3_arg0, f3_arg1 )
if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then
f3_arg0:processEvent( {
name = "menu_refresh"
} )
f3_arg0:processEvent( {
name = "refresh_content"
} )
end
end
function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 )
f4_arg0:dispatchEventToRoot( {
name = "options_window_refresh",
source_input = f4_arg1.name,
immediate = true
} )
end
function ControlBindFactory( f5_arg0, f5_arg1 )
return {
type = "UIGenericButton",
id = "bind_" .. f5_arg1,
properties = {
variant = GenericButtonSettings.Variants.Info,
button_text = Engine.Localize( f5_arg0 ),
button_display_func = function ( f6_arg0, f6_arg1 )
return GetDisplay( f5_arg1 )
end
,
button_action_func = function ( f7_arg0, f7_arg1 )
Engine.BindKey( f5_arg1 )
OptionsWindowTriggerRefresh( f7_arg0, f7_arg1 )
end
},
handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" ),
key_bound = OptionsWindowTriggerRefresh
}
}
end
function OptionsFeeder( f8_arg0 )
local f8_local0 = {}
Engine.ExecNow( "profile_menuDvarsSetup" )
f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_CHAT", "chatmodepublic" )
f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_TEAM_CHAT", "chatmodeteam" )
f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_VOICE_CHAT_BUTTON", "+talk" )
return f8_local0
end
function OptionsMainCreate( f9_arg0, f9_arg1 )
f9_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function chat_controls_vlist()
return {
type = "UIStencil",
children = {
{
type = "UIVerticalList",
childrenFeeder = OptionsFeeder,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -25,
top = 0,
bottom = 0
}
}
}
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right_wide,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom
}
},
handlers = {
options_window_refresh = OptionsWindowRefresh
}
}
end
function chat_controls()
return {
type = "UIElement",
id = "chat_controls_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
menu_close = function ( f12_arg0, f12_arg1 )
Engine.Exec( "updategamerprofile" )
end
},
children = {
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_CHAT" )
}
},
{
type = "chat_controls_vlist",
id = "chat_controls_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIBindButton",
id = "back_button",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
end
LUI.MenuBuilder.registerDef( "chat_controls_vlist", chat_controls_vlist )
LUI.MenuBuilder.registerDef( "chat_controls", chat_controls )
LockTable( _M )

1558
lui/cod.dec.lua Normal file

File diff suppressed because it is too large Load Diff

587
lui/codedependence.dec.lua Normal file
View File

@ -0,0 +1,587 @@
function ModuleInaccessible( f1_arg0 )
assert( not _G[f1_arg0] )
_G[f1_arg0] = setmetatable( {}, {
__index = function ( f2_arg0, f2_arg1 )
return function ()
assert( false, "Functions from the " .. f1_arg0 .. " module are not allowed to be called from this scope." )
end
end
} )
end
if Engine then
Engine.UsingSplitscreenUpscaling = Engine.UsingSplitscreenUpscaling or function ()
return false
end
Engine.IsNetworkConnected = Engine.IsNetworkConnected or function ()
return true
end
Engine.HasAcceptedInvite = Engine.HasAcceptedInvite or function ()
return false
end
Engine.SetAndEnableCustomClanTag = Engine.SetAndEnableCustomClanTag or function ()
end
Engine.CanViewClanTags = Engine.CanViewClanTags or function ()
return true
end
Engine.AllowOnline = Engine.AllowOnline or function ()
return true
end
Engine.IsSpecialRegion = Engine.IsSpecialRegion or function ()
return false
end
Engine.HasSnapshot = Engine.HasSnapshot or function ()
return true
end
Engine.APEXTurbulenceAvailable = Engine.APEXTurbulenceAvailable or function ()
return false
end
Engine.FurShaderAvailable = Engine.FurShaderAvailable or function ()
return false
end
Engine.HBAOAvailable = Engine.HBAOAvailable or function ()
return false
end
Engine.NVidiaGPUAvailable = Engine.NVidiaGPUAvailable or function ()
return false
end
local f0_local0 = Engine
local f0_local1 = Engine.TXAAAvailable
if not f0_local1 then
f0_local1 = Engine.NVidiaGPUAvailable
end
f0_local0.TXAAAvailable = f0_local1
Engine.CanVidRestart = Engine.CanVidRestart or function ()
return false
end
Engine.FormatTimeHoursMinutesSeconds = Engine.FormatTimeHoursMinutesSeconds or function ()
return ""
end
Engine.UserIsGuest = Engine.UserIsGuest or function ()
return false
end
Engine.ClearCustomClanTag = Engine.ClearCustomClanTag or function ()
end
Engine.GetCurrentDayMonthYear = Engine.GetCurrentDayMonthYear or function ()
return 1, 1, 2100
end
Engine.GetCurrentYear = Engine.GetCurrentYear or function ()
return 2100
end
Engine.UserCanAccessFriendsList = Engine.UserCanAccessFriendsList or function ()
return false
end
Engine.AnyoneHasSeasonPass = Engine.AnyoneHasSeasonPass or function ()
return false
end
Engine.AnyoneHasAliensDLC = Engine.AnyoneHasAliensDLC or function ()
return false
end
Engine.AnyoneHasAliensDLC1 = Engine.AnyoneHasAliensDLC1 or function ()
return false
end
Engine.AnyoneHasAliensDLC2 = Engine.AnyoneHasAliensDLC2 or function ()
return false
end
Engine.AnyoneHasAliensDLC3 = Engine.AnyoneHasAliensDLC3 or function ()
return false
end
Engine.AnyoneHasAliensDLC4 = Engine.AnyoneHasAliensDLC4 or function ()
return false
end
Engine.IsXenonDevTitle = Engine.IsXenonDevTitle or function ()
return false
end
Engine.GetRawMonthDayYear = Engine.GetRawMonthDayYear or function ()
return nil
end
Engine.GetClanTag = Engine.GetClanTag or function ()
return ""
end
Engine.LocalClientProfileCanSave = Engine.LocalClientProfileCanSave or function ()
return true
end
Engine.IsProfanity = Engine.IsProfanity or function ()
return false
end
Engine.GetAspectRatio = Engine.GetAspectRatio or function ()
return 1.78
end
Engine.IsChatRestricted = Engine.IsChatRestricted or function ()
return false
end
Engine.UserCanAccessStore = Engine.UserCanAccessStore or function ()
return false
end
Engine.ShowXB3GoldUpsell = Engine.ShowXB3GoldUpsell or function ()
return false
end
Engine.ShowLowTextureResolutionWarning = Engine.ShowLowTextureResolutionWarning or function ()
return false
end
Engine.IsPC = Engine.IsPC or function ()
return false
end
Engine.ClearUnlockData = Engine.ClearUnlockData or function ()
return false
end
Engine.GetControllerForLocalClient = Engine.GetControllerForLocalClient or function ()
return 0
end
Engine.PartyEveryoneHasMap = Engine.PartyEveryoneHasMap or function ()
return true
end
Engine.IsActiveLocalClientPrimary = Engine.IsActiveLocalClientPrimary or function ()
return true
end
Engine.PLMRefreshData = Engine.PLMRefreshData or function ()
end
Engine.HasSaveDevice = Engine.HasSaveDevice or function ()
return true
end
Engine.AnyoneHasSpecificDLCPack = Engine.AnyoneHasSpecificDLCPack or function ()
return true
end
Engine.VoteForDLCItem = Engine.VoteForDLCItem or function ()
end
Engine.GetVoteItemText = Engine.GetVoteItemText or function ()
return ""
end
Engine.GetVoteItemFileID = Engine.GetVoteItemFileID or function ()
return -1
end
Engine.GetActiveVotes = Engine.GetActiveVotes or function ()
return 0
end
Engine.GetNumberOfImagesForVote = Engine.GetNumberOfImagesForVote or function ()
return 0
end
Engine.StartVoteImageDownload = Engine.StartVoteImageDownload or function ()
end
Engine.IsVoteImageDownloaded = Engine.IsVoteImageDownloaded or function ()
return false
end
Engine.GetVoteImageHandle = Engine.GetVoteImageHandle or function ()
return RegisterMaterial( "white" )
end
Engine.GetVotingID = Engine.GetVotingID or function ()
return -1
end
Engine.GetPlayerDataReservedShort = Engine.GetPlayerDataReservedShort or function ()
end
Engine.SetPlayerDataReservedShort = Engine.SetPlayerDataReservedShort or function ()
end
Engine.GetVotingHeader = Engine.GetVotingHeader or function ()
return ""
end
Engine.HasPlayerData = Engine.HasPlayerData or function ()
return true
end
Engine.IsAnnouncerReleased = Engine.IsAnnouncerReleased or function ()
return true
end
Engine.IsAnnouncerUnlocked = Engine.IsAnnouncerUnlocked or function ()
return true
end
Engine.AnyoneHasBadReputation = Engine.AnyoneHasBadReputation or function ()
return false
end
end
if Game then
if not Engine.IsConsoleGame() then
local f0_local0 = Game.GetNumPlayersOnTeam
Game.GetNumPlayersOnTeam = function ( f63_arg0 )
if Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "systemlink" ) then
return f0_local0( f63_arg0 )
else
return 0
end
end
end
Game.IsKillCamEntityActive = Game.IsKillCamEntityActive or function ()
return false
end
Game.IsSpectatorCameraActive = Game.IsSpectatorCameraActive or function ()
return false
end
Game.StartBlur = Game.StartBlur or function ()
end
Game.GetLastMLGSpectateTeam = Game.GetLastMLGSpectateTeam or function ()
return Teams.allies
end
else
ModuleInaccessible( "Game" )
end
if Store then
Store.RequestContentServerImages = Store.RequestContentServerImages or function ()
end
Store.GetCategoryForDLCName = Store.GetCategoryForDLCName or function ()
return 0
end
Store.ShowSystemOffer = Store.ShowSystemOffer or function ()
end
else
ModuleInaccessible( "Store" )
end
if Friends then
Friends.HasPartyGameInvite = Friends.HasPartyGameInvite or function ()
return false
end
Friends.AcceptLivePartyInvitation = Friends.AcceptLivePartyInvitation or function ()
end
Friends.CanShowFriendGamercard = Friends.CanShowFriendGamercard or function ()
return true
end
Friends.GetEliteClanFriendMemberStatus = Friends.GetEliteClanFriendMemberStatus or function ( f74_arg0, f74_arg1 )
return ""
end
else
ModuleInaccessible( "Friends" )
end
if Squad then
Squad.PostMatch = Squad.PostMatch or function ()
return ""
end
Squad.GetHostSquadName = Squad.GetHostSquadName or function ()
return ""
end
Squad.UpdateReportPlayerCardCache = Squad.UpdateReportPlayerCardCache or function ()
return ""
end
Squad.GetReportPlayercard = Squad.GetReportPlayercard or function ()
end
Squad.GetClanTagForReport = Squad.GetClanTagForReport or function ()
return ""
end
Squad.GetCompareInfoForLobby = Squad.GetCompareInfoForLobby or function ()
return {}
end
Squad.SetMinPlayersToHumanMax = Squad.SetMinPlayersToHumanMax or function ()
end
Squad.GetSquadModePlaylist = Squad.GetSquadModePlaylist or function ( f82_arg0, f82_arg1 )
if f82_arg1 == 1 then
return 5, 0
elseif f82_arg1 == 2 then
return 5, 4
elseif f82_arg1 == 3 then
return 5, 1
elseif f82_arg1 == 4 then
return 5, 2
elseif f82_arg1 == 5 then
return 5, 3
elseif f82_arg1 == 6 then
return 5, 5
else
return -1, -1
end
end
else
ModuleInaccessible( "Squad" )
end
if Leaderboards then
Leaderboards.GetPlayerValue = Leaderboards.GetPlayerValue or function ( f83_arg0, f83_arg1 )
return ""
end
Leaderboards.GetValue = Leaderboards.GetValue or function ( f84_arg0, f84_arg1, f84_arg2 )
return ""
end
Leaderboards.GetOffset = Leaderboards.GetOffset or function ( f85_arg0 )
return 0
end
Leaderboards.GetCurrentIndex = Leaderboards.GetCurrentIndex or function ( f86_arg0 )
return 0
end
Leaderboards.UpdateLeaderboard = Leaderboards.UpdateLeaderboard or function ( f87_arg0, f87_arg1 )
end
Leaderboards.UpdateCurrentIndex = Leaderboards.UpdateCurrentIndex or function ( f88_arg0, f88_arg1 )
end
Leaderboards.OnSelect = Leaderboards.OnSelect or function ( f89_arg0 )
end
else
ModuleInaccessible( "Leaderboards" )
end
if Lobby then
Lobby.ShowMemberInfo = Lobby.ShowMemberInfo or function ( f90_arg0, f90_arg1, f90_arg2 )
return true
end
Lobby.UnsetAllMLGSpectators = Lobby.UnsetAllMLGSpectators or function ()
end
Lobby.GetMemberWeaponSetup = Lobby.GetMemberWeaponSetup or function ()
return {}
end
Lobby.GetPartyPrivacy = Lobby.GetPartyPrivacy or function ()
return -1
end
Lobby.SetPartyPrivacy = Lobby.SetPartyPrivacy or function ()
end
Lobby.GetPlayerLimit = Lobby.GetPlayerLimit or function ()
return -1
end
Lobby.SetPlayerLimit = Lobby.SetPlayerLimit or function ()
end
Lobby.SetUsingMLGRules = Lobby.SetUsingMLGRules or function ()
end
Lobby.IsUsingMLGRules = Lobby.IsUsingMLGRules or function ()
return false
end
Lobby.EnteringLobby = Lobby.EnteringLobby or function ()
return false
end
Lobby.EnteredLobby = Lobby.EnteredLobby or function ()
end
Lobby.HowManyPlayersCanWeHost = Lobby.HowManyPlayersCanWeHost or function ()
return 12
end
Lobby.IsUsingSecondScreen = Lobby.IsUsingSecondScreen or function ()
return false
end
Lobby.IsAlone = Lobby.IsAlone or function ()
return false
end
Lobby.IsChaosEnabled = Lobby.IsChaosEnabled or function ()
return false
end
Lobby.SetChaosEnabled = Lobby.SetChaosEnabled or function ()
end
Lobby.SetExtinctionDifficulty = Lobby.SetExtinctionDifficulty or function ()
end
Lobby.GetExtinctionDifficulty = Lobby.GetExtinctionDifficulty or function ()
return 2
end
else
ModuleInaccessible( "Lobby" )
end
if LobbyMember then
LobbyMember.SelectedMember_SetLocalMemberMLGSpectator = LobbyMember.SelectedMember_SetLocalMemberMLGSpectator or function ()
end
end
Clan = Clan or {}
Clan.IsEnabled = Clan.IsEnabled or function ()
return false
end
Clan.IsDownloadingData = Clan.IsDownloadingData or function ()
return false
end
Clan.GetDCXPTime = Clan.GetDCXPTime or function ()
return 0
end
Clan.GetClanDivision = Clan.GetClanDivision or function ()
return 0
end
CoDAnywhere = CoDAnywhere or {}
CoDAnywhere.HasUCDSaveGame = CoDAnywhere.HasUCDSaveGame or function ()
return false
end
CoDAnywhere.ServiceAvailable = CoDAnywhere.ServiceAvailable or function ()
return true
end
if Playlist then
Playlist.GetCanShowItem = Playlist.GetCanShowItem or function ()
return true
end
Playlist.GetItemMaxParty = Playlist.GetItemMaxParty or function ()
return 12
end
Playlist.WillCXPBeAwarded = Playlist.WillCXPBeAwarded or function ()
return false
end
Playlist.GetItemVideo = Playlist.GetItemVideo or function ()
return ""
end
else
ModuleInaccessible( "Playlist" )
end
if CharacterScene then
else
ModuleInaccessible( "CharacterScene" )
end
MLG = MLG or {}
MLG.GetFollowedClientNum = MLG.GetFollowedClientNum or function ()
end
MLG.HighlightClientNum = MLG.HighlightClientNum or function ()
end
MLG.TogglePlayerOutlines = MLG.TogglePlayerOutlines or function ()
end
Customization = Customization or {}
Customization.GetCompleteHeadModelName = Customization.GetCompleteHeadModelName or function ( f122_arg0, f122_arg1 )
local f122_local0 = Engine.TableLookup( "mp/cac/heads.csv", 0, f122_arg0, 1 )
local f122_local1 = ""
if f122_arg1 then
f122_local1 = Engine.TableLookup( "mp/cac/helmets.csv", 0, f122_arg1, 1 )
end
return f122_local0 .. f122_local1
end
MatchRules = MatchRules or {}
MatchRules.SelectSaveDevice = MatchRules.SelectSaveDevice or function ()
end
MatchRules.HasSelectedSaveDevice = MatchRules.HasSaveDevice or function ()
return true
end
SocialFeed = SocialFeed or {}
SocialFeed.GetNewsItemID = SocialFeed.GetNewsItemID or function ()
return ""
end
SocialFeed.HasIOTD = SocialFeed.HasIOTD or function ()
return true
end
SocialFeed.DowloadIOTD = SocialFeed.DowloadIOTD or function ()
end
SocialFeed.SetNewsArticleImageJPEG = SocialFeed.SetNewsArticleImageJPEG or function ()
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,426 @@
Cac = {
Settings = {
DataLoc = {
squadMembers = {
maxClassSlots = 10
},
privateMatchSquadMembers = {
maxClassSlots = 6
},
coopSquadMembers = {
maxClassSlots = 1
},
loadouts = {
maxClassSlots = 10,
baseClassSlots = 6
},
defaultClassesTeam0 = {
maxClassSlots = 6,
teamName = "allies"
},
defaultClassesTeam1 = {
maxClassSlots = 6,
baseClassSlots = 6,
teamName = "axis",
infectedString = Engine.Localize( "LUA_MENU_INFECT_CAPS" ),
string = Engine.Localize( "@LUA_MENU_AXIS_CAPS" )
},
defaultClassesTeam2 = {
maxClassSlots = 6,
baseClassSlots = 6,
teamName = "allies",
infectedString = Engine.Localize( "LUA_MENU_MP_SURVIVORS_CAPS" ),
string = Engine.Localize( "@LUA_MENU_ALLIES_CAPS" )
},
defaultClassesTeam3 = {
teamName = "spectator"
}
},
minUsableSlots = 5
},
MemberCost = {
0,
3,
3,
3,
3,
3,
200,
300,
400,
500
}
}
if MatchRules then
MatchRules.AllowCustomClasses = function ( f1_arg0 )
if not MatchRules.IsUsingMatchRulesData() then
return false
else
local f1_local0
if f1_arg0 then
f1_local0 = Cac.IsDefaultClass( f1_arg0 )
if not f1_local0 then
elseif not f1_local0 then
return MatchRules.GetData( "commonOption", "allowCustomClasses" )
else
end
end
end
f1_local0 = false
end
end
Cac.GetCacConfig = function ( f2_arg0, f2_arg1, f2_arg2, ... )
local f2_local0 = {
...
}
for f2_local1 = 1, #f2_local0, 1 do
if type( f2_local0[f2_local1] ) == "string" and Cac.IsDefaultClass( f2_local0[f2_local1] ) then
local f2_local4 = Cac.Settings.DataLoc[f2_local0[f2_local1]].teamName
local f2_local5 = f2_local0[f2_local1 + 1]
table.remove( f2_local0, 1 )
table.remove( f2_local0, 1 )
return MatchRules.GetData( "defaultClasses", f2_local4, f2_local5, "class", unpack( f2_local0 ) )
end
end
local f2_local1 = CoD.GetStatsGroupForSquadLocation( f2_arg1 )
if f2_local0[1] == "loadouts" and type( f2_local0[2] ) == "number" then
local f2_local2 = f2_local0[1]
local f2_local3 = f2_local0[2]
if Cac.Settings.DataLoc[f2_local2].baseClassSlots <= f2_local3 then
table.remove( f2_local0, 1 )
table.remove( f2_local0, 1 )
return Engine.GetPlayerDataExtendedEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, f2_local2, f2_local3 - Cac.Settings.DataLoc[f2_local2].baseClassSlots, unpack( f2_local0 ) )
end
end
return Engine.GetPlayerDataEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, ... )
end
Cac.SetCacConfig = function ( f3_arg0, f3_arg1, f3_arg2, ... )
local f3_local0 = {
...
}
for f3_local1 = 1, #f3_local0, 1 do
if type( f3_local0[f3_local1] ) == "string" and Cac.IsDefaultClass( f3_local0[f3_local1] ) then
local f3_local4 = Cac.Settings.DataLoc[f3_local0[f3_local1]].teamName
local f3_local5 = f3_local0[f3_local1 + 1]
table.remove( f3_local0, 1 )
table.remove( f3_local0, 1 )
return MatchRules.SetData( "defaultClasses", f3_local4, f3_local5, "class", unpack( f3_local0 ) )
end
end
local f3_local1 = CoD.GetStatsGroupForSquadLocation( f3_arg1 )
if f3_local0[1] == "loadouts" and type( f3_local0[2] ) == "number" then
local f3_local2 = f3_local0[1]
local f3_local3 = f3_local0[2]
if Cac.Settings.DataLoc[f3_local2].baseClassSlots <= f3_local3 then
table.remove( f3_local0, 1 )
table.remove( f3_local0, 1 )
return Engine.SetPlayerDataExtendedEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, f3_local2, f3_local3 - Cac.Settings.DataLoc[f3_local2].baseClassSlots, unpack( f3_local0 ) )
end
end
return Engine.SetPlayerDataEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, ... )
end
Cac.GetNumCustomSlots = function ( f4_arg0, f4_arg1 )
if not f4_arg1 then
f4_arg1 = Cac.GetCustomClassLoc()
end
if Cac.IsDefaultClass( f4_arg1 ) or IsOnlineMatch() and (Engine.HasExtendedLoadouts( f4_arg0 ) or not IsPrivateMatch()) and Engine.GetDvarInt( "extendedLoadoutsEnable" ) == 1 then
return Cac.Settings.DataLoc[f4_arg1].maxClassSlots
else
return Cac.Settings.DataLoc[f4_arg1].baseClassSlots
end
end
Cac.IsClassInUse = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4 )
local f5_local0 = nil
local f5_local1 = Cac.IsDefaultClass( f5_arg3 )
if f5_arg1 == "privateMatchSquadMembers" and not f5_local1 and f5_arg4 < Cac.Settings.DataLoc[f5_arg3].baseClassSlots then
f5_local0 = true
else
f5_local0 = Cac.GetCacConfig( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, "inUse" )
if not f5_local1 and Engine.InFrontend() and f5_arg4 <= 2 and not f5_local0 then
Cac.SetClassInUse( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, true )
end
end
return f5_local0
end
Cac.SetClassInUse = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 )
if f6_arg5 == nil then
f6_arg5 = true
end
return Cac.SetCacConfig( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, "inUse", f6_arg5 )
end
Cac.IsSquadMemberInUse = function ( f7_arg0, f7_arg1, f7_arg2 )
local f7_local0 = nil
if f7_arg1 == "privateMatchSquadMembers" then
f7_local0 = true
else
f7_local0 = Cac.GetCacConfig( f7_arg0, f7_arg1, f7_arg2, "inUse" )
end
return f7_local0
end
Cac.SetSquadMemberInUse = function ( f8_arg0, f8_arg1, f8_arg2 )
return Cac.SetCacConfig( f8_arg0, f8_arg1, f8_arg2, "inUse", true )
end
Cac.HasCustomClasses = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 )
local f9_local0 = false
for f9_local1 = 0, Cac.GetNumCustomSlots( f9_arg0, f9_arg3 ) - 1, 1 do
if Cac.IsClassInUse( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_local1 ) then
f9_local0 = true
break
end
end
return f9_local0
end
Cac.GetFirstCustomClass = function ( f10_arg0, f10_arg1, f10_arg2, f10_arg3 )
for f10_local0 = 0, Cac.GetNumCustomSlots( f10_arg0, f10_arg3 ) - 1, 1 do
if Cac.IsClassInUse( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_local0 ) then
return f10_local0
end
end
assert( Cac.HasCustomClasses( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) )
return 0
end
Cac.IsCaCSlotRestricted = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4 )
local f11_local0 = false
if MatchRules.AllowCustomClasses( f11_arg3 ) then
if not f11_arg3 then
f11_arg3 = Cac.GetCustomClassLoc()
end
if not Engine.InFrontend() and f11_arg3 == "loadouts" then
local f11_local1 = CoD.GetStatsGroupForGameMode()
if MatchRules.CustomClassIsRestricted( f11_arg0, CoD.GetStatsGroupForGameMode(), f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) then
f11_local0 = true
end
end
end
return f11_local0
end
Cac.IsCaCSlotLocked = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 )
if not Cac.IsDefaultClass( f12_arg3 ) then
return not Cac.IsClassInUse( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 )
else
end
end
Cac.GetSquadLoc = function ()
local f13_local0
if not Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "xblive_privatematch" ) then
f13_local0 = Engine.GetDvarBool( "force_ranking" )
else
f13_local0 = true
end
if Engine.IsAliensMode() then
return "coopSquadMembers"
elseif f13_local0 then
return "squadMembers"
else
return "privateMatchSquadMembers"
end
end
Cac.GetEditSquadMember = function ()
return Engine.GetDvarInt( "ui_editSquadMemberIndex" ) or 0
end
Cac.SetEditSquadMember = function ( f15_arg0 )
Engine.SetDvarInt( "ui_editSquadMemberIndex", f15_arg0 )
end
Cac.GetActiveSquadMember = function ( f16_arg0, f16_arg1 )
local f16_local0 = f16_arg1 or CoD.GetStatsGroupForGameMode()
if f16_local0 ~= CoD.StatsGroup.Ranked or not "activeSquadMember" then
local f16_local1 = "privateMatchActiveSquadMember"
end
if Engine.IsAliensMode() then
local f16_local1 = "coopActiveSquadMember"
end
return Engine.GetPlayerDataEx( f16_arg0, f16_local0, f16_local1 )
end
Cac.SetActiveSquadMember = function ( f17_arg0, f17_arg1 )
local f17_local0 = CoD.GetStatsGroupForGameMode()
local f17_local1
if f17_local0 == CoD.StatsGroup.Ranked then
f17_local1 = "activeSquadMember"
if not f17_local1 then
else
Engine.SetPlayerDataEx( f17_arg0, f17_local0, f17_local1, f17_arg1 )
if f17_local0 == CoD.StatsGroup.Ranked then
syncXP( f17_arg0, f17_arg1 )
end
Cac.SyncPrivateDataFromPlayercard( f17_arg0 )
end
end
f17_local1 = "privateMatchActiveSquadMember"
end
Cac.SyncPrivateDataFromPlayercard = function ( f18_arg0 )
local f18_local0 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "activeSquadMember" )
local f18_local1 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patch" )
local f18_local2 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patchbacking" )
local f18_local3 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "background" )
for f18_local4 = 0, Cac.Settings.DataLoc.privateMatchSquadMembers.maxClassSlots - 1, 1 do
Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patch", f18_local1 )
Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patchbacking", f18_local2 )
Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "background", f18_local3 )
end
end
Cac.GetCustomClassLoc = function ( f19_arg0 )
local f19_local0 = "loadouts"
if f19_arg0 ~= nil then
f19_local0 = f19_arg0
elseif not MatchRules.AllowCustomClasses( f19_arg0 ) then
if not Engine.InFrontend() then
f19_local0 = "defaultClassesTeam1"
else
f19_local0 = "defaultClassesTeam1"
end
end
return f19_local0
end
Cac.GetLoadoutName = function ( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4 )
local f20_local0 = Cac.GetCacConfig( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4, "name" )
if f20_local0 == "" then
f20_local0 = Engine.Localize( "@MP_LOADOUT_DEFAULT_NAME", f20_arg4 + 1 )
end
return f20_local0
end
Cac.MaxSquadMemberCount = function ( f21_arg0 )
return Cac.Settings.DataLoc[f21_arg0].maxClassSlots
end
Cac.ActiveSquadMemberCount = function ( f22_arg0, f22_arg1 )
local f22_local0 = 0
for f22_local1 = 0, Cac.MaxSquadMemberCount( f22_arg1 ) - 1, 1 do
if Cac.IsSquadMemberInUse( f22_arg0, f22_arg1, f22_local1 ) then
f22_local0 = f22_local0 + 1
end
end
return f22_local0
end
Cac.AddNewSquadMember = function ( f23_arg0, f23_arg1 )
local f23_local0 = Cac.ActiveSquadMemberCount( f23_arg0, f23_arg1 )
if f23_local0 + 1 <= Cac.MaxSquadMemberCount( f23_arg1 ) then
Cac.SetSquadMemberInUse( f23_arg0, f23_arg1, f23_local0 )
return f23_local0
else
DebugPrint( "WARNING: Attempting to add squad member when we are already at max. Ignoring..." )
end
end
Cac.UnlockSquadMember = function ( f24_arg0, f24_arg1, f24_arg2 )
if f24_arg2 < Cac.MaxSquadMemberCount( f24_arg1 ) then
Cac.SetSquadMemberInUse( f24_arg0, f24_arg1, f24_arg2 )
else
DebugPrint( "WARNING: Attempting to unlock squad member past the max index. Ignoring..." )
end
local f24_local0 = Cac.ActiveSquadMemberCount( f24_arg0, f24_arg1 )
for f24_local1 = 1, f24_local0, 1 do
Engine.SetPlayerDataEx( f24_arg0, CoD.GetStatsGroupForGameMode(), "challengeState", "ch_squad_member" .. f24_local1 .. "_purchase", 2 )
end
end
Cac.GetSquadMemberName = function ( f25_arg0, f25_arg1, f25_arg2 )
return Engine.GetPlayerDataEx( f25_arg0, CoD.GetStatsGroupForGameMode(), f25_arg1, f25_arg2, "name" )
end
Cac.SetSquadMemberName = function ( f26_arg0, f26_arg1, f26_arg2, f26_arg3 )
return Engine.SetPlayerDataEx( f26_arg0, CoD.GetStatsGroupForGameMode(), f26_arg1, f26_arg2, "name", f26_arg3 )
end
Cac.HasSquadMemberPrestiged = function ( f27_arg0, f27_arg1, f27_arg2 )
return Engine.GetPlayerDataEx( f27_arg0, CoD.GetStatsGroupForGameMode(), f27_arg1, f27_arg2, "squadMemXP" ) >= Rank.GetRankMaxXP( Rank.GetMaxRank() )
end
Cac.GetSquadMemberPrestigeLevel = function ( f28_arg0, f28_arg1, f28_arg2 )
if not Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_arg2 ) then
return 0
end
local f28_local0 = 1
local f28_local1 = Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_arg2 )
for f28_local2 = 0, Cac.MaxSquadMemberCount( f28_arg1 ) - 1, 1 do
if f28_local2 ~= f28_arg2 and Cac.IsSquadMemberInUse( f28_arg0, f28_arg1, f28_local2 ) and Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_local2 ) and Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_local2 ) < f28_local1 then
f28_local0 = f28_local0 + 1
end
end
return f28_local0
end
Cac.GetPrestigeLevel = function ( f29_arg0, f29_arg1 )
local f29_local0 = 0
for f29_local1 = 0, Cac.MaxSquadMemberCount( f29_arg1 ) - 1, 1 do
if Cac.IsSquadMemberInUse( f29_arg0, f29_arg1, f29_local1 ) and Cac.HasSquadMemberPrestiged( f29_arg0, f29_arg1, f29_local1 ) then
f29_local0 = f29_local0 + 1
end
end
return f29_local0
end
Cac.SyncPrestigeLevel = function ( f30_arg0 )
Engine.SetPlayerDataEx( f30_arg0, CoD.GetStatsGroupForGameMode(), "prestige", Cac.GetPrestigeLevel( f30_arg0, Cac.GetSquadLoc() ) )
end
Cac.GetSquadMemberLoadoutUnlockCost = function ( f31_arg0 )
if Cac.Settings.DataLoc.loadouts.baseClassSlots <= f31_arg0 then
return 0
else
return 20 + (f31_arg0 - 3) * 5
end
end
Cac.ValidateAllPlayersPrivateSquadMembers = function ()
for f32_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
if Engine.HasActiveLocalClient( f32_local0 ) and Engine.HasPlayerData( f32_local0 ) then
if not Lobby.IsItemOfTypeUnlocked( f32_local0, "wolf", "DLC" ) then
DebugPrint( "You are not Entitled to the Wolf. So removing." )
Engine.SetPlayerDataReservedInt( f32_local0, CoD.StatsGroup.Common, "mp_dog_type", 0 )
end
for f32_local3 = 0, Cac.MaxSquadMemberCount( "privateMatchSquadMembers" ) - 1, 1 do
Cac.ValidateCustomizationItems( f32_local0, "privateMatchSquadMembers", f32_local3 )
if not Engine.IsAliensMode() then
Cac.ValidateLoadoutItems( f32_local0, "privateMatchSquadMembers", f32_local3, "loadouts" )
end
end
if not Engine.IsAliensMode() then
Cac.ValidateCustomizationItems( f32_local0, "squadMembers", Cac.GetActiveSquadMember( f32_local0, CoD.StatsGroup.Ranked ) )
end
end
end
end
Cac.ValidateAllPlayersPublicSquadMembers = function ()
local f33_local0 = Cac.GetSquadLoc()
assert( f33_local0 ~= "privateMatchSquadMembers", "Cac.GetSquadLoc() returned private match location in public lobby." )
for f33_local1 = 0, Engine.GetMaxControllerCount() - 1, 1 do
if Engine.HasActiveLocalClient( f33_local1 ) then
if not Lobby.IsItemOfTypeUnlocked( f33_local1, "wolf", "DLC" ) then
DebugPrint( "You are not Entitled to the Wolf. So removing." )
Engine.SetPlayerDataReservedInt( f33_local1, CoD.StatsGroup.Common, "mp_dog_type", 0 )
end
local f33_local4 = Cac.GetActiveSquadMember( f33_local1 )
Cac.ValidateCustomizationItems( f33_local1, f33_local0, f33_local4 )
if not Engine.IsAliensMode() then
Cac.ValidateLoadoutItems( f33_local1, "squadMembers", f33_local4, "loadouts" )
end
end
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
if Friends then
Friends.Constants = {
scrollbarWidth = 14,
FriendButtonHeight = 90,
reportOffensiveLobbyPlayer = 4,
reportExploitingLobbyPlayer = 5,
reportCheatingLobbyPlayer = 6,
reportBoostingLobbyPlayer = 7
}
Friends.FacebookAllowedFlags = {
Active = 1,
FriendsActive = 2,
UploadPhotoActive = 4,
UploadVideoActive = 8
}
end

View File

@ -0,0 +1,150 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function CanSomeoneAccessFriendslist()
for f1_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
if Engine.HasActiveLocalClient( f1_local0 ) and Engine.UserCanAccessFriendsList( f1_local0 ) then
return true
end
end
return false
end
function online_friends_widget( f2_arg0, f2_arg1 )
if not f2_arg1 then
f2_arg1 = {}
end
local self = LUI.UIElement.new( {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
bottom = -35,
right = -100,
width = 50,
height = 36,
alpha = 1
} )
self:registerAnimationState( "disabled", {
alpha = 0
} )
self.id = "online_friends_widget"
self:registerEventHandler( "show_widget", function ( element, event )
local f3_local0 = element:getParent()
if f3_local0 then
local f3_local1 = LUI.ButtonHelperText.CommonEvents.addFriendsButton
f3_local1.ignorePopups = f2_arg1.ignorePopups
f3_local0:processEvent( f3_local1 )
element:animateToState( "default", 100 )
if Engine.IsXB3() or not Engine.IsConsoleGame() then
Engine.ExecNow( "friends_widget_refresh" )
end
end
end )
self:registerEventHandler( "hide_widget", function ( element, event )
local f4_local0 = element:getParent()
if f4_local0 then
local f4_local1 = LUI.ButtonHelperText.CommonEvents.removeFriendsButton
f4_local1.dispatchChildren = true
f4_local0:processEvent( f4_local1 )
element:animateToState( "disabled", 0 )
end
end )
self:registerEventHandler( "live_connection", function ( element, event )
if event.signed_in == nil then
local f5_local0 = Engine.IsNetworkConnected()
if f5_local0 then
f5_local0 = Engine.IsUserSignedInToLive()
end
event.signed_in = f5_local0
end
if event.signed_in and CanSomeoneAccessFriendslist() then
element:processEvent( {
name = "show_widget"
} )
else
element:processEvent( {
name = "hide_widget"
} )
end
end )
self:registerEventHandler( "network_connection", function ( element, event )
if not event.plugged_in then
element:processEvent( {
name = "hide_widget"
} )
elseif Engine.IsUserSignedInToLive() then
element:processEvent( {
name = "show_widget"
} )
end
end )
self:registerEventHandler( "menu_create", function ( element, event )
element:processEvent( {
name = "live_connection"
} )
end )
local f2_local1 = LUI.UIBindButton.new()
f2_local1.id = "friends_bind_buttons_id"
f2_local1:registerEventHandler( "button_alt2", function ( element, event )
if Engine.IsNetworkConnected() and Engine.IsUserSignedInToLive( event.controller ) then
local f8_local0 = Engine.UserCanAccessFriendsList( event.controller )
local f8_local1 = Engine.IsUserAGuest( event.controller )
if f8_local0 and not f8_local1 then
if Engine.InFrontend() then
LUI.FlowManager.RequestPopupMenu( element, "popup_friends", true, event.controller, false, {} )
else
LUI.FlowManager.RequestAddMenu( element, "popup_friends", true, event.controller, false, {} )
end
elseif f8_local1 then
LUI.FlowManager.RequestPopupMenu( element, "mp_no_guest_popup", false, event.controller, false )
elseif Engine.IsPS3() and event.controller ~= 0 then
LUI.FlowManager.RequestPopupMenu( element, "mp_wrong_controller_popup", false, event.controller, false )
end
end
return true
end )
self:addElement( f2_local1 )
local f2_local2 = LUI.UIImage.new
local f2_local3 = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -5,
bottom = 5,
left = 0,
right = 10,
material = RegisterMaterial( "widg_triangle" )
}
if not Engine.InFrontend() then
local f2_local4 = Engine.GetDvarBool( "dedicated_dhclient" )
local f2_local5 = 0.7
end
f2_local3.alpha = f2_local4 and f2_local5 or 0.25
f2_local3.zRot = -135
f2_local2 = f2_local2( f2_local3 )
f2_local2.id = "friends_triangle_id"
self:addElement( f2_local2 )
if Friends then
f2_local3 = LUI.UIText.new( CoD.ColorizeState( Colors.frontend_hilite, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
left = 0,
right = 0,
height = CoD.TextSettings.BigFont.Height,
font = CoD.TextSettings.BigFont.Font,
alignment = LUI.Alignment.Right
} ) )
f2_local3.id = "friends_number_text"
f2_local3:setupUIBindText( "CountOnlineFriends" )
self:addElement( f2_local3 )
end
return self
end
LUI.MenuBuilder.registerType( "online_friends_widget", online_friends_widget )
LockTable( _M )

View File

@ -0,0 +1,423 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ()
local f1_local0 = nil
local f1_local1 = Languages[Engine.GetCurrentLanguage and Engine.GetCurrentLanguage() or 0]
assert( f1_local1 )
local f1_local2 = "bkgd_manual_"
if Engine.IsSpecialRegion() then
if f1_local1 == "LANGUAGE_FRENCH" then
f1_local2 = "bkgd_manual_alt_language_"
f1_local1 = "LANGUAGE_FRENCHCA"
elseif f1_local1 == "LANGUAGE_ENGLISH" then
f1_local2 = "bkgd_manual_alt_language_"
f1_local1 = "LANGUAGE_ENGLISHUK"
end
end
local f1_local3 = {
X360 = {
LANGUAGE_BRITISH = 4,
LANGUAGE_ENGLISH = 5,
LANGUAGE_FRENCH = 5,
LANGUAGE_GERMAN = 5,
LANGUAGE_ITALIAN = 5,
LANGUAGE_SPANISH = 5,
LANGUAGE_RUSSIAN = 5,
LANGUAGE_POLISH = 5,
LANGUAGE_KOREAN = 5,
LANGUAGE_TAIWANESE = 5,
LANGUAGE_JAPANESE = 4,
LANGUAGE_CHINESE = 5,
LANGUAGE_THAI = 5,
LANGUAGE_CZECH = 5,
LANGUAGE_SPANISHNA = 5,
LANGUAGE_PORTUGUESE = 5,
LANGUAGE_FRENCHCA = 1,
LANGUAGE_ENGLISHUK = 5
},
XB3 = {
LANGUAGE_BRITISH = 5,
LANGUAGE_ENGLISH = 4,
LANGUAGE_FRENCH = 4,
LANGUAGE_GERMAN = 4,
LANGUAGE_ITALIAN = 4,
LANGUAGE_SPANISH = 4,
LANGUAGE_RUSSIAN = 4,
LANGUAGE_POLISH = 4,
LANGUAGE_KOREAN = 4,
LANGUAGE_TAIWANESE = 4,
LANGUAGE_JAPANESE = 5,
LANGUAGE_CHINESE = 4,
LANGUAGE_THAI = 4,
LANGUAGE_CZECH = 4,
LANGUAGE_SPANISHNA = 4,
LANGUAGE_PORTUGUESE = 4,
LANGUAGE_FRENCHCA = 4,
LANGUAGE_ENGLISHUK = 4
},
PS3 = {
LANGUAGE_BRITISH = 4,
LANGUAGE_ENGLISH = 6,
LANGUAGE_FRENCH = 7,
LANGUAGE_GERMAN = 7,
LANGUAGE_ITALIAN = 7,
LANGUAGE_SPANISH = 7,
LANGUAGE_RUSSIAN = 7,
LANGUAGE_POLISH = 7,
LANGUAGE_KOREAN = 6,
LANGUAGE_TAIWANESE = 6,
LANGUAGE_JAPANESE = 4,
LANGUAGE_CHINESE = 6,
LANGUAGE_THAI = 6,
LANGUAGE_CZECH = 6,
LANGUAGE_SPANISHNA = 6,
LANGUAGE_PORTUGUESE = 6,
LANGUAGE_FRENCHCA = 6,
LANGUAGE_ENGLISHUK = 7
},
PS4 = {
LANGUAGE_BRITISH = 4,
LANGUAGE_ENGLISH = 5,
LANGUAGE_FRENCH = 7,
LANGUAGE_GERMAN = 7,
LANGUAGE_ITALIAN = 7,
LANGUAGE_SPANISH = 7,
LANGUAGE_RUSSIAN = 7,
LANGUAGE_POLISH = 7,
LANGUAGE_KOREAN = 6,
LANGUAGE_TAIWANESE = 6,
LANGUAGE_JAPANESE = 4,
LANGUAGE_CHINESE = 6,
LANGUAGE_THAI = 6,
LANGUAGE_CZECH = 6,
LANGUAGE_SPANISHNA = 5,
LANGUAGE_PORTUGUESE = 5,
LANGUAGE_FRENCHCA = 5,
LANGUAGE_ENGLISHUK = 7
},
PC = {
LANGUAGE_BRITISH = 3,
LANGUAGE_ENGLISH = 5,
LANGUAGE_FRENCH = 5,
LANGUAGE_GERMAN = 5,
LANGUAGE_ITALIAN = 5,
LANGUAGE_SPANISH = 5,
LANGUAGE_RUSSIAN = 5,
LANGUAGE_POLISH = 5,
LANGUAGE_KOREAN = 5,
LANGUAGE_TAIWANESE = 5,
LANGUAGE_JAPANESE = 3,
LANGUAGE_CHINESE = 5,
LANGUAGE_THAI = 5,
LANGUAGE_CZECH = 5,
LANGUAGE_SPANISHNA = 5,
LANGUAGE_PORTUGUESE = 5,
LANGUAGE_FRENCHCA = 5,
LANGUAGE_ENGLISHUK = 5
}
}
if Engine.IsXbox360() then
f1_local0 = f1_local3.X360[f1_local1]
elseif Engine.IsXB3() then
f1_local0 = f1_local3.XB3[f1_local1]
elseif Engine.IsPS3() then
f1_local0 = f1_local3.PS3[f1_local1]
elseif Engine.IsPS4() then
f1_local0 = f1_local3.PS4[f1_local1]
else
f1_local0 = f1_local3.PC[f1_local1]
end
assert( f1_local0 )
local f1_local4 = {}
for f1_local5 = 1, f1_local0, 1 do
table.insert( f1_local4, f1_local2 .. f1_local5 )
end
return f1_local4
end
function changePage( f2_arg0, f2_arg1 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 )
local f2_local1 = f2_local0.currentPage
f2_local0.currentPage = LUI.clamp( f2_local0.currentPage + f2_arg1, 1, #f2_local0.manualPages )
f2_arg0:dispatchEventToRoot( {
name = "change_page"
} )
if f2_local1 ~= f2_local0.currentPage then
if f2_arg1 > 0 then
f2_arg0:dispatchEventToRoot( {
name = "next_page"
} )
elseif f2_arg1 < 0 then
f2_arg0:dispatchEventToRoot( {
name = "previous_page"
} )
end
end
end
function game_manual()
local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "game_manual" )
f3_local0.manualPages = f0_local0()
assert( #f3_local0.manualPages > 0 )
local self = LUI.UIElement.new()
self.id = "game_manual"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f3_local2 = LUI.UIImage.new()
f3_local2.id = "centerPage"
f3_local2:registerAnimationState( "default", {
material = RegisterMaterial( f3_local0.manualPages[1] ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
f3_local2:animateToState( "default" )
f3_local2:registerEventHandler( "change_page", function ( element, event )
local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
element:setImage( RegisterMaterial( f4_local0.manualPages[f4_local0.currentPage] ) )
end )
self:addElement( f3_local2 )
local f3_local3 = LUI.UIButton.new()
f3_local3.id = "leftArrow"
f3_local3:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -330,
left = 100,
width = 40,
height = 80,
alpha = 1
} )
f3_local3:registerAnimationState( "disabled", {
alpha = 0.5
} )
f3_local3:registerAnimationState( "bump", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -330,
left = 90,
width = 40,
height = 80
} )
f3_local3:registerEventHandler( "next_page", MBh.AnimateToState( "default", 0 ) )
f3_local3:registerEventHandler( "previous_page", function ( element, event )
local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
local f5_local1 = {
{
"default",
0
},
{
"bump",
40,
true,
true
},
{
"default",
100,
true,
true
}
}
if f5_local0.currentPage <= 1 then
table.insert( f5_local1, {
"disabled",
80
} )
end
local f5_local2 = MBh.AnimateSequence( f5_local1 )
f5_local2( element, event )
end )
f3_local3:registerEventHandler( "button_action", function ( element, event )
changePage( element, -1 )
end )
f3_local3:registerEventHandler( "button_over", function ( element, event )
if event.focusType == FocusType.MouseOver then
element:processEvent( {
name = "arrow_image_over",
immediate = true
} )
end
end )
f3_local3:registerEventHandler( "button_up", function ( element, event )
local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
if f8_local0.currentPage > 1 then
element:animateToState( "default" )
else
element:animateToState( "disabled" )
end
element:processEvent( {
name = "arrow_image_up",
immediate = true
} )
end )
f3_local3:animateToState( "default" )
f3_local3:animateToState( "disabled" )
local f3_local4 = LUI.UIImage.new()
f3_local4.id = "leftArrowImage"
f3_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "widg_margin_arrow_lt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
bottom = 0
} ) )
f3_local4:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) )
f3_local4:animateToState( "default" )
f3_local4:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) )
f3_local4:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) )
f3_local3:addElement( f3_local4 )
self:addElement( f3_local3 )
local f3_local5 = LUI.UIButton.new()
f3_local5.id = "rightArrow"
f3_local5:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = -330,
right = -100,
width = 40,
height = 80,
alpha = 1
} )
f3_local5:registerAnimationState( "disabled", {
alpha = 0.5
} )
f3_local5:registerAnimationState( "bump", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = -330,
right = -90,
width = 40,
height = 80
} )
f3_local5:registerEventHandler( "previous_page", MBh.AnimateToState( "default", 0 ) )
f3_local5:registerEventHandler( "next_page", function ( element, event )
local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
local f9_local1 = {
{
"default",
0
},
{
"bump",
40,
true,
true
},
{
"default",
100,
true,
true
}
}
if #f9_local0.manualPages <= f9_local0.currentPage then
table.insert( f9_local1, {
"disabled",
80
} )
end
local f9_local2 = MBh.AnimateSequence( f9_local1 )
f9_local2( element, event )
end )
f3_local5:animateToState( "default" )
f3_local5:registerEventHandler( "button_action", function ( element, event )
changePage( element, 1 )
end )
f3_local5:registerEventHandler( "button_over", function ( element, event )
if event.focusType == FocusType.MouseOver then
element:processEvent( {
name = "arrow_image_over",
immediate = true
} )
end
end )
f3_local5:registerEventHandler( "button_up", function ( element, event )
local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
if f12_local0.currentPage < #f12_local0.manualPages then
element:animateToState( "default" )
else
element:animateToState( "disabled" )
end
element:processEvent( {
name = "arrow_image_up",
immediate = true
} )
end )
local f3_local6 = LUI.UIImage.new()
f3_local6.id = "leftArrowImage"
f3_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.white, {
material = RegisterMaterial( "widg_margin_arrow_rt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
bottom = 0
} ) )
f3_local6:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) )
f3_local6:animateToState( "default" )
f3_local6:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) )
f3_local6:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) )
f3_local5:addElement( f3_local6 )
self:addElement( f3_local5 )
local f3_local7 = LUI.MenuBuilder.BuildAddChild( self, {
type = "button_helper_text_main",
properties = {
background_alpha = 1
}
} )
f3_local7:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
local f3_local8 = LUI.UIBindButton.new()
f3_local8.id = "bind"
f3_local8:registerEventHandler( "button_secondary", function ( element, event )
LUI.FlowManager.RequestLeaveMenu( element )
end )
f3_local8:registerEventHandler( "button_left", function ( element, event )
changePage( element, -1 )
end )
f3_local8:registerEventHandler( "button_right", function ( element, event )
changePage( element, 1 )
end )
self:addElement( f3_local8 )
self:registerEventHandler( "menu_create", function ( element, event )
local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element )
f16_local0.currentPage = 1
changePage( element, 0 )
end )
return self
end
LUI.MenuBuilder.registerType( "game_manual", game_manual )
LockTable( _M )

View File

@ -0,0 +1,782 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function KinectGuideFeeder( f1_arg0 )
local f1_local0 = {}
Kinect.BuildShortcutArray()
if Kinect.ShortcutArray ~= nil then
for f1_local1 = 1, #Kinect.ShortcutArray, 1 do
local f1_local4 = f1_local1
table.insert( f1_local0, {
type = "UIButton",
id = "kinect_guide_grid_" .. f1_local4 .. "_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
width = Kinect.Layout.CellWidth,
height = Kinect.Layout.CellHeight
}
},
handlers = {
button_action = function ( f2_arg0, f2_arg1 )
Kinect.ExecShortcut( f2_arg0, f2_arg1, f1_local4 )
end
},
children = {
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
},
dim = {
alpha = 0.8
}
},
handlers = {
button_over = MBh.AnimateLoop( {
{
"dim",
750,
true,
true
},
{
"default",
750
}
} ),
button_up = MBh.AnimateToState( "default", 0 )
},
children = {
{
type = "kinect_button_background",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.05
},
focused = {
alpha = 0.4
}
},
handlers = {
button_over = MBh.AnimateToState( "focused" ),
button_up = MBh.AnimateToState( "default" )
}
}
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 16,
left = 0,
right = 16,
material = RegisterMaterial( "widg_triangle" ),
alpha = 0
},
focused = {
alpha = 1
}
},
handlers = {
button_over = MBh.AnimateToState( "focused" ),
button_up = MBh.AnimateToState( "default" )
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 0,
width = 128,
height = 128,
material = RegisterMaterial( "icon_kinect_number_0" .. f1_local4 ),
alpha = 0.1
} ),
focused = CoD.ColorizeState( Colors.black, {
scale = 0.1
} ),
unfocused = CoD.ColorizeState( Colors.black, {
scale = 0
} )
},
handlers = {
button_over = MBh.AnimateSequence( {
{
"unfocused",
0
},
{
"focused",
100
},
{
"unfocused",
100
}
} ),
button_up = MBh.AnimateToState( "default", 0 )
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = 0,
left = 0,
right = 0,
height = 32
}
},
children = {
{
type = "kinect_btn_footer_bg",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.5
}
}
},
{
type = "UIMarqueeText",
id = "kinect_guide_grid_desc_id",
properties = {
text = Engine.Localize( Kinect.ShortcutArray[f1_local4].TextLabel ),
textStyle = CoD.TextStyle.OutlinedMore
},
states = {
default = CoD.ColorizeState( Kinect.Swatch.DescColor, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 3,
right = -3,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center
} ),
focused = CoD.ColorizeState( Kinect.Swatch.DescColorInvert, {} ),
unfocused = CoD.ColorizeState( Kinect.Swatch.DescColor, {} )
}
}
}
}
}
} )
end
else
DebugPrint( "Kinect: Warning, Kinect.ShortcutArray is nil!" )
end
return f1_local0
end
function kinect_btn_footer_bg()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = 8,
material = RegisterMaterial( "box_kinect_name_lt" )
}
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 8,
right = -8,
material = RegisterMaterial( "box_kinect_name_mid" )
}
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -8,
right = 0,
material = RegisterMaterial( "box_kinect_name_rt" )
}
}
}
}
}
end
function HandleKinectGuideMenuAutoRefresh( f4_arg0, f4_arg1 )
if Kinect.DoWeNeedToRebuildShortcutArray() == true then
LUI.FlowManager.RequestLeaveMenu( f4_arg0 )
end
end
function kinect_guide_grid()
return {
type = "UIGrid",
id = "kinect_guide_grid_id",
handlers = {
autorefresh = HandleKinectGuideMenuAutoRefresh
},
properties = {
elementsPerRow = Kinect.Layout.NumRows,
rowHeight = 150,
hSpacing = 6,
vSpacing = 6,
vAlign = LUI.Alignment.Center,
hAlign = LUI.Alignment.Center
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
childrenFeeder = KinectGuideFeeder
}
end
function HandleKinectGuideMenuSpeechBack( f6_arg0, f6_arg1, f6_arg2 )
if not Kinect.IsWhatCanISayMenuUp() and Kinect.IsKinectGuideUp() then
LUI.FlowManager.RequestLeaveMenu( f6_arg0 )
LUI.Speech.PerformingSpeechAction()
end
end
function HandleKinectGuideMenuSpeechCancel( f7_arg0, f7_arg1, f7_arg2 )
LUI.FlowManager.RequestLeaveMenu( f7_arg0 )
LUI.Speech.PerformingSpeechAction()
end
function HandleKinectGuideMenuSpeechYes( f8_arg0, f8_arg1, f8_arg2 )
end
function HandleKinectGuideMenuSpeechNo( f9_arg0, f9_arg1, f9_arg2 )
end
function HandleKinectGuideMenuSpeechShortcut( f10_arg0, f10_arg1, f10_arg2 )
assert( f10_arg2, "HandleKinectGuideMenuSpeechShortcut: Missing extradata param!" )
assert( f10_arg2.shortcutNum, "HandleKinectGuideMenuSpeechShortcut: Missing extradata shortcutNum param!" )
Kinect.ExecShortcut( f10_arg0, f10_arg1, f10_arg2.shortcutNum )
end
function HandleKinectGuideMenuSpeechReplaceShortcut( f11_arg0, f11_arg1, f11_arg2 )
assert( f11_arg2, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata param!" )
assert( f11_arg2.shortcutNum, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata shortcutNum param!" )
end
if Engine.HasSpeechFeature() then
KinectGuideMenuSpeechGrammarHandlersArray = {
{
action = "back",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechBack,
extradata = nil
},
{
action = "cancel",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechCancel,
extradata = nil
},
{
action = "yes",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechYes,
extradata = nil
},
{
action = "no",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechNo,
extradata = nil
},
{
action = "Shortcut 1",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 1
}
},
{
action = "Shortcut 2",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 2
}
},
{
action = "Shortcut 3",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 3
}
},
{
action = "Shortcut 4",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 4
}
},
{
action = "Shortcut 5",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 5
}
},
{
action = "Shortcut 6",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 6
}
},
{
action = "Shortcut 7",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 7
}
},
{
action = "Shortcut 8",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 8
}
},
{
action = "Shortcut 9",
confidence = LUI.Speech.shortcutMenuConfidence,
handler = HandleKinectGuideMenuSpeechShortcut,
extradata = {
shortcutNum = 9
}
},
{
action = "Replace Shortcut 1",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 1
}
},
{
action = "Replace Shortcut 2",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 2
}
},
{
action = "Replace Shortcut 3",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 3
}
},
{
action = "Replace Shortcut 4",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 4
}
},
{
action = "Replace Shortcut 5",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 5
}
},
{
action = "Replace Shortcut 6",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 6
}
},
{
action = "Replace Shortcut 7",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 7
}
},
{
action = "Replace Shortcut 8",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 8
}
},
{
action = "Replace Shortcut 9",
confidence = LUI.Speech.defaultConfidence,
handler = HandleKinectGuideMenuSpeechReplaceShortcut,
extradata = {
shortcutNum = 9
}
}
}
else
KinectGuideMenuSpeechGrammarHandlersArray = {}
end
function HandleKinectGuideMenuSpeechHandler( f12_arg0, f12_arg1 )
if Engine.HasSpeechFeature() then
LUI.Speech.ProcessActionEvent( f12_arg0, f12_arg1, KinectGuideMenuSpeechGrammarHandlersArray )
end
end
function HandleKinectGuideMenuCreate( f13_arg0, f13_arg1 )
f13_arg0:processEvent( {
name = "add_button_helper_text",
button_ref = "button_secondary",
helper_text = Engine.Localize( "@LUA_MENU_BACK" ),
side = "left",
clickable = true
} )
end
function kinect_guide()
return {
type = "UIElement",
id = "kinect_guide_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
handlers = {
menu_create = HandleKinectGuideMenuCreate,
speech_action = HandleKinectGuideMenuSpeechHandler
},
children = {
{
type = "UIImage",
id = "kinect_menu_overlay_id",
states = {
default = CoD.ColorizeState( Swatches.Overlay.Color, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
material = RegisterMaterial( "white" ),
alpha = Swatches.Overlay.AlphaMore
} )
}
},
{
type = "UIElement",
id = "kinect_menu_container_id",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
width = Kinect.Layout.Width,
height = Kinect.Layout.Height
}
},
children = {
{
type = "generic_drop_shadow",
properties = {
offset_shadow = 0
}
},
{
type = "generic_menu_titlebar",
id = "kinect_title_id",
properties = {
font = CoD.TextSettings.ExtraBigFont,
title_bar_text = Engine.Localize( "@SPEECH_SHORTCUTS_TITLE" ),
title_bar_alignment = LUI.Alignment.Center,
fill_alpha = 1
}
},
{
type = "generic_menu_background",
id = "kinect_background_id",
properties = {
fill_alpha = 1
}
},
{
type = "kinect_guide_grid",
id = "kinect_guide_grid_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = GenericTitleBarDims.TitleBarHeight + 10,
bottom = -1 * (GenericFooterDims.Height + 5),
left = 5,
right = -5
}
}
},
{
type = "UITimer",
id = "kinect_guid_grid_autorefresh_timer",
properties = {
event = "autorefresh",
interval = 1000,
disposable = false,
broadcastToRoot = false
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottom = -40,
left = 1,
right = -1,
height = 1,
material = RegisterMaterial( "white" ),
alpha = Swatches.GenericMenu.BorderAlpha
} )
}
},
{
type = "button_helper_text_main",
id = "kinect_helper_text_id",
properties = {
left_inset = 10,
left_margin = 1,
right_margin = -1,
top_margin = GenericFooterDims.TopMargin_WithoutBackground,
spacing = 65,
background_alpha = 0
}
},
{
type = "UIBindButton",
id = "kinect_bind_buttons_id",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
}
}
end
function kinect_button_background( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg1.red or 1
local f15_local1 = f15_arg1.green or 1
local f15_local2 = f15_arg1.blue or 1
local f15_local3 = f15_arg1.alpha or 1
local f15_local4 = f15_arg1.colorLocked or false
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = top,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f15_local6 = LUI.UIImage.new()
f15_local6.id = "corner"
f15_local6:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 32,
left = 0,
right = 32,
material = RegisterMaterial( "btn_cas_item_topleft" )
} )
f15_local6:animateToState( "default" )
self:addElement( f15_local6 )
local f15_local7 = LUI.UIImage.new()
f15_local7.id = "top"
f15_local7:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 32,
left = 32,
right = 0,
material = RegisterMaterial( "white" )
} )
f15_local7:animateToState( "default" )
self:addElement( f15_local7 )
local f15_local8 = LUI.UIImage.new()
f15_local8.id = "bottom"
f15_local8:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 32,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" )
} )
f15_local8:animateToState( "default" )
self:addElement( f15_local8 )
self.colorize = function ( f16_arg0, f16_arg1, f16_arg2, f16_arg3 )
for f16_local3, f16_local4 in ipairs( {
f15_local6,
f15_local7,
f15_local8
} ) do
f16_local4:registerAnimationState( "current", {
red = f16_arg0,
green = f16_arg1,
blue = f16_arg2,
alpha = f16_arg3
} )
f16_local4:animateToState( "current" )
end
end
self.colorize( f15_local0, f15_local1, f15_local2, f15_local3 )
if not f15_local4 then
self:registerEventHandler( "updateBackgroundColor", function ( element, event )
element.colorize( event.red, event.green, event.blue, event.alpha )
end )
end
return self
end
LUI.MenuBuilder.registerDef( "kinect_guide", kinect_guide )
LUI.FlowManager.RegisterStackPopBehaviour( "kinect_guide", function ()
Engine.ExecNow( "decnosplitscreencontrol kinect_guide_dec" )
end )
LUI.MenuBuilder.registerDef( "kinect_guide_grid", kinect_guide_grid )
LUI.MenuBuilder.registerDef( "kinect_btn_footer_bg", kinect_btn_footer_bg )
LUI.MenuBuilder.registerType( "kinect_button_background", kinect_button_background )
LockTable( _M )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,425 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
LUI.Playercard = {}
XP_BAR_WIDTH = 212
LUI.Playercard.new = function ( f1_arg0, f1_arg1, f1_arg2 )
local f1_local0 = 130
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
height = 128,
width = 512,
alpha = 1
} )
self:registerAnimationState( "hidden", {
alpha = 0
} )
self:animateToState( "default" )
self.card = LUI.UIElement.new()
local f1_local2 = self.card
self:addElement( f1_local2 )
f1_local2.id = "playercard" .. (f1_arg1.gamertag and "_" .. f1_arg1.gamertag or "")
f1_local2:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -18,
left = -12,
height = 128,
width = 512
} )
f1_local2:animateToState( "default" )
local f1_local3 = LUI.UIImage.new()
f1_local3.id = "mainBG"
f1_local3:registerAnimationState( "default", {
material = RegisterMaterial( "card_bg" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
f1_local3:animateToState( "default" )
f1_local2:addElement( f1_local3 )
f1_local2.playerBG = LUI.UIImage.new()
f1_local2.playerBG.id = "playerBG"
f1_local2.playerBG:animateToState( "default" )
f1_local2:addElement( f1_local2.playerBG )
f1_local2.playerBGdarken = LUI.UIImage.new()
f1_local2.playerBGdarken.id = "playerBGdarken"
f1_local2.playerBGdarken:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
width = 399,
height = 64,
bottom = -24,
left = 53,
alpha = 0.85
} )
f1_local2.playerBGdarken:animateToState( "default" )
f1_local2.playerBGdarken:setImage( RegisterMaterial( "card_image_darken" ) )
f1_local2:addElement( f1_local2.playerBGdarken )
f1_local2.gamertag = LUI.UIMarqueeText.new()
f1_local2.gamertag.id = "gamertag"
f1_local2.gamertag:registerAnimationState( "default", {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f1_local0,
right = -60,
top = 18,
height = CoD.TextSettings.NormalFont.Height
} )
f1_local2.gamertag:animateToState( "default" )
f1_local2:addElement( f1_local2.gamertag )
f1_local2.slogan = LUI.UIMarqueeText.new()
f1_local2.slogan.id = "slogan"
f1_local2.slogan:setTextStyle( CoD.TextStyle.OutlinedMore )
f1_local2.slogan:registerAnimationState( "default", {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f1_local0,
right = -60,
top = 40,
height = CoD.TextSettings.NormalFont.Height,
red = 1,
green = 1,
blue = 1
} )
f1_local2.slogan:animateToState( "default" )
f1_local2:addElement( f1_local2.slogan )
f1_local2.clantag = LUI.UIText.new()
f1_local2.clantag.id = "clantag"
f1_local2.clantag.m_textStyle = CoD.TextStyle.OutlinedMore
f1_local2.clantag:registerAnimationState( "default", {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = f1_local0,
right = -60,
top = 80,
height = CoD.TextSettings.NormalFont.Height,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
} )
f1_local2.clantag:animateToState( "default" )
f1_local2:addElement( f1_local2.clantag )
if not (not IsPublicMatch or not IsPublicMatch()) or Engine.IsAliensMode() or f1_arg1.force_show_rank then
f1_local2.rankIcon = LUI.UIImage.new()
f1_local2.rankIcon.id = "rankIcon"
f1_local2:addElement( f1_local2.rankIcon )
f1_local2.rankNum = LUI.UIText.new()
f1_local2.rankNum.id = "rankNum"
f1_local2.rankNum.m_textStyle = CoD.TextStyle.ShadowedMore
f1_local2.rankNum:registerAnimationState( "default", {
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.BigFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
left = -165,
right = -65,
top = 58,
height = CoD.TextSettings.BigFont.MaxHeight
} )
f1_local2.rankNum:animateToState( "default" )
f1_local2:addElement( f1_local2.rankNum )
end
if f1_arg1.use_level_progress then
LUI.Playercard.AddLevelProgressBar( f1_local2 )
end
f1_local2.patchShape = LUI.UIImage.new()
f1_local2.patchShape.id = "patchShape"
f1_local2:addElement( f1_local2.patchShape )
f1_local2.patchEmblem = LUI.UIImage.new()
f1_local2.patchEmblem.id = "patchEmblem"
f1_local2.patchEmblem:animateToState( "default" )
f1_local2.patchEmblem.scale = f1_arg1.patchScale or 0
f1_local2:addElement( f1_local2.patchEmblem )
self.feedContent = LUI.Playercard.FeedContent
self:registerEventHandler( "update_playercard", function ( element, event )
element:feedContent( event )
end )
self:registerEventHandler( "hide_playercard", function ( element, event )
element:animateToState( "hidden", event.fade or 0 )
end )
self:registerEventHandler( "show_playercard", function ( element, event )
element:animateToState( "default", event.fade or 0 )
end )
self:feedContent( f1_arg1 )
return self
end
LUI.Playercard.AddLevelProgressBar = function ( f5_arg0 )
local f5_local0 = 0
local f5_local1 = 140
local f5_local2 = -50
local f5_local3 = 150
local f5_local4 = CoD.TextSettings.SmallFont.Height
local levelProgressContainer = LUI.UIElement.new( CoD.CreateState( 45, -22, -58, 0, CoD.AnchorTypes.BottomLeftRight ) )
levelProgressContainer.id = "playercard_level_bar_container_id"
local f5_local6 = CoD.CreateState( 0, 0, f5_local3, 0, CoD.AnchorTypes.TopBottomLeft )
CoD.ColorizeState( Colors.black, f5_local6 )
f5_local6.material = RegisterMaterial( "box_white_gradient_fade_rt" )
f5_arg0.bgFade = LUI.UIImage.new( f5_local6 )
levelProgressContainer:addElement( f5_arg0.bgFade )
f5_local6 = CoD.CreateState( f5_local3, 0, 0, 0, CoD.AnchorTypes.All )
CoD.ColorizeState( Colors.black, f5_local6 )
f5_local6.material = RegisterMaterial( "white" )
f5_arg0.bgFill = LUI.UIImage.new( f5_local6 )
levelProgressContainer:addElement( f5_arg0.bgFill )
f5_local6 = CoD.CreateState( f5_local1, 6, f5_local1 + XP_BAR_WIDTH, -6, CoD.AnchorTypes.TopBottomLeft )
CoD.ColorizeState( Colors.grey_2, f5_local6 )
f5_arg0.xpBar = LUI.UIImage.new( f5_local6 )
f5_arg0.xpBar.id = "playercard_level_bar_bg_id"
levelProgressContainer:addElement( f5_arg0.xpBar )
f5_local6 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.TopBottomLeft )
f5_local6.material = RegisterMaterial( "btn_cas_fill_f" )
f5_arg0.xpFillBar = LUI.UIImage.new( {
f5_local6
} )
f5_arg0.xpFillBar.id = "playercard_level_bar_id"
f5_arg0.xpBar:addElement( f5_arg0.xpFillBar )
f5_arg0.currentRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local1 - 26, f5_local0, f5_local1 - 6, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft ) )
f5_arg0.currentRankIcon.id = "playercard_current_rank_icon_id"
f5_local6 = CoD.CreateState( 0, f5_local0, f5_local1 - 32, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft )
f5_local6.font = CoD.TextSettings.SmallFont.Font
f5_local6.alignment = LUI.Alignment.Right
CoD.ColorizeState( Colors.md_grey, f5_local6 )
f5_arg0.currentRankText = LUI.UIText.new( f5_local6 )
f5_arg0.currentRankText.id = "playercard_current_rank_id"
f5_arg0.nextRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local2, f5_local0, f5_local2 + 20, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight ) )
f5_arg0.nextRankIcon.id = "playercard_next_rank_icon_id"
f5_local6 = CoD.CreateState( f5_local2 + 25, f5_local0, 0, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight )
f5_local6.font = CoD.TextSettings.SmallFont.Font
f5_local6.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.md_grey, f5_local6 )
f5_arg0.nextRankText = LUI.UIText.new( f5_local6 )
f5_arg0.nextRankText.id = "playercard_next_rank_id"
levelProgressContainer:addElement( f5_arg0.currentRankIcon )
levelProgressContainer:addElement( f5_arg0.currentRankText )
levelProgressContainer:addElement( f5_arg0.nextRankIcon )
levelProgressContainer:addElement( f5_arg0.nextRankText )
f5_arg0:addElement( levelProgressContainer )
f5_arg0.levelProgressContainer = levelProgressContainer
end
LUI.Playercard.FeedContent = function ( f6_arg0, f6_arg1 )
local f6_local0 = f6_arg0.card
if f6_arg1.gamertag then
f6_local0.gamertag:setText( f6_arg1.gamertag )
end
if f6_arg1.clantag then
local f6_local1 = f6_arg1.clantag
if f6_arg1.clantag ~= "" then
if not string.find( f6_arg1.clantag, "[", nil, true ) then
f6_local1 = "[" .. f6_local1
end
if not string.find( f6_arg1.clantag, "]", nil, true ) then
f6_local1 = f6_local1 .. "]"
end
end
f6_local0.clantag:setText( f6_local1 )
end
if f6_arg1.background then
local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].GetUIMaterial( f6_arg1.background ) )
if f6_local1 then
f6_local0.playerBG:setImage( f6_local1 )
f6_local0.playerBG:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
width = 399,
height = 64,
bottom = -24,
left = 53
} )
f6_local0.playerBG:animateToState( "default" )
end
end
if f6_local0.rankIcon and f6_local0.rankNum and f6_arg1.rank and f6_arg1.prestige then
local f6_local1 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core
local f6_local2 = Rank.GetRankDisplay( f6_arg1.rank, f6_local1 )
f6_local0.rankNum:setText( f6_local2 )
local f6_local3 = RegisterMaterial( Rank.GetRankIcon( f6_arg1.rank, f6_arg1.prestige, f6_local1 ) )
if f6_local3 then
local f6_local4 = f6_arg1.prestige > 0
local f6_local5
if f6_local4 then
f6_local5 = 46
if not f6_local5 then
else
local f6_local6
if f6_local4 then
f6_local6 = 61
if not f6_local6 then
else
local f6_local7, f6_local8, f6_local9, f6_local10 = GetTextDimensions( f6_local2, CoD.TextSettings.BigFont.Font, CoD.TextSettings.BigFont.MaxHeight )
local f6_local11 = f6_local9 - f6_local7
f6_local0.rankIcon:setImage( f6_local3 )
f6_local0.rankIcon:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = f6_local6,
right = -70 - f6_local11,
width = f6_local5,
height = f6_local5
} )
f6_local0.rankIcon:animateToState( "default" )
end
end
f6_local6 = 63
end
end
f6_local5 = 40
end
end
if f6_arg1.patchShape then
local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patchbacking].GetUIMaterial( f6_arg1.patchShape ) )
if f6_local1 then
f6_local0.patchShape:setImage( f6_local1 )
f6_local0.patchShape:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
width = 128,
height = 128
} )
f6_local0.patchShape:animateToState( "default" )
end
end
if f6_arg1.patchEmblem then
local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetUIMaterial( f6_arg1.patchEmblem ) )
if f6_local1 then
f6_local0.patchEmblem:setImage( f6_local1 )
f6_local0.patchEmblem:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
width = 128,
height = 128,
red = 1,
green = 1,
blue = 1,
alpha = 1,
scale = f6_local0.patchEmblem.scale
} )
f6_local0.patchEmblem:animateToState( "default" )
end
local f6_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch]
if f6_local2 and f6_local2.GetQuip then
local f6_local3 = f6_local2.GetQuip( f6_arg1.patchEmblem )
if f6_local3 then
f6_local0.slogan:setText( Engine.Localize( f6_local3 ) )
end
end
end
if f6_arg1.experience and f6_arg1.prestige and f6_local0.levelProgressContainer then
local f6_local1 = Engine.GetCurrentCoDPlayMode()
local f6_local2 = Rank.GetMaxRank( f6_local1 )
local f6_local3 = Engine.IsAliensMode() and Lobby.GetAlienRankForXP( f6_arg1.experience ) or Lobby.GetRankForXP( f6_arg1.experience )
local f6_local4
if f6_local3 < f6_local2 then
f6_local4 = f6_local3 + 1
if not f6_local4 then
else
local f6_local5 = Engine.IsAliensMode() and LUI.mp_menus.Aliens.AlienRanks.MaxPrestige or Lobby.GetMaxPrestigeLevel()
local f6_local6 = Rank.GetRankMaxXP( f6_local2 ) <= f6_arg1.experience
f6_local0.currentRankText:setText( Rank.GetRankDisplay( f6_local3 ) )
local f6_local7 = RegisterMaterial( Rank.GetRankIcon( f6_local3, f6_arg1.prestige, f6_local1 ) )
if f6_local7 then
f6_local0.currentRankIcon:setImage( f6_local7 )
end
local f6_local8 = false
if not Engine.IsAliensMode() and f6_local3 == f6_local4 and not f6_local6 and f6_arg1.prestige < f6_local5 then
f6_local8 = true
end
if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.MaxLevel and f6_arg1.prestige < f6_local5 then
f6_local8 = true
f6_local4 = 0
end
f6_local0.nextRankText:setText( Rank.GetRankDisplay( f6_local4, f6_local1 ) )
local f6_local9 = RegisterMaterial
local f6_local10 = Rank.GetRankIcon
local f6_local11 = f6_local4
local f6_local12
if f6_local8 then
f6_local12 = f6_arg1.prestige + 1
if not f6_local12 then
else
f6_local7 = f6_local9( f6_local10( f6_local11, f6_local12, f6_local1 ) )
if f6_local7 then
f6_local0.nextRankIcon:setImage( f6_local7 )
end
f6_local9 = Rank.GetRankMinXP( f6_local3, f6_local1 )
f6_local10 = Rank.GetRankMinXP( f6_local4, f6_local1 )
f6_local11 = Rank.GetRankXPToNext( f6_local3, f6_local1 )
if f6_local11 == nil or f6_local11 == 0 then
f6_local11 = 1
end
f6_local12 = math.min( (f6_arg1.experience - f6_local9) / f6_local11, 1 )
if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.SuperMaxLevel then
f6_local12 = 1
end
f6_local0.xpFillBar:registerAnimationState( "default", {
top = 0,
bottom = 0,
left = 0,
right = f6_local12 * XP_BAR_WIDTH,
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false
} )
f6_local0.xpFillBar:animateToState( "default", 0 )
end
end
f6_local12 = f6_arg1.prestige
end
end
f6_local4 = f6_local3
end
end
LUI.MenuBuilder.registerType( "playercard", LUI.Playercard.new )
LockTable( _M )

View File

@ -0,0 +1,122 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function profileMenuOptionsFeeder( f1_arg0 )
return {
{
type = "UIGenericButton",
id = "offile_profile_create_btn",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@MENU_CREATE_NEW_OFFLINE_PROFILE" ),
button_action_func = function ( f2_arg0, f2_arg1 )
DebugPrint( "button offile_profile_create_btn press" )
Engine.Exec( "newOfflineProfile", f2_arg1.controller )
LUI.FlowManager.RequestLeaveMenu( f2_arg0 )
end
}
},
{
type = "UIGenericButton",
id = "offile_profile_load_btn",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@MENU_LOAD_EXISTING_OFFLINE_PROFILE" ),
button_action_func = function ( f3_arg0, f3_arg1 )
DebugPrint( "button offile_profile_load_btn press" )
Engine.Exec( "loadOfflineProfile", f3_arg1.controller )
LUI.FlowManager.RequestLeaveMenu( f3_arg0 )
end
}
},
{
type = "UIGenericButton",
id = "offile_profile_delete_btn",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "@MENU_DELETE_OFFLINE_PROFILE" ),
button_action_func = function ( f4_arg0, f4_arg1 )
DebugPrint( "button offile_profile_delete_btn press" )
Engine.Exec( "deleteOfflineProfile", f4_arg1.controller )
LUI.FlowManager.RequestLeaveMenu( f4_arg0 )
end
}
}
}
end
function OnCreatePS3ProfileMenu( f5_arg0, f5_arg1 )
DebugPrint( "On Create PS3 profile menu" )
Engine.ExecNow( "incnosplitscreencontrol menu_ps3_profile" )
end
function OnClosePS3ProfileMenu( f6_arg0, f6_arg1 )
DebugPrint( "On Close PS3 profile menu" )
Engine.ExecNow( "decnosplitscreencontrol menu_ps3_profile" )
local f6_local0 = Engine.GetLuiRoot()
if f6_local0:IsMenuOpenAndVisible( "menu_splitscreensignin" ) and not f6_local0:IsMenuOpenAndVisible( "menu_resetstats_warning" ) and not f6_local0:IsMenuOpenAndVisible( "menu_ps3_savegame_warning" ) then
Engine.Exec( "startsplitscreensignin" )
end
end
function menu_ps3_profile()
return {
type = "generic_selectionList_popup",
id = "offline_profile_management_popup",
properties = {
popup_title = Engine.Localize( "@MENU_LOAD_OFFLINE_PROFILE" ),
popup_childfeeder = profileMenuOptionsFeeder
},
handlers = {
menu_create = OnCreatePS3ProfileMenu,
menu_close = OnClosePS3ProfileMenu
}
}
end
function SaveErrorContinue( f8_arg0, f8_arg1 )
DebugPrint( "Save Error Continue" )
if Engine.GetDvarBool( "splitscreen" ) then
Engine.Exec( "endsplitscreensignin" )
LUI.FlowManager.RequestAddMenu( f8_arg0, "menu_gamesetup_splitscreen", false, f8_arg1.controller, false, {} )
else
assert( f8_arg0.properties.callback_params.continue_to_menu )
LUI.FlowManager.RequestOldMenu( f8_arg0, f8_arg0.properties.callback_params.continue_to_menu, false )
end
end
function SaveErrorReturn( f9_arg0, f9_arg1 )
DebugPrint( "Save Error Cancel" )
if Engine.GetDvarBool( "splitscreen" ) then
Engine.Exec( "startsplitscreensignin" )
end
end
function GetSomeText()
return "my cool text"
end
function menu_ps3_savegame_error()
return {
type = "generic_yesno_popup",
properties = {
message_text = Engine.UserWithoutOfflineProfile(),
popup_title = Engine.Localize( "@MENU_SAVE_ERROR_MP" ),
yes_text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE_MP" ),
no_text = Engine.Localize( "@MENU_RETURN_SIGNIN_MP" ),
yes_action = SaveErrorContinue,
no_action = SaveErrorReturn
}
}
end
LUI.MenuBuilder.registerDef( "menu_ps3_profile", menu_ps3_profile )
LUI.MenuBuilder.registerDef( "menu_ps3_savegame_error", menu_ps3_savegame_error )
LockTable( _M )

View File

@ -0,0 +1,123 @@
Rank = {}
RankTable = {
File = "mp/rankTable.csv",
AlienFile = "mp/alien/rankTable.csv",
Cols = {
RankId = 0,
Rank = 1,
MinXp = 2,
XpToNextLevel = 3,
ShortRankName = 4,
FullRankName = 5,
RankIcon = 6,
MaxXp = 7,
Level = 13,
DisplayLevel = 14,
InGameRank = 16,
UnlockString = 17
}
}
RankIconTable = {
File = "mp/rankIconTable.csv",
AlienFile = "mp/alien/rankIconTable.csv",
Cols = {
RankId = 0,
Standard = 1,
Prestige1 = 2
}
}
Rank.GetMaxRank = function ( f1_arg0 )
local f1_local0 = nil
if not f1_arg0 or f1_arg0 == CoD.PlayMode.Core or f1_arg0 == CoD.PlayMode.SquadVsSquad then
f1_local0 = tonumber( Engine.TableLookup( RankTable.File, 0, "maxrank", 1 ) )
assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (MP)" )
elseif f1_arg0 == CoD.PlayMode.Aliens then
f1_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, 0, "maxrank", 1 ) )
assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (ALIENS)" )
else
DebugPrint( "[WARNING] Rank.GetMaxRank() : Unsupported CodPlayMode [" .. f1_arg0 .. "]!" )
f1_local0 = 0
end
return f1_local0
end
Rank.GetRankDisplay = function ( f2_arg0, f2_arg1 )
local f2_local0 = nil
if not f2_arg1 or f2_arg1 == CoD.PlayMode.Core or f2_arg1 == CoD.PlayMode.SquadVsSquad then
f2_local0 = Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel )
elseif f2_arg1 == CoD.PlayMode.Aliens then
f2_local0 = Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel )
else
DebugPrint( "[WARNING] Rank.GetRankDisplay() : Unsupported CodPlayMode [" .. f2_arg1 .. "]!" )
f2_local0 = ""
end
return f2_local0
end
Rank.GetRankMinXP = function ( f3_arg0, f3_arg1 )
local f3_local0 = nil
if not f3_arg1 or f3_arg1 == CoD.PlayMode.Core or f3_arg1 == CoD.PlayMode.SquadVsSquad then
f3_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) )
elseif f3_arg1 == CoD.PlayMode.Aliens then
f3_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) )
else
DebugPrint( "[WARNING] Rank.GetRankMinXP() : Unsupported CodPlayMode [" .. f3_arg1 .. "]!" )
f3_local0 = 0
end
return f3_local0
end
Rank.GetRankMaxXP = function ( f4_arg0, f4_arg1 )
local f4_local0 = nil
if not f4_arg1 or f4_arg1 == CoD.PlayMode.Core or f4_arg1 == CoD.PlayMode.SquadVsSquad then
f4_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) )
assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (MP)" )
elseif f4_arg1 == CoD.PlayMode.Aliens then
f4_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) )
assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (ALIENS)" )
else
DebugPrint( "[WARNING] Rank.GetRankMaxXP() : Unsupported CodPlayMode [" .. f4_arg1 .. "]!" )
f4_local0 = 0
end
return f4_local0
end
Rank.GetRankXPToNext = function ( f5_arg0, f5_arg1 )
local f5_local0 = nil
if not f5_arg1 or f5_arg1 == CoD.PlayMode.Core or f5_arg1 == CoD.PlayMode.SquadVsSquad then
f5_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) )
elseif f5_arg1 == CoD.PlayMode.Aliens then
f5_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) )
else
DebugPrint( "[WARNING] Rank.GetRankXPToNext() : Unsupported CodPlayMode [" .. f5_arg1 .. "]!" )
f5_local0 = 0
end
return f5_local0
end
Rank.GetRankIcon = function ( f6_arg0, f6_arg1, f6_arg2 )
local f6_local0 = nil
if not f6_arg2 or f6_arg2 == CoD.PlayMode.Core or f6_arg2 == CoD.PlayMode.SquadVsSquad then
f6_local0 = Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 )
elseif f6_arg2 == CoD.PlayMode.Aliens then
f6_local0 = Engine.TableLookup( RankIconTable.AlienFile, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 )
else
DebugPrint( "[WARNING] Rank.GetRankIcon() : Unsupported CodPlayMode [" .. f6_arg2 .. "]!" )
f6_local0 = ""
end
return f6_local0
end
Rank.GetFullRank = function ( f7_arg0, f7_arg1 )
local f7_local0 = nil
if not f7_arg1 or f7_arg1 == CoD.PlayMode.Core or f7_arg1 == CoD.PlayMode.SquadVsSquad then
f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) )
elseif f7_arg1 == CoD.PlayMode.Aliens then
f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) )
else
DebugPrint( "[WARNING] Rank.GetFullRank() : Unsupported CodPlayMode [" .. f7_arg1 .. "]!" )
f7_local0 = ""
end
return f7_local0
end

View File

@ -0,0 +1,129 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function ExitVirtualKeyboard( f1_arg0, f1_arg1, f1_arg2 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
if f1_local0.exiting then
return
end
f1_local0.exiting = true
f1_arg0:dispatchEventToRoot( {
name = "exit_virtual_keyboard",
immediate = true
} )
if Engine.TriggerVirtualKeyboardCallback then
local f1_local1 = Engine.TriggerVirtualKeyboardCallback
local f1_local2 = f1_arg1.controller
local f1_local3 = f1_arg2
local f1_local4
if not f1_arg2 then
f1_local4 = f1_local0.input
if not f1_local4 then
else
f1_local1( f1_local2, f1_local3, f1_local4, f1_local0.verifyString or false )
end
end
f1_local4 = ""
end
end
function input_popup( f2_arg0, f2_arg1 )
local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" )
local f2_local1 = f2_arg1.keyboardType
if not f2_local1 then
f2_local1 = CoD.KeyboardInputTypes.Normal
end
local f2_local2
if f2_local1 == CoD.KeyboardInputTypes.Email then
f2_local2 = 1000
if not f2_local2 then
else
local f2_local3 = f2_local1 == CoD.KeyboardInputTypes.Password
local f2_local4 = f2_arg1.use_auto_align or false
local f2_local5 = LUI.MenuGenerics.generic_selectionList_popup( {}, {
popup_title = f2_arg1.title,
popup_width = f2_local2,
popup_childfeeder = function ()
return {
{
type = "generic_input_field",
id = "not_so_virtual_input",
requireFocusType = FocusType.MouseOver,
properties = {
keyboard_type = f2_local1,
password_field = f2_local3,
use_auto_align = f2_local4,
max_length = f2_local0.maxLength,
help_value = f2_local0.input,
field_edited_func = function ( f4_arg0, f4_arg1 )
local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 )
f4_local0.input = f4_arg1.text or ""
if f4_local0.exiting then
return
else
f4_arg1.controller = f4_local0.exclusiveController
ExitVirtualKeyboard( f4_arg0, f4_arg1, f4_arg1.cancelled )
LUI.FlowManager.RequestLeaveMenu( f4_arg0 )
end
end
,
additional_handlers = {
menu_create = MBh.EmitEvent( {
name = "button_action",
mouse = true
} ),
exit_virtual_keyboard = function ( f5_arg0, f5_arg1 )
f5_arg0:processEvent( {
name = "finish_editing"
} )
end
}
}
},
{
type = "UIGenericButton",
id = "input_ok",
audio = {
button_over = CoD.SFX.SubMenuMouseOver
},
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = Engine.Localize( "MENU_OK" ),
button_action_func = function ( f6_arg0, f6_arg1 )
ExitVirtualKeyboard( f6_arg0, f6_arg1, false )
LUI.FlowManager.RequestLeaveMenu( f6_arg0 )
end
}
}
}
end
} )
f2_local5:registerEventHandler( "popup_back", function ( element, event )
ExitVirtualKeyboard( element, event, true )
end )
f2_local5:dispatchEventToRoot( {
name = "virtual_keyboard_popup_active",
immediate = true
} )
return f2_local5
end
end
f2_local2 = nil
end
function virtual_keyboard( f8_arg0, f8_arg1 )
local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" )
f8_local0.input = f8_arg1.defaultText or ""
f8_local0.maxLength = f8_arg1.maxLength or 12
f8_local0.verifyString = f8_arg1.verifyString or false
return input_popup( f8_arg0, f8_arg1 )
end
LUI.MenuBuilder.registerType( "virtual_keyboard", virtual_keyboard )
LockTable( _M )

View File

@ -0,0 +1,372 @@
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 )
Kinect.CloseWhatCanISayMenu( f1_arg0, f1_arg1 )
end
function TitleFactory( f2_arg0, f2_arg1 )
return {
type = "UIText",
id = "text_whatcanisay_" .. tostring( f2_arg0 ),
properties = {
text = Engine.Localize( f2_arg1 )
},
states = {
default = {
height = CoD.TextSettings.ExtraBigFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Left,
width = 600,
r = 1,
g = 1,
b = 1
}
}
}
end
function BlankFactory( f3_arg0 )
return {
type = "UIText",
id = "text_whatcanisay_" .. tostring( f3_arg0 ),
properties = {
text = ""
},
states = {
default = {
height = 20,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Left,
width = 600,
r = 1,
g = 1,
b = 1
}
}
}
end
function TextFactory( f4_arg0, f4_arg1, f4_arg2 )
local f4_local0
if f4_arg2 then
f4_local0 = 200
if not f4_local0 then
else
return {
type = "UIText",
id = "text_whatcanisay_" .. tostring( f4_arg0 ),
properties = {
text = Engine.Localize( f4_arg1 )
},
states = {
default = {
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
width = f4_local0
}
}
}
end
end
f4_local0 = 370
end
function BigTextFactory( f5_arg0, f5_arg1 )
return {
type = "UIText",
id = "text_whatcanisay_" .. tostring( f5_arg0 ),
properties = {
text = Engine.Localize( f5_arg1 )
},
states = {
default = {
height = CoD.TextSettings.BigFont.Height,
font = CoD.TextSettings.BigFont.Font,
alignment = LUI.Alignment.Left,
width = 600
}
}
}
end
function DescFactory( f6_arg0, f6_arg1 )
return {
type = "UIText",
id = "text_whatcanisay_" .. tostring( f6_arg0 ),
properties = {
text = Engine.Localize( f6_arg1 )
},
states = {
default = {
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
width = 600,
red = 0.75,
green = 0.75,
blue = 0.75
}
}
}
end
function GrammarFeeder( f7_arg0 )
local f7_local0 = {}
if Engine.InFrontend() then
local f7_local1 = false
if Kinect.menu_under_what_can_i_say then
if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "main_lockout" ) then
f7_local1 = true
elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_brightness" ) then
f7_local1 = true
elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_screen_margins" ) then
f7_local1 = true
elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "no_profile_warning_popmenu" ) then
f7_local1 = true
end
end
if f7_local1 == true then
elseif Kinect.IsKinectGuideUp() then
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_KINECT_GUIDE_COMMANDS_CAPS" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_BACK", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_BACK_COMMAND" )
else
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUTS_1", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUTS_COMMAND" )
local f7_local2 = false
if Kinect.menu_under_what_can_i_say then
if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_lobby" ) then
f7_local2 = true
elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_privatelobby" ) then
f7_local2 = true
elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive" ) then
f7_local2 = true
end
end
if f7_local2 == true then
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_LOBBY_COMMANDS_CAPS" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" )
else
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COMPARE", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_COMPARE_COMMAND" )
end
end
end
elseif not Engine.IsMultiplayer() then
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GHOST_PAUSE_GHOST_PLAY", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_PAUSE_PLAY_COMMAND" )
local f7_local1 = Engine.GetDvarString( "mapname" )
if f7_local1 == "enemyhq" or f7_local1 == "nml" then
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_ATTACK_1", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_ATTACK_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_1", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_COMMAND" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BARK_1", true )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_BARK_COMMAND" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SPECIFIC_COMMMAND_CAPS" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_LOCATION_COMMAND" )
f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_DOOR" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WINDOW" )
if f7_local1 == "enemyhq" then
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COUNTER" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STAIRS" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STATUE" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WALKWAY" )
elseif f7_local1 == "nml" then
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BALCONY" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BRIDGE" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BUILDING" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CAR" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GARAGE" )
f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_TRAILER" )
end
end
end
if #f7_local0 == 0 then
if Engine.InFrontend() then
f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_FRONT_END" )
else
f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_IN_GAME" )
end
end
return f7_local0
end
function OptionsMainCreate( f8_arg0, f8_arg1 )
f8_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function what_can_i_say_vlist()
return {
type = "UIGrid",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 120,
right = -120,
top = 110,
bottom = -60
}
},
properties = {
elementsPerRow = 2,
hSpacing = 10,
rowHeight = 33,
hAlign = LUI.Alignment.Left,
vAlign = LUI.Alignment.Top
},
childrenFeeder = GrammarFeeder
}
end
function WhatCanISayHandleSpeechActionBack( f10_arg0, f10_arg1, f10_arg2 )
if Kinect.IsWhatCanISayMenuUp() then
f0_local0( f10_arg0, f10_arg1 )
LUI.Speech.PerformingSpeechAction()
end
end
if Engine.HasSpeechFeature() then
WhatCanISaySpeechGrammarHandlersArray = {
{
action = "back",
confidence = LUI.Speech.defaultConfidence,
handler = WhatCanISayHandleSpeechActionBack,
extradata = nil
},
{
action = "cancel",
confidence = LUI.Speech.defaultConfidence,
handler = WhatCanISayHandleSpeechActionBack,
extradata = nil
}
}
else
WhatCanISaySpeechGrammarHandlersArray = {}
end
function WhatCanISayHandleSpeechAction( f11_arg0, f11_arg1 )
if Engine.HasSpeechFeature() then
LUI.Speech.ProcessActionEvent( f11_arg0, f11_arg1, WhatCanISaySpeechGrammarHandlersArray )
end
end
function what_can_i_say()
return {
type = "UIElement",
id = "what_can_i_say_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
speech_action = WhatCanISayHandleSpeechAction
},
children = {
{
type = "UIWorldBlur",
id = "world_blur_id",
states = {
default = {
worldBlur = 5
}
}
},
{
type = "UIImage",
id = "options_background",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.95,
material = RegisterMaterial( "black" )
}
}
},
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@SPEECH_WHATCANISAY_CAPS" )
}
},
{
type = "what_can_i_say_vlist",
id = "what_can_i_say_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIBindButton",
id = "back_button",
handlers = {
button_start = f0_local0,
button_select = f0_local0,
button_secondary = f0_local0
}
}
}
}
end
LUI.MenuBuilder.registerDef( "what_can_i_say_vlist", what_can_i_say_vlist )
LUI.MenuBuilder.registerDef( "what_can_i_say", what_can_i_say )
LockTable( _M )

1
lui/default.dec.lua Normal file
View File

@ -0,0 +1 @@

124
lui/eventcatcher.dec.lua Normal file
View File

@ -0,0 +1,124 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
require( "LUI.CoD" )
f0_local0 = hashset( {
"keybind",
"action_slot_pressed",
"game_message",
"hide_host_migration",
"obituary",
"show_host_migration_triggered",
"toggle_pause",
"weapon_change",
"show_hud_menu",
"hide_hud_menu",
"playerstate_client_changed",
"close_rival_info",
"open_rival_info",
"camera_client_changed",
"refresh_options_button",
"update_mlg_prev_next",
"spectate_team_change"
} )
function isDirectDispatchEventType( f1_arg0 )
return f0_local0[f1_arg0]
end
function new()
local f2_local0 = {}
setmetatable( f2_local0, {
__index = _M
} )
f2_local0.direct_dispatch = {}
f2_local0.omnvar_update = {}
f2_local0.dvar_update = {}
return f2_local0
end
function setupRoot( f3_arg0, f3_arg1 )
f3_arg1:registerEventHandler( "omnvar_update", omnvarUpdateDispatcher )
f3_arg1:registerEventHandler( "dvar_update", dvarUpdateDispatcher )
for f3_local3, f3_local4 in pairs( f0_local0 ) do
f3_arg1:registerEventHandler( f3_local3, directDispatcher )
end
end
function registerOmnvarHandler( f4_arg0, f4_arg1, f4_arg2, f4_arg3 )
assert( type( f4_arg1 ) == "userdata" )
assert( type( f4_arg2 ) == "string" )
assert( type( f4_arg3 ) == "function" )
local f4_local0 = f4_arg0.omnvar_update
local f4_local1 = f4_arg0.omnvar_update[f4_arg2]
if not f4_local1 then
f4_local1 = setmetatable( {}, {
__mode = "k"
} )
end
f4_local0[f4_arg2] = f4_local1
f4_arg0.omnvar_update[f4_arg2][f4_arg1] = f4_arg3
end
function omnvarUpdateDispatcher( f5_arg0, f5_arg1 )
local f5_local0 = f5_arg0.eventCatcher.omnvar_update[f5_arg1.omnvar]
if f5_local0 then
for f5_local4, f5_local5 in pairs( f5_local0 ) do
if not f5_local4:isClosed() then
f5_local5( f5_local4, f5_arg1 )
end
end
end
end
function registerDvarHandler( f6_arg0, f6_arg1, f6_arg2, f6_arg3 )
assert( type( f6_arg1 ) == "userdata" )
assert( type( f6_arg2 ) == "string" )
assert( type( f6_arg3 ) == "function" )
if not f6_arg0.dvar_update[f6_arg2] then
assert( Engine.WatchDvar( f6_arg2 ), "failed to watch dvar" )
f6_arg0.dvar_update[f6_arg2] = setmetatable( {}, {
__mode = "k"
} )
end
f6_arg0.dvar_update[f6_arg2][f6_arg1] = f6_arg3
end
function dvarUpdateDispatcher( f7_arg0, f7_arg1 )
local f7_local0 = f7_arg0.eventCatcher.dvar_update[f7_arg1.dvar]
if f7_local0 then
for f7_local4, f7_local5 in pairs( f7_local0 ) do
if not f7_local4:isClosed() then
f7_local5( f7_local4, f7_arg1 )
end
end
end
end
function registerDirectDispatchHandler( f8_arg0, f8_arg1, f8_arg2, f8_arg3 )
assert( type( f8_arg1 ) == "userdata" )
assert( type( f8_arg2 ) == "string" )
assert( type( f8_arg3 ) == "function" )
local f8_local0 = f8_arg0.direct_dispatch
local f8_local1 = f8_arg0.direct_dispatch[f8_arg2]
if not f8_local1 then
f8_local1 = setmetatable( {}, {
__mode = "k"
} )
end
f8_local0[f8_arg2] = f8_local1
f8_arg0.direct_dispatch[f8_arg2][f8_arg1] = f8_arg3
end
function directDispatcher( f9_arg0, f9_arg1 )
local f9_local0 = f9_arg0.eventCatcher.direct_dispatch[f9_arg1.name]
if f9_local0 then
for f9_local4, f9_local5 in pairs( f9_local0 ) do
if not f9_local4:isClosed() then
assert( f9_local4.m_eventHandlers[f9_arg1.name] == f9_local5 )
f9_local5( f9_local4, f9_arg1 )
end
end
end
end
LockTable( _M )

1068
lui/flowmanager.dec.lua Normal file

File diff suppressed because it is too large Load Diff

405
lui/gamepadcontrols.dec.lua Normal file
View File

@ -0,0 +1,405 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function GamepadDisabledFunc( f1_arg0, f1_arg1 )
return not Engine.GetProfileData( "gpadEnabled" )
end
function OptionsWindowRefresh( f2_arg0, f2_arg1 )
if f2_arg1.source_input == "button_action" or f2_arg1.source_input == "key_bound" or f2_arg1.source_input == "button_right" or f2_arg1.source_input == "button_left" then
f2_arg0:processEvent( {
name = "menu_refresh"
} )
f2_arg0:processEvent( {
name = "refresh_content"
} )
end
end
function SinglePlayerDisableFunction( f3_arg0, f3_arg1 )
return not Engine.IsMultiplayer()
end
function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 )
f4_arg0:dispatchEventToRoot( {
name = "options_window_refresh",
source_input = f4_arg1.name,
immediate = true
} )
end
function OptionFactoryProfileData( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 )
local f5_local0 = Engine.GetProfileData( f5_arg0 )
local f5_local1 = 1
for f5_local5, f5_local6 in pairs( f5_arg3 ) do
if f5_local6.value == f5_local0 then
f5_local1 = f5_local5
break
end
end
f5_local2 = function ( f6_arg0, f6_arg1 )
Engine.ExecNow( f5_arg1 )
Engine.ExecNow( "profile_menuDvarsFinish" )
OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 )
if f5_arg6 and type( f5_arg6 ) == "function" then
f5_arg6( f6_arg0 )
end
end
f5_local3 = {
type = "UIGenericButton",
id = "option_" .. f5_arg0,
disabledFunc = f5_arg4 or function ()
return false
end
}
f5_local4 = {
variant = GenericButtonSettings.Variants.Select
}
if f5_arg5 then
local f5_local7 = f5_arg2
end
f5_local4.button_text = f5_local7 or Engine.Localize( f5_arg2 )
f5_local4.button_display_func = function ( f8_arg0, f8_arg1 )
return Engine.Localize( f5_arg3[f5_local1].text )
end
f5_local4.button_left_func = function ( f9_arg0, f9_arg1 )
f5_local1 = 1 + (#f5_arg3 + f5_local1 - 1 - 1) % #f5_arg3
f5_local2( f9_arg0, f9_arg1 )
end
f5_local4.button_right_func = function ( f10_arg0, f10_arg1 )
f5_local1 = 1 + (f5_local1 - 1 + 1) % #f5_arg3
f5_local2( f10_arg0, f10_arg1 )
end
f5_local3.properties = f5_local4
f5_local3.handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" )
}
return f5_local3
end
function SliderOptionFactory( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4, f11_arg5 )
local f11_local0 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 )
Engine.SetDvarFloat( f11_arg0, math.min( f12_arg1, math.max( f12_arg0, Engine.GetDvarFloat( f11_arg0 ) + f12_arg2 ) ) )
Engine.ExecNow( "profile_menuDvarsFinish" )
OptionsWindowTriggerRefresh( f12_arg3, f12_arg4 )
end
return {
type = "UIGenericButton",
id = "options_" .. f11_arg0,
disabledFunc = f11_arg5 or function ()
return false
end
,
properties = {
button_text = Engine.Localize( f11_arg1 ),
variant = GenericButtonSettings.Variants.Slider,
button_display_func = function ( f14_arg0, f14_arg1 )
return (Engine.GetDvarFloat( f11_arg0 ) - f11_arg2) / (f11_arg3 - f11_arg2)
end
,
button_left_func = function ( f15_arg0, f15_arg1 )
f11_local0( f11_arg2, f11_arg3, -f11_arg4, f15_arg0, f15_arg1 )
end
,
button_right_func = function ( f16_arg0, f16_arg1 )
f11_local0( f11_arg2, f11_arg3, f11_arg4, f16_arg0, f16_arg1 )
end
},
handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" )
}
}
end
function GetButtonsLayoutName()
local f17_local0 = Engine.GetProfileData( "gpadButtonsConfig" )
if f17_local0 == "buttons_default" then
return Engine.Localize( "@MENU_DEFAULT" )
elseif f17_local0 == "buttons_tactical" then
return Engine.Localize( "@MENU_TACTICAL" )
elseif f17_local0 == "buttons_lefty" then
return Engine.Localize( "@MENU_LEFTY" )
elseif f17_local0 == "buttons_nomad" then
return Engine.Localize( "@MENU_NOMAD" )
elseif f17_local0 == "buttons_nomad_tactical" then
return Engine.Localize( "@MENU_NOMAD_TACTICAL" )
elseif f17_local0 == "buttons_default_alt" then
return Engine.Localize( "@MENU_DEFAULT_ALT" )
elseif f17_local0 == "buttons_tactical_alt" then
return Engine.Localize( "@MENU_TACTICAL_ALT" )
elseif f17_local0 == "buttons_lefty_alt" then
return Engine.Localize( "@MENU_LEFTY_ALT" )
elseif f17_local0 == "buttons_nomad_alt" then
return Engine.Localize( "@MENU_NOMAD_ALT" )
else
return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" )
end
end
function ButtonsLayoutAction( f18_arg0, f18_arg1 )
LUI.FlowManager.RequestAddMenu( f18_arg0, "buttons", true, f18_arg1.controller, false )
end
function GetSticksLayoutName()
local f19_local0 = Engine.GetProfileData( "gpadSticksConfig" )
if f19_local0 == "thumbstick_default" then
return Engine.Localize( "@MENU_DEFAULT" )
elseif f19_local0 == "thumbstick_southpaw" then
return Engine.Localize( "@MENU_SOUTHPAW" )
elseif f19_local0 == "thumbstick_legacy" then
return Engine.Localize( "@MENU_LEGACY" )
elseif f19_local0 == "thumbstick_southpaw_ns" then
return Engine.Localize( "@MENU_SOUTHPAW_NS" )
elseif f19_local0 == "thumbstick_legacysouthpaw_ns" then
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" )
else
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" )
end
end
function SticksLayoutAction( f20_arg0, f20_arg1 )
LUI.FlowManager.RequestAddMenu( f20_arg0, "thumbstick", true, f20_arg1.controller, false )
end
function GetSensitivityText()
local f21_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" )
if f21_local0 == 1 then
return Engine.Localize( "@MENU_LOW" ) .. " " .. f21_local0
elseif f21_local0 == 3 then
return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f21_local0
elseif f21_local0 == 7 then
return Engine.Localize( "@MENU_HIGH" ) .. " " .. f21_local0
elseif f21_local0 == 13 then
return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f21_local0
elseif f21_local0 == 20 then
return Engine.Localize( "@MENU_INSANE" ) .. " " .. f21_local0
else
return f21_local0 .. ""
end
end
function SensitivityChange( f22_arg0, f22_arg1 )
Engine.SetDvarFloat( "profileMenuOption_sensitivity", math.min( 20, math.max( 1, Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + f22_arg1 ) ) )
Engine.MenuDvarsFinish( f22_arg0 )
end
function OnToggleGPadEnabled( f23_arg0 )
LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() )
Engine.Exec( "updategamerprofile" )
f23_arg0:dispatchEventToRoot( {
name = "refresh_button_helper",
dispatchChildren = true
} )
end
function OptionsFeeder( f24_arg0 )
local f24_local0 = {}
Engine.ExecNow( "profile_menuDvarsSetup" )
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "gpadEnabled", "profile_toggleEnableGamepad", "LUA_MENU_GAMEPAD", {
{
text = "@LUA_MENU_DISABLED",
value = false
},
{
text = "@LUA_MENU_ENABLED",
value = true
}
}, nil, nil, OnToggleGPadEnabled )
f24_local0[#f24_local0 + 1] = {
type = "UIGenericButton",
id = "stick_layout_button_id",
disabledFunc = GamepadDisabledFunc,
properties = {
variant = GenericButtonSettings.Variants.Info,
button_text = Engine.Localize( "MENU_THUMBSTICK_LAYOUT" ),
button_display_func = GetSticksLayoutName,
button_action_func = SticksLayoutAction
}
}
f24_local0[#f24_local0 + 1] = {
type = "UIGenericButton",
id = "buttons_layout_button_id",
disabledFunc = GamepadDisabledFunc,
properties = {
variant = GenericButtonSettings.Variants.Info,
button_text = Engine.Localize( "MENU_BUTTON_LAYOUT" ),
button_display_func = GetButtonsLayoutName,
button_action_func = ButtonsLayoutAction
}
}
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "invertedPitch", "profile_toggleInvertedPitch", "MENU_LOOK_INVERSION", {
{
text = "@LUA_MENU_DISABLED",
value = false
},
{
text = "@LUA_MENU_ENABLED",
value = true
}
}, GamepadDisabledFunc )
f24_local0[#f24_local0 + 1] = {
type = "UIGenericButton",
id = "sensitivity_button_id",
disabledFunc = GamepadDisabledFunc,
properties = {
variant = GenericButtonSettings.Variants.Select,
button_text = Engine.Localize( "MENU_LOOK_SENSITIVITY" ),
button_display_func = GetSensitivityText,
button_left_func = function ( f25_arg0, f25_arg1 )
return SensitivityChange( f24_arg0.exclusiveController, -1 )
end,
button_right_func = function ( f26_arg0, f26_arg1 )
return SensitivityChange( f24_arg0.exclusiveController, 1 )
end
}
}
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "rumble", "profile_toggleRumble", "MENU_CONTROLLER_VIBRATION", {
{
text = "@LUA_MENU_DISABLED",
value = false
},
{
text = "@LUA_MENU_ENABLED",
value = true
}
}, GamepadDisabledFunc )
if SinglePlayerDisableFunction() then
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "autoAim", "profile_toggleAutoAim", "MENU_AIM_ASSIST", {
{
text = "@LUA_MENU_DISABLED",
value = false
},
{
text = "@LUA_MENU_ENABLED",
value = true
}
}, GamepadDisabledFunc )
end
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "LUA_MENU_LEAN_TOGGLE", {
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
}, GamepadDisabledFunc )
if Engine.IsDevelopmentBuild() then
f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "useDevKeyboard", "profile_toggleDevKeyboard", "DEBUG_KEYBOARD", {
{
text = "@LUA_MENU_DISABLED",
value = false
},
{
text = "@LUA_MENU_ENABLED",
value = true
}
}, GamepadDisabledFunc, true )
end
return f24_local0
end
function OptionsMainCreate( f27_arg0, f27_arg1 )
f27_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function OptionsMainClose( f28_arg0, f28_arg1 )
Engine.Exec( "updategamerprofile" )
end
function gamepad_controls_vlist()
return {
type = "UIStencil",
children = {
{
type = "UIVerticalList",
childrenFeeder = OptionsFeeder,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -25,
top = 0,
bottom = 0
}
}
}
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right_wide,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom
}
},
handlers = {}
}
end
function gamepad_controls()
return {
type = "UIElement",
id = "gamepad_controls_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
menu_close = OptionsMainClose,
options_window_refresh = OptionsWindowRefresh
},
children = {
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_GAMEPAD" )
}
},
{
type = "gamepad_controls_vlist",
id = "gamepad_controls_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIBindButton",
id = "back_button",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
end
LUI.MenuBuilder.registerDef( "gamepad_controls_vlist", gamepad_controls_vlist )
LUI.MenuBuilder.registerDef( "gamepad_controls", gamepad_controls )
LockTable( _M )

288
lui/gamex.dec.lua Normal file
View File

@ -0,0 +1,288 @@
if not GameX then
GameX = {}
end
GameX.GetPlayerOpposingTeam = function ( f1_arg0 )
local f1_local0 = f1_arg0
if not f1_local0 then
f1_local0 = Game.GetPlayerTeam()
if GameX.IsSpectatingNotOnTeam( f1_local0 ) then
f1_local0 = spectatorFakeTeam
end
end
local f1_local1 = otherTeamLookup[f1_local0]
if not f1_local1 then
f1_local1 = 0
end
return f1_local1
end
GameX.gameModeIsFFA = function ( f2_arg0 )
local f2_local0 = f2_arg0 or Engine.GetDvarString( "ui_gametype" )
if f2_local0 == "dm" or f2_local0 == "sotf_ffa" or f2_local0 == "gun" or f2_local0 == "mugger" or f2_local0 == "adrn" or f2_local0 == "assn" or f2_local0 == "fo" or f2_local0 == "sna" then
return true
elseif f2_local0 == "cranked" then
return Engine.GetDvarInt( "scr_cranked_teambased" ) == 0
else
return false
end
end
GameX.GetTeamName = function ( f3_arg0 )
local f3_local0 = {
"free",
"axis",
"allies"
}
return f3_local0[f3_arg0 + 1]
end
GameX.GetFactionName = function ( f4_arg0 )
local f4_local0 = {
"free",
"federation",
"ghosts"
}
return f4_local0[f4_arg0 + 1]
end
GameX.IsSpectatingNotOnTeam = function ( f5_arg0 )
local f5_local0
if not (Game.IsSpectating() or Game.GetOmnvar( "ui_session_state" ) == "spectator") or (f5_arg0 or Game.GetPlayerTeam()) ~= Teams.spectator then
f5_local0 = false
else
f5_local0 = true
end
return f5_local0
end
GameX.IsHardcoreMode = function ()
return Engine.GetDvarBool( "g_hardcore" )
end
GameX.IsRankedMatch = function ()
return Engine.GetDvarBool( "onlinegame" ) and not Engine.GetDvarBool( "xblive_privatematch" )
end
GameX.IsOnlineMatch = function ()
local f8_local0 = Engine.GetDvarBool( "onlinegame" )
if not f8_local0 then
f8_local0 = Engine.GetDvarBool( "xblive_privatematch" )
end
return f8_local0
end
GameX.GetGameMode = function ()
return Engine.GetDvarString( "ui_gametype" )
end
GameX.GetNumPlayerSlotsForFinalScoreboard = function ( f10_arg0, f10_arg1 )
local f10_local0 = GameX.IsRankedMatch() and Engine.GetDvarInt( "party_maxplayers" ) or 0
local f10_local1 = Game.GetNumPlayersOnTeam( f10_arg0 )
if GameX.gameModeIsFFA( f10_arg1 ) then
assert( f10_arg0 == Teams.free )
return math.max( 1, math.max( f10_local1, f10_local0 ) )
elseif f10_arg1 == "infect" then
if f10_arg0 == Teams.allies then
return math.max( 0, f10_local1 )
else
local f10_local2 = Game.GetNumPlayersOnTeam( GameX.GetPlayerOpposingTeam( f10_arg0 ) )
local f10_local3 = f10_local0 - f10_local2
if f10_local1 + f10_local2 == 0 then
return 1
else
return math.max( 0, math.max( f10_local1, f10_local3 ) )
end
end
elseif f10_arg1 == "horde" then
if f10_arg0 == Teams.allies then
return math.max( 4, math.max( f10_local1, f10_local0 ) )
else
return math.max( 0, f10_local1 )
end
end
local f10_local2 = assert
local f10_local3
if f10_arg0 ~= Teams.axis and f10_arg0 ~= Teams.allies then
f10_local3 = false
else
f10_local3 = true
end
f10_local2( f10_local3 )
return math.max( 1, math.max( f10_local1, f10_local0 / 2 ) )
end
GameX.GetPlayerScoreInfoAtRankForGameMode = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 )
local f11_local0 = Game.GetPlayerScoreInfoAtRank( f11_arg0, f11_arg1 )
if not f11_local0 then
return nil
end
local f11_local1 = 99
local f11_local2 = 99
if f11_arg2 == "horde" then
f11_local1 = 999
f11_local2 = 999
end
f11_local0.score = math.min( 9999, f11_local0.score )
f11_local0.kills = math.min( f11_local1, f11_local0.kills )
f11_local0.deaths = math.min( 99, f11_local0.deaths )
f11_local0.assists = math.min( f11_local2, f11_local0.assists )
f11_local0.prestige = f11_local0.prestige or 0
if not (f11_arg2 ~= "dm" and (f11_arg2 ~= "cranked" or not GameX.gameModeIsFFA( f11_arg2 ))) or f11_arg2 == "sotf_ffa" then
local f11_local3 = Game.GetOmnvar( "ui_game_type_kill_value" )
if not f11_local3 then
f11_local0.extrascore0 = 0
else
f11_local0.extrascore0 = math.min( 9999, f11_local0.score * f11_local3 )
end
elseif f11_arg2 == "horde" then
f11_local0.extrascore0 = math.min( 999, f11_local0.extrascore0 )
elseif f11_arg2 == "infect" then
f11_local0.time = CoD.FormatInfectedTime( f11_local0.extrascore0, f11_arg3 )
else
f11_local0.extrascore0 = math.min( 99, f11_local0.extrascore0 )
end
return f11_local0
end
GameX.GetScreenDims = function ()
local f12_local0 = {}
local f12_local1 = Engine.GetLuiRoot()
f12_local0 = f12_local1:getCurrentGlobalRect()
return f12_local0[3], f12_local0[4]
end
GameX.GetScreenWidth = function ()
local f13_local0 = {}
local f13_local1 = Engine.GetLuiRoot()
f13_local0 = f13_local1:getCurrentGlobalRect()
return f13_local0[3]
end
GameX.GetScreenHeight = function ()
local f14_local0 = {}
local f14_local1 = Engine.GetLuiRoot()
f14_local0 = f14_local1:getCurrentGlobalRect()
return f14_local0[4]
end
GameX.GetSafeZoneSize = function ( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg0 or SliderBounds.HorzMargin.Min
local f15_local1 = f15_arg1 or SliderBounds.VertMargin.Min
local f15_local2, f15_local3 = GameX.GetScreenDims()
local f15_local4 = f15_local2 * (1 - f15_local0) / 2
local f15_local5 = f15_local3 * (1 - f15_local1) / 2
local f15_local6 = Engine.SplitscreenPlayerCount()
assert( f15_local6 <= MaxLocalClients )
local f15_local7 = assert
local f15_local8
if f15_local6 ~= 1 and f15_local6 ~= 2 then
f15_local8 = false
else
f15_local8 = true
end
f15_local7( f15_local8 )
if f15_local6 == 2 then
f15_local5 = f15_local5 * 2
f15_local7 = Engine.GetCurrentLocalClient()
assert( f15_local7 and f15_local7 < MaxLocalClients )
if f15_local7 == 0 then
return f15_local4, f15_local5, -f15_local4, 0
else
return f15_local4, 0, -f15_local4, -f15_local5
end
else
return f15_local4, f15_local5, -f15_local4, -f15_local5
end
end
GameX.GetAdjustedSafeZoneSize = function ()
return GameX.GetSafeZoneSize( Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ), Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) )
end
GameX.IsSplitscreen = function ()
local f17_local0 = Engine.SplitscreenPlayerCount()
local f17_local1 = assert
local f17_local2
if f17_local0 and f17_local0 > MaxLocalClients then
f17_local2 = false
else
f17_local2 = true
end
f17_local1( f17_local2 )
return f17_local0 > 1
end
OptionState = {
Locked = false
}
GameX.IsOptionStateLocked = function ()
return OptionState.Locked
end
GameX.SetOptionState = function ( f19_arg0 )
OptionState.Locked = f19_arg0
end
GameX.GetTeamNameOverride = function ( f20_arg0 )
if not MLG.IsMLGSpectator() then
return nil
elseif MatchRules.IsUsingMatchRulesData() then
local f20_local0 = nil
if f20_arg0 == Teams.allies then
f20_local0 = "ghostsTeamName"
elseif f20_arg0 == Teams.axis then
f20_local0 = "fedTeamName"
end
local f20_local1 = MatchRules.GetData( "commonOption", f20_local0 )
if f20_local1 and f20_local1 ~= "" then
return f20_local1
end
end
return nil
end
GameX.GetLocalizedTeamName = function ( f21_arg0 )
if f21_arg0 ~= Teams.allies and f21_arg0 ~= Teams.axis then
return nil
else
local f21_local0 = GameX.GetTeamNameOverride( f21_arg0 )
if f21_local0 and f21_local0 ~= "" then
return f21_local0
elseif f21_arg0 == Teams.allies then
return Engine.Localize( "LUA_MENU_ALLIES_CAPS" )
elseif f21_arg0 == Teams.axis then
return Engine.Localize( "LUA_MENU_AXIS_CAPS" )
else
end
end
end
GameX.GetLocalizedTeamNameMixedCase = function ( f22_arg0 )
if f22_arg0 ~= Teams.allies and f22_arg0 ~= Teams.axis then
return nil
else
local f22_local0 = GameX.GetTeamNameOverride( f22_arg0 )
if f22_local0 and f22_local0 ~= "" then
return f22_local0
elseif f22_arg0 == Teams.allies then
return Engine.Localize( "MP_GHOSTS_NAME" )
elseif f22_arg0 == Teams.axis then
return Engine.Localize( "MP_FEDERATION_NAME" )
else
end
end
end
GameX.UsesFakeLoadout = function ()
local f23_local0 = GameX.GetGameMode()
local f23_local1
if f23_local0 ~= "sotf" and f23_local0 ~= "sotf_ffa" and f23_local0 ~= "infect" and f23_local0 ~= "gun" and f23_local0 ~= "horde" then
f23_local1 = false
else
f23_local1 = true
end
return f23_local1
end

215
lui/hudmanager.dec.lua Normal file
View File

@ -0,0 +1,215 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
require( "LUI.CoD" )
if Engine.HasSpeechFeature() then
require( "LUI.Speech" )
end
f0_local0 = nil
function new()
local f1_local0 = {}
setmetatable( f1_local0, {
__index = _M
} )
return f1_local0
end
function setupRoot( f2_arg0, f2_arg1 )
f2_arg1:registerEventHandler( "init_hud", hudRootEventHandler( initHud ) )
f2_arg1:registerEventHandler( "close_hud", closeHudHandler )
f2_arg1:registerEventHandler( "intermission_began", hudRootEventHandler( beginIntermission ) )
f2_arg1:registerEventHandler( "post_game_begin", hudRootEventHandler( openRoundEndScreen ) )
f2_arg1:registerEventHandler( "round_end_show", hudRootEventHandler( openRoundEndScreen ) )
f2_arg1:registerEventHandler( "show_host_migration", showHostMigrationHandler )
end
function registerHud( f3_arg0 )
f0_local0 = f3_arg0
end
function initHud( f4_arg0, f4_arg1, f4_arg2 )
if not f0_local0 then
return
elseif not f4_arg0.hudContainer then
f4_arg0.hudContainer = LUI.UIElement.new( {
left = 0,
right = 0,
top = 0,
bottom = 0,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true
} )
f4_arg0.hudContainer.id = "hudContainer"
local f4_local0 = function ()
end
f4_arg0.hudContainer:registerEventHandler( "mousemove", f4_local0 )
f4_arg0.hudContainer:registerEventHandler( "mousedown", f4_local0 )
f4_arg0.hudContainer:registerEventHandler( "mouseup", f4_local0 )
f4_arg0.hudContainer:registerEventHandler( "gamepad_button", f4_local0 )
f4_arg0.hudContainer:registerEventHandler( "gamepad_sticks", f4_local0 )
f4_arg0.hudContainer:registerEventHandler( "keybind", f4_local0 )
f4_arg0.hudContainer:setPriority( LUI.UIRoot.childPriorities.hudContainer )
f4_arg2:addElement( f4_arg0.hudContainer )
if not f4_arg2.m_hudElemLayer then
local f4_local1 = LUI.UIElement.new( {
left = 0,
right = 0,
top = 0,
bottom = 0,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true
} )
f4_local1:setHudElemLayer()
f4_local1:setPriority( LUI.UIRoot.childPriorities.hudElems )
f4_arg2:addElement( f4_local1 )
f4_arg2.m_hudElemLayer = f4_local1
end
end
if not GameX.GetScreenWidth() then
LUI.UIRoot.ProcessEvent( f4_arg2, {
name = "init_hud"
} )
return
end
if Engine.IsMultiplayer() and not Engine.HasSnapshot() then
LUI.UIRoot.ProcessEvent( f4_arg2, {
name = "init_hud"
} )
return
elseif not f4_arg0.hud then
run_gc()
profile.beginuserevent( "hud_create" )
local f4_local1 = LUI.MenuBuilder.buildMenu( f0_local0 )
profile.enduserevent( "hud_create" )
run_gc()
f4_arg0.hud = f4_local1
f4_arg0.hudContainer.hud = f4_local1
f4_arg0.hudContainer:addElement( f4_local1 )
f4_local1:processEvent( {
name = "menu_create",
dispatchChildren = true
} )
if Engine.HasSpeechFeature() then
Kinect.EnableGlobalGrammars()
end
collectgarbage( "collect" )
end
local f4_local1 = Engine.IsMultiplayer()
if f4_local1 then
f4_local1 = MLG.IsMLGSpectator()
end
if f4_local1 then
if not f4_arg0.MLGHud then
f4_arg0.MLGHud = LUI.mp_hud.MLGHud.MLGHud( f4_arg0.hudContainer )
f4_arg0.MLGHud:setPriority( LUI.UIRoot.childPriorities.MLGHud )
f4_arg2:addElement( f4_arg0.MLGHud )
f4_arg0.MLGHud:processEvent( {
name = "menu_create",
dispatchChildren = true
} )
f4_arg0.hudContainer:registerEventHandler( "gamepad_button", LUI.UIElement.GamepadButton )
end
MLG.SetMLGActiveMenu()
f4_arg0.MLGHud:processEvent( {
name = "init_hud",
dispatchChildren = true
} )
end
end
function closeHud( f6_arg0, f6_arg1, f6_arg2 )
if f6_arg0.hud then
f6_arg0.hud:processEvent( {
name = "menu_close",
dispatchChildren = true
} )
f6_arg0.hud:close()
f6_arg0.hud = nil
if f6_arg0.hudContainer then
f6_arg0.hudContainer.hud = nil
end
end
if f6_arg0.MLGHud then
f6_arg0.MLGHud:processEvent( {
name = "menu_close",
dispatchChildren = true
} )
f6_arg0.MLGHud:close()
f6_arg0.MLGHud = nil
end
end
function closeRoundEndScreen( f7_arg0, f7_arg1, f7_arg2 )
if f7_arg0.roundEndScreen then
f7_arg0.roundEndScreen:processEvent( {
name = "menu_close"
} )
f7_arg0.roundEndScreen:close()
f7_arg0.roundEndScreen = nil
end
end
function endIntermission( f8_arg0, f8_arg1, f8_arg2 )
if f8_arg0.finalScoresScreen then
f8_arg0.finalScoresScreen:processEvent( {
name = "menu_close"
} )
f8_arg0.finalScoresScreen:close()
f8_arg0.finalScoresScreen = nil
end
end
function beginIntermission( f9_arg0, f9_arg1, f9_arg2 )
f9_arg0:closeHud( f9_arg1, f9_arg2 )
f9_arg0:closeRoundEndScreen( f9_arg1, f9_arg2 )
if Engine.GetDvarBool( "squad_match" ) then
Engine.SetDvarBool( "squad_find_match", true )
Engine.SetDvarBool( "squad_send_results", true )
Squad.PostMatch( Engine.GetClientMatchData( "alliesScore" ), Engine.GetClientMatchData( "axisScore" ), Engine.GetClientMatchData( "alliesKills" ), Engine.GetClientMatchData( "alliesDeaths" ), false )
end
if not f9_arg0.finalScoresScreen then
f9_arg0.finalScoresScreen = LUI.MenuBuilder.BuildAddChild( f9_arg2, {
type = "scoreboard"
} )
f9_arg0.finalScoresScreen:setPriority( LUI.UIRoot.childPriorities.finalScoresScreen )
end
end
function openRoundEndScreen( f10_arg0, f10_arg1, f10_arg2 )
if not f10_arg0.roundEndScreen then
f10_arg0.roundEndScreen = LUI.MenuBuilder.BuildAddChild( f10_arg2, {
type = "roundEndHudDef"
} )
f10_arg0.roundEndScreen:setPriority( LUI.UIRoot.childPriorities.roundEndHud )
end
end
function hudRootEventHandler( f11_arg0 )
return function ( f12_arg0, f12_arg1 )
f11_arg0( f12_arg0.hudManager, f12_arg1, f12_arg0 )
end
end
function closeHudHandler( f13_arg0, f13_arg1 )
local f13_local0 = f13_arg0.hudManager
if f13_local0 then
f13_local0:closeHud( f13_arg1, f13_arg0 )
f13_local0:endIntermission( f13_arg1, f13_arg0 )
end
end
function showHostMigrationHandler( f14_arg0, f14_arg1 )
LUI.FlowManager.RequestAddMenu( nil, "host_migration_main" )
f14_arg0:dispatchEventToRoot( {
name = "show_host_migration_triggered"
} )
end
LockTable( _M )

300
lui/lookcontrols.dec.lua Normal file
View File

@ -0,0 +1,300 @@
local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function SinglePlayerDisableFunction( f1_arg0, f1_arg1 )
return not Engine.IsMultiplayer()
end
function GetDisplay( f2_arg0 )
return Engine.GetBinding( f2_arg0 )
end
function bindKey( f3_arg0 )
Engine.BindKey( f3_arg0 )
end
function OptionsWindowRefresh( f4_arg0, f4_arg1 )
if f4_arg1.source_input == "button_action" or f4_arg1.source_input == "key_bound" then
f4_arg0:processEvent( {
name = "menu_refresh"
} )
f4_arg0:processEvent( {
name = "refresh_content"
} )
end
end
function OptionsWindowTriggerRefresh( f5_arg0, f5_arg1 )
f5_arg0:dispatchEventToRoot( {
name = "options_window_refresh",
source_input = f5_arg1.name,
immediate = true
} )
end
function ControlBindFactory( f6_arg0, f6_arg1 )
return {
type = "UIGenericButton",
id = "bind_" .. f6_arg1,
properties = {
variant = GenericButtonSettings.Variants.Info,
button_text = Engine.Localize( f6_arg0 ),
button_display_func = function ( f7_arg0, f7_arg1 )
return GetDisplay( f6_arg1 )
end
,
button_action_func = function ( f8_arg0, f8_arg1 )
Engine.BindKey( f6_arg1 )
OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 )
end
},
handlers = {
element_refresh = MBh.EmitEvent( "content_refresh" ),
key_bound = OptionsWindowTriggerRefresh
}
}
end
function OptionFactory( f9_arg0, f9_arg1, f9_arg2 )
local f9_local0 = nil
local f9_local1 = 1
local f9_local2 = Engine.GetDvarType( f9_arg0 )
if f9_local2 == DvarTypeTable.DvarString then
f9_local0 = Engine.GetDvarString( f9_arg0 )
elseif f9_local2 == DvarTypeTable.DvarInt then
f9_local0 = Engine.GetDvarInt( f9_arg0 )
elseif f9_local2 == DvarTypeTable.DvarBool then
f9_local0 = Engine.GetDvarBool( f9_arg0 )
end
for f9_local6, f9_local7 in pairs( f9_arg2 ) do
if f9_local7.value == f9_local0 then
f9_local1 = f9_local6
break
end
end
f9_local3 = function ( f10_arg0, f10_arg1 )
if f9_arg0 == "ui_mousePitch" then
if Engine.GetDvarBool( f9_arg0 ) then
Engine.SetDvarFloat( "m_pitch", MousePitchTable.PitchFloat )
else
Engine.SetDvarFloat( "m_pitch", -MousePitchTable.PitchFloat )
end
end
if f9_local2 == DvarTypeTable.DvarString then
Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value )
elseif f9_local2 == DvarTypeTable.DvarInt then
Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value )
elseif f9_local2 == DvarTypeTable.DvarBool then
Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value )
end
end
return {
type = "UIGenericButton",
id = "option_" .. f9_arg0,
properties = {
variant = GenericButtonSettings.Variants.Select,
button_text = Engine.Localize( f9_arg1 ),
button_display_func = function ( f11_arg0, f11_arg1 )
return Engine.Localize( f9_arg2[f9_local1].text )
end
,
button_left_func = function ( f12_arg0, f12_arg1 )
f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2
f9_local3( f12_arg0, f12_arg1 )
end
,
button_right_func = function ( f13_arg0, f13_arg1 )
f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2
f9_local3( f13_arg0, f13_arg1 )
end
}
}
end
function SliderOptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 )
local f14_local0 = function ( f15_arg0, f15_arg1, f15_arg2 )
Engine.SetDvarFloat( f14_arg0, math.min( f15_arg1, math.max( f15_arg0, Engine.GetDvarFloat( f14_arg0 ) + f15_arg2 ) ) )
Engine.ExecNow( "profile_menuDvarsFinish" )
end
return {
type = "UIGenericButton",
id = "options_" .. f14_arg0,
properties = {
button_text = Engine.Localize( f14_arg1 ),
variant = GenericButtonSettings.Variants.Slider,
button_display_func = function ( f16_arg0, f16_arg1 )
return (Engine.GetDvarFloat( f14_arg0 ) - f14_arg2) / (f14_arg3 - f14_arg2)
end
,
button_left_func = function ( f17_arg0, f17_arg1 )
f14_local0( f14_arg2, f14_arg3, -f14_arg4 )
end
,
button_right_func = function ( f18_arg0, f18_arg1 )
f14_local0( f14_arg2, f14_arg3, f14_arg4 )
end
,
button_over_func = MBh.EmitEventToRoot( "brightness_over" ),
button_up_func = MBh.EmitEventToRoot( "brightness_up" )
}
}
end
function OptionsFeeder( f19_arg0 )
local f19_local0 = {}
local f19_local1 = {}
Engine.ExecNow( "profile_menuDvarsSetup" )
f19_local0[#f19_local0 + 1] = SliderOptionFactory( "sensitivity", "@MENU_MOUSE_SENSITIVITY", SliderBounds.MouseSensitivity.Min, SliderBounds.MouseSensitivity.Max, SliderBounds.MouseSensitivity.Step )
if SinglePlayerDisableFunction() then
f19_local1 = {
{
text = "@LUA_MENU_YES",
value = true
},
{
text = "@LUA_MENU_NO",
value = false
}
}
else
f19_local1 = {
{
text = "@LUA_MENU_YES",
value = "1"
},
{
text = "@LUA_MENU_NO",
value = "0"
}
}
end
f19_local0[#f19_local0 + 1] = OptionFactory( "ui_mousePitch", "@MENU_INVERT_MOUSE", f19_local1 )
f19_local0[#f19_local0 + 1] = OptionFactory( "m_filter", "@MENU_SMOOTH_MOUSE", {
{
text = "@LUA_MENU_YES",
value = true
},
{
text = "@LUA_MENU_NO",
value = false
}
} )
f19_local0[#f19_local0 + 1] = OptionFactory( "cl_freelook", "@MENU_FREE_LOOK", {
{
text = "@LUA_MENU_YES",
value = true
},
{
text = "@LUA_MENU_NO",
value = false
}
} )
f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_UP", "+lookup" )
f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_DOWN", "+lookdown" )
f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_HOLD_MOUSE_LOOK", "+mlook" )
f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_CENTER_VIEW", "centerview" )
return f19_local0
end
function OptionsMainCreate( f20_arg0, f20_arg1 )
f20_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
end
function OptionsMainClose( f21_arg0, f21_arg1 )
Engine.ExecNow( "profile_menuDvarsFinish" )
Engine.Exec( "updategamerprofile" )
end
function look_controls_vlist()
return {
type = "UIStencil",
children = {
{
type = "UIVerticalList",
childrenFeeder = OptionsFeeder,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -25,
top = 0,
bottom = 0
}
}
}
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = GenericMenuDims.menu_left,
right = GenericMenuDims.menu_right_wide,
top = GenericMenuDims.menu_top,
bottom = GenericMenuDims.menu_bottom
}
},
handlers = {
options_window_refresh = OptionsWindowRefresh
}
}
end
function look_controls()
return {
type = "UIElement",
id = "look_controls_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = OptionsMainCreate,
menu_close = OptionsMainClose
},
children = {
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_LOOK" )
}
},
{
type = "look_controls_vlist",
id = "look_controls_vlist_id"
},
{
type = "button_helper_text_main",
id = "button_helper_text_id"
},
{
type = "UIBindButton",
id = "back_button",
handlers = {
button_secondary = MBh.LeaveMenu()
}
}
}
}
end
LUI.MenuBuilder.registerDef( "look_controls_vlist", look_controls_vlist )
LUI.MenuBuilder.registerDef( "look_controls", look_controls )
LockTable( _M )

289
lui/lui.dec.lua Normal file
View File

@ -0,0 +1,289 @@
LUI = {
roots = {},
Alignment = {
None = 0,
Left = 1,
Center = 2,
Right = 3,
Top = 4,
Middle = 5,
Bottom = 6
},
savedMenuStates = {},
ActiveScoped = nil
}
if not Engine.IsDevelopmentBuild() then
function print()
end
function printf()
end
end
LUI.CachedEvents = {
process_events = {
name = "process_events",
immediate = true
},
transition_complete = {
name = "transistion_complete_default",
lateness = 0
},
gamepad_button = {
name = "gamepad_button",
controller = 0,
button = "primary",
down = true,
immediate = true
}
}
function DisableGlobals()
local f3_local0 = getmetatable( _G )
if not f3_local0 then
f3_local0 = {}
setmetatable( _G, f3_local0 )
end
f3_local0.__newindex = function ( f4_arg0, f4_arg1, f4_arg2 )
error( "LUI Error: Tried to create global variable " .. f4_arg1, 2 )
end
end
function LockTable( f5_arg0 )
local f5_local0 = getmetatable( f5_arg0 )
if not f5_local0 then
f5_local0 = {}
setmetatable( f5_arg0, f5_local0 )
end
f5_local0.__newindex = function ( f6_arg0, f6_arg1, f6_arg2 )
error( "LUI Error: Tried to create module variable " .. f6_arg1, 2 )
end
end
function InheritFrom( f7_arg0 )
if not f7_arg0 then
error( "LUI Error: Did not specify base class in InheritFrom!" )
end
local f7_local0 = {}
setmetatable( f7_local0, {
__index = f7_arg0
} )
f7_local0.m_eventHandlers = {}
setmetatable( f7_local0.m_eventHandlers, {
__index = f7_arg0.m_eventHandlers
} )
return f7_local0
end
if nil ~= hpairs then
pairs = hpairs
end
LUI.ShallowCopy = function ( f8_arg0 )
local f8_local0 = {}
for f8_local4, f8_local5 in pairs( f8_arg0 ) do
f8_local0[f8_local4] = f8_local5
end
return f8_local0
end
LUI.ConcatenateToTable = function ( f9_arg0, f9_arg1 )
if f9_arg1 == nil then
return
end
for f9_local3, f9_local4 in ipairs( f9_arg1 ) do
table.insert( f9_arg0, f9_local4 )
end
end
LUI.RemoveSingleItemFromArray = function ( f10_arg0, f10_arg1 )
for f10_local0 = 1, #f10_arg0, 1 do
if f10_arg0[f10_local0] == f10_arg1 then
table.remove( f10_arg0, f10_local0 )
break
end
end
end
LUI.IsItemInArray = function ( f11_arg0, f11_arg1 )
for f11_local0 = 1, #f11_arg0, 1 do
if f11_arg0[f11_local0] == f11_arg1 then
return true
end
end
return false
end
LUI.ReverseTable = function ( f12_arg0 )
local f12_local0 = #f12_arg0
local f12_local1 = {}
for f12_local5, f12_local6 in ipairs( f12_arg0 ) do
f12_local1[f12_local0 - f12_local5 + 1] = f12_local6
end
return f12_local1
end
LUI.clamp = function ( f13_arg0, f13_arg1, f13_arg2 )
if f13_arg0 < f13_arg1 then
return f13_arg1
elseif f13_arg2 < f13_arg0 then
return f13_arg2
else
return f13_arg0
end
end
LUI.FormatAnimStateFinishEvent = function ( f14_arg0 )
return "transition_complete_" .. f14_arg0
end
LUI.MakeFlyOverAnimationState = function ( f15_arg0, f15_arg1 )
assert( f15_arg0 )
assert( f15_arg1 )
local f15_local0, f15_local1, f15_local2, f15_local3 = f15_arg0:getCurrentGlobalRect()
local f15_local4, f15_local5, f15_local6, f15_local7 = f15_arg1:getCurrentGlobalRect()
local f15_local8 = f15_local4 - f15_local0
local f15_local9 = f15_local6 - f15_local2
local f15_local10 = f15_local5 - f15_local1
local f15_local11 = f15_local7 - f15_local3
local f15_local12, f15_local13, f15_local14, f15_local15 = f15_arg0:getLocalRect()
local f15_local16, f15_local17, f15_local18, f15_local19 = f15_arg0:GetAnchorData()
return {
topAnchor = f15_local17,
bottomAnchor = f15_local19,
leftAnchor = f15_local16,
rightAnchor = f15_local18,
top = f15_local13 + f15_local10,
bottom = f15_local15 + f15_local11,
left = f15_local12 + f15_local8,
right = f15_local14 + f15_local9
}
end
LUI.Debug = {}
LargestElements = {}
LargestElementsSize = {}
LargestElementsCount = {}
if debug then
debug.postdeploymentfunction = function ()
for f16_local3, f16_local4 in pairs( LUI.roots ) do
f16_local4.debugReload = true
end
end
end
function LUITestFunction()
DebugPrint( "Running LUITestFunction()" )
end
function CountFieldsHelper( f18_arg0, f18_arg1 )
if f18_arg1[f18_arg0] then
return
end
f18_arg1[f18_arg0] = true
local f18_local0 = 0
for f18_local4, f18_local5 in pairs( f18_arg0 ) do
if type( f18_local4 ) == "table" then
f18_local0 = f18_local0 + CountFieldsHelper( f18_local4, f18_arg1 )
end
f18_local0 = f18_local0 + 1
end
return f18_local0
end
function CountFields( f19_arg0 )
return CountFieldsHelper( f19_arg0, {} )
end
function CountReferencesHelper( f20_arg0, f20_arg1 )
if f20_arg1[f20_arg0] then
return
end
f20_arg1[f20_arg0] = true
if type( f20_arg0 ) == "userdata" then
local f20_local0 = getmetatable( f20_arg0 )
if not f20_local0 then
return
end
f20_arg0 = f20_local0.__index
if not f20_arg0 then
return
elseif type( f20_arg0 ) == "table" and f20_arg0.id then
local f20_local1 = CountFields( f20_arg0 )
if not LargestElementsSize[f20_arg0.id] or LargestElementsSize[f20_arg0.id] < f20_local1 then
LargestElements[f20_arg0.id] = f20_arg0
LargestElementsSize[f20_arg0.id] = f20_local1
end
if not LargestElementsCount[f20_arg0.id] then
LargestElementsCount[f20_arg0.id] = 0
end
LargestElementsCount[f20_arg0.id] = LargestElementsCount[f20_arg0.id] + 1
end
end
if type( f20_arg0 ) ~= "table" then
return
end
for f20_local3, f20_local4 in pairs( f20_arg0 ) do
CountReferencesHelper( f20_local4, f20_arg1 )
end
end
function CountReferences( f21_arg0 )
local f21_local0 = {
[f21_arg0] = true
}
if type( f21_arg0 ) == "userdata" then
local f21_local1 = getmetatable( f21_arg0 )
if not f21_local1 then
return 0
end
f21_arg0 = f21_local1.__index
if not f21_arg0 then
return 0
end
end
if type( f21_arg0 ) ~= "table" then
return 0
end
for f21_local4, f21_local5 in pairs( f21_arg0 ) do
CountReferencesHelper( f21_local5, f21_local0 )
end
f21_local1 = 0
for f21_local5, f21_local6 in pairs( f21_local0 ) do
f21_local1 = f21_local1 + 1
end
return f21_local1
end
require( "LUI.LUIElement" )
require( "LUI.LUIRoot" )
require( "LUI.LUITimer" )
require( "LUI.LUIButtonRepeater" )
require( "LUI.LUIImage" )
require( "LUI.LUILitImage" )
require( "LUI.LUIText" )
require( "LUI.LUIAnimNumber" )
require( "LUI.LUITightText" )
require( "LUI.LUIButton" )
require( "LUI.LUIBindButton" )
require( "LUI.LUIMouseCursor" )
require( "LUI.LUIVerticalList" )
require( "LUI.LUIScrollingVerticalList" )
require( "LUI.LUIHorizontalList" )
require( "LUI.LUIBarrelList" )
require( "LUI.LUIGrid" )
require( "LUI.LUIScrollable" )
require( "LUI.LUIVerticalScrollbar" )
require( "LUI.LUISafeAreaOverlay" )
require( "LUI.LUICountdown" )
require( "LUI.LUILongCountdown" )
require( "LUI.LUITechyDigits" )
require( "LUI.LUIPrettyNumber" )
require( "LUI.LUICharacterWindow" )
require( "LUI.FlowManager" )
require( "LUI.HudManager" )
require( "LUI.MenuBuilder" )
require( "LUI.LUIMarqueeText" )
MBh = LUI.MenuBuilder.helpers

56
lui/luianimnumber.dec.lua Normal file
View File

@ -0,0 +1,56 @@
LUI.UIAnimNumber = {}
LUI.UIAnimNumber.new = function ( f1_arg0 )
local self = LUI.UIText.new( f1_arg0 )
self.setNumber = LUI.UIAnimNumber.SetNumber
self.setLocalizedString = LUI.UIAnimNumber.SetLocalizedString
self.layout = LUI.UIAnimNumber.Layout
return self
end
LUI.UIAnimNumber.SetNumber = function ( f2_arg0, f2_arg1, f2_arg2 )
if f2_arg2 == nil or f2_arg0.currentNumber == nil then
f2_arg0.currentNumber = f2_arg1
f2_arg0:setText( f2_arg1 )
return
else
f2_arg0.startingNumber = f2_arg0.currentNumber
f2_arg0.numberChange = f2_arg1 - f2_arg0.startingNumber
f2_arg0.timeLeft = f2_arg2
f2_arg0.duration = f2_arg2
f2_arg0:setLayoutCached( false )
end
end
LUI.UIAnimNumber.SetLocalizedString = function ( f3_arg0, f3_arg1 )
f3_arg0.localizedString = f3_arg1
end
LUI.UIAnimNumber.Layout = function ( f4_arg0, f4_arg1 )
local f4_local0 = true
if f4_arg0.timeLeft ~= nil then
local f4_local1 = f4_arg0.timeLeft - f4_arg1.deltaTime
local f4_local2 = nil
if f4_local1 < 0 then
f4_local2 = f4_arg0.startingNumber + f4_arg0.numberChange
f4_arg0.startingNumber = nil
f4_arg0.numberChange = nil
f4_arg0.timeLeft = nil
f4_arg0.duration = nil
else
f4_arg0.timeLeft = f4_local1
f4_local2 = math.floor( f4_arg0.startingNumber + f4_arg0.numberChange * (1 - f4_local1 / f4_arg0.duration) + 0.5 )
end
local f4_local3 = f4_arg0.localizedString
if f4_local3 ~= nil then
f4_arg0:setText( Engine.Localize( f4_local3, f4_local2 ) )
else
f4_arg0:setText( f4_local2 )
end
f4_arg0.currentNumber = f4_local2
f4_local0 = false
end
f4_local0 = f4_arg0:updateElementLayout( f4_arg1 ) and f4_local0
f4_arg0:layoutChildren( f4_arg1 )
f4_arg0:setLayoutCached( f4_local0 )
end

295
lui/luibarrellist.dec.lua Normal file
View File

@ -0,0 +1,295 @@
LUI.UIBarrelList = {}
LUI.UIBarrelList.build = function ( f1_arg0, f1_arg1 )
return LUI.UIBarrelList.new( nil, f1_arg1 )
end
LUI.UIBarrelList.new = function ( menu, controller )
local self = LUI.UIElement.new( menu )
self.id = "UIBarrelList"
if not controller then
controller = {}
end
self.animSpeed = controller.anim_speed or 60
self.listOffset = controller.list_offset or 0
self.onUpdateFunc = controller.on_update_func
self.onScrollFunc = controller.on_scroll_func
local hList = LUI.UIHorizontalList.new( menu )
hList:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = self.listOffset,
spacing = controller.spacing or 0
} )
hList:animateToState( "default" )
self:addElement( hList )
self.hList = hList
self:registerEventHandler( "gain_focus", LUI.UIBarrelList.gainFocus )
self.addElement = LUI.UIBarrelList.AddElement
self.removeElement = LUI.UIBarrelList.RemoveElement
self.increment = LUI.UIBarrelList.IncrementIndex
self.decrement = LUI.UIBarrelList.DecrementIndex
self.getCurrentIndex = LUI.UIBarrelList.GetCurrentIndex
self.handleGamepadButton = LUI.UIBarrelList.handleGamepadButton
self.setupForAnimation = LUI.UIBarrelList.SetupForAnimation
self.manualUpdate = LUI.UIBarrelList.UpdateList
self:makeFocusable()
self.currentIndex = 0
return self
end
LUI.UIBarrelList.AddElement = function ( f3_arg0, f3_arg1 )
if f3_arg0.usingAnimation then
DebugPrint( "WARNING: Adding an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" )
end
f3_arg0.hList:addElement( f3_arg1 )
LUI.UIBarrelList.UpdateList( f3_arg0 )
end
LUI.UIBarrelList.RemoveElement = function ( f4_arg0, f4_arg1 )
if f4_arg0.usingAnimation then
DebugPrint( "WARNING: Removing an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" )
end
f4_arg0.hList:removeElement( f4_arg1 )
LUI.UIBarrelList.UpdateList( f4_arg0 )
end
LUI.UIBarrelList.UpdateList = function ( f5_arg0 )
local f5_local0 = f5_arg0.hList:getNumChildren()
local f5_local1 = f5_arg0.hList:getFirstChild()
local f5_local2 = math.floor( f5_local0 / 2 )
for f5_local3 = 0, f5_local0 - 1, 1 do
f5_local1:processEvent( {
name = "barrel_index_update",
index = f5_arg0.currentIndex - f5_local2 - f5_local3
} )
f5_local1 = f5_local1:getNextSibling()
end
if f5_arg0.onUpdateFunc then
f5_arg0:onUpdateFunc( f5_arg0.currentIndex )
end
return false
end
LUI.UIBarrelList.gainFocus = function ( f6_arg0 )
f6_arg0:setFocus( true )
local f6_local0 = f6_arg0.hList:getNumChildren()
local f6_local1 = f6_arg0.hList:getFirstChild()
local f6_local2 = math.floor( f6_local0 / 2 )
for f6_local3 = 1, f6_local2, 1 do
local f6_local6 = f6_local3
f6_local1 = f6_local1:getNextSibling()
end
f6_arg0.focusedChild = f6_local1
f6_local1:processEvent( {
name = "barrel_list_focus"
} )
return true
end
LUI.UIBarrelList.handleGamepadButton = function ( f7_arg0, f7_arg1 )
if not f7_arg0:isInFocus() or not f7_arg1.down then
return false
end
local f7_local0 = false
if f7_arg1.button == "primary" then
if not f7_arg0.isAnimating then
f7_arg0.focusedChild:processEvent( {
name = "barrel_list_action",
index = f7_arg0.currentIndex,
controller = f7_arg1.controller
} )
end
f7_local0 = true
elseif f7_arg1.button == "left" then
if not f7_arg0.isAnimating then
LUI.UIBarrelList.DecrementIndex( f7_arg0 )
end
f7_local0 = true
elseif f7_arg1.button == "right" then
if not f7_arg0.isAnimating then
LUI.UIBarrelList.IncrementIndex( f7_arg0 )
end
f7_local0 = true
elseif f7_arg1.button == "alt1" then
if not f7_arg0.isAnimating then
f7_arg0.focusedChild:processEvent( {
name = "barrel_list_button_alt1",
index = f7_arg0.currentIndex,
controller = f7_arg1.controller
} )
end
f7_local0 = true
end
return f7_local0
end
LUI.UIBarrelList.IncrementIndex = function ( f8_arg0 )
f8_arg0.currentIndex = f8_arg0.currentIndex + 1
if f8_arg0.usingAnimation then
f8_arg0:animateToState( "shift_left", f8_arg0.animSpeed, true, true )
f8_arg0.rightCap:processEvent( {
name = "barrel_index_update",
index = f8_arg0.currentIndex + math.floor( f8_arg0.hList:getNumChildren() / 2 ),
barrelList = f8_arg0
} )
f8_arg0:dispatchEventToChildren( {
name = "barrel_anim_start",
barrelList = f8_arg0,
movingLeft = true
} )
if f8_arg0.onScrollFunc then
f8_arg0:onScrollFunc()
end
f8_arg0:dispatchEventToChildren( {
name = "barrel_list_unfocus"
} )
f8_arg0.isAnimating = true
else
LUI.UIBarrelList.UpdateList( f8_arg0 )
end
end
LUI.UIBarrelList.DecrementIndex = function ( f9_arg0 )
f9_arg0.currentIndex = f9_arg0.currentIndex - 1
if f9_arg0.usingAnimation then
f9_arg0:animateToState( "shift_right", f9_arg0.animSpeed, true, true )
f9_arg0.leftCap:processEvent( {
name = "barrel_index_update",
index = f9_arg0.currentIndex - math.floor( f9_arg0.hList:getNumChildren() / 2 ),
barrelList = f9_arg0
} )
f9_arg0:dispatchEventToChildren( {
name = "barrel_anim_start",
barrelList = f9_arg0,
movingRight = true
} )
if f9_arg0.onScrollFunc then
f9_arg0:onScrollFunc()
end
f9_arg0:dispatchEventToChildren( {
name = "barrel_list_unfocus"
} )
f9_arg0.isAnimating = true
else
LUI.UIBarrelList.UpdateList( f9_arg0 )
end
end
LUI.UIBarrelList.GetCurrentIndex = function ( f10_arg0 )
return f10_arg0.currentIndex
end
LUI.UIBarrelList.ScrollFinished = function ( f11_arg0, f11_arg1 )
f11_arg0:animateToState( "default", 0 )
f11_arg0.isAnimating = false
end
LUI.UIBarrelList.OnDefaultState = function ( f12_arg0, f12_arg1 )
local f12_local0 = f12_arg0.hList:getNumChildren()
local f12_local1 = f12_arg0.hList:getFirstChild()
local f12_local2 = math.floor( f12_local0 / 2 )
for f12_local3 = 0, f12_local0 - 1, 1 do
if f12_local3 == f12_local2 then
f12_local1:processEvent( {
name = "barrel_list_focus"
} )
end
f12_local1 = f12_local1:getNextSibling()
end
LUI.UIBarrelList.UpdateList( f12_arg0 )
f12_arg0:dispatchEventToChildren( {
name = "barrel_default_state"
} )
end
LUI.UIBarrelList.CreateCap = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6, f13_arg7, f13_arg8 )
local f13_local0 = f13_arg0( f13_arg2 )
f13_local0.id = f13_arg1
f13_local0:registerAnimationState( "default", {
topAnchor = f13_arg7.topAnchor,
bottomAnchor = f13_arg7.bottomAnchor,
leftAnchor = f13_arg7.leftAnchor,
rightAnchor = f13_arg7.rightAnchor,
top = f13_arg3,
bottom = f13_arg4,
left = f13_arg5,
right = f13_arg6
} )
f13_local0:animateToState( "default", 0 )
for f13_local4, f13_local5 in pairs( f13_arg8 ) do
f13_local0:registerEventHandler( f13_local4, f13_local5 )
end
return f13_local0
end
LUI.UIBarrelList.SetupForAnimation = function ( f14_arg0, f14_arg1, f14_arg2, f14_arg3 )
local f14_local0 = f14_arg0.hList:getNumChildren()
local f14_local1 = f14_arg0.hList:getFirstChild()
local f14_local2 = f14_local1.properties
if f14_arg3 then
f14_arg0:setUseStencil( false )
else
f14_arg0:setUseStencil( true )
end
if f14_arg2 then
for f14_local6, f14_local7 in pairs( f14_arg2 ) do
f14_local2[f14_local6] = f14_local7
end
end
local f14_local3, f14_local4, f14_local5, f14_local6 = f14_local1:getLocalRect()
local f14_local7, f14_local8, f14_local9, f14_local10 = f14_local1:GetAnchorData()
local f14_local11 = {
leftAnchor = f14_local7,
topAnchor = f14_local8,
rightAnchor = f14_local9,
bottomAnchor = f14_local10
}
local f14_local12 = f14_local5 - f14_local3
local f14_local13 = -(f14_local12 + f14_arg0.properties.spacing + f14_arg0.listOffset)
f14_arg0.leftCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_left_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers )
f14_local13 = (f14_local12 + f14_arg0.properties.spacing) * f14_local0 + f14_arg0.listOffset
f14_arg0.rightCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_right_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers )
LUI.UIElement.addElement( f14_arg0, f14_arg0.leftCap )
LUI.UIElement.addElement( f14_arg0, f14_arg0.rightCap )
f14_local3, f14_local4, f14_local5, f14_local6 = f14_arg0:getLocalRect()
f14_local7, f14_local8, f14_local9, f14_local10 = f14_arg0:GetAnchorData()
local f14_local14 = f14_arg0
local f14_local15 = f14_arg0.registerAnimationState
local f14_local16 = "shift_right"
local f14_local17 = {
topAnchor = f14_local8,
bottomAnchor = f14_local10,
leftAnchor = f14_local7
}
local f14_local18 = f14_local9
f14_local17.top = f14_local4
f14_local17.bottom = f14_local6
f14_local17.left = f14_local3 + f14_local12 + f14_arg0.properties.spacing
f14_local17.right = 0
f14_local17[1] = f14_local18
f14_local15( f14_local14, f14_local16, f14_local17 )
f14_local14 = f14_arg0
f14_local15 = f14_arg0.registerAnimationState
f14_local16 = "shift_left"
f14_local17 = {
topAnchor = f14_local8,
bottomAnchor = f14_local10,
leftAnchor = f14_local7
}
f14_local18 = f14_local9
f14_local17.top = f14_local4
f14_local17.bottom = f14_local6
f14_local17.left = f14_local3 - f14_local12 - f14_arg0.properties.spacing
f14_local17.right = 0
f14_local17[1] = f14_local18
f14_local15( f14_local14, f14_local16, f14_local17 )
f14_arg0:registerEventHandler( "transition_complete_shift_left", LUI.UIBarrelList.ScrollFinished )
f14_arg0:registerEventHandler( "transition_complete_shift_right", LUI.UIBarrelList.ScrollFinished )
f14_arg0:registerEventHandler( "transition_complete_default", LUI.UIBarrelList.OnDefaultState )
f14_arg0.usingAnimation = true
end

105
lui/luibindbutton.dec.lua Normal file
View File

@ -0,0 +1,105 @@
LUI.UIBindButton = {}
LUI.UIBindButton.GamepadButton = function ( f1_arg0, f1_arg1 )
if f1_arg0:handleGamepadButton( f1_arg1 ) then
return true
elseif f1_arg0.m_ownerController ~= nil and f1_arg0.m_ownerController ~= f1_arg1.controller then
DebugPrint( "Item Exclusive to controller " .. f1_arg1.controller )
return false
elseif f1_arg1.down == true then
local f1_local0 = false
local f1_local1 = {
controller = f1_arg1.controller,
qualifier = f1_arg1.qualifier
}
if not f1_arg0.disabled then
f1_local0 = true
if f1_arg1.button == "secondary" then
f1_local1.name = "button_secondary"
elseif f1_arg1.button == "alt1" then
f1_local1.name = "button_alt1"
elseif f1_arg1.button == "alt2" then
f1_local1.name = "button_alt2"
elseif f1_arg1.button == "right_trigger" then
f1_local1.name = "button_right_trigger"
elseif f1_arg1.button == "left_trigger" then
f1_local1.name = "button_left_trigger"
elseif f1_arg1.button == "shoulderr" then
f1_local1.name = "button_shoulderr"
elseif f1_arg1.button == "shoulderl" then
f1_local1.name = "button_shoulderl"
elseif f1_arg1.button == "right_stick" then
f1_local1.name = "button_right_stick"
elseif f1_arg1.button == "left_stick" then
f1_local1.name = "button_left_stick"
elseif f1_arg1.button == "left" then
f1_local1.name = "button_left"
elseif f1_arg1.button == "right" then
f1_local1.name = "button_right"
elseif f1_arg1.button == "up" then
f1_local1.name = "button_up"
elseif f1_arg1.button == "down" then
f1_local1.name = "button_down"
elseif f1_arg1.button == "start" then
f1_local1.name = "button_start"
elseif f1_arg1.button == "select" then
f1_local1.name = "button_select"
elseif f1_arg1.button == "options" then
f1_local1.name = "button_options"
else
f1_local0 = false
end
end
if f1_local0 and f1_arg0:processEvent( f1_local1 ) then
if f1_arg0.actionSFX then
Engine.PlaySound( f1_arg0.actionSFX )
end
return true
end
end
return f1_arg0:dispatchEventToChildren( f1_arg1 )
end
LUI.UIBindButton.ElementEnable = function ( f2_arg0, f2_arg1 )
f2_arg0.disabled = nil
end
LUI.UIBindButton.ElementDisable = function ( f3_arg0, f3_arg1 )
f3_arg0.disabled = true
end
LUI.UIBindButton.Enable = function ( f4_arg0 )
f4_arg0:processEvent( {
name = "enable",
dispatchChildren = true
} )
end
LUI.UIBindButton.Disable = function ( f5_arg0 )
f5_arg0:processEvent( {
name = "disable",
dispatchChildren = true
} )
end
LUI.UIBindButton.SetActionSFX = function ( f6_arg0, f6_arg1 )
f6_arg0.actionSFX = f6_arg1
end
LUI.UIBindButton.build = function ( f7_arg0, f7_arg1 )
return LUI.UIBindButton.new()
end
LUI.UIBindButton.new = function ( menu, controller )
local self = LUI.UIElement.new( menu )
self.id = "LUIBindButton"
self.enable = LUI.UIBindButton.Enable
self.disable = LUI.UIBindButton.Disable
self.setActionSFX = LUI.UIBindButton.SetActionSFX
self:registerEventHandlerIfFree( "enable", LUI.UIBindButton.ElementEnable )
self:registerEventHandlerIfFree( "disable", LUI.UIBindButton.ElementDisable )
self:registerEventHandlerIfFree( "popup_active", LUI.UIBindButton.ElementDisable )
self:registerEventHandlerIfFree( "popup_inactive", LUI.UIBindButton.ElementEnable )
self:registerEventHandler( "gamepad_button", LUI.UIBindButton.GamepadButton )
return self
end

415
lui/luibutton.dec.lua Normal file
View File

@ -0,0 +1,415 @@
LUI.UIButton = {}
LUI.UIButton.popupActive = function ( f1_arg0, f1_arg1 )
f1_arg0.m_ignoreMouseFocus = true
end
LUI.UIButton.popupInactive = function ( f2_arg0, f2_arg1 )
f2_arg0.m_ignoreMouseFocus = nil
end
LUI.UIButton.MouseEnter = function ( f3_arg0, f3_arg1 )
if f3_arg0.m_leftMouseDown == nil then
if f3_arg0:canFocus( FocusType.MouseOver ) and not f3_arg0:isInFocus() then
if f3_arg0.disabled then
f3_arg0:processEvent( {
name = "button_over_disable"
} )
else
f3_arg0:processEvent( {
name = "button_over",
controller = f3_arg1.controller
} )
end
end
elseif f3_arg0.m_leftMouseDown ~= nil then
f3_arg0:processEvent( {
name = "button_over_down"
} )
end
end
LUI.UIButton.MouseLeave = function ( f4_arg0, f4_arg1 )
if f4_arg0.m_leftMouseDown == nil then
if f4_arg0.m_focusable and not f4_arg0:isInFocus() then
if f4_arg0.disabled then
f4_arg0:processEvent( {
name = "button_disable"
} )
else
f4_arg0:processEvent( {
name = "button_up"
} )
end
end
else
f4_arg0:processEvent( {
name = "button_down"
} )
end
end
LUI.UIButton.LeftMouseDown = function ( f5_arg0, f5_arg1 )
f5_arg0:processEvent( {