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

1411 lines
35 KiB
Lua

function sns_category_window()
return {
type = "UIElement",
id = "sns_category_window_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 120,
height = 500,
left = 100,
width = 270
}
},
properties = {
feeder = nil,
initialDlcName = ""
},
children = {
{
type = "generic_menu_background_withfade",
id = "category_window_bg_id",
properties = {
top_offset = 0
}
},
{
type = "UIElement",
id = "padding",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
top = 1,
bottom = 0,
left = 1,
right = -1
}
},
children = {
{
type = "UIVerticalList",
id = "category_list_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
spacing = 0
}
},
childrenFeeder = MBh.Property( "feeder" )
}
}
}
}
}
end
function sns_thumbnail()
return {
type = "UIButton",
id = "sns_category_window_id",
properties = {
item_id = -1,
file_id = "",
item_index = -1,
thumbName = ""
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = Sns.Dims.Thumbnail.height,
left = 0,
right = Sns.Dims.Thumbnail.width
}
},
children = {
{
type = "generic_drop_shadow",
properties = {
offset_shadow = -1
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0.45
}
}
},
{
type = "ContentServerImage",
id = "sns_thumbnail_image",
properties = {
file_id = MBh.Property( "file_id" ),
thumbName = MBh.Property( "thumbName" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 1,
right = -1,
top = 1,
bottom = -1,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
download_complete = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg0:getParent()
f3_local0:processEvent( {
name = "done_loading"
} )
end
,
material_lost = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg0:getParent()
f4_local0:processEvent( {
name = "start_loading"
} )
end
,
start_loading = function ( f5_arg0, f5_arg1 )
f5_arg0:animateToState( "default", 0 )
end
,
done_loading = function ( f6_arg0, f6_arg1 )
f6_arg0:animateToState( "visible", 150 )
end
,
update_hack_banner = function ( f7_arg0, f7_arg1 )
local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 )
if CrossGameHackVisual( f7_local0.category ) then
f7_arg0.m_fileId = nil
f7_arg0:setImage( RegisterMaterial( "img_store_advanced_warfare" ) )
local f7_local1 = f7_arg0:getParent()
f7_local1:processEvent( {
name = "done_loading"
} )
end
end
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 1,
right = -1,
top = 1,
bottom = -1,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
start_loading = MBh.AnimateToState( "default", 0 ),
done_loading = MBh.AnimateToState( "hidden", 50 )
},
children = {
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0,
alpha = 0.25
}
}
},
{
type = "live_dialog_processing_widget",
id = "popup_diamond_id"
}
}
},
{
type = "UIImage",
id = "sns_thumbnail_sale_banner",
properties = {
item_id = MBh.Property( "item_id" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
bottom = -1,
width = 48,
right = -1,
height = 32,
material = RegisterMaterial( "icon_sale" ),
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_sale_banners = function ( f8_arg0, f8_arg1 )
local f8_local0 = Sns.GetScopedArticleInfo( f8_arg0, "sale" )
local f8_local1 = f8_arg0
local f8_local2 = f8_arg0.animateToState
local f8_local3
if f8_local0 and f8_local0 > 0 then
f8_local3 = "default"
if not f8_local3 then
else
f8_local2( f8_local1, f8_local3, 0 )
end
end
f8_local3 = "hidden"
end
}
},
{
type = "UIImage",
id = "sns_thumbnail_purchased_checkbox",
properties = {
item_index = MBh.Property( "item_index" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 3,
width = 16,
left = 3,
height = 16,
material = RegisterMaterial( "box_empty" ),
alpha = 1
},
checked = {
material = RegisterMaterial( "box_check" ),
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_purchase_checkboxes = function ( f9_arg0, f9_arg1 )
local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 )
if CrossGameHackVisual( f9_local0.category ) then
f9_arg0:animateToState( "hidden" )
else
local f9_local1 = Store.IsItemPurchasedByIndex( f9_local0.category, f9_arg0.properties.item_index )
local f9_local2 = f9_arg0
local f9_local3 = f9_arg0.animateToState
local f9_local4
if f9_local1 then
f9_local4 = "checked"
if not f9_local4 then
else
f9_local3( f9_local2, f9_local4, 0 )
end
end
f9_local4 = "default"
end
end
}
},
{
type = "generic_border",
id = "sns_thumbnail_border_id",
properties = {
border_red = Colors.white.r,
border_green = Colors.white.g,
border_blue = Colors.white.b,
thickness = 3
},
states = {
default = {
alpha = 0
},
dim = {
alpha = 0.5
},
focused = {
alpha = 0.8
}
},
handlers = {
gain_focus = MBh.AnimateLoop( {
{
"focused",
0,
true,
true
},
{
"focused",
350,
true,
true
},
{
"dim",
750,
true,
true
},
{
"focused",
750,
true,
true
}
} ),
lose_focus = MBh.AnimateToState( "default" )
}
}
}
}
end
function sns_thumbnail_window()
return {
type = "UIElement",
id = "store_thumbnail_window_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 113,
height = 120,
left = 430,
width = 730
}
},
properties = {
feeder = nil,
initialDlcName = ""
},
children = {
{
type = "UIStencil",
id = "thumbnail_window_stencil_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIHorizontalList",
id = "thumbnail_list_id",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = Sns.HListOffset,
right = -Sns.HListOffset,
top = Sns.HListOffset,
bottom = -Sns.HListOffset,
spacing = Sns.HListSpacing
}
},
childrenFeeder = MBh.Property( "feeder" ),
handlers = {
refresh_thumbnails = RefreshThumbnails
}
}
}
},
{
type = "UIButton",
id = "thumbnail_list_left_arrow_id",
properties = {
visible = false
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 40,
left = -20,
width = 20,
height = 40,
alpha = 1
},
shifted = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 40,
left = -25,
width = 20,
height = 40,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_thumbnail_arrows = function ( f11_arg0, f11_arg1 )
if f11_arg1.left_visible then
if not f11_arg0.properties.visible then
local f11_local0 = MBh.AnimateLoop( {
{
"shifted",
500,
true,
true
},
{
"default",
500,
true,
true
}
} )
f11_local0( f11_arg0, f11_arg1 )
f11_arg0.properties.visible = true
end
else
f11_arg0:animateToState( "hidden", 0 )
f11_arg0.properties.visible = false
end
end
},
children = {
{
type = "UIImage",
id = "thumbnail_list_left_arrow_image_id",
states = {
default = {
material = RegisterMaterial( "widg_btn_arrow_lt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
}
}
}
},
{
type = "UIButton",
id = "thumbnail_list_right_arrow_id",
properties = {
visible = false
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 40,
right = 30,
width = 20,
height = 40,
alpha = 1
},
shifted = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 40,
right = 35,
width = 20,
height = 40,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
update_thumbnail_arrows = function ( f12_arg0, f12_arg1 )
if f12_arg1.right_visible then
if not f12_arg0.properties.visible then
local f12_local0 = MBh.AnimateLoop( {
{
"shifted",
500,
true,
true
},
{
"default",
500,
true,
true
}
} )
f12_local0( f12_arg0, f12_arg1 )
f12_arg0.properties.visible = true
end
else
f12_arg0:animateToState( "hidden", 0 )
f12_arg0.properties.visible = false
end
end
},
children = {
{
type = "UIImage",
id = "thumbnail_list_right_arrow_image_id",
states = {
default = {
material = RegisterMaterial( "widg_btn_arrow_rt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
}
}
}
}
}
}
end
function sns_article_detail_widget()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
properties = {
label_text = "Placeholder Label",
value_text = "Placeholder Value",
width = 160
},
children = {
{
type = "UIMarqueeText",
id = "sns_article_detail_widget_label_id",
properties = {
text = MBh.Property( "label_text" ),
width = MBh.Property( "width" )
},
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
left = 0,
top = 0,
width = MBh.Property( "width" ),
height = CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center
} )
}
},
{
type = "UIElement",
id = "sns_article_detail_widget_value_bg_id",
states = {
default = {
top = CoD.TextSettings.BoldFont.Height + 2,
left = 0,
width = MBh.Property( "width" ),
height = 24
}
},
children = {
{
type = "generic_border",
properties = {
border_red = Swatches.GenericMenu.Border.r,
border_green = Swatches.GenericMenu.Border.g,
border_blue = Swatches.GenericMenu.Border.b
}
},
{
type = "UIImage",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Background, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 1
} )
}
},
{
type = "UIMarqueeText",
id = "sns_article_detail_widget_value_id",
properties = {
text = MBh.Property( "value_text" ),
width = MBh.Property( "width" )
},
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
height = CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center
} )
},
handlers = {
update_article_detail_value = function ( f14_arg0, f14_arg1 )
f14_arg0:setText( f14_arg1.value )
end
}
}
}
}
}
}
end
function sns_article_countdown_widget()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
show_article_countdown = MBh.AnimateToState( "visible", 0 ),
show_article_purchaseinfo = MBh.AnimateToState( "default", 0 ),
hide_article_overlays = MBh.AnimateToState( "default", 0 )
},
children = {
{
type = "UIText",
id = "sns_countdown_widget_label_id",
properties = {
text = "Time Left: "
},
states = {
default = {
left = -80,
top = 45,
width = 160,
height = CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center,
red = 0.7,
green = 0.7,
blue = 0.7
}
}
},
{
type = "UILongCountdown",
id = "sns_countdown_widget_time_id",
properties = {
end_time = 0
},
states = {
default = {
left = -80,
top = 65,
width = 160,
height = CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Center
}
},
handlers = {
update_article_details = function ( f16_arg0, f16_arg1 )
if f16_arg1.end_time then
f16_arg0:setEndTime( Sns.GetScopedArticleInfo( f16_arg0, "endTime" ) )
end
end
}
}
}
}
end
function sns_article_purchaseinfo_widget()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -35,
bottom = 0,
left = 29,
right = -29,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
show_article_countdown = MBh.AnimateToState( "default", 0 ),
show_article_purchaseinfo = MBh.AnimateToState( "visible", 0 ),
hide_article_overlays = MBh.AnimateToState( "default", 0 )
},
children = {
{
type = "sns_value_bar",
id = "sns_article_cost_bar",
properties = {
title_text = Engine.Localize( "@LUA_MENU_COST" ),
top = 228
}
}
}
}
end
function sns_article()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 230,
height = 380,
left = 420,
width = 780,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
show_fetching_metadata = MBh.AnimateToState( "default" ),
hide_fetching_metadata = MBh.AnimateToState( "visible" )
},
children = {
{
type = "generic_menu_titlebar",
id = "article_details_window_title_id",
properties = {
font = CoD.TextSettings.BoldFont,
title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth,
title_bar_alignment = LUI.Alignment.Left
},
handlers = {
update_article_details = function ( f19_arg0, f19_arg1 )
f19_arg0:processEvent( {
name = "update_title",
title_text = Sns.GetScopedArticleInfo( f19_arg0, "title" )
} )
end
}
},
{
type = "generic_menu_background_withfade",
id = "article_details_window_bg_id"
},
{
type = "UIElement",
id = "article_details_window_backdrpo_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
left = 2,
right = 400,
top = GenericTitleBarDims.TitleBarHeight + 2,
bottom = 380
}
},
children = {
{
type = "UIImage",
id = "article_details_window_backdrpo_image_id",
states = {
default = CoD.ColorizeState( Colors.black, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
material = RegisterMaterial( "gradient_top" ),
alpha = 0.4
} )
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 29,
right = -29,
top = 12,
bottom = 182
}
},
children = {
{
type = "ContentServerImage",
id = "article_details_window_image_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
update_article_details = function ( f20_arg0, f20_arg1 )
local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 )
if CrossGameHackVisual( f20_local0.category ) then
f20_arg0.m_fileId = nil
f20_arg0:setImage( RegisterMaterial( "img_store_advanced_warfare" ) )
local f20_local1 = f20_arg0:getParent()
f20_local1:processEvent( {
name = "done_loading"
} )
else
local f20_local1 = Sns.GetScopedArticleInfo( f20_arg0, "image" )
local f20_local2 = f20_arg0:getParent()
f20_local2:processEvent( {
name = "start_loading"
} )
f20_arg0:setFileId( f20_local1 )
end
end
,
download_complete = function ( f21_arg0, f21_arg1 )
local f21_local0 = f21_arg0:getParent()
f21_local0:processEvent( {
name = "done_loading"
} )
end
,
material_lost = function ( f22_arg0, f22_arg1 )
local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 )
if not CrossGameHackVisual( f22_local0.category ) then
local f22_local1 = f22_arg0:getParent()
f22_local1:processEvent( {
name = "start_loading"
} )
end
end
,
start_loading = MBh.AnimateToState( "default", 0 ),
done_loading = MBh.AnimateToState( "visible", 150 )
}
},
{
type = "UIElement",
states = {
default = {
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
start_loading = MBh.AnimateToState( "default", 0 ),
done_loading = MBh.AnimateToState( "hidden", 50 )
},
children = {
{
type = "live_dialog_processing_widget",
id = "popup_diamond_id"
}
}
}
}
},
{
type = "sns_article_purchaseinfo_widget"
},
{
type = "sns_article_countdown_widget"
}
}
},
{
type = "UIMarqueeText",
id = "article_details_window_desc_id",
properties = {
textHeight = CoD.TextSettings.BoldFont.Height,
scrollSpeed = 50,
useTextWrapping = true
},
states = {
default = CoD.ColorizeState( Colors.md_grey, {
left = 35,
top = -145,
width = 340,
height = 15 * CoD.TextSettings.BoldFont.Height,
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Left,
alpha = 1
} )
},
handlers = {
update_article_details = function ( f23_arg0, f23_arg1 )
f23_arg0:setText( Sns.GetScopedArticleInfo( f23_arg0, "details" ) )
f23_arg0.text:setForceLineBreaks( true )
end
}
}
}
}
end
function sns_fetching_category_spinner()
return {
type = "UIElement",
states = {
default = {
alpha = 0
},
visible = {
alpha = 1
}
},
handlers = {
hide_fetching_metadata = MBh.AnimateToState( "default" ),
show_fetching_metadata = MBh.AnimateToState( "visible" )
},
children = {
{
type = "live_dialog_text_box",
id = "live_dialog_text_box_id",
properties = {
message = Engine.Localize( "LUA_MENU_RETRIEVING_INFO" ),
overlay_alpha = 0,
top = -DialogPopupDims.Height / 2,
left = -15
}
}
}
}
end
function sns_value_bar_children_feeder( f25_arg0 )
local f25_local0 = {
[#f25_local0 + 1] = {
type = "UIImage",
id = "sns_value_bar_bg",
states = {
default = CoD.ColorizeState( Colors.very_dark_cyan, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
alpha = 1
} )
}
},
[#f25_local0 + 1] = {
type = "UIImage",
id = "sns_value_bar_cap",
states = {
default = CoD.ColorizeState( Colors.grey_22, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -212,
right = -180,
material = RegisterMaterial( "box_angle_ltcap" ),
alpha = 0.5
} )
}
},
[#f25_local0 + 1] = {
type = "UIImage",
id = "sns_value_bar_alt_bg",
states = {
default = CoD.ColorizeState( Colors.grey_22, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -180,
right = 0,
material = RegisterMaterial( "white" ),
alpha = 0.5
} )
}
},
[#f25_local0 + 1] = {
type = "UIText",
id = "sns_value_bar_title_text",
states = {
default = CoD.ColorizeState( Colors.white, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = 5,
right = 0,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left
} )
},
properties = {
text = f25_arg0.title_text
}
},
[#f25_local0 + 1] = {
type = "UIText",
id = "sns_value_bar_value_text",
states = {
default = CoD.ColorizeState( Colors.frontend_hilite, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = -180,
right = -10,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right
} ),
purchased = CoD.ColorizeState( Colors.primary_text_color, {} )
},
handlers = {
show_article_purchaseinfo = function ( f26_arg0, f26_arg1 )
if Sns.GetScopedArticleInfo( f26_arg0, "purchased" ) then
f26_arg0:setText( Engine.Localize( "@LUA_MENU_PURCHASED_CAPS" ) )
f26_arg0:animateToState( "purchased" )
else
local f26_local0 = Sns.GetScopedArticleInfo( f26_arg0, "sale" )
if f26_local0 == 0 then
f26_arg0:setText( Sns.GetScopedArticleInfo( f26_arg0, "cost" ) )
else
f26_arg0:setText( f26_local0 )
end
f26_arg0:animateToState( "default" )
end
end
}
},
[#f25_local0 + 1] = {
type = "UIText",
id = "sns_value_bar_old_cost_text",
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = -180,
right = -10,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
alpha = 1
} ),
hidden = {
alpha = 0
}
},
handlers = {
show_article_purchaseinfo = function ( f27_arg0, f27_arg1 )
if Sns.GetScopedArticleInfo( f27_arg0, "purchased" ) then
f27_arg0:animateToState( "hidden", 0 )
return false
end
local f27_local0 = Sns.GetScopedArticleInfo( f27_arg0, "sale" )
if f27_local0 == 0 then
f27_arg0:animateToState( "hidden", 0 )
else
local f27_local1 = Sns.GetScopedArticleInfo( f27_arg0, "cost" )
local f27_local2, f27_local3, f27_local4, f27_local5 = GetTextDimensions( f27_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
local f27_local6 = f27_local4 - f27_local2
local f27_local7, f27_local8, f27_local9, f27_local10 = GetTextDimensions( f27_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
f27_arg0:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 3,
bottom = 3 + CoD.TextSettings.NormalFont.Height,
left = -(f27_local9 - f27_local7) - f27_local6 - 25,
right = -f27_local6 - 25,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
alpha = 1
} )
f27_arg0:animateToState( "default", 0 )
f27_arg0:setText( f27_local1 )
end
return false
end
},
children = {
{
type = "UIImage",
id = "sns_value_bar_old_cost_strikethrough_id",
states = {
default = CoD.ColorizeState( Colors.secondary_text_color, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 9,
height = 2,
left = -4,
right = 4
} )
}
}
}
}
}
return f25_local0
end
function sns_value_bar()
return {
type = "UIElement",
properties = {
value_text = "",
top = 0
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = MBh.Property( "top" ),
height = 26,
left = 0,
right = 0,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
show_article_purchaseinfo = function ( f29_arg0, f29_arg1 )
local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 )
if CrossGameHackVisual( f29_local0.category ) then
f29_arg0:animateToState( "hidden" )
else
f29_arg0:animateToState( "default" )
end
end
},
childrenFeeder = sns_value_bar_children_feeder
}
end
LUI.SocialFeedTicker = {}
LUI.SocialFeedTicker = InheritFrom( LUI.UIElement )
LUI.SocialFeedTicker.new = function ( f30_arg0, f30_arg1, f30_arg2 )
if not Sns.SocialFeedEnabled() then
return LUI.UIElement.new()
end
local f30_local0 = 0.75
local f30_local1 = 95
local self = LUI.UIElement.new( CoD.CreateState( 0, -124, 0, -54, CoD.AnchorTypes.BottomLeftRight ) )
self.id = "social_feed_ticker_id"
self:registerEventHandler( "change_ticker_story", Sns.ChangeTickerStory )
local f30_local3 = CoD.CreateState( 0, 0, 20, 0, CoD.AnchorTypes.TopBottomLeft )
f30_local3.material = RegisterMaterial( "box_feed_content_lt" )
f30_local3.alpha = f30_local0
local f30_local4 = LUI.UIImage.new( f30_local3 )
f30_local4.id = "ticker_left_cap_id"
self:addElement( f30_local4 )
f30_local3 = CoD.CreateState( 20, 0, -20, 0, CoD.AnchorTypes.All )
f30_local3.material = RegisterMaterial( "box_feed_content_mid" )
f30_local3.alpha = f30_local0
local f30_local5 = LUI.UIImage.new( f30_local3 )
f30_local5.id = "ticker_mid_bg_id"
self:addElement( f30_local5 )
f30_local3 = CoD.CreateState( -20, 0, 0, 0, CoD.AnchorTypes.TopBottomRight )
f30_local3.material = RegisterMaterial( "box_feed_content_rt" )
f30_local3.alpha = f30_local0
local f30_local6 = LUI.UIImage.new( f30_local3 )
f30_local6.id = "ticker_right_cap_id"
self:addElement( f30_local6 )
local f30_local7 = LUI.UIButton.new( CoD.CreateState( 5, 26, -5, -21, CoD.AnchorTypes.All ) )
f30_local7.id = "ticker_stencil_id"
f30_local7:setUseStencil( true )
f30_local7.requireFocusType = FocusType.MouseOver
f30_local7:registerEventHandler( "button_action", function ( element, event )
Sns.OpenSocialFeed( element, event.controller, f30_arg1 and f30_arg1.isLobbyTicker or false )
end )
self:addElement( f30_local7 )
local f30_local8 = 30
local f30_local9 = 20
local f30_local10 = f30_local1
if SocialFeed.HasUnreadArticles( Engine.GetControllerForLocalClient( 0 ) ) then
f30_local3 = CoD.CreateState( f30_local1 - 30, -12, f30_local1 - 6, 12, CoD.AnchorTypes.Left )
f30_local3.material = RegisterMaterial( "icon_new" )
local f30_local11 = LUI.UIImage.new( f30_local3 )
f30_local11.id = "ticker_new_icon_id"
f30_local7:addElement( f30_local11 )
end
if CoD.UsingController() then
f30_local10 = f30_local10 + f30_local8 + 7
f30_local3 = CoD.CreateState( f30_local1, -f30_local8 / 2, f30_local1 + f30_local8, f30_local8 / 2, CoD.AnchorTypes.Left )
f30_local3.font = CoD.TextSettings.NormalFont.Font
f30_local3.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.white, f30_local3 )
local f30_local11 = LUI.UIText.new( f30_local3 )
f30_local11.id = "ticker_button_icon_id"
f30_local11:setText( Engine.Localize( "@LUA_MENU_PAD_LEFT_SHOULDER_BUTTON" ) )
f30_local7:addElement( f30_local11 )
end
local f30_local11 = CoD.TextSettings.NormalFont.Height / 2
f30_local3 = CoD.CreateState( f30_local10, -f30_local11, f30_local10, f30_local11, CoD.AnchorTypes.LeftRight )
f30_local3.font = CoD.TextSettings.NormalFont.Font
f30_local3.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.white, f30_local3 )
self.tickerText = LUI.UIText.new( f30_local3 )
self.tickerText.id = "ticker_text_id"
f30_local7:addElement( self.tickerText )
local f30_local12 = Sns.GetTickerHeader( Sns.TickerCategory, Sns.TickerIndex )
if f30_local12 == "" then
f30_local12 = Engine.Localize( "@SOCIALFEED_TICKER_DEFAULT_TEXT" )
end
self.tickerText:setText( f30_local12 )
f30_local3 = CoD.CreateState( f30_local10, -f30_local11 + f30_local9, f30_local10, f30_local11 + f30_local9, CoD.AnchorTypes.LeftRight )
f30_local3.font = CoD.TextSettings.NormalFont.Font
f30_local3.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.white, f30_local3 )
self.nextText = LUI.UIText.new( f30_local3 )
self.nextText.id = "ticker_next_text_id"
f30_local7:addElement( self.nextText )
f30_local3 = CoD.CreateState( f30_local10, -f30_local11 - f30_local9, f30_local10, f30_local11 - f30_local9, CoD.AnchorTypes.LeftRight )
f30_local3.font = CoD.TextSettings.NormalFont.Font
f30_local3.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.white, f30_local3 )
self.tickerText:registerAnimationState( "transition_to_next", f30_local3 )
f30_local3 = CoD.CreateState( f30_local10, -f30_local11, f30_local10, f30_local11, CoD.AnchorTypes.LeftRight )
f30_local3.font = CoD.TextSettings.NormalFont.Font
f30_local3.alignment = LUI.Alignment.Left
CoD.ColorizeState( Colors.white, f30_local3 )
self.nextText:registerAnimationState( "transition_to_next", f30_local3 )
self.nextText:registerEventHandler( "transition_complete_transition_to_next", function ( element, event )
local f32_local0 = element:getParent()
Sns.TickerScrollEnded( f32_local0:getParent(), event )
end )
local f30_local13 = LUI.UITimer.new( Sns.TickerUpdateInterval, "change_ticker_story", "social_feed_ticker", false, self )
f30_local13.id = "ticker_timer_id"
self:addElement( f30_local13 )
if CoD.UsingController() then
local f30_local14 = LUI.UIBindButton.new()
f30_local14.id = "ticker_bind_button_id"
f30_local14:registerEventHandler( "button_shoulderl", function ( element, event )
Sns.OpenSocialFeed( element, event.controller, f30_arg1 and f30_arg1.isLobbyTicker or false )
end )
self:addElement( f30_local14 )
end
return self
end
function popup_social_to_store_lobby_confirm()
return {
type = "generic_yesno_popup",
id = "popup_social_leave_lobby_confirm",
properties = {
popup_title = Engine.Localize( "@MENU_NOTICE" ),
message_text = Engine.Localize( "@SOCIALFEED_TO_STORE_WARNING" ),
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
no_text = Engine.Localize( "@LUA_MENU_CANCEL" ),
yes_action = function ( f35_arg0, f35_arg1 )
LUI.mp_menus.mpLobbyWidgets.leaveLobbyAndPartyYesActionWithExitLobby( f35_arg0, f35_arg1 )
LUI.FlowManager.RequestRestoreMenu( f35_arg0, "menu_xboxlive" )
Sns.OpenStoreMenu( f35_arg1.controller, "social_feed", false, f35_arg0.properties.callback_params.itemID )
end
}
}
end
LUI.MenuBuilder.registerType( "SocialFeedTicker", LUI.SocialFeedTicker.new )
LUI.MenuBuilder.registerDef( "sns_category_window", sns_category_window )
LUI.MenuBuilder.registerDef( "sns_thumbnail", sns_thumbnail )
LUI.MenuBuilder.registerDef( "sns_thumbnail_window", sns_thumbnail_window )
LUI.MenuBuilder.registerDef( "sns_article", sns_article )
LUI.MenuBuilder.registerDef( "sns_article_purchaseinfo_widget", sns_article_purchaseinfo_widget )
LUI.MenuBuilder.registerDef( "sns_article_countdown_widget", sns_article_countdown_widget )
LUI.MenuBuilder.registerDef( "sns_article_detail_widget", sns_article_detail_widget )
LUI.MenuBuilder.registerDef( "sns_fetching_category_spinner", sns_fetching_category_spinner )
LUI.MenuBuilder.registerDef( "sns_value_bar", sns_value_bar )
LUI.MenuBuilder.registerDef( "popup_social_to_store_lobby_confirm", popup_social_to_store_lobby_confirm )