init
This commit is contained in:
164
lui/movementcontrols.dec.lua
Normal file
164
lui/movementcontrols.dec.lua
Normal file
@@ -0,0 +1,164 @@
|
||||
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,
|
||||
disabledFunc = shouldBeDisabledFunc or function ()
|
||||
return false
|
||||
end
|
||||
,
|
||||
properties = {
|
||||
variant = GenericButtonSettings.Variants.Info,
|
||||
button_text = Engine.Localize( f5_arg0 ),
|
||||
button_display_func = function ( f7_arg0, f7_arg1 )
|
||||
return GetDisplay( f5_arg1 )
|
||||
end
|
||||
,
|
||||
button_action_func = function ( f8_arg0, f8_arg1 )
|
||||
Engine.BindKey( f5_arg1 )
|
||||
OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 )
|
||||
end
|
||||
|
||||
},
|
||||
handlers = {
|
||||
element_refresh = MBh.EmitEvent( "content_refresh" ),
|
||||
key_bound = OptionsWindowTriggerRefresh
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function OptionsFeeder( f9_arg0 )
|
||||
local f9_local0 = {}
|
||||
Engine.ExecNow( "profile_menuDvarsSetup" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_FORWARD", "+forward" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_BACK", "+back" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_LEFT", "+moveleft" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_RIGHT", "+moveright" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STANDJUMP", "+gostand" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CROUCH", "+togglecrouch" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_PRONE", "toggleprone" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT_HOLD_BREATH", "+breath_sprint" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_CROUCH", "+movedown" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_PRONE", "+prone" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CHANGE_STANCE", "+stance" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT", "+sprint" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_BREATH", "+holdbreath" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_LEFT", "+left" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_RIGHT", "+right" )
|
||||
f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STRAFE", "+strafe" )
|
||||
return f9_local0
|
||||
end
|
||||
|
||||
function OptionsMainCreate( f10_arg0, f10_arg1 )
|
||||
f10_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
|
||||
end
|
||||
|
||||
function movement_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 movement_controls()
|
||||
return {
|
||||
type = "UIElement",
|
||||
id = "movement_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 ( f13_arg0, f13_arg1 )
|
||||
Engine.Exec( "updategamerprofile" )
|
||||
end
|
||||
|
||||
},
|
||||
children = {
|
||||
{
|
||||
type = "generic_menu_title",
|
||||
properties = {
|
||||
menu_title = Engine.Localize( "@LUA_MENU_MOVEMENT" )
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "movement_vlist",
|
||||
id = "movement_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( "movement_vlist", movement_vlist )
|
||||
LUI.MenuBuilder.registerDef( "movement_controls", movement_controls )
|
||||
LockTable( _M )
|
Reference in New Issue
Block a user