@@ -13,33 +13,48 @@ import {
1313 OVERLAY_MOVEMENT_RUNTIME ,
1414 createMovementOverlayCycleMap ,
1515} from '/samples/phase-17/shared/movementOverlayStack.js' ;
16+ import {
17+ createOverlayExtensionContractMap ,
18+ defineOverlayExtensionContract ,
19+ getOverlayControllerConfigFromContract ,
20+ } from '/samples/phase-17/shared/overlayExpansionContracts.js' ;
1621
17- const SAMPLE_OVERLAY_STACKS = Object . freeze ( {
18- '1708' : Object . freeze ( {
22+ const LEVEL17_OVERLAY_EXTENSION_CONTRACTS = Object . freeze ( [
23+ defineOverlayExtensionContract ( {
24+ id : '1708' ,
25+ channel : 'debug' ,
1926 overlays : Object . freeze ( createMiniGameOverlayCycleMap ( ) ) ,
2027 initialOverlayId : OVERLAY_UI_LAYER ,
2128 persistenceKey : 'phase17:1708:overlay-index' ,
2229 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
2330 } ) ,
24- '1709' : Object . freeze ( {
31+ defineOverlayExtensionContract ( {
32+ id : '1709' ,
33+ channel : 'debug' ,
2534 overlays : Object . freeze ( createMovementOverlayCycleMap ( ) ) ,
2635 initialOverlayId : OVERLAY_MOVEMENT_RUNTIME ,
2736 persistenceKey : 'phase17:1709:overlay-index' ,
2837 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
2938 } ) ,
30- '1710' : Object . freeze ( {
39+ defineOverlayExtensionContract ( {
40+ id : '1710' ,
41+ channel : 'debug' ,
3142 overlays : Object . freeze ( createMiniGameOverlayCycleMap ( ) ) ,
3243 initialOverlayId : OVERLAY_UI_LAYER ,
3344 persistenceKey : 'phase17:1710:overlay-index' ,
3445 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
3546 } ) ,
36- '1711' : Object . freeze ( {
47+ defineOverlayExtensionContract ( {
48+ id : '1711' ,
49+ channel : 'debug' ,
3750 overlays : Object . freeze ( createMovementOverlayCycleMap ( ) ) ,
3851 initialOverlayId : OVERLAY_MOVEMENT_RUNTIME ,
3952 persistenceKey : 'phase17:1711:overlay-index' ,
4053 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
4154 } ) ,
42- '1712' : Object . freeze ( {
55+ defineOverlayExtensionContract ( {
56+ id : '1712' ,
57+ channel : 'debug' ,
4358 overlays : Object . freeze ( [
4459 { id : 'ui-layer' , label : 'UI Layer' } ,
4560 { id : 'mission-feed' , label : 'Mission Feed' } ,
@@ -50,7 +65,9 @@ const SAMPLE_OVERLAY_STACKS = Object.freeze({
5065 persistenceKey : 'phase17:1712:overlay-index' ,
5166 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
5267 } ) ,
53- '1713' : Object . freeze ( {
68+ defineOverlayExtensionContract ( {
69+ id : '1713' ,
70+ channel : 'debug' ,
5471 overlays : Object . freeze ( [
5572 { id : 'ui-layer' , label : 'UI Layer' } ,
5673 { id : 'mission-feed' , label : 'Mission Feed' } ,
@@ -61,7 +78,30 @@ const SAMPLE_OVERLAY_STACKS = Object.freeze({
6178 persistenceKey : 'phase17:1713:overlay-index' ,
6279 cycleKey : LEVEL17_OVERLAY_CYCLE_KEY ,
6380 } ) ,
64- } ) ;
81+ ] ) ;
82+
83+ const LEVEL17_OVERLAY_EXTENSION_CONTRACT_MAP = createOverlayExtensionContractMap ( LEVEL17_OVERLAY_EXTENSION_CONTRACTS ) ;
84+
85+ const SAMPLE_OVERLAY_STACKS = Object . freeze (
86+ Object . fromEntries (
87+ Array . from ( LEVEL17_OVERLAY_EXTENSION_CONTRACT_MAP . entries ( ) , ( [ sampleId , contract ] ) => [
88+ sampleId ,
89+ getOverlayControllerConfigFromContract ( contract ) ,
90+ ] )
91+ )
92+ ) ;
93+
94+ export function getLevel17OverlayExtensionContract ( sampleId ) {
95+ const id = String ( sampleId || '' ) . trim ( ) ;
96+ if ( ! id ) {
97+ return null ;
98+ }
99+ return LEVEL17_OVERLAY_EXTENSION_CONTRACT_MAP . get ( id ) ?? null ;
100+ }
101+
102+ export function listLevel17OverlayExtensionContracts ( ) {
103+ return LEVEL17_OVERLAY_EXTENSION_CONTRACTS ;
104+ }
65105
66106export function getLevel17OverlayStackConfig ( sampleId ) {
67107 return SAMPLE_OVERLAY_STACKS [ String ( sampleId || '' ) . trim ( ) ] ?? null ;
0 commit comments