local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) UnlockIconSizesByType = { Patch = { height = 128, width = 128 }, Patchbacking = { height = 128, width = 128 }, Background = { height = 35, width = 220 }, Head = { height = 128, width = 128 }, Helmet = { height = 128, width = 128 }, Body = { height = 128, width = 128 }, AlienPerk = { height = 64, width = 64 }, AlienAbility = { height = 64, width = 64 }, AlienPrestige = { height = 128, width = 128 }, Prestige = { height = 128, width = 128 }, perk = { height = 64, width = 64 }, camo = { height = 128, width = 128 }, reticle = { height = 128, width = 128 } } function UnlockedItemsFeeder( f1_arg0 ) local f1_local0 = f1_arg0.unlockData local f1_local1 = f1_arg0.curr_page local f1_local2 = AAR.NumUnlocksPerPage local f1_local3 = 1 + (f1_local1 - 1) * f1_local2 local f1_local4 = f1_local3 + f1_local2 - 1 local f1_local5 = {} for f1_local6 = f1_local3, f1_local4, 1 do if f1_local0[f1_local6] and UnlockIconSizesByType[f1_local0[f1_local6].type] then local f1_local9 = nil local f1_local10 = "" local f1_local11 = "" local f1_local12 = 0 local f1_local13 = "" local f1_local14 = "" local f1_local15, f1_local16, f1_local17 = nil local f1_local18 = false if isUnlockItem( f1_local0[f1_local6].type ) then if f1_local0[f1_local6].type == "Patch" then f1_local10 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetQuip( f1_local0[f1_local6].item ) else f1_local10 = getNameForUnlockItem( f1_local0[f1_local6].type, f1_local0[f1_local6].item ) end f1_local9 = getMaterialForUnlockItem( f1_local0[f1_local6].type, f1_local0[f1_local6].item ) f1_local11 = f1_local0[f1_local6].ch_desc elseif f1_local0[f1_local6].type == "AlienPerk" then local f1_local19 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Category ) f1_local15 = Colors.alien_frontend_hilite.r f1_local16 = Colors.alien_frontend_hilite.g f1_local17 = Colors.alien_frontend_hilite.b f1_local10 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Name ) f1_local9 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Icon ) f1_local11 = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Desc ) ) f1_local13 = Engine.Localize( "@" .. tostring( f1_local19 ) ) f1_local12 = 1 elseif f1_local0[f1_local6].type == "AlienAbility" then local f1_local19 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Category ) f1_local15 = Colors.alien_frontend_hilite.r f1_local16 = Colors.alien_frontend_hilite.g f1_local17 = Colors.alien_frontend_hilite.b f1_local10 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Name ) f1_local9 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Icon ) f1_local11 = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Desc ) ) f1_local13 = Engine.Localize( "@" .. tostring( f1_local19 ) ) f1_local12 = 1 elseif f1_local0[f1_local6].type == "perk" then local f1_local19 = Cac.GetPerkGroup( f1_local0[f1_local6].item ) local f1_local20 = tonumber( Engine.TableLookup( "mp/squadUnlockTable.csv", 0, f1_local0[f1_local6].item, 2 ) ) f1_local14 = tostring( Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f1_local0[f1_local6].item, PerkTable.Cols.Cost ) ) f1_local15 = Colors.cac_ability[f1_local19].r f1_local16 = Colors.cac_ability[f1_local19].g f1_local17 = Colors.cac_ability[f1_local19].b f1_local10 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f1_local0[f1_local6].item, PerkTable.Cols.Name ) f1_local9 = Cac.GetPerkImage( f1_local0[f1_local6].item ) f1_local11 = Engine.Localize( "@LUA_MENU_AAR_NEW_PERK_UNLOCKS", f1_local20 ) f1_local13 = Cac.GetAbilityName( f1_local19 ) f1_local12 = 1 elseif f1_local0[f1_local6].type == "AlienPrestige" then f1_local10 = Engine.Localize( "@ALIENS_RELIC_SLOT" ) f1_local18 = true f1_local9 = "alien_icon_nerf_1" f1_local11 = Engine.Localize( "@ALIENS_NEW_RELIC_SLOT_DESC" ) elseif f1_local0[f1_local6].type == "Prestige" then f1_local10 = Engine.Localize( "@LUA_MENU_PRESTIGE_ICON" ) f1_local18 = true f1_local9 = Rank.GetRankIcon( Rank.GetMaxRank(), f1_local0[f1_local6].item ) elseif f1_local0[f1_local6].type == "camo" then f1_local10 = Cac.GetWeaponName( f1_local0[f1_local6].weapon ) f1_local18 = true f1_local11 = f1_local0[f1_local6].ch_desc f1_local9 = Cac.GetCamoImage( f1_local0[f1_local6].item ) elseif f1_local0[f1_local6].type == "reticle" then f1_local10 = Cac.GetAttachmentName( f1_local0[f1_local6].sight ) f1_local18 = true f1_local11 = f1_local0[f1_local6].ch_desc f1_local9 = Cac.GetReticleImage( f1_local0[f1_local6].item ) end local f1_local19 = #f1_local5 + 1 local f1_local20 = { type = "aar_unlocked_item" } local f1_local21 = {} if f1_local18 then local f1_local22 = f1_local10 end f1_local21.item_name = f1_local22 or Engine.Localize( f1_local10 ) f1_local21.item_icon = RegisterMaterial( f1_local9 ) f1_local21.icon_width = UnlockIconSizesByType[f1_local0[f1_local6].type].width f1_local21.icon_height = UnlockIconSizesByType[f1_local0[f1_local6].type].height f1_local21.item_detail_1 = f1_local11 f1_local21.perk_container_alpha = f1_local12 f1_local21.perk_category = f1_local13 f1_local21.perk_cost = f1_local14 f1_local21.perk_tint_r = f1_local15 f1_local21.perk_tint_g = f1_local16 f1_local21.perk_tint_b = f1_local17 f1_local20.properties = f1_local21 f1_local5[f1_local19] = f1_local20 end end return f1_local5 end f0_local0 = function ( f2_arg0 ) local f2_local0 = 0 if f2_arg0.detail_text ~= "" then f2_local0 = 1 end return f2_local0 end function aar_unlocked_item() return { type = "UIElement", properties = { item_name = "", item_icon = RegisterMaterial( "white" ), item_detail_1 = "", icon_width = 256, icon_height = 128, perk_container_alpha = 0, perk_category = "", perk_cost = "", perk_tint_r = Colors.white.r, perk_tint_g = Colors.white.g, perk_tint_b = Colors.white.b }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = 226, left = 0, right = 226 } }, children = { { type = "generic_drop_shadow", properties = { offset_shadow = -5 } }, { type = "cac_edit_choose_image_button_background", properties = { red = AAR.Swatch.background_5.r, green = AAR.Swatch.background_5.g, blue = AAR.Swatch.background_5.b, alpha = 1 }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } } }, { type = "cac_edit_choose_image_button_background_outline", properties = { red = AAR.Swatch.border.r, green = AAR.Swatch.border.g, blue = AAR.Swatch.border.b, alpha = 0.4 }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } } }, { type = "UIElement", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = -32, left = 0, right = 0 } }, children = { { type = "UIElement", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, width = 150, height = 130, alpha = MBh.Property( "perk_container_alpha" ) } }, children = { { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "box_white_gradient_top" ), red = MBh.Property( "perk_tint_r" ), green = MBh.Property( "perk_tint_g" ), blue = MBh.Property( "perk_tint_b" ), alpha = 0.15 } } }, { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, width = 16, height = 16, material = RegisterMaterial( "widg_triangle" ), red = MBh.Property( "perk_tint_r" ), green = MBh.Property( "perk_tint_g" ), blue = MBh.Property( "perk_tint_b" ), alpha = 0.5 } } }, { type = "UIMarqueeText", properties = { text = MBh.Property( "perk_category" ) }, states = { default = CoD.ColorizeState( AAR.Swatch.title, { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 10, right = -10, top = 5, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Center } ) } }, { type = "UIText", properties = { text = MBh.Property( "perk_cost" ), textStyle = CoD.TextSettings.Shadowed }, states = { default = CoD.ColorizeState( AAR.Swatch.title_2, { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, left = 5, right = 0, bottom = 0, height = CoD.TextSettings.ExtraBigFont.Height, font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Left } ) } } } }, { type = "UIImage", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, left = MBh.HalfOppositeProperty( "icon_width" ), right = MBh.HalfProperty( "icon_width" ), top = MBh.HalfOppositeProperty( "icon_height" ), bottom = MBh.HalfProperty( "icon_height" ), material = MBh.Property( "item_icon" ) } } } } }, { type = "UIElement", id = "HeaderBarId", states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, bottom = 0, left = 0, right = 0, height = 32 } }, children = { { type = "UIImage", states = { default = CoD.ColorizeState( AAR.Swatch.border, { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = -2, left = 2, right = -2, alpha = 0.4 } ) } }, { type = "UIMarqueeText", properties = { text = MBh.Property( "item_name" ) }, states = { default = CoD.ColorizeState( AAR.Swatch.header_text, { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 5, right = -5, height = CoD.TextSettings.BoldFont.Height, font = CoD.TextSettings.BoldFont.Font, alignment = LUI.Alignment.Center } ) } } } }, { type = "UIMarqueeText", id = "desc_text_id", properties = { text = MBh.Property( "item_detail_1" ), useTextWrapping = true, textHeight = CoD.TextSettings.NormalFont.Height }, states = { default = CoD.ColorizeState( AAR.Swatch.trim, { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = true, left = 5, right = -5, top = 5, height = 3 * CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Center } ) } } } } end function changeUnlocksScreen( f4_arg0, f4_arg1, f4_arg2 ) local f4_local0 = f4_arg0.properties.curr_page local f4_local1 = f4_arg0.properties.num_pages local f4_local2 = f4_local0 if f4_local0 > 1 and f4_arg2 == "left" then f4_local2 = f4_local0 - 1 elseif f4_local0 < f4_local1 and f4_arg2 == "right" then f4_local2 = f4_local0 + 1 end if f4_local2 ~= f4_local0 then f4_arg0.properties.curr_page = f4_local2 local f4_local3 = f4_arg0:getParent() f4_local3:processEvent( { name = "refresh_unlocks_page" } ) end if f4_local1 <= f4_local2 then f4_arg0:dispatchEventToRoot( { name = "disable_unlock_right_arrow" } ) else f4_arg0:dispatchEventToRoot( { name = "enable_unlock_right_arrow" } ) end if f4_local2 <= 1 then f4_arg0:dispatchEventToRoot( { name = "disable_unlock_left_arrow" } ) else f4_arg0:dispatchEventToRoot( { name = "enable_unlock_left_arrow" } ) end end function dotsFeeder( f5_arg0 ) local f5_local0 = f5_arg0.curr_page local f5_local1 = f5_arg0.num_pages if f5_local1 <= 1 then return {} end local f5_local2 = {} for f5_local3 = 1, f5_local1, 1 do local f5_local6 = #f5_local2 + 1 local f5_local7 = { type = "UIImage", id = "nav_dot_" .. f5_local3 } local f5_local8 = {} local f5_local9 = { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = false, left = 0, right = 12, top = 0, bottom = 12 } local f5_local10 if f5_local3 == f5_local0 then f5_local10 = RegisterMaterial( "widg_circle_fill" ) if not f5_local10 then else f5_local9.material = f5_local10 f5_local8.default = f5_local9 f5_local7.states = f5_local8 f5_local2[f5_local6] = f5_local7 end end f5_local10 = RegisterMaterial( "widg_circle_empty" ) end return f5_local2 end function UnlockMainHandleCreate( f6_arg0, f6_arg1 ) assert( f6_arg0.properties.unlockData ) local f6_local0 = f6_arg0.properties.unlockData local f6_local1 = f6_arg0:getChildById( "num_items_unlocked" ) if f6_local1 then if #f6_local0 > 1 then f6_local1:setText( Engine.Localize( "@LUA_MENU_NUM_ITEMS_UNLOCKED", #f6_local0 ) ) else f6_local1:setText( Engine.Localize( "@LUA_MENU_NUM_ITEM_UNLOCKED", #f6_local0 ) ) end end changeUnlocksScreen( f6_arg0, f6_arg1, "left" ) local f6_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) local f6_local3 = f6_local2.controller local f6_local4 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f6_local3, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name ) local f6_local5 = Engine.GetPlayerDataEx( f6_local3, CoD.StatsGroup.Common, "round", "map" ) local f6_local6 = Squad.GetRealBaseNameFromLoadName( f6_local5 ) if Engine.IsAliensMode() then f6_arg0:processEvent( { name = "aar_set_subtitle_text", new_text = Engine.Localize( "LUA_MENU_ALIENS" ) } ) elseif f6_local5 ~= "" then f6_arg0:processEvent( { name = "aar_set_subtitle_text", new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f6_local4, Engine.MarkLocalized( f6_local6 ) ), dispatchChildren = true } ) end end function aar_unlock_main() return { type = "UIElement", id = "main_container", properties = { curr_page = 1, num_pages = 1 }, handlers = { menu_create = UnlockMainHandleCreate, nav_right = function ( f8_arg0, f8_arg1 ) changeUnlocksScreen( f8_arg0, f8_arg1, "right" ) end , nav_left = function ( f9_arg0, f9_arg1 ) changeUnlocksScreen( f9_arg0, f9_arg1, "left" ) end }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, width = AAR.Layout.Width, height = AAR.Layout.Height } }, children = { { type = "generic_menu_background", id = "kinect_background_id", properties = { fill_alpha = 1, border_alpha = 0 } }, { type = "aar_title_bar", properties = { title_text = Engine.Localize( "@LUA_MENU_UNLOCKS_CAPS" ), subtitle_text = "", subtitle_banner_width = 300, border_alpha = 0 } }, { type = "UIText", id = "num_items_unlocked", properties = { text = Engine.Localize( "@LUA_MENU_NEW_ITEMS" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 95, left = 0, right = 0, height = CoD.TextSettings.ExtraBigFont.Height, font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Center, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or AAR.Swatch.colorpop.r, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or AAR.Swatch.colorpop.g, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or AAR.Swatch.colorpop.b } } }, { type = "UIHorizontalList", id = "unlock_items_row", focusable = false, childrenFeeder = UnlockedItemsFeeder, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = -100, left = 0, right = 0, height = 260, alignment = LUI.Alignment.Center, spacing = 30 } }, handlers = { refresh_unlocks_page = function ( f10_arg0, f10_arg1 ) f10_arg0:closeChildren() f10_arg0:processEvent( { name = "menu_refresh" } ) end } }, { type = "UIHorizontalList", id = "page_dots", focusable = false, childrenFeeder = dotsFeeder, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 67, left = -100, right = 100, height = 12, alignment = LUI.Alignment.Center, alpha = 1, spacing = 4 }, hidden = { alpha = 0 } }, handlers = { refresh_unlocks_page = function ( f11_arg0, f11_arg1 ) f11_arg0:closeChildren() f11_arg0:processEvent( { name = "menu_refresh" } ) end } }, { type = "aar_footer_bar", id = "oink_5" }, { type = "UIBindButton", id = "aar_summary_main_bind_btn_id", handlers = { button_right = aar_unlock_right, button_left = aar_unlock_left } }, { type = "aar_unlock_nav_arrows", id = "aar_unlock_nav_arrows_id" } } } end function aar_unlock_left( f12_arg0, f12_arg1 ) f12_arg0:dispatchEventToRoot( { name = "nav_left" } ) end function aar_unlock_right( f13_arg0, f13_arg1 ) f13_arg0:dispatchEventToRoot( { name = "nav_right" } ) end function aar_unlock_nav_arrows() return { type = "UIElement", focusable = true, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = false, left = 0, right = 0, top = -30, bottom = 30, alpha = 1 }, hidden = { alpha = 0 } }, handlers = { popup_active = MBh.AnimateToState( "hidden" ), popup_inactive = MBh.AnimateToState( "default" ) }, children = { { type = "UIButton", id = "left_nav_arrow_button_id", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = AAR.Layout.Width / -2 - 10 - 30, right = AAR.Layout.Width / -2 - 10, top = 0, bottom = 0 } }, handlers = { button_action = aar_unlock_left }, children = { { type = "UIImage", id = "left_nav_arrow_image_id", states = { default = { material = RegisterMaterial( "widg_margin_arrow_lt" ), leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, alpha = 0 }, bright = { alpha = 1 } }, handlers = { disable_unlock_left_arrow = MBh.AnimateToState( "default", 0 ), enable_unlock_left_arrow = MBh.AnimateToState( "bright", 0 ) } } } }, { type = "UIButton", id = "right_nav_arrow_button_id", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = AAR.Layout.Width / 2 + 10, right = AAR.Layout.Width / 2 + 10 + 30, top = 0, bottom = 0 } }, handlers = { button_action = aar_unlock_right }, children = { { type = "UIImage", id = "right_nav_arrow_image_id", states = { default = { material = RegisterMaterial( "widg_margin_arrow_rt" ), leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, alpha = 0 }, bright = { alpha = 1 } }, handlers = { disable_unlock_right_arrow = MBh.AnimateToState( "default", 0 ), enable_unlock_right_arrow = MBh.AnimateToState( "bright", 0 ) } } } } } } end LUI.MenuBuilder.registerDef( "aar_unlock_nav_arrows", aar_unlock_nav_arrows ) LUI.MenuBuilder.registerDef( "aar_unlock_main", aar_unlock_main ) LUI.MenuBuilder.registerDef( "aar_unlocked_item", aar_unlocked_item ) LockTable( _M )