diff --git a/components/configSwizzleManager.ts b/components/configSwizzleManager.ts index 38a801d1..b425d98c 100644 --- a/components/configSwizzleManager.ts +++ b/components/configSwizzleManager.ts @@ -113,6 +113,7 @@ import MasteryDataForLocationTemplate from "../static/MasteryDataForLocationTemp import DefaultCpdConfig from "../static/DefaultCpdConfig.json" import EvergreenGameChangerProperties from "../static/EvergreenGameChangerProperties.json" import AreaMap from "../static/AreaMap.json" +import HitsCategoryElusiveTemplate from "../static/HitsCategoryElusiveTemplate.json" import type { GameVersion } from "./types/types" import { fastClone } from "./utils" @@ -213,6 +214,7 @@ const configs: Record = { DefaultCpdConfig, EvergreenGameChangerProperties, AreaMap, + HitsCategoryElusiveTemplate, } Object.keys(configs).forEach((cfg) => { diff --git a/components/menus/menuSystem.ts b/components/menus/menuSystem.ts index 66e5e77f..0777e72c 100644 --- a/components/menus/menuSystem.ts +++ b/components/menus/menuSystem.ts @@ -84,10 +84,6 @@ export class MenuSystemDatabase { configs.push( "menusystem/elements/settings/data/isnonvroptionvisible.json", ) - - configs.push( - "menusystem/elements/contract/hitscategory_elusive.json", - ) } if (["h3", "h1"].includes(gameVersion)) { @@ -108,6 +104,10 @@ export class MenuSystemDatabase { "menusystem/pages/hub/dashboard/category_escalation/result.json", ) + configs.push( + "menusystem/elements/contract/hitscategory_elusive.json", + ) + // The following is to allow restart/replan/save/load on elusive contracts // alongside removing the warning when starting one in H2/3 - AF configs.push( @@ -126,6 +126,9 @@ export class MenuSystemDatabase { configs.push( "menusystem/pages/multiplayer/content/lobbyslim.json", ) + configs.push( + "menusystem/elements/contract/contractshitcategoryloading.json", + ) } }, ) @@ -143,9 +146,49 @@ export class MenuSystemDatabase { }, } case "/elements/contract/hitscategory_elusive.json": + return getConfig("HitsCategoryElusiveTemplate", false) + case "/elements/contract/contractshitcategoryloading.json": return { - $include: - "menusystem/elements/contract/hitscategory.json", + controller: "group", + view: "menu3.containers.ScrollingListContainer", + layoutchildren: true, + id: "hitscategory_container", + nrows: 3, + ncols: 10, + pressable: false, + data: { direction: "horizontal" }, + actions: { + activated: { + "load-async": { + path: { + "$if $eq ($.Category,Elusive_Target_Hits)": + { + $then: "menusystem/elements/contract/hitscategory_elusive.json", + $else: "menusystem/elements/contract/hitscategory.json", + }, + }, + from: { + url: "hitscategory", + args: { + page: 0, + type: "$.Category", + mode: "dataonly", + }, + }, + target: "hitscategory_container", + showloadingindicator: true, + blocksinput: false, + "post-load-action": [ + { + "set-selected": { + target: "hitscategory_container", + }, + }, + ], + }, + }, + }, + children: [{ pressable: false, selectable: true }], } case "/data/ishitman3available.json": return { diff --git a/static/HitsCategoryElusiveTemplate.json b/static/HitsCategoryElusiveTemplate.json new file mode 100644 index 00000000..c61f8e36 --- /dev/null +++ b/static/HitsCategoryElusiveTemplate.json @@ -0,0 +1,71 @@ +{ + "$datacontext": { + "in": "$.data", + "datavalues": { + "NoContractsAvailableLine": "UI_MENU_PAGE_NO_CONTRACTS_AVAILABLE", + "GroupedHits": { + "$arraygroupby": { + "source": "$.data.Data.Hits", + "property": "UserCentricContract.Contract.Metadata.Season" + } + } + }, + "do": { + "controller": "category", + "id": "sub_category_container", + "row": -1, + "col": 0, + "view": "menu3.containers.ScrollingTabsContainer", + "ncols": 10, + "direction": "horizontal", + "submenunavigation": true, + "loopedselection": false, + "data": { + "direction": "horizontal", + "submenu": true + }, + "children": { + "$each $.GroupedHits": { + "id": "$formatstring category_season_{$.by, .f}", + "view": "menu3.basic.SubCategoryElement", + "controller": "categoryitem", + "data": { + "title": "$loc $formatstring UI_SEASON_{$.by, .f}" + }, + "children": [ + { + "controller": "group", + "view": "menu3.containers.ScrollingListContainer", + "layoutchildren": true, + "id": "hitscategory_container", + "row": 1, + "nrows": 3, + "ncols": 10, + "pressable": false, + "navigationmode": "leaf-selection", + "data": { + "direction": "horizontal" + }, + "hidedefaultnocontent": false, + "children": { + "$datacontext": { + "in": "$.", + "datavalues": { + "Data": { + "Hits": "$.group" + } + }, + "do": { + "$include": { + "$path": "menusystem/elements/contract/hitscategory_contracts.json" + } + } + } + } + } + ] + } + } + } + } +}