619 lines
16 KiB
Lua
619 lines
16 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
function popup_choose_platform_intro_create( f1_arg0, f1_arg1 )
|
|
local f1_local0 = nil
|
|
if CoDAnywhere.HasUCDSaveGame( f1_arg1.controller ) then
|
|
f1_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_PLATFORM_CHOOSE_INTRO_UCD" )
|
|
else
|
|
f1_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_PLATFORM_CHOOSE_INTRO_NO_UCD" )
|
|
end
|
|
f1_arg0:dispatchEventToChildren( {
|
|
name = "update_message",
|
|
message_text = f1_local0
|
|
} )
|
|
end
|
|
|
|
function popup_choose_platform_intro()
|
|
return {
|
|
type = "generic_confirmation_popup",
|
|
id = "popup_choose_platform_intro_id",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ),
|
|
message_text = "",
|
|
confirmation_action = MBh.LeaveMenu()
|
|
},
|
|
handlers = {
|
|
menu_create = popup_choose_platform_intro_create
|
|
}
|
|
}
|
|
end
|
|
|
|
function popup_choose_platform_are_you_sure()
|
|
return {
|
|
type = "generic_yesno_popup",
|
|
id = "popup_choose_platform_are_you_sure",
|
|
properties = {
|
|
platformIndex = -1,
|
|
popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ),
|
|
message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_USE_PLATFORM_FOR_GLOBAL" ),
|
|
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
|
|
no_text = Engine.Localize( "@LUA_MENU_CANCEL" ),
|
|
yes_action = function ( f4_arg0, f4_arg1 )
|
|
CoDAnywhere.StartContextSwitch( f4_arg1.controller, f4_arg0.properties.callback_params.platformIndex )
|
|
end
|
|
|
|
}
|
|
}
|
|
end
|
|
|
|
function ChoosePlatform( f5_arg0, f5_arg1 )
|
|
LUI.FlowManager.RequestPopupMenu( f5_arg0, "popup_choose_platform_are_you_sure", true, f5_arg1.controller, false, {
|
|
callback_params = {
|
|
platformIndex = f5_arg0.properties.index
|
|
}
|
|
} )
|
|
end
|
|
|
|
function CoDAnywherePlatformFeeder( f6_arg0 )
|
|
local f6_local0 = {}
|
|
local f6_local1 = CoDAnywhere.NumFoundNonUCDPlatforms( f6_arg0.exclusiveController ) - 1
|
|
if f6_local1 == -1 then
|
|
return f6_local0
|
|
end
|
|
for f6_local2 = 0, f6_local1, 1 do
|
|
f6_local0[#f6_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "cod_anywhere_platform_button_" .. f6_local2,
|
|
disabled = CoDAnywhere.IsUCDAccount( f6_local2 ),
|
|
listDefaultFocus = f6_local2 == 0,
|
|
properties = {
|
|
index = f6_local2,
|
|
button_text = CoDAnywhere.GetPlatformDescriptionString( f6_arg0.exclusiveController, f6_local2, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_PLATFORM_NAME ),
|
|
button_action_func = ChoosePlatform,
|
|
button_over_disable_func = MBh.EmitEventToRoot( {
|
|
name = "update_desc",
|
|
platform_index = f6_local2
|
|
} ),
|
|
button_over_func = MBh.EmitEventToRoot( {
|
|
name = "update_desc",
|
|
platform_index = f6_local2
|
|
} )
|
|
}
|
|
}
|
|
end
|
|
return f6_local0
|
|
end
|
|
|
|
function choose_cod_anywhere_platform_vlist()
|
|
return {
|
|
type = "UIVerticalList",
|
|
focusable = true,
|
|
states = {
|
|
default = {
|
|
alignment = LUI.Alignment.Top,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = GenericMenuDims.menu_left,
|
|
right = GenericMenuDims.menu_right,
|
|
top = GenericMenuDims.menu_top,
|
|
bottom = GenericMenuDims.menu_bottom
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function UpdatePlatformLastPlayed( f8_arg0, f8_arg1 )
|
|
if f8_arg1.platform_index == nil then
|
|
return
|
|
end
|
|
local f8_local0 = f8_arg0:getParent()
|
|
local f8_local1 = f8_local0:getChildById( "platform_last_played" )
|
|
if f8_local1 then
|
|
f8_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f8_local0.properties.exclusiveController, f8_arg1.platform_index, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_LAST_PLAYED ) )
|
|
end
|
|
end
|
|
|
|
function UpdatePlatformTimePlayed( f9_arg0, f9_arg1 )
|
|
if f9_arg1.platform_index == nil then
|
|
return
|
|
end
|
|
local f9_local0 = f9_arg0:getParent()
|
|
local f9_local1 = f9_local0:getChildById( "platform_time_played" )
|
|
if f9_local1 then
|
|
f9_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f9_local0.properties.exclusiveController, f9_arg1.platform_index, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_TIME_PLAYED ) )
|
|
end
|
|
end
|
|
|
|
function UpdatePlatformSquadMember( f10_arg0, f10_arg1, f10_arg2 )
|
|
if f10_arg1.platform_index == nil then
|
|
return
|
|
end
|
|
local f10_local0 = f10_arg0:getParent()
|
|
local f10_local1 = f10_local0:getChildById( "platform_squad_member" .. tostring( f10_arg2 ) )
|
|
local f10_local2 = ""
|
|
if f10_local1 then
|
|
f10_local1:setText( Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_MEMBER" ) .. " " .. f10_arg2 .. ": " .. CoDAnywhere.GetPlatformDescriptionString( f10_local0.properties.exclusiveController, f10_arg1.platform_index, f10_arg2 + 1 ) )
|
|
end
|
|
end
|
|
|
|
function UpdatePlatformSquadMemberRank( f11_arg0, f11_arg1, f11_arg2 )
|
|
if f11_arg1.platform_index == nil then
|
|
return
|
|
end
|
|
local f11_local0 = f11_arg0:getParent()
|
|
local f11_local1 = f11_arg0:getChildById( "platform_squad_member_rank" .. tostring( f11_arg2 ) )
|
|
local f11_local2 = "1"
|
|
if f11_local1 then
|
|
f11_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f11_local0.properties.exclusiveController, f11_arg1.platform_index, f11_arg2 + 11 ) )
|
|
end
|
|
end
|
|
|
|
function UpdatePlatformTokensEarned( f12_arg0, f12_arg1 )
|
|
if f12_arg1.platform_index == nil then
|
|
return
|
|
end
|
|
local f12_local0 = f12_arg0:getParent()
|
|
local f12_local1 = f12_local0:getChildById( "platform_points_avail" )
|
|
if f12_local1 then
|
|
f12_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f12_local0.properties.exclusiveController, f12_arg1.platform_index, CoD.CoDAnywhere .. COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_AVAILABLE ) )
|
|
end
|
|
end
|
|
|
|
function LeaveChooseCoDAnywherePlatformMenu( f13_arg0, f13_arg1 )
|
|
LUI.FlowManager.RequestLeaveMenu( f13_arg0 )
|
|
end
|
|
|
|
function OpenIntroPopup( f14_arg0, f14_arg1 )
|
|
LUI.FlowManager.RequestPopupMenu( f14_arg0, "popup_choose_platform_intro", true, f14_arg1.controller )
|
|
end
|
|
|
|
function CoDAnywhereMenuCreate( f15_arg0, f15_arg1 )
|
|
f15_arg0:dispatchEventToRoot( {
|
|
name = "open_intro",
|
|
controller = f15_arg1.controller
|
|
} )
|
|
end
|
|
|
|
function OpenCoDAnywhereErrorPopup( f16_arg0, f16_arg1 )
|
|
LUI.FlowManager.RequestPopupMenu( f16_arg0, "cod_anywhere_error_popup_menu", true, f16_arg1.controller )
|
|
end
|
|
|
|
function OpenCoDAnywhereSuccessPopup( f17_arg0, f17_arg1 )
|
|
LUI.FlowManager.RequestPopupMenu( f17_arg0, "cod_anywhere_success_popup_menu", true, f17_arg1.controller )
|
|
end
|
|
|
|
function SquadMemberBoxFactory( f18_arg0 )
|
|
return {
|
|
type = "UIImage",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
left = 1,
|
|
right = -1,
|
|
top = 114 + f18_arg0 * 32,
|
|
bottom = 144 + f18_arg0 * 32,
|
|
alpha = 0.1,
|
|
material = RegisterMaterial( "white" )
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function SquadMemberFactory( f19_arg0, f19_arg1 )
|
|
return {
|
|
type = "UIText",
|
|
id = "platform_squad_member" .. tostring( f19_arg0 ),
|
|
states = {
|
|
default = {
|
|
left = -65,
|
|
top = -106 + f19_arg0 * 32,
|
|
width = 450,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1,
|
|
red = Colors.generic_button_text_default_color.r,
|
|
green = Colors.generic_button_text_default_color.g,
|
|
blue = Colors.generic_button_text_default_color.b
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_MEMBER" ) .. " " .. f19_arg0 .. ": "
|
|
},
|
|
handlers = {
|
|
update_desc = function ( f20_arg0, f20_arg1 )
|
|
UpdatePlatformSquadMember( f20_arg0, f20_arg1, f19_arg0 )
|
|
UpdatePlatformSquadMemberRank( f20_arg0, f20_arg1, f19_arg0 )
|
|
end
|
|
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
material = RegisterMaterial( Rank.GetRankIcon( 22, 0 ) ),
|
|
left = -10,
|
|
right = 10,
|
|
alpha = 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "platform_squad_member_rank" .. tostring( f19_arg0 ),
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
right = 40,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Right,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function choose_cod_anywhere_platform()
|
|
local f21_local0 = {
|
|
type = "UIElement",
|
|
id = "choose_cod_anywhere_platform",
|
|
handlers = {
|
|
menu_create = CoDAnywhereMenuCreate,
|
|
open_intro = OpenIntroPopup,
|
|
open_cod_anywhere_error_popup = OpenCoDAnywhereErrorPopup,
|
|
open_cod_anywhere_success_popup = OpenCoDAnywhereSuccessPopup,
|
|
leave_platform_screen = LeaveChooseCoDAnywherePlatformMenu
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
}
|
|
}
|
|
local f21_local1 = {}
|
|
local f21_local2 = {
|
|
type = "generic_menu_title",
|
|
id = "cod_anywhere_title_text_id",
|
|
properties = {
|
|
menu_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" )
|
|
}
|
|
}
|
|
local f21_local3 = {
|
|
type = "generic_menu_background",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 135,
|
|
bottom = -120,
|
|
left = 550,
|
|
right = -200
|
|
}
|
|
}
|
|
}
|
|
local f21_local4 = {}
|
|
local f21_local5 = {
|
|
type = "generic_menu_titlebar",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = -30,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
left = 25,
|
|
top = 5,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_TITLE" )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
local f21_local6 = {
|
|
type = "UIText",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = 25,
|
|
right = 140,
|
|
top = 10,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1,
|
|
red = Colors.generic_button_text_default_color.r,
|
|
green = Colors.generic_button_text_default_color.g,
|
|
blue = Colors.generic_button_text_default_color.b
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_LAST_PLAY" )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "platform_last_played",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
left = 0,
|
|
right = 200,
|
|
top = 0,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_desc = UpdatePlatformLastPlayed
|
|
}
|
|
}
|
|
}
|
|
}
|
|
local f21_local7 = {
|
|
type = "UIText",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = 25,
|
|
right = 145,
|
|
top = 43,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1,
|
|
red = Colors.generic_button_text_default_color.r,
|
|
green = Colors.generic_button_text_default_color.g,
|
|
blue = Colors.generic_button_text_default_color.b
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_TIME_PLAY" )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "platform_time_played",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
left = 0,
|
|
right = 200,
|
|
top = 0,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_desc = UpdatePlatformTimePlayed
|
|
}
|
|
}
|
|
}
|
|
}
|
|
local f21_local8 = {
|
|
type = "UIText",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
left = 25,
|
|
right = 225,
|
|
top = 75,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1,
|
|
red = Colors.generic_button_text_default_color.r,
|
|
green = Colors.generic_button_text_default_color.g,
|
|
blue = Colors.generic_button_text_default_color.b
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_POINTS" )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "platform_points_avail",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
left = 15,
|
|
right = 200,
|
|
top = 0,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_desc = UpdatePlatformTokensEarned
|
|
}
|
|
},
|
|
{
|
|
type = "UIImage",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = false,
|
|
rightAnchor = true,
|
|
material = RegisterMaterial( "icon_unlock_token_32" ),
|
|
left = -10,
|
|
right = 10,
|
|
alpha = 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
local f21_local9 = {
|
|
type = "UIImage",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
left = 1,
|
|
right = -1,
|
|
top = 112,
|
|
bottom = 142,
|
|
alpha = 0.2,
|
|
material = RegisterMaterial( "white" )
|
|
}
|
|
}
|
|
}
|
|
local f21_local10 = {
|
|
type = "UIText",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
left = 25,
|
|
top = 117,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
alpha = 1
|
|
}
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_NAME" )
|
|
}
|
|
}
|
|
local f21_local11 = SquadMemberBoxFactory( 2 )
|
|
local f21_local12 = SquadMemberBoxFactory( 4 )
|
|
local f21_local13 = SquadMemberBoxFactory( 6 )
|
|
local f21_local14 = SquadMemberBoxFactory( 8 )
|
|
local f21_local15 = SquadMemberBoxFactory( 10 )
|
|
f21_local3.children = f21_local5
|
|
f21_local4 = SquadMemberFactory( 1 )
|
|
f21_local5 = SquadMemberFactory( 2 )
|
|
f21_local6 = SquadMemberFactory( 3 )
|
|
f21_local7 = SquadMemberFactory( 4 )
|
|
f21_local8 = SquadMemberFactory( 5 )
|
|
f21_local9 = SquadMemberFactory( 6 )
|
|
f21_local10 = SquadMemberFactory( 7 )
|
|
f21_local11 = SquadMemberFactory( 8 )
|
|
f21_local12 = SquadMemberFactory( 9 )
|
|
f21_local13 = SquadMemberFactory( 10 )
|
|
f21_local14 = {
|
|
type = "choose_cod_anywhere_platform_vlist",
|
|
id = "choose_cod_anywhere_platform_vlist_id",
|
|
childrenFeeder = CoDAnywherePlatformFeeder
|
|
}
|
|
f21_local15 = {
|
|
type = "button_helper_text_main",
|
|
id = "barracks_button_helper_text_id"
|
|
}
|
|
local f21_local16 = {
|
|
type = "UIBindButton",
|
|
id = "squad_results_back_id",
|
|
handlers = {
|
|
button_secondary = LeaveChooseCoDAnywherePlatformMenu
|
|
}
|
|
}
|
|
f21_local1[1] = f21_local2
|
|
f21_local1[2] = f21_local3
|
|
f21_local1[3] = f21_local4
|
|
f21_local1[4] = f21_local5
|
|
f21_local1[5] = f21_local6
|
|
f21_local1[6] = f21_local7
|
|
f21_local1[7] = f21_local8
|
|
f21_local1[8] = f21_local9
|
|
f21_local1[9] = f21_local10
|
|
f21_local1[10] = f21_local11
|
|
f21_local1[11] = f21_local12
|
|
f21_local1[12] = f21_local13
|
|
f21_local1[13] = f21_local14
|
|
f21_local1[14] = f21_local15
|
|
f21_local1[15] = f21_local16
|
|
f21_local0.children = f21_local1
|
|
return f21_local0
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "choose_cod_anywhere_platform", choose_cod_anywhere_platform )
|
|
LUI.MenuBuilder.registerDef( "choose_cod_anywhere_platform_vlist", choose_cod_anywhere_platform_vlist )
|
|
LUI.MenuBuilder.registerDef( "popup_choose_platform_are_you_sure", popup_choose_platform_are_you_sure )
|
|
LUI.MenuBuilder.registerDef( "popup_choose_platform_intro", popup_choose_platform_intro )
|
|
LockTable( _M )
|