init
This commit is contained in:
124
lui/eventcatcher.dec.lua
Normal file
124
lui/eventcatcher.dec.lua
Normal file
@@ -0,0 +1,124 @@
|
||||
local f0_local0 = module
|
||||
local f0_local1, f0_local2 = ...
|
||||
f0_local0( f0_local1, package.seeall )
|
||||
require( "LUI.CoD" )
|
||||
f0_local0 = hashset( {
|
||||
"keybind",
|
||||
"action_slot_pressed",
|
||||
"game_message",
|
||||
"hide_host_migration",
|
||||
"obituary",
|
||||
"show_host_migration_triggered",
|
||||
"toggle_pause",
|
||||
"weapon_change",
|
||||
"show_hud_menu",
|
||||
"hide_hud_menu",
|
||||
"playerstate_client_changed",
|
||||
"close_rival_info",
|
||||
"open_rival_info",
|
||||
"camera_client_changed",
|
||||
"refresh_options_button",
|
||||
"update_mlg_prev_next",
|
||||
"spectate_team_change"
|
||||
} )
|
||||
function isDirectDispatchEventType( f1_arg0 )
|
||||
return f0_local0[f1_arg0]
|
||||
end
|
||||
|
||||
function new()
|
||||
local f2_local0 = {}
|
||||
setmetatable( f2_local0, {
|
||||
__index = _M
|
||||
} )
|
||||
f2_local0.direct_dispatch = {}
|
||||
f2_local0.omnvar_update = {}
|
||||
f2_local0.dvar_update = {}
|
||||
return f2_local0
|
||||
end
|
||||
|
||||
function setupRoot( f3_arg0, f3_arg1 )
|
||||
f3_arg1:registerEventHandler( "omnvar_update", omnvarUpdateDispatcher )
|
||||
f3_arg1:registerEventHandler( "dvar_update", dvarUpdateDispatcher )
|
||||
for f3_local3, f3_local4 in pairs( f0_local0 ) do
|
||||
f3_arg1:registerEventHandler( f3_local3, directDispatcher )
|
||||
end
|
||||
end
|
||||
|
||||
function registerOmnvarHandler( f4_arg0, f4_arg1, f4_arg2, f4_arg3 )
|
||||
assert( type( f4_arg1 ) == "userdata" )
|
||||
assert( type( f4_arg2 ) == "string" )
|
||||
assert( type( f4_arg3 ) == "function" )
|
||||
local f4_local0 = f4_arg0.omnvar_update
|
||||
local f4_local1 = f4_arg0.omnvar_update[f4_arg2]
|
||||
if not f4_local1 then
|
||||
f4_local1 = setmetatable( {}, {
|
||||
__mode = "k"
|
||||
} )
|
||||
end
|
||||
f4_local0[f4_arg2] = f4_local1
|
||||
f4_arg0.omnvar_update[f4_arg2][f4_arg1] = f4_arg3
|
||||
end
|
||||
|
||||
function omnvarUpdateDispatcher( f5_arg0, f5_arg1 )
|
||||
local f5_local0 = f5_arg0.eventCatcher.omnvar_update[f5_arg1.omnvar]
|
||||
if f5_local0 then
|
||||
for f5_local4, f5_local5 in pairs( f5_local0 ) do
|
||||
if not f5_local4:isClosed() then
|
||||
f5_local5( f5_local4, f5_arg1 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function registerDvarHandler( f6_arg0, f6_arg1, f6_arg2, f6_arg3 )
|
||||
assert( type( f6_arg1 ) == "userdata" )
|
||||
assert( type( f6_arg2 ) == "string" )
|
||||
assert( type( f6_arg3 ) == "function" )
|
||||
if not f6_arg0.dvar_update[f6_arg2] then
|
||||
assert( Engine.WatchDvar( f6_arg2 ), "failed to watch dvar" )
|
||||
f6_arg0.dvar_update[f6_arg2] = setmetatable( {}, {
|
||||
__mode = "k"
|
||||
} )
|
||||
end
|
||||
f6_arg0.dvar_update[f6_arg2][f6_arg1] = f6_arg3
|
||||
end
|
||||
|
||||
function dvarUpdateDispatcher( f7_arg0, f7_arg1 )
|
||||
local f7_local0 = f7_arg0.eventCatcher.dvar_update[f7_arg1.dvar]
|
||||
if f7_local0 then
|
||||
for f7_local4, f7_local5 in pairs( f7_local0 ) do
|
||||
if not f7_local4:isClosed() then
|
||||
f7_local5( f7_local4, f7_arg1 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function registerDirectDispatchHandler( f8_arg0, f8_arg1, f8_arg2, f8_arg3 )
|
||||
assert( type( f8_arg1 ) == "userdata" )
|
||||
assert( type( f8_arg2 ) == "string" )
|
||||
assert( type( f8_arg3 ) == "function" )
|
||||
local f8_local0 = f8_arg0.direct_dispatch
|
||||
local f8_local1 = f8_arg0.direct_dispatch[f8_arg2]
|
||||
if not f8_local1 then
|
||||
f8_local1 = setmetatable( {}, {
|
||||
__mode = "k"
|
||||
} )
|
||||
end
|
||||
f8_local0[f8_arg2] = f8_local1
|
||||
f8_arg0.direct_dispatch[f8_arg2][f8_arg1] = f8_arg3
|
||||
end
|
||||
|
||||
function directDispatcher( f9_arg0, f9_arg1 )
|
||||
local f9_local0 = f9_arg0.eventCatcher.direct_dispatch[f9_arg1.name]
|
||||
if f9_local0 then
|
||||
for f9_local4, f9_local5 in pairs( f9_local0 ) do
|
||||
if not f9_local4:isClosed() then
|
||||
assert( f9_local4.m_eventHandlers[f9_arg1.name] == f9_local5 )
|
||||
f9_local5( f9_local4, f9_arg1 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
LockTable( _M )
|
Reference in New Issue
Block a user