init
This commit is contained in:
215
lui/hudmanager.dec.lua
Normal file
215
lui/hudmanager.dec.lua
Normal file
@@ -0,0 +1,215 @@
|
||||
local f0_local0 = module
|
||||
local f0_local1, f0_local2 = ...
|
||||
f0_local0( f0_local1, package.seeall )
|
||||
require( "LUI.CoD" )
|
||||
if Engine.HasSpeechFeature() then
|
||||
require( "LUI.Speech" )
|
||||
end
|
||||
f0_local0 = nil
|
||||
function new()
|
||||
local f1_local0 = {}
|
||||
setmetatable( f1_local0, {
|
||||
__index = _M
|
||||
} )
|
||||
return f1_local0
|
||||
end
|
||||
|
||||
function setupRoot( f2_arg0, f2_arg1 )
|
||||
f2_arg1:registerEventHandler( "init_hud", hudRootEventHandler( initHud ) )
|
||||
f2_arg1:registerEventHandler( "close_hud", closeHudHandler )
|
||||
f2_arg1:registerEventHandler( "intermission_began", hudRootEventHandler( beginIntermission ) )
|
||||
f2_arg1:registerEventHandler( "post_game_begin", hudRootEventHandler( openRoundEndScreen ) )
|
||||
f2_arg1:registerEventHandler( "round_end_show", hudRootEventHandler( openRoundEndScreen ) )
|
||||
f2_arg1:registerEventHandler( "show_host_migration", showHostMigrationHandler )
|
||||
end
|
||||
|
||||
function registerHud( f3_arg0 )
|
||||
f0_local0 = f3_arg0
|
||||
end
|
||||
|
||||
function initHud( f4_arg0, f4_arg1, f4_arg2 )
|
||||
if not f0_local0 then
|
||||
return
|
||||
elseif not f4_arg0.hudContainer then
|
||||
f4_arg0.hudContainer = LUI.UIElement.new( {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
topAnchor = true,
|
||||
bottomAnchor = true
|
||||
} )
|
||||
f4_arg0.hudContainer.id = "hudContainer"
|
||||
local f4_local0 = function ()
|
||||
|
||||
end
|
||||
|
||||
f4_arg0.hudContainer:registerEventHandler( "mousemove", f4_local0 )
|
||||
f4_arg0.hudContainer:registerEventHandler( "mousedown", f4_local0 )
|
||||
f4_arg0.hudContainer:registerEventHandler( "mouseup", f4_local0 )
|
||||
f4_arg0.hudContainer:registerEventHandler( "gamepad_button", f4_local0 )
|
||||
f4_arg0.hudContainer:registerEventHandler( "gamepad_sticks", f4_local0 )
|
||||
f4_arg0.hudContainer:registerEventHandler( "keybind", f4_local0 )
|
||||
f4_arg0.hudContainer:setPriority( LUI.UIRoot.childPriorities.hudContainer )
|
||||
f4_arg2:addElement( f4_arg0.hudContainer )
|
||||
if not f4_arg2.m_hudElemLayer then
|
||||
local f4_local1 = LUI.UIElement.new( {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
topAnchor = true,
|
||||
bottomAnchor = true
|
||||
} )
|
||||
f4_local1:setHudElemLayer()
|
||||
f4_local1:setPriority( LUI.UIRoot.childPriorities.hudElems )
|
||||
f4_arg2:addElement( f4_local1 )
|
||||
f4_arg2.m_hudElemLayer = f4_local1
|
||||
end
|
||||
end
|
||||
if not GameX.GetScreenWidth() then
|
||||
LUI.UIRoot.ProcessEvent( f4_arg2, {
|
||||
name = "init_hud"
|
||||
} )
|
||||
return
|
||||
end
|
||||
if Engine.IsMultiplayer() and not Engine.HasSnapshot() then
|
||||
LUI.UIRoot.ProcessEvent( f4_arg2, {
|
||||
name = "init_hud"
|
||||
} )
|
||||
return
|
||||
elseif not f4_arg0.hud then
|
||||
run_gc()
|
||||
profile.beginuserevent( "hud_create" )
|
||||
local f4_local1 = LUI.MenuBuilder.buildMenu( f0_local0 )
|
||||
profile.enduserevent( "hud_create" )
|
||||
run_gc()
|
||||
f4_arg0.hud = f4_local1
|
||||
f4_arg0.hudContainer.hud = f4_local1
|
||||
f4_arg0.hudContainer:addElement( f4_local1 )
|
||||
f4_local1:processEvent( {
|
||||
name = "menu_create",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
if Engine.HasSpeechFeature() then
|
||||
Kinect.EnableGlobalGrammars()
|
||||
end
|
||||
collectgarbage( "collect" )
|
||||
end
|
||||
local f4_local1 = Engine.IsMultiplayer()
|
||||
if f4_local1 then
|
||||
f4_local1 = MLG.IsMLGSpectator()
|
||||
end
|
||||
if f4_local1 then
|
||||
if not f4_arg0.MLGHud then
|
||||
f4_arg0.MLGHud = LUI.mp_hud.MLGHud.MLGHud( f4_arg0.hudContainer )
|
||||
f4_arg0.MLGHud:setPriority( LUI.UIRoot.childPriorities.MLGHud )
|
||||
f4_arg2:addElement( f4_arg0.MLGHud )
|
||||
f4_arg0.MLGHud:processEvent( {
|
||||
name = "menu_create",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
f4_arg0.hudContainer:registerEventHandler( "gamepad_button", LUI.UIElement.GamepadButton )
|
||||
end
|
||||
MLG.SetMLGActiveMenu()
|
||||
f4_arg0.MLGHud:processEvent( {
|
||||
name = "init_hud",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
end
|
||||
end
|
||||
|
||||
function closeHud( f6_arg0, f6_arg1, f6_arg2 )
|
||||
if f6_arg0.hud then
|
||||
f6_arg0.hud:processEvent( {
|
||||
name = "menu_close",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
f6_arg0.hud:close()
|
||||
f6_arg0.hud = nil
|
||||
if f6_arg0.hudContainer then
|
||||
f6_arg0.hudContainer.hud = nil
|
||||
end
|
||||
end
|
||||
if f6_arg0.MLGHud then
|
||||
f6_arg0.MLGHud:processEvent( {
|
||||
name = "menu_close",
|
||||
dispatchChildren = true
|
||||
} )
|
||||
f6_arg0.MLGHud:close()
|
||||
f6_arg0.MLGHud = nil
|
||||
end
|
||||
end
|
||||
|
||||
function closeRoundEndScreen( f7_arg0, f7_arg1, f7_arg2 )
|
||||
if f7_arg0.roundEndScreen then
|
||||
f7_arg0.roundEndScreen:processEvent( {
|
||||
name = "menu_close"
|
||||
} )
|
||||
f7_arg0.roundEndScreen:close()
|
||||
f7_arg0.roundEndScreen = nil
|
||||
end
|
||||
end
|
||||
|
||||
function endIntermission( f8_arg0, f8_arg1, f8_arg2 )
|
||||
if f8_arg0.finalScoresScreen then
|
||||
f8_arg0.finalScoresScreen:processEvent( {
|
||||
name = "menu_close"
|
||||
} )
|
||||
f8_arg0.finalScoresScreen:close()
|
||||
f8_arg0.finalScoresScreen = nil
|
||||
end
|
||||
end
|
||||
|
||||
function beginIntermission( f9_arg0, f9_arg1, f9_arg2 )
|
||||
f9_arg0:closeHud( f9_arg1, f9_arg2 )
|
||||
f9_arg0:closeRoundEndScreen( f9_arg1, f9_arg2 )
|
||||
if Engine.GetDvarBool( "squad_match" ) then
|
||||
Engine.SetDvarBool( "squad_find_match", true )
|
||||
Engine.SetDvarBool( "squad_send_results", true )
|
||||
Squad.PostMatch( Engine.GetClientMatchData( "alliesScore" ), Engine.GetClientMatchData( "axisScore" ), Engine.GetClientMatchData( "alliesKills" ), Engine.GetClientMatchData( "alliesDeaths" ), false )
|
||||
end
|
||||
if not f9_arg0.finalScoresScreen then
|
||||
f9_arg0.finalScoresScreen = LUI.MenuBuilder.BuildAddChild( f9_arg2, {
|
||||
type = "scoreboard"
|
||||
} )
|
||||
f9_arg0.finalScoresScreen:setPriority( LUI.UIRoot.childPriorities.finalScoresScreen )
|
||||
end
|
||||
end
|
||||
|
||||
function openRoundEndScreen( f10_arg0, f10_arg1, f10_arg2 )
|
||||
if not f10_arg0.roundEndScreen then
|
||||
f10_arg0.roundEndScreen = LUI.MenuBuilder.BuildAddChild( f10_arg2, {
|
||||
type = "roundEndHudDef"
|
||||
} )
|
||||
f10_arg0.roundEndScreen:setPriority( LUI.UIRoot.childPriorities.roundEndHud )
|
||||
end
|
||||
end
|
||||
|
||||
function hudRootEventHandler( f11_arg0 )
|
||||
return function ( f12_arg0, f12_arg1 )
|
||||
f11_arg0( f12_arg0.hudManager, f12_arg1, f12_arg0 )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function closeHudHandler( f13_arg0, f13_arg1 )
|
||||
local f13_local0 = f13_arg0.hudManager
|
||||
if f13_local0 then
|
||||
f13_local0:closeHud( f13_arg1, f13_arg0 )
|
||||
f13_local0:endIntermission( f13_arg1, f13_arg0 )
|
||||
end
|
||||
end
|
||||
|
||||
function showHostMigrationHandler( f14_arg0, f14_arg1 )
|
||||
LUI.FlowManager.RequestAddMenu( nil, "host_migration_main" )
|
||||
f14_arg0:dispatchEventToRoot( {
|
||||
name = "show_host_migration_triggered"
|
||||
} )
|
||||
end
|
||||
|
||||
LockTable( _M )
|
Reference in New Issue
Block a user