iw6-lui/lui/persistentbackground.dec.lua
2024-09-12 17:25:45 +02:00

1056 lines
26 KiB
Lua

PersistentBackground = {
Init = function ()
PersistentBackground.SetToDefault()
end,
SetToDefault = function ()
if not Engine.IsMultiplayer() then
PersistentBackground.Set( PersistentBackground.Variants.SPBackground )
elseif Engine.IsAliensMode() then
PersistentBackground.Set( PersistentBackground.Variants.AliensBackground )
elseif SvS.IsSvS() then
PersistentBackground.Set( PersistentBackground.Variants.SvSBackground )
else
PersistentBackground.Set( PersistentBackground.Variants.MPBackground )
end
end,
Set = function ( f3_arg0 )
local f3_local0 = Engine.GetLuiRoot()
if f3_arg0 == PersistentBackground.current then
PersistentBackground.ProcessEvent( {
name = "refresh_alien_tint"
} )
return
elseif not f3_local0.background then
local self = LUI.UIElement.new()
self.id = "persistent_bg_container"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
} )
self:registerAnimationState( "hidden", {
alpha = 0
} )
self:animateToState( "default" )
self:setupLetterboxElement()
self:setUseStencil( true )
f3_local0.background = self
f3_local0.background:setPriority( -1000 )
f3_local0:addElement( self )
end
if f3_arg0 then
local self = f3_arg0()
f3_local0.background:closeChildren()
f3_local0.background:addElement( self )
f3_local0.background:processEvent( {
name = "menu_create",
dispatchChildren = true
} )
end
PersistentBackground.current = f3_arg0
end,
ProcessEvent = function ( f4_arg0 )
local f4_local0 = Engine.GetLuiRoot()
if f4_local0.background then
f4_local0.background:processEvent( f4_arg0 )
end
end,
Hide = function ( f5_arg0 )
local f5_local0 = Engine.GetLuiRoot()
if f5_local0.background then
f5_local0.background:animateToState( "hidden", f5_arg0 or 0 )
end
end,
Show = function ( f6_arg0 )
local f6_local0 = Engine.GetLuiRoot()
if f6_local0.background then
f6_local0.background:animateToState( "default", f6_arg0 or 0 )
else
DebugPrint( "WARNING: Trying to show menu persistent background but none has been set" )
end
end
}
local f0_local0 = function ()
local self = LUI.UIImage.new()
self:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 300,
height = 256,
right = 0,
width = 256
} ) )
self:registerAnimationState( "far", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 300,
height = 256,
left = 0,
width = 256
} )
self:animateToState( "default" )
local f7_local1 = MBh.AnimateLoop( {
{
"default",
0
},
{
"far",
5000
}
} )
f7_local1( self, {} )
return self
end
local f0_local1 = function ()
local f8_local0 = "background_start"
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f8_local2 = LUI.UIImage.new()
f8_local2:registerAnimationState( "default", {
material = RegisterMaterial( f8_local0 ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
f8_local2:animateToState( "default" )
f8_local2:registerEventHandler( "update_sp_persistent_background", function ( element, event )
element:setImage( event.newImage )
end )
self:addElement( f8_local2 )
local f8_local3 = {
type = "UIElement",
id = "smoky_bg_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "background_smoky_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "frontend_sp_alpha_shards" ),
alpha = 0.75
},
left = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = -1280,
right = -1280
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"left",
60000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_smoky_2_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 1280,
right = 1280,
material = RegisterMaterial( "frontend_sp_alpha_shards" ),
alpha = 0.75
},
right = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"right",
60000,
false,
false
}
} )
}
}
}
}
local f8_local4 = {
type = "UIElement",
id = "skull_image_container_id",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = -750,
bottom = 30,
left = 100,
right = -680,
alpha = 0
},
normal = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = -750,
bottom = 30,
left = 100,
right = -680,
alpha = 1
}
},
handlers = {
enter_lockout_menu = MBh.AnimateToState( "default", 500 ),
menu_create = function ( f10_arg0 )
f10_arg0:animateToState( "normal", 500 )
end
},
children = {
{
type = "UIImage",
id = "skull_image_intro01_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "frontend_sp_alpha_art_01" ),
alpha = 0
},
intro1 = {
alpha = 0
},
loopstate1 = {
alpha = 0.2
}
},
handlers = {
menu_create = MBh.AnimateSequence( {
{
"default",
0
},
{
"intro1",
500
}
} ),
transition_complete_intro1 = MBh.AnimateLoop( {
{
"loopstate1",
2000
},
{
"intro1",
2000
}
} )
}
},
{
type = "UIImage",
id = "skull_image_intro02_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "frontend_sp_alpha_art_02" ),
alpha = 0
},
intro2 = {
alpha = 0
},
loopstate2 = {
alpha = 0.2
}
},
handlers = {
menu_create = MBh.AnimateSequence( {
{
"default",
1000
},
{
"intro2",
2000
}
} ),
transition_complete_intro2 = MBh.AnimateLoop( {
{
"loopstate2",
2000
},
{
"intro2",
2000
}
} )
}
},
{
type = "UIImage",
id = "skull_image_intro03_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "frontend_sp_alpha_art_03" ),
alpha = 0
},
intro3 = {
alpha = 0
},
loopstate3 = {
alpha = 0.2
}
},
handlers = {
menu_create = MBh.AnimateSequence( {
{
"default",
2000
},
{
"intro3",
2000
}
} ),
transition_complete_intro3 = MBh.AnimateLoop( {
{
"loopstate3",
2000
},
{
"intro3",
2000
}
} )
}
},
{
type = "UIImage",
id = "skull_image_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "frontend_sp_alpha_art" ),
alpha = 0
},
intro4 = {
alpha = 0.2
},
loopstate4 = {
alpha = 0.3
}
},
handlers = {
menu_create = MBh.AnimateSequence( {
{
"default",
3000
},
{
"intro4",
3000
}
} ),
transition_complete_intro4 = MBh.AnimateLoop( {
{
"loopstate4",
3000
},
{
"intro4",
3000
}
} )
}
}
}
}
LUI.MenuBuilder.BuildAddChild( self, f8_local3 )
self:registerEventHandler( "enter_main_menu", function ( element, event )
if self.skull then
self.skull:close()
end
self.skull = LUI.MenuBuilder.BuildAddChild( self, f8_local4 )
self.skull:processEvent( {
name = "menu_create",
dispatchChildren = true
} )
end )
return self
end
local f0_local2 = function ( f12_arg0 )
local f12_local0 = "frontend_mp_alpha_art"
local f12_local1 = "frontend_mp_alpha_art_blur"
local f12_local2 = "frontend_mp_alpha_shards_mid"
local f12_local3 = "frontend_mp_alpha_shards_fore"
local f12_local4 = "frontend_mp_add_glints"
local f12_local5
if f12_arg0 then
f12_local5 = 1
if not f12_local5 then
else
local f12_local6
if f12_arg0 then
f12_local6 = 0
if not f12_local6 then
else
local f12_local7
if f12_arg0 then
f12_local7 = 0
if not f12_local7 then
else
local f12_local8
if f12_arg0 then
f12_local8 = 0
if not f12_local8 then
else
local f12_local9
if f12_arg0 then
f12_local9 = true
else
f12_local9 = false
end
local f12_local10
if f12_arg0 then
f12_local10 = 0
if not f12_local10 then
else
if f12_arg0 then
if f12_arg0.squads then
f12_local0 = "frontend_sq_art"
f12_local1 = "frontend_sq_art_blur"
elseif f12_arg0.aliens then
f12_local0 = "frontend_aliens_art"
f12_local1 = "frontend_aliens_art_blur"
end
if f12_arg0.squads or f12_arg0.aliens then
f12_local2 = "frontend_sp_alpha_shards"
end
end
return LUI.MenuBuilder.buildItems( {
type = "UIElement",
id = "mp_bg_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "bg_image_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( f12_local0 )
}
}
},
{
type = "UIImage",
id = "bg_image_blurry_id",
states = {
default = {
material = RegisterMaterial( f12_local1 ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0
},
active = {
alpha = 1
}
},
handlers = {
unblur_persistent_background = function ( f13_arg0, f13_arg1 )
f13_arg0:animateToState( "default", f13_arg1.duration or 0 )
end
,
blur_persistent_background = function ( f14_arg0, f14_arg1 )
f14_arg0:animateToState( "active", f14_arg1.duration or 0 )
end
}
},
{
type = "UIImage",
id = "background_shards_mid_img_id",
states = {
default = {
topAnchor = f12_local9,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f12_local10,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( f12_local2 ),
alpha = f12_local5
},
left = {
topAnchor = f12_local9,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f12_local10,
bottom = 0,
left = -1280,
right = -1280
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"left",
60000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_shards2_mid_img_id",
states = {
default = {
topAnchor = f12_local9,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f12_local10,
bottom = 0,
left = 1280,
right = 1280,
material = RegisterMaterial( f12_local2 ),
alpha = f12_local5
},
right = {
topAnchor = f12_local9,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f12_local10,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"right",
60000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_fore_img_id",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -190,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( f12_local3 ),
alpha = f12_local6
},
left = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -190,
bottom = 0,
left = -1280,
right = -1280
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"left",
40000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_fore2_img_id",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -190,
bottom = 0,
left = 1280,
right = 1280,
material = RegisterMaterial( f12_local3 ),
alpha = f12_local6
},
right = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -190,
bottom = 0,
left = 0,
right = 0
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"right",
40000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_mp_glints_img_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( f12_local4 ),
alpha = f12_local7
},
left = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = -640,
right = -640,
alpha = f12_local8
},
left2 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = -1280,
right = -1280,
alpha = f12_local7
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"left",
15000,
false,
false
},
{
"left2",
15000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "background_mp_glints2_img_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 1280,
right = 1280,
material = RegisterMaterial( f12_local4 ),
alpha = f12_local7
},
right = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 640,
right = 640,
alpha = f12_local8
},
right2 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = f12_local7
}
},
handlers = {
menu_create = MBh.AnimateLoop( {
{
"default",
0,
false,
false
},
{
"right",
15000,
false,
false
},
{
"right2",
15000,
false,
false
}
} )
}
},
{
type = "UIImage",
id = "large_map_preview_id",
states = {
default = {
material = RegisterMaterial( "loadscreen_mp_prisonbreak" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
background_transition_timer = RefreshLargeMapImage,
menu_create = InitLargeMapImage
},
children = {
{
type = "UIImage",
id = "large_map_preview_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
lobby_transition_to_game = ShowAliensCleanLobbyBkg,
lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime )
}
},
{
type = "UIImage",
id = "large_map_preview_overlay_id",
states = {
default = {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
red = Swatches.Overlay.Color.r,
green = Swatches.Overlay.Color.g,
blue = Swatches.Overlay.Color.b,
alpha = Swatches.Overlay.AlphaMedium
},
hidden = {
alpha = 0
},
rollback = {
alpha = Swatches.Overlay.AlphaMedium
}
},
handlers = {
lobby_transition_to_game = MBh.AnimateToStateWithEvent( "hidden", Lobby.TransitionTime, false, false ),
transition_complete_hidden = MBh.EmitEventToRoot( "lobby_transition_complete" ),
lobby_rollback_transition_to_game = MBh.AnimateToState( "rollback", Lobby.TransitionTime )
}
},
GetUpperGradient(),
GetLowerGradient(),
{
type = "UITimer",
properties = {
event = "background_transition_timer",
interval = 200,
disposable = false
}
}
}
},
{
type = "UIImage",
id = "bg_image_tint_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "box_alien_color_tint" ),
red = Colors.alien_frontend_hilite.r,
green = Colors.alien_frontend_hilite.g,
blue = Colors.alien_frontend_hilite.b,
alpha = 0
},
aliens = {
alpha = 0.2
}
},
handlers = {
menu_create = MBh.EmitEvent( {
name = "refresh_alien_tint"
} ),
refresh_alien_tint = function ( f15_arg0, f15_arg1 )
local f15_local0 = "default"
if Engine.IsAliensMode() then
f15_local0 = "aliens"
end
f15_arg0:animateToState( f15_local0 )
end
}
}
}
}, {}, nil )
end
end
f12_local10 = -320
end
end
f12_local8 = 0.75
end
end
f12_local7 = 1
end
end
f12_local6 = 1
end
end
f12_local5 = 0.85
end
PersistentBackground.Variants = {
DebugBackground = f0_local0,
SPBackground = f0_local1,
MPBackground = function ()
return f0_local2()
end,
SvSBackground = function ()
return f0_local2( {
squads = true
} )
end,
AliensBackground = function ()
return f0_local2( {
aliens = true
} )
end
}