local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) SearchWidgetStatus = { INACTIVE = 0, FOUND_NO_GAMES = 1, SEARCHING = 2, FOUND_GAMES = 3, WAITING_FOR_PLAYERS = 4, WAITING_FOR_HOST = 5, JOINING = 6, STARTING = 7 } function lobby_search_widget() local f1_local0 = function ( f2_arg0, f2_arg1, f2_arg2 ) if f2_arg0.currentState ~= f2_arg1 then f2_arg0:animateToState( f2_arg1, f2_arg2 or 200 ) f2_arg0.currentState = f2_arg1 end end local f1_local1 = 320 local self = LUI.UIElement.new() self.id = "search_widget" self:registerAnimationState( "default", { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = 0, top = f1_local1, width = 512, height = 256, alpha = 1 } ) self:registerAnimationState( "disabled", { alpha = 0 } ) self:animateToState( "default" ) local f1_local3 = LUI.UITimer.new( 50, "main_update" ) f1_local3.id = "mainTimer" self:addElement( f1_local3 ) self:registerEventHandler( "main_update", function ( element, event ) if SvS.IsSvS() then local f3_local0 = SvS.GetCurrentSquadModeInfo() if f3_local0 == SvS.SquadModes.SquadAssault then if Squad.FoundMatch() then element:animateToState( "disabled" ) event.timer:close() end elseif f3_local0 == SvS.SquadModes.SquadVsSquad then local f3_local1 = Lobby.GetSearchWidgetStatus() >= SearchWidgetStatus.WAITING_FOR_PLAYERS if f3_local1 and not element.disableForSquadVsSquad then element:animateToState( "disabled" ) element.disableForSquadVsSquad = true elseif not f3_local1 and element.disableForSquadVsSquad then element:animateToState( "default" ) element.disableForSquadVsSquad = false end end end if Lobby.GetSearchWidgetStatus then local f3_local0 = element.status or -1 local f3_local1 = Lobby.GetSearchWidgetStatus() if f3_local1 ~= element.status then element.status = f3_local1 DebugPrint( "Search widget status is now " .. f3_local1 ) element:processEvent( { name = "update_search_status", oldStatus = f3_local0, status = element.status, dispatchChildren = true } ) end end end ) local f1_local4 = LUI.UIImage.new() f1_local4.id = "bg" f1_local4:registerAnimationState( "default", { material = RegisterMaterial( "widg_grid_fade" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.1 } ) f1_local4:animateToState( "default" ) self:addElement( f1_local4 ) local f1_local5 = { { 268, 85 }, { 352, 72 }, { 170, 136 }, { 384, 28 }, { 408, 139 }, { 234, 173 }, { 157, 4 }, { 92, 145 }, { 412, 227 }, { 285, 114 }, { 98, 40 }, { 112, 77 }, { 330, 168 }, { 421, 8 }, { 105, 189 }, { 381, 106 }, { 305, 12 }, { 136, 89 }, { 224, 33 } } local f1_local6 = LUI.UIElement.new() f1_local6.id = "techyDigits" f1_local6:registerAnimationState( "default", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 1 } ) f1_local6:registerAnimationState( "hidden", { alpha = 0 } ) f1_local6:animateToState( "default" ) f1_local6:registerEventHandler( "update_search_status", function ( element, event ) assert( event.status ) if event.status >= SearchWidgetStatus.FOUND_GAMES then f1_local0( f1_local6, "hidden" ) else f1_local0( f1_local6, "default" ) end end ) self:addElement( f1_local6 ) local f1_local7 = LUI.UITimer.new( 450, "update_digits_bg" ) f1_local7.id = "digitsTimer" f1_local6:addElement( f1_local7 ) f1_local6.animIndex = 0 f1_local6:registerEventHandler( "update_digits_bg", function ( element, event ) local f5_local0 = element:getFirstChild() while f5_local0 do if f5_local0.index == element.animIndex then local f5_local1 = MBh.AnimateSequence( { { "visible", 800, true, true }, { "visible", 2400, false, false }, { "default", 1200, true, true } } ) f5_local1( f5_local0, {} ) end f5_local0 = f5_local0:getNextSibling() end element.animIndex = (element.animIndex + 1) % #f1_local5 end ) for f1_local11, f1_local12 in ipairs( f1_local5 ) do local f1_local13 = LUI.UITechyDigits.new() f1_local13.id = "digits_" .. f1_local11 f1_local13.index = f1_local11 f1_local13:registerAnimationState( "default", { font = CoD.TextSettings.TinyFont.Font, alignment = LUI.Alignment.Center, topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = f1_local12[1], top = f1_local12[2], width = 0, height = CoD.TextSettings.TinyFont.Height, alpha = 0 } ) f1_local13:registerAnimationState( "visible", { alpha = 0.3 } ) f1_local13:animateToState( "default", 0 ) local f1_local14 = MBh.AnimateLoop( { { "default", (f1_local11 - 1) * 600, false, false }, { "visible", 800, true, true }, { "visible", 2400, false, false }, { "default", 1200, true, true }, { "default", (#f1_local5 - f1_local11) * 400, false, false } } ) f1_local14( f1_local13, {} ) f1_local6:addElement( f1_local13 ) f1_local14 = LUI.UIImage.new() f1_local14.id = "blip" f1_local14:registerAnimationState( "default", { material = RegisterMaterial( "icon_lobby_map_blip2" ), topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 15, height = 8, left = -4, width = 8, alpha = 0.6 } ) f1_local14:animateToState( "default" ) f1_local13:addElement( f1_local14 ) end f1_local8 = LUI.UITechyDigits.new() f1_local8.id = "middleDigits" f1_local8:registerAnimationState( "default", { font = CoD.TextSettings.TinyFont.Font, alignment = LUI.Alignment.Center, topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, left = -50, top = -8, width = 100, height = CoD.TextSettings.TinyFont.Height, alpha = 0 } ) f1_local8:registerAnimationState( "visible", { alpha = 0.5 } ) f1_local8:animateToState( "default", 0 ) f1_local8:registerEventHandler( "update_search_status", function ( element, event ) assert( event.status ) if event.status >= SearchWidgetStatus.FOUND_GAMES and event.status < SearchWidgetStatus.JOINING then f1_local0( f1_local8, "visible", 400 ) else f1_local0( f1_local8, "default", 100 ) end end ) self:addElement( f1_local8 ) f1_local9 = 48 f1_local10 = 8 f1_local11 = LUI.UIElement.new() f1_local11.id = "spinner" f1_local11:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -f1_local9, bottom = f1_local9, left = -f1_local9, right = f1_local9 } ) f1_local11:registerEventHandler( "update_search_status", function ( element, event ) local f7_local0 if event.status < SearchWidgetStatus.FOUND_GAMES or event.status >= SearchWidgetStatus.JOINING then f7_local0 = false else f7_local0 = true end element.spinningRequested = f7_local0 end ) f1_local11:animateToState( "default" ) self:addElement( f1_local11 ) f1_local12 = LUI.UITimer.new( 80, "update_spinner" ) f1_local12.id = "spinnerTimer" f1_local11:addElement( f1_local12 ) f1_local11.spinningPossible = false f1_local11.spinningRequested = false f1_local11.spinIndex = 0 f1_local11:registerEventHandler( "update_spinner", function ( element, event ) if element.spinningPossible and element.spinningRequested then local f8_local0 = element:getFirstChild() while f8_local0 do if f8_local0.index and f8_local0.index == element.spinIndex then local f8_local1 = MBh.AnimateSequence( { { "positioned", 80 }, { "faded", 140 } } ) f8_local1( f8_local0, {} ) end f8_local0 = f8_local0:getNextSibling() end element.spinIndex = (f1_local10 + element.spinIndex - 1) % f1_local10 end end ) for f1_local13 = 0, f1_local10 - 1, 1 do local f1_local16 = LUI.UIImage.new() f1_local16.id = "dot_" .. f1_local13 f1_local16.index = f1_local13 f1_local16:registerAnimationState( "default", { material = RegisterMaterial( "icon_lobby_map_blip2" ), topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -4, bottom = 4, left = -4, right = 4, alpha = 0 } ) local f1_local17 = -(f1_local13 / 8) * 2 * math.pi local f1_local18 = f1_local9 * math.cos( f1_local17 ) local f1_local19 = f1_local9 * math.sin( f1_local17 ) f1_local16:registerAnimationState( "positioned", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = f1_local19 - 4, bottom = f1_local19 + 4, left = f1_local18 - 4, right = f1_local18 + 4, alpha = 1 } ) f1_local16:registerAnimationState( "faded", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = f1_local19 - 4, bottom = f1_local19 + 4, left = f1_local18 - 4, right = f1_local18 + 4, alpha = 0.3 } ) f1_local16:registerAnimationState( "final_blink", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = f1_local19 - 4, bottom = f1_local19 + 4, left = f1_local18 - 4, right = f1_local18 + 4, alpha = 0.3 } ) f1_local16:registerAnimationState( "vanished", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = f1_local19 - 4 + 2 * f1_local18, bottom = f1_local19 + 4 + 2 * f1_local18, left = f1_local18 - 4 - 2 * f1_local19, right = f1_local18 + 4 - 2 * f1_local19, alpha = 0 } ) f1_local16:animateToState( "default" ) f1_local16:addEventHandler( LUI.FormatAnimStateFinishEvent( "final_blink" ), function ( f9_arg0, f9_arg1 ) f1_local11.spinningPossible = true end ) f1_local16:registerEventHandler( "update_search_status", function ( element, event ) if event.oldStatus < SearchWidgetStatus.FOUND_GAMES and event.status >= SearchWidgetStatus.FOUND_GAMES and event.status < SearchWidgetStatus.JOINING then f1_local11.spinningPossible = false local f10_local0 = MBh.AnimateSequence( { { "default", 20 }, { "positioned", 250 }, { "faded", 250 }, { "positioned", 120 }, { "faded", 250 }, { "positioned", 120 }, { "faded", 250 }, { "positioned", 120 }, { "final_blink", 250 } } ) f10_local0( f1_local16, {} ) elseif event.status < SearchWidgetStatus.FOUND_GAMES then f1_local11.spinningPossible = false f1_local16:animateToState( "default", 140 ) elseif event.status == SearchWidgetStatus.JOINING then f1_local16:animateToState( "faded", 100 ) elseif event.status == SearchWidgetStatus.STARTING then f1_local16:animateToState( "vanished", 300 ) end end ) f1_local11:addElement( f1_local16 ) end local f1_local13 = 3 local f1_local14 = LUI.UIElement.new() f1_local14.id = "gameFound" f1_local14:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, bottom = 0, left = 0, right = 0 } ) f1_local14:animateToState( "default" ) self:addElement( f1_local14 ) f1_local14:registerEventHandler( "update_search_status", function ( element, event ) element.pulseRequested = event.status >= SearchWidgetStatus.JOINING end ) local f1_local15 = LUI.UITimer.new( 400, "update_game_found" ) f1_local15.id = "gameFoundTimer" f1_local14:addElement( f1_local15 ) f1_local14.pulseRequested = false f1_local14.pulsePossible = false f1_local14.pulseIndex = 0 f1_local14:registerEventHandler( "update_game_found", function ( element, event ) if element.pulsePossible and element.pulseRequested then local f12_local0 = element:getFirstChild() while f12_local0 do if f12_local0.index and f12_local0.index == element.pulseIndex then local f12_local1 = MBh.AnimateSequence( { { "default", 0 }, { "expanded", 1000, true, true } } ) f12_local1( f12_local0, {} ) end f12_local0 = f12_local0:getNextSibling() end element.pulseIndex = (element.pulseIndex + 1) % f1_local13 end end ) local f1_local20 = LUI.UIImage.new() f1_local20.id = "foundBlip" local f1_local16 = -(3 / f1_local10) * 2 * math.pi f1_local20:registerAnimationState( "default", { material = RegisterMaterial( "icon_lobby_map_blip3" ), topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = f1_local9 * math.sin( f1_local16 ) - 4, height = 8, left = f1_local9 * math.cos( f1_local16 ) - 4, width = 8, alpha = 0 } ) f1_local20:registerAnimationState( "visible", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -4, height = 8, left = -4, width = 8, alpha = 1 } ) f1_local20:registerAnimationState( "invisible", { alpha = 0 } ) f1_local20:animateToState( "default" ) f1_local14:addElement( f1_local20 ) f1_local20:addEventHandler( LUI.FormatAnimStateFinishEvent( "visible" ), function ( f13_arg0, f13_arg1 ) f1_local14.pulsePossible = true end ) f1_local20:registerEventHandler( "update_search_status", function ( element, event ) if event.oldStatus < SearchWidgetStatus.JOINING and event.status >= SearchWidgetStatus.JOINING then f1_local14.pulsePossible = false local f14_local0 = MBh.AnimateSequence( { { "invisible", 20 }, { "default", 0 }, { "visible", 250 } } ) f14_local0( element, {} ) elseif event.status < SearchWidgetStatus.JOINING then f1_local14.pulsePossible = false element:animateToState( "invisible", 140 ) end end ) for f1_local19 = 0, f1_local13 - 1, 1 do local f1_local23 = LUI.UIImage.new() f1_local23.id = "pulse_" .. f1_local19 f1_local23.index = f1_local19 f1_local23:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { material = RegisterMaterial( "widg_circle" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.5 } ) ) f1_local23:registerAnimationState( "expanded", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -32, bottom = 32, left = -32, right = 32, alpha = 0 } ) f1_local23:animateToState( "default" ) f1_local14:addElement( f1_local23 ) end return self end LUI.MenuBuilder.registerType( "lobby_search_widget", lobby_search_widget ) LockTable( _M )