1143 lines
33 KiB
Lua
1143 lines
33 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
function GetToggleTextForProfileData( f1_arg0, f1_arg1 )
|
|
return Engine.GetProfileData( f1_arg0, f1_arg1 ) and Engine.Localize( "@LUA_MENU_ENABLED" ) or Engine.Localize( "@LUA_MENU_DISABLED" )
|
|
end
|
|
|
|
function GetReverseToggleTextForProfileData( f2_arg0, f2_arg1 )
|
|
return Engine.GetProfileData( f2_arg0, f2_arg1 ) and Engine.Localize( "@LUA_MENU_DISABLED" ) or Engine.Localize( "@LUA_MENU_ENABLED" )
|
|
end
|
|
|
|
function ProfileMenuOption( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 )
|
|
Engine.SetDvarFloat( f3_arg4, math.min( f3_arg2, math.max( f3_arg1, Engine.GetDvarFloat( f3_arg4 ) + f3_arg3 ) ) )
|
|
Engine.MenuDvarsFinish( f3_arg0 )
|
|
end
|
|
|
|
function GetSticksLayoutName( f4_arg0 )
|
|
local f4_local0 = Engine.GetProfileData( "gpadSticksConfig", f4_arg0 )
|
|
if f4_local0 == "thumbstick_default" then
|
|
return Engine.Localize( "@MENU_DEFAULT" )
|
|
elseif f4_local0 == "thumbstick_southpaw" then
|
|
return Engine.Localize( "@MENU_SOUTHPAW" )
|
|
elseif f4_local0 == "thumbstick_legacy" then
|
|
return Engine.Localize( "@MENU_LEGACY" )
|
|
elseif f4_local0 == "thumbstick_southpaw_ns" then
|
|
return Engine.Localize( "@MENU_SOUTHPAW_NS" )
|
|
elseif f4_local0 == "thumbstick_legacysouthpaw_ns" then
|
|
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" )
|
|
else
|
|
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" )
|
|
end
|
|
end
|
|
|
|
function SticksLayoutAction( f5_arg0, f5_arg1 )
|
|
LUI.FlowManager.RequestAddMenu( f5_arg0, "thumbstick", true, f5_arg1.controller, false )
|
|
end
|
|
|
|
function GetButtonsLayoutName( f6_arg0 )
|
|
local f6_local0 = Engine.GetProfileData( "gpadButtonsConfig", f6_arg0 )
|
|
if f6_local0 == "buttons_default" then
|
|
return Engine.Localize( "@MENU_DEFAULT" )
|
|
elseif f6_local0 == "buttons_tactical" then
|
|
return Engine.Localize( "@MENU_TACTICAL" )
|
|
elseif f6_local0 == "buttons_lefty" then
|
|
return Engine.Localize( "@MENU_LEFTY" )
|
|
elseif f6_local0 == "buttons_nomad" then
|
|
return Engine.Localize( "@MENU_NOMAD" )
|
|
elseif f6_local0 == "buttons_nomad_tactical" then
|
|
return Engine.Localize( "@MENU_NOMAD_TACTICAL" )
|
|
elseif f6_local0 == "buttons_default_alt" then
|
|
return Engine.Localize( "@MENU_DEFAULT_ALT" )
|
|
elseif f6_local0 == "buttons_tactical_alt" then
|
|
return Engine.Localize( "@MENU_TACTICAL_ALT" )
|
|
elseif f6_local0 == "buttons_lefty_alt" then
|
|
return Engine.Localize( "@MENU_LEFTY_ALT" )
|
|
elseif f6_local0 == "buttons_nomad_alt" then
|
|
return Engine.Localize( "@MENU_NOMAD_ALT" )
|
|
else
|
|
return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" )
|
|
end
|
|
end
|
|
|
|
function ButtonsLayoutAction( f7_arg0, f7_arg1 )
|
|
LUI.FlowManager.RequestAddMenu( f7_arg0, "buttons", true, f7_arg1.controller, false )
|
|
end
|
|
|
|
function LookInversionToggle( f8_arg0 )
|
|
Engine.ToggleInvertedPitch( f8_arg0 )
|
|
end
|
|
|
|
function GetLookInversionText( f9_arg0 )
|
|
return GetToggleTextForProfileData( "invertedPitch", f9_arg0 )
|
|
end
|
|
|
|
function VibrationToggle( f10_arg0 )
|
|
Engine.ToggleRumble( f10_arg0 )
|
|
end
|
|
|
|
function GetVibrationText( f11_arg0 )
|
|
return GetToggleTextForProfileData( "rumble", f11_arg0 )
|
|
end
|
|
|
|
function GetSensitivityText()
|
|
local f12_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" )
|
|
if f12_local0 == 1 then
|
|
return Engine.Localize( "@MENU_LOW" ) .. " " .. f12_local0
|
|
elseif f12_local0 == 3 then
|
|
return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f12_local0
|
|
elseif f12_local0 == 7 then
|
|
return Engine.Localize( "@MENU_HIGH" ) .. " " .. f12_local0
|
|
elseif f12_local0 == 13 then
|
|
return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f12_local0
|
|
elseif f12_local0 == 20 then
|
|
return Engine.Localize( "@MENU_INSANE" ) .. " " .. f12_local0
|
|
else
|
|
return f12_local0 .. ""
|
|
end
|
|
end
|
|
|
|
function SensitivityLess( f13_arg0 )
|
|
ProfileMenuOption( f13_arg0, 1, 20, -1, "profileMenuOption_sensitivity" )
|
|
end
|
|
|
|
function SensitivityMore( f14_arg0 )
|
|
ProfileMenuOption( f14_arg0, 1, 20, 1, "profileMenuOption_sensitivity" )
|
|
end
|
|
|
|
function LeanToggle( f15_arg0 )
|
|
Engine.ToggleLean( f15_arg0 )
|
|
end
|
|
|
|
function GetLeanToggleText( f16_arg0 )
|
|
return GetToggleTextForProfileData( "leanEnabled", f16_arg0 )
|
|
end
|
|
|
|
function RenderColorBlindToggle( f17_arg0 )
|
|
if Engine.ToggleRenderColorBlind then
|
|
Engine.ToggleRenderColorBlind( f17_arg0 )
|
|
end
|
|
end
|
|
|
|
function GetRenderColorBlindText( f18_arg0 )
|
|
if Engine.ToggleRenderColorBlind then
|
|
return GetToggleTextForProfileData( "renderColorBlind", f18_arg0 )
|
|
else
|
|
return Engine.Localize( "@LUA_MENU_DISABLED" )
|
|
end
|
|
end
|
|
|
|
function SubtitlesToggle( f19_arg0 )
|
|
Engine.SetSubtitlesEnabled( f19_arg0, not Engine.SubtitlesEnabled( f19_arg0 ) )
|
|
end
|
|
|
|
function GetSubtitlesText( f20_arg0 )
|
|
return GetToggleTextForProfileData( "subtitles", f20_arg0 )
|
|
end
|
|
|
|
function AimAssistToggle( f21_arg0 )
|
|
Engine.ToggleAutoAim( f21_arg0 )
|
|
end
|
|
|
|
function GetAimAssistText( f22_arg0 )
|
|
return GetToggleTextForProfileData( "autoAim", f22_arg0 )
|
|
end
|
|
|
|
function SelectSaveDeviceAction( f23_arg0, f23_arg1 )
|
|
if Engine.IsProfileSignedIn( f23_arg1.controller ) then
|
|
Engine.ForceSelectSaveDevice( f23_arg1.controller )
|
|
else
|
|
Engine.Exec( "xsignin" )
|
|
end
|
|
end
|
|
|
|
function RedrawMarginGuide( f24_arg0, f24_arg1 )
|
|
local f24_local0 = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" )
|
|
local f24_local1 = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" )
|
|
local f24_local2 = math.ceil( (1 - (f24_local0 - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)) * 1280 * (1 - SliderBounds.HorzMargin.Min) / 2 )
|
|
local f24_local3 = math.ceil( (1 - (f24_local1 - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min)) * 720 * (1 - SliderBounds.VertMargin.Min) / 2 )
|
|
f24_arg0:registerAnimationState( "current", {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = f24_local2,
|
|
right = -f24_local2,
|
|
top = f24_local3,
|
|
bottom = -f24_local3
|
|
} )
|
|
f24_arg0:animateToState( "current", 0 )
|
|
end
|
|
|
|
function margins_guide()
|
|
local f25_local0 = {
|
|
type = "UIElement",
|
|
id = "horizontal_margins_guide_id",
|
|
states = {
|
|
default = {
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
}
|
|
}
|
|
local f25_local1 = {}
|
|
local f25_local2 = MBh.DoMultiple
|
|
local f25_local3 = {}
|
|
local f25_local4 = MBh.AnimateToState( "visible", 0 )
|
|
local f25_local5 = RedrawMarginGuide
|
|
local f25_local6 = MBh.EmitEvent( {
|
|
name = "horizontal_margin_over_children"
|
|
} )
|
|
f25_local1.horizontal_margin_over = f25_local2( f25_local4 )
|
|
f25_local2 = MBh.DoMultiple
|
|
f25_local3 = {}
|
|
f25_local4 = MBh.AnimateToState( "visible", 0 )
|
|
f25_local5 = RedrawMarginGuide
|
|
f25_local6 = MBh.EmitEvent( {
|
|
name = "vertical_margin_over_children"
|
|
} )
|
|
f25_local1.vertical_margin_over = f25_local2( f25_local4 )
|
|
f25_local2 = MBh.DoMultiple
|
|
f25_local3 = {}
|
|
f25_local4 = MBh.AnimateToState( "default", 100, true, false )
|
|
f25_local5 = MBh.EmitEvent( {
|
|
name = "horizontal_margin_up_children"
|
|
} )
|
|
f25_local1.horizontal_margin_up = f25_local2( f25_local4 )
|
|
f25_local2 = MBh.DoMultiple
|
|
f25_local3 = {}
|
|
f25_local4 = MBh.AnimateToState( "default", 100, true, false )
|
|
f25_local5 = MBh.EmitEvent( {
|
|
name = "vertical_margin_up_children"
|
|
} )
|
|
f25_local1.vertical_margin_up = f25_local2( f25_local4 )
|
|
f25_local1.margin_updated = RedrawMarginGuide
|
|
f25_local0.handlers = f25_local1
|
|
f25_local0.children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "margins_guide_dim",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
material = RegisterMaterial( "white" ),
|
|
red = 0.21,
|
|
green = 0.21,
|
|
blue = 0.21,
|
|
alpha = 0.5
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "margins_guide_arrow_lt",
|
|
handlers = {
|
|
horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ),
|
|
horizontal_margin_up_children = MBh.AnimateToState( "default", 0 )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -3,
|
|
right = 29,
|
|
top = -32,
|
|
bottom = 32,
|
|
material = RegisterMaterial( "widg_margin_arrow_lt" ),
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "margins_guide_arrow_rt",
|
|
handlers = {
|
|
horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ),
|
|
horizontal_margin_up_children = MBh.AnimateToState( "default", 0 )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -24,
|
|
right = 8,
|
|
top = -32,
|
|
bottom = 32,
|
|
material = RegisterMaterial( "widg_margin_arrow_rt" ),
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "margins_guide_arrow_top",
|
|
handlers = {
|
|
vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ),
|
|
vertical_margin_up_children = MBh.AnimateToState( "default", 0 )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = -32,
|
|
right = 32,
|
|
top = -3,
|
|
bottom = 29,
|
|
material = RegisterMaterial( "widg_margin_arrow_top" ),
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "margins_guide_arrow_bot",
|
|
handlers = {
|
|
vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ),
|
|
vertical_margin_up_children = MBh.AnimateToState( "default", 0 )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = -32,
|
|
right = 32,
|
|
top = -24,
|
|
bottom = 8,
|
|
material = RegisterMaterial( "widg_margin_arrow_bot" ),
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "generic_border"
|
|
}
|
|
}
|
|
return f25_local0
|
|
end
|
|
|
|
function GetVolume()
|
|
return (Engine.GetDvarFloat( "profileMenuOption_volume" ) - SliderBounds.Volume.Min) / (SliderBounds.Volume.Max - SliderBounds.Volume.Min)
|
|
end
|
|
|
|
function VolumeLess( f27_arg0 )
|
|
ProfileMenuOption( f27_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, -SliderBounds.Volume.Step, "profileMenuOption_volume" )
|
|
end
|
|
|
|
function VolumeMore( f28_arg0 )
|
|
ProfileMenuOption( f28_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.Step, "profileMenuOption_volume" )
|
|
end
|
|
|
|
function GetBrightness()
|
|
return 1 - (Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) - SliderBounds.Brightness.Min) / (SliderBounds.Brightness.Max - SliderBounds.Brightness.Min)
|
|
end
|
|
|
|
function BrightnessLess( f30_arg0, f30_arg1 )
|
|
ProfileMenuOption( f30_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, -SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" )
|
|
f30_arg1:dispatchEventToRoot( {
|
|
name = "brightness_updated"
|
|
} )
|
|
end
|
|
|
|
function BrightnessMore( f31_arg0, f31_arg1 )
|
|
ProfileMenuOption( f31_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" )
|
|
f31_arg1:dispatchEventToRoot( {
|
|
name = "brightness_updated"
|
|
} )
|
|
end
|
|
|
|
function UpdateBrightnessGuide( f32_arg0, f32_arg1 )
|
|
if Engine.IsXbox360() then
|
|
return
|
|
end
|
|
local f32_local0 = Engine.GetDvarFloat( "profileMenuOption_blacklevel" )
|
|
local f32_local1 = nil
|
|
if f32_arg0.id == BrightnessGuideConstants.not_visible.item_id then
|
|
f32_local1 = BrightnessGuideConstants.not_visible.color_default
|
|
elseif f32_arg0.id == BrightnessGuideConstants.barely_visible.item_id then
|
|
f32_local1 = BrightnessGuideConstants.barely_visible.color_default
|
|
elseif f32_arg0.id == BrightnessGuideConstants.easily_visible.item_id then
|
|
f32_local1 = BrightnessGuideConstants.easily_visible.color_default
|
|
end
|
|
if f32_local1 ~= nil then
|
|
local f32_local2 = (f32_local1 - f32_local0) / (1 - f32_local0)
|
|
f32_arg0:registerAnimationState( "current", {
|
|
red = f32_local2,
|
|
green = f32_local2,
|
|
blue = f32_local2
|
|
} )
|
|
f32_arg0:animateToState( "current", 0 )
|
|
end
|
|
end
|
|
|
|
function brightness_guide()
|
|
local f33_local0 = {
|
|
type = "UIElement",
|
|
id = "brightness_guide_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
top = 150,
|
|
bottom = 510,
|
|
left = 710,
|
|
right = 1070,
|
|
alpha = 0
|
|
},
|
|
visible = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
band_height = 120
|
|
}
|
|
}
|
|
local f33_local1 = {}
|
|
local f33_local2 = MBh.DoMultiple
|
|
local f33_local3 = {}
|
|
local f33_local4 = MBh.AnimateToState( "visible", 0 )
|
|
local f33_local5 = MBh.EmitEvent( {
|
|
name = "brightness_over_children"
|
|
} )
|
|
f33_local1.brightness_over = f33_local2( f33_local4 )
|
|
f33_local1.brightness_up = MBh.AnimateToState( "default", 0 )
|
|
f33_local0.handlers = f33_local1
|
|
f33_local0.children = {
|
|
{
|
|
type = "generic_border",
|
|
properties = {
|
|
thickness = 2,
|
|
border_red = Colors.generic_menu_frame_color.r,
|
|
border_green = Colors.generic_menu_frame_color.g,
|
|
border_blue = Colors.generic_menu_frame_color.b
|
|
}
|
|
},
|
|
{
|
|
type = "UIVerticalList",
|
|
id = "brightness_guide_list_id",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = BrightnessGuideConstants.not_visible.item_id,
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = MBh.Property( "band_height" ),
|
|
material = RegisterMaterial( "white" ),
|
|
red = BrightnessGuideConstants.not_visible.color_default,
|
|
green = BrightnessGuideConstants.not_visible.color_default,
|
|
blue = BrightnessGuideConstants.not_visible.color_default
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "text_not_visible",
|
|
properties = {
|
|
text = Engine.Localize( "@MENU_BRIGHTNESS_NOT_VISIBLE" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = -CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
bottom = CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alignment = LUI.Alignment.Center
|
|
}
|
|
}
|
|
}
|
|
},
|
|
handlers = {
|
|
brightness_over_children = UpdateBrightnessGuide,
|
|
brightness_updated = UpdateBrightnessGuide
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = BrightnessGuideConstants.barely_visible.item_id,
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = MBh.Property( "band_height" ),
|
|
material = RegisterMaterial( "white" ),
|
|
red = BrightnessGuideConstants.barely_visible.color_default,
|
|
green = BrightnessGuideConstants.barely_visible.color_default,
|
|
blue = BrightnessGuideConstants.barely_visible.color_default
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "text_barely_visible",
|
|
properties = {
|
|
text = Engine.Localize( "@MENU_BRIGHTNESS_BARELY_VISIBLE" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = -CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
bottom = CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alignment = LUI.Alignment.Center
|
|
}
|
|
}
|
|
}
|
|
},
|
|
handlers = {
|
|
brightness_over_children = UpdateBrightnessGuide,
|
|
brightness_updated = UpdateBrightnessGuide
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = BrightnessGuideConstants.easily_visible.item_id,
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = MBh.Property( "band_height" ),
|
|
material = RegisterMaterial( "white" ),
|
|
red = BrightnessGuideConstants.easily_visible.color_default,
|
|
green = BrightnessGuideConstants.easily_visible.color_default,
|
|
blue = BrightnessGuideConstants.easily_visible.color_default
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "text_barely_visible",
|
|
properties = {
|
|
text = Engine.Localize( "@MENU_BRIGHTNESS_EASILY_VISIBLE" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = -CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
bottom = CoD.TextSettings.ExtraBigFont.Height / 2,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alignment = LUI.Alignment.Center
|
|
}
|
|
}
|
|
}
|
|
},
|
|
handlers = {
|
|
brightness_over_children = UpdateBrightnessGuide,
|
|
brightness_updated = UpdateBrightnessGuide
|
|
}
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "spacing_element_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 15
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "background_guide_help",
|
|
properties = {
|
|
text = Engine.Localize( "@MENU_BRIGHTNESS_DESC2" )
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.NormalFont.Height,
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return f33_local0
|
|
end
|
|
|
|
function facebook_notice()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@MENU_NOTICE" ),
|
|
message_text = Engine.Localize( "@MENU_FACEBOOK_LEGAL" ),
|
|
yes_action = MBh.PopupMenu( "facebook_warning", true, false ),
|
|
no_action = function ( f35_arg0, f35_arg1 )
|
|
DebugPrint( "Running generic_confirmation_popup no action" )
|
|
end
|
|
,
|
|
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function facebook_warning()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@MENU_NOTICE" ),
|
|
message_text = Engine.Localize( "@PLATFORM_FACEBOOK_LEGAL2" ),
|
|
yes_action = MBh.PopupMenu( "facebook_login_form", true, false ),
|
|
no_action = function ( f37_arg0, f37_arg1 )
|
|
DebugPrint( "Running generic_confirmation_popup no action" )
|
|
end
|
|
,
|
|
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function facebook_login_form()
|
|
return {
|
|
type = "generic_selectionList_popup",
|
|
properties = {
|
|
popup_title = Engine.Localize( "LUA_MENU_FACEBOOK_LOGIN_POPUP" ),
|
|
popup_childfeeder = FacebookLoginListFeeder
|
|
}
|
|
}
|
|
end
|
|
|
|
function UpdateFacebookLoginButton( f39_arg0, f39_arg1 )
|
|
local f39_local0 = Engine.GetDvarString( "facebook_username" )
|
|
local f39_local1 = Engine.GetDvarString( "facebook_password" )
|
|
if f39_local0 and f39_local1 and #f39_local1 * #f39_local0 ~= 0 then
|
|
f39_arg0:enable()
|
|
else
|
|
f39_arg0:disable()
|
|
end
|
|
end
|
|
|
|
function FacebookLoginListFeeder()
|
|
return {
|
|
{
|
|
type = "generic_input_field",
|
|
id = "user_login",
|
|
properties = {
|
|
dvar_hook = "facebook_username",
|
|
help_value = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ),
|
|
field_name = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ),
|
|
field_edited_func = MBh.EmitEventToRoot( "facebook_login_changed" )
|
|
}
|
|
},
|
|
{
|
|
type = "generic_input_field",
|
|
id = "user_password",
|
|
properties = {
|
|
dvar_hook = "facebook_password",
|
|
help_value = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ),
|
|
field_name = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ),
|
|
password_field = true,
|
|
field_edited_func = MBh.EmitEventToRoot( "facebook_password_changed" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "facebook_login_button",
|
|
properties = {
|
|
text = Engine.Localize( "@MENU_FACEBOOK_LOGIN" ),
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
|
|
button_action_func = MBh.PopupMenu( "facebook_error_popup", true, false )
|
|
},
|
|
handlers = {
|
|
menu_create = UpdateFacebookLoginButton,
|
|
facebook_login_changed = UpdateFacebookLoginButton,
|
|
facebook_password_changed = UpdateFacebookLoginButton
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "facebook_cancel_login_button",
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CANCEL" ),
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
|
|
button_action_func = MBh.LeaveMenu()
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function facebook_error_popup()
|
|
return {
|
|
type = "generic_confirmation_popup",
|
|
id = "facebook_error_popup_id",
|
|
properties = {
|
|
popup_title = Engine.Localize( "Placeholder" ),
|
|
message_text = Engine.Localize( "@MENU_FACEBOOK_UNAVAILABLE" )
|
|
}
|
|
}
|
|
end
|
|
|
|
function options_vlist()
|
|
return {
|
|
type = "UIScrollingVerticalList",
|
|
properties = {
|
|
use_arrows = true,
|
|
sendScrollEvents = true,
|
|
exclusiveController = MBh.Property( "exclusiveController" ),
|
|
focusSafeArea = MBh.Property( "focusSafeArea" )
|
|
},
|
|
focusable = true,
|
|
childrenFeeder = OptionsFeeder,
|
|
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 OptionsFeeder( f43_arg0 )
|
|
local f43_local0 = nil
|
|
Engine.MenuDvarsSetup( f43_arg0.exclusiveController )
|
|
f43_local0 = {
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "stick_layout_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Info,
|
|
button_text = Engine.Localize( "@MENU_THUMBSTICK_LAYOUT_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_STICK_LAYOUT_DESC" ),
|
|
button_display_func = function ( f44_arg0, f44_arg1 )
|
|
return GetSticksLayoutName( f43_arg0.exclusiveController )
|
|
end,
|
|
button_action_func = SticksLayoutAction
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "buttons_layout_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Info,
|
|
button_text = Engine.Localize( "@MENU_BUTTON_LAYOUT_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_BUTTON_LAYOUT_DESC" ),
|
|
button_display_func = function ( f45_arg0, f45_arg1 )
|
|
return GetButtonsLayoutName( f43_arg0.exclusiveController )
|
|
end,
|
|
button_action_func = ButtonsLayoutAction
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "look_inversion_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@MENU_LOOK_INVERSION_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_LOOK_INVERSION_DESC" ),
|
|
button_display_func = function ( f46_arg0, f46_arg1 )
|
|
return GetLookInversionText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f47_arg0, f47_arg1 )
|
|
LookInversionToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f48_arg0, f48_arg1 )
|
|
LookInversionToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "vibration_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@MENU_CONTROLLER_VIBRATION_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VIBRATION_DESC" ),
|
|
button_display_func = function ( f49_arg0, f49_arg1 )
|
|
return GetVibrationText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f50_arg0, f50_arg1 )
|
|
return VibrationToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f51_arg0, f51_arg1 )
|
|
return VibrationToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "sensitivity_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@MENU_LOOK_SENSITIVITY_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SENSITIVITY_DESC" ),
|
|
button_display_func = GetSensitivityText,
|
|
button_left_func = function ( f52_arg0, f52_arg1 )
|
|
return SensitivityLess( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f53_arg0, f53_arg1 )
|
|
return SensitivityMore( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "safe_area_button_id",
|
|
listDefaultFocus = f43_arg0.focusSafeArea,
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Info,
|
|
button_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_CAPS" ),
|
|
button_display_func = function ()
|
|
return ""
|
|
end,
|
|
desc_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_DESC" ),
|
|
button_action_func = function ( f55_arg0, f55_arg1 )
|
|
LUI.FlowManager.RequestAddMenu( f55_arg0, "boot_screen_margins", false, f55_arg1.controller, true, {
|
|
linkTo = "controls",
|
|
continueExclusive = true
|
|
} )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "volume_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Slider,
|
|
button_text = Engine.Localize( "@MENU_VOLUME_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_GAME_VOLUME_DESC" ),
|
|
button_display_func = GetVolume,
|
|
button_left_func = function ( f56_arg0, f56_arg1 )
|
|
VolumeLess( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f57_arg0, f57_arg1 )
|
|
VolumeMore( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "brightness_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Slider,
|
|
button_text = Engine.Localize( "@MENU_BRIGHTNESS_CAPS" ),
|
|
desc_text = Engine.Localize( "@MENU_BRIGHTNESS_DESC1" ),
|
|
button_display_func = GetBrightness,
|
|
button_left_func = function ( f58_arg0, f58_arg1 )
|
|
BrightnessLess( f43_arg0.exclusiveController, f58_arg0 )
|
|
end,
|
|
button_right_func = function ( f59_arg0, f59_arg1 )
|
|
BrightnessMore( f43_arg0.exclusiveController, f59_arg0 )
|
|
end,
|
|
button_over_func = MBh.EmitEventToRoot( "brightness_over" ),
|
|
button_up_func = MBh.EmitEventToRoot( "brightness_up" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "render_color_blind_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "LUA_MENU_COLORBLIND_FILTER_CAPS" ),
|
|
desc_text = Engine.Localize( "LUA_MENU_COLOR_BLIND_DESC" ),
|
|
button_display_func = function ( f60_arg0, f60_arg1 )
|
|
return GetRenderColorBlindText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f61_arg0, f61_arg1 )
|
|
RenderColorBlindToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f62_arg0, f62_arg1 )
|
|
RenderColorBlindToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "manual_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Info,
|
|
button_text = Engine.IsXB3() and Engine.Localize( "@LUA_MENU_HELP_CAPS" ) or Engine.Localize( "@LUA_MENU_GAME_MANUAL_CAPS" ),
|
|
button_display_func = function ()
|
|
return ""
|
|
end,
|
|
desc_text = Engine.Localize( "@LUA_MENU_GAME_MANUAL_DESC" ),
|
|
button_action_func = function ( f64_arg0, f64_arg1 )
|
|
LUI.FlowManager.RequestAddMenu( f64_arg0, "game_manual", true, f64_arg1.controller, false )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UIGenericButton",
|
|
id = "toggle_lean_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_CAPS" ),
|
|
desc_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_DESC" ),
|
|
button_display_func = function ( f65_arg0, f65_arg1 )
|
|
return GetLeanToggleText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f66_arg0, f66_arg1 )
|
|
LeanToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f67_arg0, f67_arg1 )
|
|
LeanToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
}
|
|
}
|
|
if not Engine.IsMultiplayer() then
|
|
f43_local0[#f43_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "aim_assist_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@MENU_AIM_ASSIST_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_AIM_ASSIST_DESC" ),
|
|
button_display_func = function ( f68_arg0, f68_arg1 )
|
|
return GetAimAssistText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f69_arg0, f69_arg1 )
|
|
AimAssistToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f70_arg0, f70_arg1 )
|
|
AimAssistToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
}
|
|
if Engine.GetCurrentLanguage() ~= 6 then
|
|
f43_local0[#f43_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "subtitles_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@MENU_SUBTITLES_CAPS" ),
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SUBTITLES_DESC" ),
|
|
button_display_func = function ( f71_arg0, f71_arg1 )
|
|
return GetSubtitlesText( f43_arg0.exclusiveController )
|
|
end,
|
|
button_left_func = function ( f72_arg0, f72_arg1 )
|
|
SubtitlesToggle( f43_arg0.exclusiveController )
|
|
end,
|
|
button_right_func = function ( f73_arg0, f73_arg1 )
|
|
SubtitlesToggle( f43_arg0.exclusiveController )
|
|
end
|
|
}
|
|
}
|
|
end
|
|
end
|
|
if not Engine.IsXB3() and not Engine.IsPS3() and not Engine.IsPS4() then
|
|
f43_local0[#f43_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "save_device_button_id",
|
|
properties = {
|
|
variant = GenericButtonSettings.Variants.Info,
|
|
button_text = Engine.Localize( "@MENU_SP_SELECT_SAVE_DEVICE_CAPS" ),
|
|
button_display_func = function ()
|
|
return ""
|
|
end,
|
|
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SAVE_DEVICE_DESC" ),
|
|
button_action_func = SelectSaveDeviceAction
|
|
}
|
|
}
|
|
end
|
|
return f43_local0
|
|
end
|
|
|
|
function OptionsMainCreate( f75_arg0, f75_arg1 )
|
|
f75_arg0:dispatchEventToRoot( {
|
|
name = "add_button_helper_text",
|
|
button_ref = "button_secondary",
|
|
helper_text = Engine.Localize( "@LUA_MENU_BACK" ),
|
|
side = "left",
|
|
clickable = true
|
|
} )
|
|
end
|
|
|
|
function OptionsMainClose( f76_arg0, f76_arg1 )
|
|
Engine.Exec( "updategamerprofile" )
|
|
end
|
|
|
|
function options()
|
|
local f77_local0 = {
|
|
type = "UIElement",
|
|
id = "options_root",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
properties = {
|
|
focusSafeArea = false
|
|
},
|
|
handlers = {
|
|
menu_create = OptionsMainCreate,
|
|
menu_close = OptionsMainClose
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_menu_title",
|
|
properties = {
|
|
menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_UPPER_CASE" )
|
|
}
|
|
},
|
|
{
|
|
type = "options_vlist",
|
|
id = "options_vlist_id"
|
|
},
|
|
{
|
|
type = "button_desc_text",
|
|
id = "button_info_text",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 590,
|
|
bottom = 590 + CoD.TextSettings.SmallFont.Height,
|
|
left = 0,
|
|
right = OptionsListDims.menu_right - 80
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "button_helper_text_main",
|
|
id = "button_helper_text_id"
|
|
},
|
|
{
|
|
type = "UIBindButton",
|
|
id = "options_back_id",
|
|
handlers = {
|
|
button_secondary = function ( f78_arg0, f78_arg1 )
|
|
local f78_local0 = Engine.GetLuiRoot()
|
|
if LUI.FlowManager.IsInStack( f78_local0.flowManager, "mp_main_menu" ) then
|
|
Engine.ExecNow( "forcesplitscreencontrol main_options_menu_CLOSE", f78_arg0.properties.exclusiveController )
|
|
end
|
|
LUI.FlowManager.RequestLeaveMenu( f78_arg0 )
|
|
end
|
|
}
|
|
}
|
|
}
|
|
}
|
|
table.insert( f77_local0.children, {
|
|
type = "brightness_guide"
|
|
} )
|
|
return f77_local0
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "margins_guide", margins_guide )
|
|
LUI.MenuBuilder.registerDef( "brightness_guide", brightness_guide )
|
|
LUI.MenuBuilder.registerDef( "facebook_notice", facebook_notice )
|
|
LUI.MenuBuilder.registerDef( "facebook_warning", facebook_warning )
|
|
LUI.MenuBuilder.registerDef( "facebook_login_form", facebook_login_form )
|
|
LUI.MenuBuilder.registerDef( "facebook_error_popup", facebook_error_popup )
|
|
LUI.MenuBuilder.registerDef( "options_vlist", options_vlist )
|
|
LUI.MenuBuilder.registerDef( "controls", options )
|
|
LockTable( _M )
|