286 lines
8.3 KiB
Lua
286 lines
8.3 KiB
Lua
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 )
|