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

193 lines
5.7 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then
f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton )
end
end
f0_local1 = function ( f2_arg0, f2_arg1 )
LUI.FlowManager.RequestLeaveMenu( f2_arg0 )
end
f0_local2 = function ( f3_arg0, f3_arg1 )
Engine.NotifyServer( "team_select", 0 )
local f3_local0 = Engine.GetDvarString( "g_gametype" )
end
local f0_local3 = function ( f4_arg0, f4_arg1 )
Engine.NotifyServer( "team_select", 1 )
local f4_local0 = Engine.GetDvarString( "g_gametype" )
end
local f0_local4 = function ( f5_arg0, f5_arg1 )
Engine.NotifyServer( "team_select", 2 )
local f5_local0 = Engine.GetDvarString( "g_gametype" )
end
local f0_local5 = function ( f6_arg0, f6_arg1 )
Engine.NotifyServer( "team_select", 3 )
local f6_local0 = MBh.EmitEventToRoot( "toggle_pause_off" )
f6_local0( f6_arg0 )
LUI.FlowManager.RequestCloseAllMenus( f6_arg0 )
end
local f0_local6 = function ()
local f7_local0 = MatchRules.GetData( "commonOption", "spectateModeAllowed" )
local f7_local1 = Game.GetPlayerTeam()
if Engine.GetDvarBool( "xblive_competitionmatch" ) and Engine.GetDvarBool( "xblive_privatematch" ) then
f7_local0 = 0
end
local self = LUI.UIVerticalList.new()
self.id = "team_select_selections_Id"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = GenericMenuDims.menu_top,
left = GenericMenuDims.menu_left,
bottom = GenericMenuDims.menu_bottom,
right = GenericMenuDims.menu_right,
alignment = LUI.Alignment.Top
} )
self:animateToState( "default", 0 )
self:makeFocusable()
LUI.MenuBuilder.BuildAddChild( self, {
type = "UIGenericButton",
id = "btn_MPTeamChange_0",
properties = {
childNum = 1,
button_text = Engine.Localize( "@LUA_MENU_AUTOASSIGN_CAPS" ),
button_action_func = f0_local4
}
} )
local f7_local3 = LUI.MenuBuilder.BuildAddChild
local f7_local4 = self
local f7_local5 = {
type = "UIGenericButton",
id = "btn_MPTeamChange_1"
}
local f7_local6 = {
childNum = 2,
button_text = GameX.GetLocalizedTeamName( Teams.allies ),
button_action_func = f0_local3
}
local f7_local7
if f7_local1 == Teams.allies then
f7_local7 = Colors.yellow
if not f7_local7 then
else
f7_local6.text_default_color = f7_local7
f7_local5.properties = f7_local6
f7_local5.handlers = {
menu_create = function ( f8_arg0, f8_arg1 )
f8_arg0.listDefaultFocus = f7_local1 == Teams.allies
end
}
f7_local3( f7_local4, f7_local5 )
f7_local3 = LUI.MenuBuilder.BuildAddChild
f7_local4 = self
f7_local5 = {
type = "UIGenericButton",
id = "btn_MPTeamChange_2"
}
f7_local6 = {
childNum = 3,
button_text = GameX.GetLocalizedTeamName( Teams.axis ),
button_action_func = f0_local2
}
if f7_local1 == Teams.axis then
f7_local7 = Colors.yellow
if not f7_local7 then
else
f7_local6.text_default_color = f7_local7
f7_local5.properties = f7_local6
f7_local5.handlers = {
menu_create = function ( f9_arg0, f9_arg1 )
f9_arg0.listDefaultFocus = f7_local1 == Teams.axis
end
}
f7_local3( f7_local4, f7_local5 )
if f7_local0 ~= 0 then
LUI.MenuBuilder.BuildAddChild( self, {
type = "UIGenericButton",
id = "btn_MPTeamChange_3",
properties = {
childNum = 4,
button_text = Engine.Localize( "@LUA_MENU_SPECTATOR_CAPS" ),
button_action_func = f0_local5,
text_default_color = Game.GetOmnvar( "ui_spectator_selected" ) and Colors.yellow or Colors.generic_button_text_default_color
},
handlers = {
menu_create = function ( f10_arg0, f10_arg1 )
f10_arg0.listDefaultFocus = Game.GetOmnvar( "ui_spectator_selected" ) == 1
end
}
} )
end
return self
end
end
f7_local7 = Colors.generic_button_text_default_color
end
end
f7_local7 = Colors.generic_button_text_default_color
end
LUI.MenuBuilder.registerType( "team_select_main", function ()
local f11_local0 = Engine.Localize( "@LUA_MENU_CHANGE_TEAM_CAPS" )
local self = LUI.UIElement.new()
self.id = "mp_team_select_id"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerEventHandler( "menu_create", f0_local0 )
self:registerOmnvarHandler( "ui_pause_menu_show", LUI.mp_hud.OptionsMenu.pauseMenuUpdate )
LUI.MenuBuilder.BuildAddChild( self, {
type = "UIWorldBlur",
id = "tsWorldBlurOverlay",
states = {
default = {
worldBlur = 5
}
}
} )
self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_background_def() )
LUI.MenuBuilder.BuildAddChild( self, {
type = "button_helper_text_main",
id = "tshelper_text_id"
} )
if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then
LUI.MenuBuilder.BuildAddChild( self, {
type = "online_friends_widget",
id = "tsfriends_widget_id"
} )
end
local f11_local2 = LUI.UIBindButton.new()
f11_local2.id = "tsBackToGameStartButton"
f11_local2:registerEventHandler( "button_start", f0_local1 )
f11_local2:registerEventHandler( "button_secondary", f0_local1 )
self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_title_def( f11_local0 ) )
self:addElement( f0_local6() )
self:addElement( LUI.mp_hud.OptionsMenu.game_mode_def() )
self:addElement( LUI.mp_hud.OptionsMenu.map_display_def() )
self:addElement( f11_local2 )
return self
end )
LockTable( _M )