init
This commit is contained in:
159
lui/chatcontrols.dec.lua
Normal file
159
lui/chatcontrols.dec.lua
Normal 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 )
|
Reference in New Issue
Block a user