623 lines
15 KiB
Lua
623 lines
15 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
f0_local0 = {
|
|
ButtonPos1 = 75,
|
|
ButtonPos2 = 100,
|
|
ButtonPos3 = 125,
|
|
ButtonPos4 = 150,
|
|
ButtonPos5 = 175,
|
|
ButtonPos6 = 200
|
|
}
|
|
function SplitScreenSignInCreate( f1_arg0, f1_arg1 )
|
|
Engine.PlaySound( CoD.SFX.MouseOver )
|
|
if not f1_arg1.stackRestore then
|
|
Engine.Exec( "startsplitscreensignin", 0 )
|
|
end
|
|
end
|
|
|
|
function SplitscreensigninRefresh( f2_arg0, f2_arg1 )
|
|
f2_arg0:dispatchEventToRoot( {
|
|
name = "refresh_quadrant_options",
|
|
immediate = true
|
|
} )
|
|
f2_arg0:dispatchEventToRoot( {
|
|
name = "refresh_quadrant_leds",
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function GetQuadsLayoutData( f3_arg0 )
|
|
local f3_local0 = assert
|
|
local f3_local1
|
|
if f3_arg0 ~= 2 and f3_arg0 ~= 4 then
|
|
f3_local1 = false
|
|
else
|
|
f3_local1 = true
|
|
end
|
|
f3_local0( f3_local1, "numQuads must be 2 or 4" )
|
|
f3_local0 = 245
|
|
f3_local1 = 517
|
|
local f3_local2 = {}
|
|
if f3_arg0 == 4 then
|
|
f3_local2 = {
|
|
{
|
|
x = 100,
|
|
y = 124
|
|
},
|
|
{
|
|
x = 660,
|
|
y = 124
|
|
},
|
|
{
|
|
x = 100,
|
|
y = 395
|
|
},
|
|
{
|
|
x = 660,
|
|
y = 395
|
|
}
|
|
}
|
|
else
|
|
f3_local2 = {
|
|
{
|
|
x = 370,
|
|
y = 124
|
|
},
|
|
{
|
|
x = 370,
|
|
y = 395
|
|
}
|
|
}
|
|
end
|
|
return f3_local0, f3_local1, f3_local2
|
|
end
|
|
|
|
function QuadrantFeeder( f4_arg0 )
|
|
local f4_local0 = f4_arg0.numQuads
|
|
local f4_local1 = 245
|
|
local f4_local2 = 517
|
|
local f4_local3 = nil
|
|
f4_local1, f4_local2, f4_local3 = GetQuadsLayoutData( f4_local0 )
|
|
local f4_local4 = {}
|
|
for f4_local5 = 1, #f4_local3, 1 do
|
|
f4_local4[#f4_local4 + 1] = {
|
|
type = "menu_splitscreensignin_quadrant",
|
|
id = "quadrant_" .. f4_local5,
|
|
properties = {
|
|
qid = f4_local5 - 1,
|
|
listen_on_controller = -1
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f4_local3[f4_local5].x,
|
|
right = f4_local3[f4_local5].x + f4_local2,
|
|
top = f4_local3[f4_local5].y,
|
|
bottom = f4_local3[f4_local5].y + f4_local1
|
|
}
|
|
}
|
|
}
|
|
end
|
|
return f4_local4
|
|
end
|
|
|
|
function menu_splitscreensignin()
|
|
return {
|
|
type = "UIElement",
|
|
id = "menu_splitscreensigninmain",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
},
|
|
properties = {
|
|
numQuads = 2
|
|
},
|
|
handlers = {
|
|
menu_create = SplitScreenSignInCreate,
|
|
refresh_splitscreensignin_menu = SplitscreensigninRefresh
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_menu_title",
|
|
id = "splitscreen_signin_menu_title",
|
|
properties = {
|
|
menu_title = Engine.Localize( "@LUA_MENU_LOCAL_PLAY_SIGNIN_CAPS" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "horizontal_line_id",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 21.5,
|
|
bottom = 22.5,
|
|
red = 1,
|
|
green = 1,
|
|
blue = 1,
|
|
alpha = 0.3
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "quadrants_container_id",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
},
|
|
childrenFeeder = QuadrantFeeder,
|
|
handlers = {
|
|
refresh_quadrant_leds = RefreshQuadrantLEDs
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function GetOptionsList( f6_arg0 )
|
|
local f6_local0 = 200
|
|
local f6_local1 = {
|
|
{
|
|
string = Engine.Localize( "@XBOXLIVE_JOINSPLITSCREENGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_JOINSPLITSCREENGAME_MW3" ),
|
|
visarg = Engine.GetDvarBool( "joingame" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos1
|
|
},
|
|
{
|
|
string = Engine.Localize( "@XBOXLIVE_BACK_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_BACK_MW3" ),
|
|
visarg = Engine.GetDvarBool( "joingame" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos2
|
|
},
|
|
{
|
|
string = Engine.Localize( "@MENU_WAITING_FOR_MORE_PLAYERS1" ),
|
|
visarg = Engine.GetDvarBool( "waiting" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos3
|
|
},
|
|
{
|
|
string = Engine.Localize( "@XBOXLIVE_STARTGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_STARTGAME_MW3" ),
|
|
visarg = Engine.GetDvarBool( "startgame" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos3
|
|
},
|
|
{
|
|
string = Engine.Localize( "@XBOXLIVE_LEAVESPLITSCREENGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_LEAVESPLITSCREENGAME_MW3" ),
|
|
visarg = Engine.GetDvarBool( "leavegame" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos4
|
|
}
|
|
}
|
|
if Engine.IsPS3() then
|
|
f6_local1[#f6_local1 + 1] = {
|
|
string = Engine.Localize( "@XBOXLIVE_CHANGEOFFLINEPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_CHANGEOFFLINEPROFILE_MW3" ),
|
|
visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos5
|
|
}
|
|
elseif not Engine.IsPS4() then
|
|
f6_local1[#f6_local1 + 1] = {
|
|
string = Engine.Localize( "@XBOXLIVE_SIGNINPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_SIGNINPROFILE_MW3" ),
|
|
visarg = Engine.GetDvarBool( "signin" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos5,
|
|
xbox_only = true
|
|
}
|
|
f6_local1[#f6_local1 + 1] = {
|
|
string = Engine.Localize( "@XBOXLIVE_CHANGEPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_CHANGEPROFILE_MW3" ),
|
|
visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos5,
|
|
xbox_only = true
|
|
}
|
|
if not Engine.IsXB3() then
|
|
f6_local1[#f6_local1 + 1] = {
|
|
string = Engine.Localize( "@XBOXLIVE_SELECTSAVEDEVICE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_SELECTSAVEDEVICE_MW3" ),
|
|
visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ),
|
|
xpos = f6_local0,
|
|
ypos = f0_local0.ButtonPos6,
|
|
xbox_only = true
|
|
}
|
|
end
|
|
end
|
|
return f6_local1
|
|
end
|
|
|
|
function QuadrantOptionsListFeeder( f7_arg0 )
|
|
local f7_local0 = {}
|
|
local f7_local1 = 0.7
|
|
local f7_local2 = 0.7
|
|
local f7_local3 = 0.7
|
|
local f7_local4 = CoD.TextSettings.BigFont.Height
|
|
local f7_local5 = GetOptionsList( f7_arg0 )
|
|
for f7_local6 = 1, #f7_local5, 1 do
|
|
local f7_local9 = 0
|
|
if f7_local5[f7_local6].visarg == true then
|
|
f7_local9 = 1
|
|
end
|
|
f7_local0[#f7_local0 + 1] = {
|
|
type = "UIText",
|
|
id = "option_" .. f7_local6 .. "id_controller" .. f7_arg0.listen_on_controller,
|
|
properties = {
|
|
text = f7_local5[f7_local6].string
|
|
},
|
|
states = {
|
|
default = {
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = f7_local5[f7_local6].xpos,
|
|
right = 0,
|
|
top = f7_local5[f7_local6].ypos,
|
|
bottom = f7_local5[f7_local6].ypos + f7_local4,
|
|
red = f7_local1,
|
|
green = f7_local2,
|
|
blue = f7_local3,
|
|
alpha = f7_local9,
|
|
animateOnRefresh = true
|
|
}
|
|
}
|
|
}
|
|
end
|
|
if Engine.GetDvarBool( "startgame" .. f7_arg0.listen_on_controller .. "_vis" ) then
|
|
f7_local0[#f7_local0 + 1] = {
|
|
type = "playercard",
|
|
id = "basic_playercard_for_controller_" .. f7_arg0.listen_on_controller,
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 20,
|
|
left = 40,
|
|
height = 128,
|
|
width = 512
|
|
}
|
|
}
|
|
}
|
|
end
|
|
return f7_local0
|
|
end
|
|
|
|
function ToggleQuadrantLED( f8_arg0, f8_arg1, f8_arg2 )
|
|
local f8_local0 = assert
|
|
local f8_local1
|
|
if f8_arg2 ~= "on" and f8_arg2 ~= "off" then
|
|
f8_local1 = false
|
|
else
|
|
f8_local1 = true
|
|
end
|
|
f8_local0( f8_local1 )
|
|
f8_arg0:dispatchEventToRoot( {
|
|
name = "quadrant_" .. f8_arg1 .. "_led_" .. f8_arg2,
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function RefreshQuadrantOptions( f9_arg0, f9_arg1 )
|
|
local f9_local0 = f9_arg0.properties
|
|
if not f9_local0 then
|
|
DebugPrint( "Warning: could not resolve properties for Split screen sign in quadrant" )
|
|
return
|
|
end
|
|
local f9_local1 = "basic_playercard_for_controller_" .. f9_local0.listen_on_controller
|
|
local f9_local2 = f9_arg0:getChildById( f9_local1 )
|
|
if f9_local2 then
|
|
f9_local2:close()
|
|
end
|
|
f9_arg0:processEvent( {
|
|
name = "menu_refresh"
|
|
} )
|
|
f9_local2 = f9_arg0:getChildById( f9_local1 )
|
|
if f9_local2 then
|
|
local f9_local3 = nil
|
|
if Engine.IsAliensMode() then
|
|
f9_local3 = Lobby.GetMemberAlienRank( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller )
|
|
else
|
|
f9_local3 = Lobby.GetMemberRank( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller )
|
|
end
|
|
if not f9_local3 then
|
|
f9_local3 = 0
|
|
end
|
|
local f9_local4 = ""
|
|
if Lobby.HasMemberClanTag( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) then
|
|
f9_local4 = Lobby.GetMemberClanTag( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller )
|
|
end
|
|
local f9_local5 = nil
|
|
if Engine.IsAliensMode() then
|
|
f9_local5 = Lobby.GetMemberAlienPrestigeLevel( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller )
|
|
else
|
|
f9_local5 = Lobby.GetMemberPrestigeLevel( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller )
|
|
end
|
|
f9_local2:processEvent( {
|
|
gamertag = Lobby.GetMemberName( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ),
|
|
clantag = f9_local4,
|
|
prestige = f9_local5,
|
|
background = "0",
|
|
patchEmblem = "0",
|
|
patchShape = "0",
|
|
name = "update_playercard"
|
|
} )
|
|
end
|
|
end
|
|
|
|
function AssignControllerToQuadrant( f10_arg0, f10_arg1 )
|
|
if f10_arg0.properties.qid == f10_arg1.qid then
|
|
f10_arg0.properties.listen_on_controller = f10_arg1.controller
|
|
end
|
|
end
|
|
|
|
function menu_splitscreensignin_quadrant()
|
|
return {
|
|
type = "UIElement",
|
|
properties = {
|
|
qid = -1,
|
|
listen_on_controller = -1
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
assign_controller_to_quadrant = AssignControllerToQuadrant
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_drop_shadow",
|
|
properties = {
|
|
offset_shadow = 0
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
alpha = 0.5
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "white" ),
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.b,
|
|
alpha = 0.75
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "generic_border",
|
|
properties = {
|
|
border_red = Colors.window_border_color.r,
|
|
border_green = Colors.window_border_color.g,
|
|
border_blue = Colors.window_border_color.b
|
|
}
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "quadrant_options_list",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
refresh_quadrant_options = RefreshQuadrantOptions
|
|
},
|
|
childrenFeeder = QuadrantOptionsListFeeder
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function RefreshQuadrantLEDs( f12_arg0, f12_arg1 )
|
|
for f12_local0 = 1, 4, 1 do
|
|
local f12_local3 = false
|
|
local f12_local4 = f12_local0 - 1
|
|
for f12_local5 = 1, 4, 1 do
|
|
local f12_local8 = f12_arg0:getChildById( "quadrant_" .. f12_local5 )
|
|
if f12_local8 and f12_local8.properties.listen_on_controller == f12_local4 then
|
|
f12_local3 = true
|
|
break
|
|
end
|
|
end
|
|
if f12_local3 then
|
|
ToggleQuadrantLED( f12_arg0, f12_local4, "on" )
|
|
else
|
|
ToggleQuadrantLED( f12_arg0, f12_local4, "off" )
|
|
end
|
|
end
|
|
end
|
|
|
|
function controller_port_indicators()
|
|
return {
|
|
type = "UIImage",
|
|
id = "console_logo_icon_id",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "cont_port_indicators_bg" ),
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -20,
|
|
right = 20,
|
|
top = 2,
|
|
bottom = 42,
|
|
alpha = 1
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "quadrant_1_led",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "cont_port_0_on" ),
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -20,
|
|
right = 0,
|
|
top = -20,
|
|
bottom = 0,
|
|
alpha = 0
|
|
},
|
|
on = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
quadrant_0_led_on = MBh.AnimateToState( "on", 0 ),
|
|
quadrant_0_led_off = MBh.AnimateToState( "default", 0 )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "quadrant_2_led",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "cont_port_1_on" ),
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 20,
|
|
top = -20,
|
|
bottom = 0,
|
|
alpha = 0
|
|
},
|
|
on = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
quadrant_1_led_on = MBh.AnimateToState( "on", 0 ),
|
|
quadrant_1_led_off = MBh.AnimateToState( "default", 0 )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "quadrant_3_led",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "cont_port_2_on" ),
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = -20,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 20,
|
|
alpha = 0
|
|
},
|
|
on = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
quadrant_2_led_on = MBh.AnimateToState( "on", 0 ),
|
|
quadrant_2_led_off = MBh.AnimateToState( "default", 0 )
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
id = "quadrant_4_led",
|
|
states = {
|
|
default = {
|
|
material = RegisterMaterial( "cont_port_3_on" ),
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 20,
|
|
top = 0,
|
|
bottom = 20,
|
|
alpha = 0
|
|
},
|
|
on = {
|
|
alpha = 1
|
|
}
|
|
},
|
|
handlers = {
|
|
quadrant_3_led_on = MBh.AnimateToState( "on", 0 ),
|
|
quadrant_3_led_off = MBh.AnimateToState( "default", 0 )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "controller_port_indicators", controller_port_indicators )
|
|
LUI.MenuBuilder.registerDef( "menu_splitscreensignin_quadrant", menu_splitscreensignin_quadrant )
|
|
LUI.MenuBuilder.registerDef( "menu_splitscreensignin", menu_splitscreensignin )
|
|
LUI.FlowManager.RegisterStackPopBehaviour( "menu_splitscreensignin", SplitScreenSignInExit )
|
|
LockTable( _M )
|