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

1047 lines
30 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
f0_local0 = function ()
local f4_local0 = Engine.GetLuiRoot()
if GameX.IsSplitscreen() then
GameX.SetOptionState( false )
f4_local0:dispatchEventToAllOtherRoots( {
name = "refresh_options_button",
immediate = true
} )
end
end
f0_local1 = function ( f5_arg0, f5_arg1 )
LUI.FlowManager.RequestLeaveMenu( f5_arg0 )
end
function GetSticksLayoutName( f6_arg0 )
local f6_local0 = Engine.GetProfileData( "gpadSticksConfig", f6_arg0 )
if f6_local0 == "thumbstick_default" then
return Engine.Localize( "@MENU_DEFAULT" )
elseif f6_local0 == "thumbstick_southpaw" then
return Engine.Localize( "@MENU_SOUTHPAW" )
elseif f6_local0 == "thumbstick_legacy" then
return Engine.Localize( "@MENU_LEGACY" )
elseif f6_local0 == "thumbstick_southpaw_ns" then
return Engine.Localize( "@MENU_SOUTHPAW_NS" )
elseif f6_local0 == "thumbstick_legacysouthpaw_ns" then
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" )
else
return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" )
end
end
function SticksLayoutAction( f7_arg0, f7_arg1 )
LUI.FlowManager.RequestAddMenu( f7_arg0, "thumbstick", true, f7_arg1.controller, false )
end
function GetButtonsLayoutName( f8_arg0 )
local f8_local0 = Engine.GetProfileData( "gpadButtonsConfig", f8_arg0 )
if f8_local0 == "buttons_default" then
return Engine.Localize( "@MENU_DEFAULT" )
elseif f8_local0 == "buttons_tactical" then
return Engine.Localize( "@MENU_TACTICAL" )
elseif f8_local0 == "buttons_lefty" then
return Engine.Localize( "@MENU_LEFTY" )
elseif f8_local0 == "buttons_nomad" then
return Engine.Localize( "@MENU_NOMAD" )
elseif f8_local0 == "buttons_nomad_tactical" then
return Engine.Localize( "@MENU_NOMAD_TACTICAL" )
elseif f8_local0 == "buttons_default_alt" then
return Engine.Localize( "@MENU_DEFAULT_ALT" )
elseif f8_local0 == "buttons_tactical_alt" then
return Engine.Localize( "@MENU_TACTICAL_ALT" )
elseif f8_local0 == "buttons_lefty_alt" then
return Engine.Localize( "@MENU_LEFTY_ALT" )
elseif f8_local0 == "buttons_nomad_alt" then
return Engine.Localize( "@MENU_NOMAD_ALT" )
else
return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" )
end
end
function ButtonsLayoutAction( f9_arg0, f9_arg1 )
LUI.FlowManager.RequestAddMenu( f9_arg0, "buttons", true, f9_arg1.controller, false )
end
function LookInversionToggle( f10_arg0 )
Engine.ToggleInvertedPitch( f10_arg0 )
end
function GetLookInversionText( f11_arg0 )
return GetToggleTextForProfileData( "invertedPitch", f11_arg0 )
end
function VibrationToggle( f12_arg0 )
Engine.ToggleRumble( f12_arg0 )
end
function GetVibrationText( f13_arg0 )
return GetToggleTextForProfileData( "rumble", f13_arg0 )
end
function GetSensitivityText()
local f14_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" )
if f14_local0 == 1 then
return Engine.Localize( "@MENU_LOW" ) .. " " .. f14_local0
elseif f14_local0 == 3 then
return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f14_local0
elseif f14_local0 == 7 then
return Engine.Localize( "@MENU_HIGH" ) .. " " .. f14_local0
elseif f14_local0 == 13 then
return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f14_local0
elseif f14_local0 == 20 then
return Engine.Localize( "@MENU_INSANE" ) .. " " .. f14_local0
else
return f14_local0 .. ""
end
end
function SensitivityLess( f15_arg0 )
ProfileMenuOption( f15_arg0, 1, 20, -1, "profileMenuOption_sensitivity" )
end
function SensitivityMore( f16_arg0 )
ProfileMenuOption( f16_arg0, 1, 20, 1, "profileMenuOption_sensitivity" )
end
function LeanToggle( f17_arg0 )
Engine.ToggleLean( f17_arg0 )
end
function GetLeanToggleText( f18_arg0 )
return GetToggleTextForProfileData( "leanEnabled", f18_arg0 )
end
function RenderColorBlindToggle( f19_arg0 )
if Engine.ToggleRenderColorBlind then
Engine.ToggleRenderColorBlind( f19_arg0 )
end
end
function GetRenderColorBlindText( f20_arg0 )
if Engine.ToggleRenderColorBlind then
return GetToggleTextForProfileData( "renderColorBlind", f20_arg0 )
else
return Engine.Localize( "LUA_MENU_DISABLED" )
end
end
function GetHorizontalMargin()
return (Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)
end
function HorizontalMarginLess( f22_arg0 )
ProfileMenuOption( f22_arg0, SliderBounds.HorzMargin.Min, SliderBounds.HorzMargin.Max, -SliderBounds.HorzMargin.Step, "profileMenuOption_safeAreaHorz" )
local f22_local0 = Engine.GetLuiRoot()
f22_local0:processEvent( {
name = "update_hud_margins"
} )
end
function HorizontalMarginMore( f23_arg0 )
ProfileMenuOption( f23_arg0, SliderBounds.HorzMargin.Min, SliderBounds.HorzMargin.Max, SliderBounds.HorzMargin.Step, "profileMenuOption_safeAreaHorz" )
local f23_local0 = Engine.GetLuiRoot()
f23_local0:processEvent( {
name = "update_hud_margins"
} )
end
function RedrawMarginGuide( f24_arg0, f24_arg1 )
local f24_local0 = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" )
local f24_local1 = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" )
local f24_local2 = (1 - (f24_local0 - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)) * 1280 * (1 - SliderBounds.HorzMargin.Min) / 2
local f24_local3 = (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 in_game_margins_guide()
local f25_local0 = {
type = "UIElement",
id = "in_game_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.horizontal_margin_update = RedrawMarginGuide
f25_local1.vertical_margin_update = 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 = -7,
right = 57,
top = -64,
bottom = 64,
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 = -47,
right = 17,
top = -64,
bottom = 64,
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 = -64,
right = 64,
top = -7,
bottom = 57,
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 = -64,
right = 64,
top = -47,
bottom = 17,
material = RegisterMaterial( "widg_margin_arrow_bot" ),
alpha = 0
},
visible = {
alpha = 1
}
}
},
{
type = "generic_border"
}
}
return f25_local0
end
function GetVerticalMargin()
return (Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min)
end
function VerticalMarginLess( f27_arg0 )
ProfileMenuOption( f27_arg0, SliderBounds.VertMargin.Min, SliderBounds.VertMargin.Max, -SliderBounds.VertMargin.Step, "profileMenuOption_safeAreaVert" )
local f27_local0 = Engine.GetLuiRoot()
f27_local0:processEvent( {
name = "update_hud_margins"
} )
end
function VerticalMarginMore( f28_arg0 )
ProfileMenuOption( f28_arg0, SliderBounds.VertMargin.Min, SliderBounds.VertMargin.Max, SliderBounds.VertMargin.Step, "profileMenuOption_safeAreaVert" )
local f28_local0 = Engine.GetLuiRoot()
f28_local0:processEvent( {
name = "update_hud_margins"
} )
end
function GetVolume()
return (Engine.GetDvarFloat( "profileMenuOption_volume" ) - SliderBounds.Volume.Min) / (SliderBounds.Volume.Max - SliderBounds.Volume.Min)
end
function VolumeLess( f30_arg0 )
ProfileMenuOption( f30_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, -SliderBounds.Volume.Step, "profileMenuOption_volume" )
end
function VolumeMore( f31_arg0 )
ProfileMenuOption( f31_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( f33_arg0, f33_arg1 )
ProfileMenuOption( f33_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, -SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" )
f33_arg1:dispatchEventToRoot( {
name = "brightness_updated"
} )
end
function BrightnessMore( f34_arg0, f34_arg1 )
ProfileMenuOption( f34_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" )
f34_arg1:dispatchEventToRoot( {
name = "brightness_updated"
} )
end
function UpdateBrightnessGuide( f35_arg0, f35_arg1 )
if Engine.IsXbox360() then
return
end
local f35_local0 = Engine.GetDvarFloat( "profileMenuOption_blacklevel" )
local f35_local1 = nil
if f35_arg0.id == BrightnessGuideConstants.not_visible.item_id then
f35_local1 = BrightnessGuideConstants.not_visible.color_default
elseif f35_arg0.id == BrightnessGuideConstants.barely_visible.item_id then
f35_local1 = BrightnessGuideConstants.barely_visible.color_default
elseif f35_arg0.id == BrightnessGuideConstants.easily_visible.item_id then
f35_local1 = BrightnessGuideConstants.easily_visible.color_default
end
if f35_local1 ~= nil then
local f35_local2 = (f35_local1 - f35_local0) / (1 - f35_local0)
f35_arg0:registerAnimationState( "current", {
red = f35_local2,
green = f35_local2,
blue = f35_local2
} )
f35_arg0:animateToState( "current", 0 )
end
end
function in_game_brightness_guide()
local f36_local0 = {
type = "UIElement",
id = "in_game_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 f36_local1 = {}
local f36_local2 = MBh.DoMultiple
local f36_local3 = {}
local f36_local4 = MBh.AnimateToState( "visible", 0 )
local f36_local5 = MBh.EmitEvent( {
name = "brightness_over_children"
} )
f36_local1.brightness_over = f36_local2( f36_local4 )
f36_local1.brightness_up = MBh.AnimateToState( "default", 0 )
f36_local0.handlers = f36_local1
f36_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 f36_local0
end
function OptionsFeeder( f37_arg0 )
Engine.MenuDvarsSetup( f37_arg0.exclusiveController )
local f37_local0 = GameX.IsSplitscreen()
local f37_local1 = {
[#f37_local1 + 1] = {
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 ( f38_arg0, f38_arg1 )
return GetSticksLayoutName( f37_arg0.exclusiveController )
end,
button_action_func = SticksLayoutAction
}
},
[#f37_local1 + 1] = {
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 ( f39_arg0, f39_arg1 )
return GetButtonsLayoutName( f37_arg0.exclusiveController )
end,
button_action_func = ButtonsLayoutAction
}
},
[#f37_local1 + 1] = {
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 ( f40_arg0, f40_arg1 )
return GetLookInversionText( f37_arg0.exclusiveController )
end,
button_left_func = function ( f41_arg0, f41_arg1 )
LookInversionToggle( f37_arg0.exclusiveController )
end,
button_right_func = function ( f42_arg0, f42_arg1 )
LookInversionToggle( f37_arg0.exclusiveController )
end
}
},
[#f37_local1 + 1] = {
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 ( f43_arg0, f43_arg1 )
return GetVibrationText( f37_arg0.exclusiveController )
end,
button_left_func = function ( f44_arg0, f44_arg1 )
return VibrationToggle( f37_arg0.exclusiveController )
end,
button_right_func = function ( f45_arg0, f45_arg1 )
return VibrationToggle( f37_arg0.exclusiveController )
end
}
},
[#f37_local1 + 1] = {
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 ( f46_arg0, f46_arg1 )
return SensitivityLess( f37_arg0.exclusiveController )
end,
button_right_func = function ( f47_arg0, f47_arg1 )
return SensitivityMore( f37_arg0.exclusiveController )
end
}
}
}
if not f37_local0 then
f37_local1[#f37_local1 + 1] = {
type = "UIGenericButton",
id = "horizontal_margin_button_id",
properties = {
variant = GenericButtonSettings.Variants.Slider,
button_text = Engine.Localize( "@MENU_HUD_MARGIN_HORIZONTAL_CAPS" ),
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_HORIZONTAL_MARGIN_DESC" ),
button_display_func = GetHorizontalMargin,
button_left_func = function ( f48_arg0, f48_arg1 )
HorizontalMarginLess( f37_arg0.exclusiveController )
f48_arg0:dispatchEventToRoot( {
name = "horizontal_margin_update"
} )
end,
button_right_func = function ( f49_arg0, f49_arg1 )
HorizontalMarginMore( f37_arg0.exclusiveController )
f49_arg0:dispatchEventToRoot( {
name = "horizontal_margin_update"
} )
end,
button_over_func = MBh.EmitEventToRoot( "horizontal_margin_over" ),
button_up_func = MBh.EmitEventToRoot( "horizontal_margin_up" )
}
}
f37_local1[#f37_local1 + 1] = {
type = "UIGenericButton",
id = "vertical_margin_button_id",
properties = {
variant = GenericButtonSettings.Variants.Slider,
button_text = Engine.Localize( "@MENU_HUD_MARGIN_VERTICAL_CAPS" ),
desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VERTICAL_MARGIN_DESC" ),
button_display_func = GetVerticalMargin,
button_left_func = function ( f50_arg0, f50_arg1 )
VerticalMarginLess( f37_arg0.exclusiveController )
f50_arg0:dispatchEventToRoot( {
name = "vertical_margin_update"
} )
end,
button_right_func = function ( f51_arg0, f51_arg1 )
VerticalMarginMore( f37_arg0.exclusiveController )
f51_arg0:dispatchEventToRoot( {
name = "vertical_margin_update"
} )
end,
button_over_func = MBh.EmitEventToRoot( "vertical_margin_over" ),
button_up_func = MBh.EmitEventToRoot( "vertical_margin_up" )
}
}
end
if not f37_local0 then
f37_local1[#f37_local1 + 1] = {
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 ( f52_arg0, f52_arg1 )
VolumeLess( f37_arg0.exclusiveController )
end,
button_right_func = function ( f53_arg0, f53_arg1 )
VolumeMore( f37_arg0.exclusiveController )
end
}
}
f37_local1[#f37_local1 + 1] = {
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 ( f54_arg0, f54_arg1 )
BrightnessLess( f37_arg0.exclusiveController, f54_arg0 )
end,
button_right_func = function ( f55_arg0, f55_arg1 )
BrightnessMore( f37_arg0.exclusiveController, f55_arg0 )
end,
button_over_func = MBh.EmitEventToRoot( "brightness_over" ),
button_up_func = MBh.EmitEventToRoot( "brightness_up" )
}
}
end
f37_local1[#f37_local1 + 1] = {
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 ( f56_arg0, f56_arg1 )
return GetRenderColorBlindText( f37_arg0.exclusiveController )
end,
button_left_func = function ( f57_arg0, f57_arg1 )
RenderColorBlindToggle( f37_arg0.exclusiveController )
end,
button_right_func = function ( f58_arg0, f58_arg1 )
RenderColorBlindToggle( f37_arg0.exclusiveController )
end
}
}
f37_local1[#f37_local1 + 1] = {
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 ( f59_arg0, f59_arg1 )
return GetLeanToggleText( f37_arg0.exclusiveController )
end,
button_left_func = function ( f60_arg0, f60_arg1 )
LeanToggle( f37_arg0.exclusiveController )
end,
button_right_func = function ( f61_arg0, f61_arg1 )
LeanToggle( f37_arg0.exclusiveController )
end
}
}
return f37_local1
end
function in_game_options_vlist()
return {
type = "UIStencil",
children = {
{
type = "UIVerticalList",
focusable = true,
childrenFeeder = OptionsFeeder,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -25,
top = 0,
bottom = 0
}
},
properties = {
scrollByChildHeight = true
}
}
},
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
}
}
}
end
function OptionsMainCreate( f63_arg0, f63_arg1 )
f63_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then
f63_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton )
end
end
function OptionsMainClose( f64_arg0, f64_arg1 )
Engine.Exec( "updategamerprofile" )
f64_arg0:dispatchEventToRoot( {
name = "refresh_controls"
} )
end
function mp_in_game_controls_menu()
local f65_local0 = {
type = "UIElement",
id = "mp_in_game_controls_menu_root",
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,
omnvar_update = {
ui_pause_menu_show = LUI.mp_hud.OptionsMenu.pauseMenuUpdate
}
},
children = {
{
type = "UIWorldBlur",
id = "optionsWorldBlurOverlay",
states = {
default = {
worldBlur = 5
}
}
},
{
type = "UIImage",
id = "options_background2",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.5,
material = RegisterMaterial( "black" )
}
}
},
{
type = "generic_menu_title",
properties = {
menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_UPPER_CASE" )
}
},
{
type = "in_game_options_vlist",
id = "in_game_options_vlist_id"
},
{
type = "button_helper_text_main",
id = "in_game_options_helper_bar_id"
},
{
type = "UIBindButton",
id = "options_back_id",
handlers = {
button_start = f0_local1,
button_secondary = f0_local1
}
}
}
}
if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then
table.insert( f65_local0.children, {
type = "online_friends_widget"
} )
end
table.insert( f65_local0.children, {
type = "in_game_brightness_guide"
} )
table.insert( f65_local0.children, {
type = "in_game_margins_guide"
} )
return f65_local0
end
LUI.MenuBuilder.registerDef( "in_game_margins_guide", in_game_margins_guide )
LUI.MenuBuilder.registerDef( "in_game_brightness_guide", in_game_brightness_guide )
LUI.MenuBuilder.registerDef( "in_game_options_vlist", in_game_options_vlist )
LUI.MenuBuilder.registerDef( "mp_in_game_controls_menu", mp_in_game_controls_menu )
LUI.FlowManager.RegisterStackPopBehaviour( "mp_in_game_controls_menu", f0_local0 )
LockTable( _M )