brick-engine-js 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -4952
- package/dist/brick-engine.js +1 -4970
- package/dist/css/{app.bundle.css → app.0ce9b8479d1758fc15ba.css} +0 -2
- package/dist/css/{brick-engine.bundle.css → brick-engine.0ce9b8479d1758fc15ba.css} +0 -2
- package/dist/docs/GAME_DEVELOPER_GUIDE.html +1 -1
- package/dist/docs/brick-engine-guide.html +1 -1
- package/dist/docs/getting-started.html +1 -1
- package/dist/docs/jsdoc_standard.html +1 -1
- package/dist/docs/publishing.html +1 -1
- package/dist/docs/reference/interfaces/modules/Session.html +1 -1
- package/dist/docs/reference/modules/GameMenu.html +1 -1
- package/dist/docs/reference/modules/GameSession.html +1 -1
- package/dist/docs/reference/modules/InitialStateSnapshot.html +1 -1
- package/dist/docs/reference/modules/SessionModal.html +1 -1
- package/dist/docs/testing_best_practices.html +1 -1
- package/dist/index.html +1 -15
- package/dist/vendor/p5.min.js +1 -1
- package/package.json +2 -4
- package/dist/app.js.map +0 -1
- package/dist/brick-engine.js.map +0 -1
- package/dist/css/app.bundle.css.map +0 -1
- package/dist/css/brick-engine.bundle.css.map +0 -1
- package/docs/GAME_DEVELOPER_GUIDE.adoc +0 -167
- package/docs/brick-engine-guide.adoc +0 -87
- package/docs/diagrams/lifecycle.mmd +0 -19
- package/docs/documentation_style_guide.adoc +0 -210
- package/docs/getting-started.adoc +0 -147
- package/docs/images/lifecycle.svg +0 -1
- package/docs/jsdoc_standard.adoc +0 -109
- package/docs/publishing.adoc +0 -58
- package/docs/reference/enums/Color.adoc +0 -35
- package/docs/reference/enums/ControlEventType.adoc +0 -28
- package/docs/reference/enums/ControlKey.adoc +0 -34
- package/docs/reference/enums/FontAlignment.adoc +0 -43
- package/docs/reference/enums/FontSize.adoc +0 -31
- package/docs/reference/enums/Sound.adoc +0 -42
- package/docs/reference/enums/StateProperty.adoc +0 -33
- package/docs/reference/helpers/CellHelper.adoc +0 -37
- package/docs/reference/helpers/ControlInputHandlerHelper.adoc +0 -57
- package/docs/reference/helpers/CoordinateHelper.adoc +0 -118
- package/docs/reference/helpers/RelativeValuesHelper.adoc +0 -53
- package/docs/reference/interfaces/Debuggable.adoc +0 -29
- package/docs/reference/interfaces/GameModules.adoc +0 -35
- package/docs/reference/interfaces/Initializable.adoc +0 -24
- package/docs/reference/interfaces/RendererInitializable.adoc +0 -33
- package/docs/reference/interfaces/StateSyncable.adoc +0 -41
- package/docs/reference/interfaces/modules/Control.adoc +0 -98
- package/docs/reference/interfaces/modules/Grid.adoc +0 -411
- package/docs/reference/interfaces/modules/Renderer.adoc +0 -34
- package/docs/reference/interfaces/modules/RendererComposite.adoc +0 -57
- package/docs/reference/interfaces/modules/Score.adoc +0 -107
- package/docs/reference/interfaces/modules/Session.adoc +0 -66
- package/docs/reference/interfaces/modules/State.adoc +0 -290
- package/docs/reference/interfaces/modules/Text.adoc +0 -110
- package/docs/reference/interfaces/modules/Time.adoc +0 -119
- package/docs/reference/modules/Debugger.adoc +0 -71
- package/docs/reference/modules/DisplayRenderer.adoc +0 -55
- package/docs/reference/modules/Game.adoc +0 -256
- package/docs/reference/modules/GameControl.adoc +0 -139
- package/docs/reference/modules/GameGrid.adoc +0 -794
- package/docs/reference/modules/GameHudGrid.adoc +0 -38
- package/docs/reference/modules/GameMenu.adoc +0 -39
- package/docs/reference/modules/GameRenderer.adoc +0 -79
- package/docs/reference/modules/GameScore.adoc +0 -138
- package/docs/reference/modules/GameSession.adoc +0 -43
- package/docs/reference/modules/GameSound.adoc +0 -111
- package/docs/reference/modules/GameState.adoc +0 -318
- package/docs/reference/modules/GameText.adoc +0 -139
- package/docs/reference/modules/GameTime.adoc +0 -141
- package/docs/reference/modules/HudRenderer.adoc +0 -56
- package/docs/reference/modules/InitialStateSnapshot.adoc +0 -47
- package/docs/reference/modules/SessionModal.adoc +0 -34
- package/docs/reference/types/Axis.adoc +0 -28
- package/docs/reference/types/Cell.adoc +0 -29
- package/docs/reference/types/ControlCallback.adoc +0 -23
- package/docs/reference/types/Coordinate.adoc +0 -29
- package/docs/reference/types/GameEntry.adoc +0 -29
- package/docs/reference/types/GameEvent.adoc +0 -29
- package/docs/reference/types/Piece.adoc +0 -32
- package/docs/reference/types/RendererMetrics.adoc +0 -29
- package/docs/reference/types/Vector.adoc +0 -28
- package/docs/testing_best_practices.adoc +0 -190
- package/public/CNAME +0 -1
- package/public/docs/GAME_DEVELOPER_GUIDE.html +0 -727
- package/public/docs/brick-engine-guide.html +0 -610
- package/public/docs/diagrams/lifecycle.mmd +0 -19
- package/public/docs/documentation_style_guide.html +0 -994
- package/public/docs/getting-started.html +0 -648
- package/public/docs/images/lifecycle.svg +0 -1
- package/public/docs/index.html +0 -593
- package/public/docs/jsdoc_standard.html +0 -656
- package/public/docs/publishing.html +0 -573
- package/public/docs/reference/enums/Color.html +0 -533
- package/public/docs/reference/enums/ControlEventType.html +0 -505
- package/public/docs/reference/enums/ControlKey.html +0 -529
- package/public/docs/reference/enums/FontAlignment.html +0 -545
- package/public/docs/reference/enums/FontSize.html +0 -517
- package/public/docs/reference/enums/Sound.html +0 -558
- package/public/docs/reference/enums/StateProperty.html +0 -525
- package/public/docs/reference/helpers/CellHelper.html +0 -520
- package/public/docs/reference/helpers/ControlInputHandlerHelper.html +0 -569
- package/public/docs/reference/helpers/CoordinateHelper.html +0 -703
- package/public/docs/reference/helpers/RelativeValuesHelper.html +0 -560
- package/public/docs/reference/interfaces/Debuggable.html +0 -501
- package/public/docs/reference/interfaces/GameModules.html +0 -544
- package/public/docs/reference/interfaces/Initializable.html +0 -495
- package/public/docs/reference/interfaces/RendererInitializable.html +0 -517
- package/public/docs/reference/interfaces/StateSyncable.html +0 -542
- package/public/docs/reference/interfaces/modules/Control.html +0 -648
- package/public/docs/reference/interfaces/modules/Grid.html +0 -1256
- package/public/docs/reference/interfaces/modules/Renderer.html +0 -522
- package/public/docs/reference/interfaces/modules/RendererComposite.html +0 -577
- package/public/docs/reference/interfaces/modules/Score.html +0 -669
- package/public/docs/reference/interfaces/modules/Session.html +0 -585
- package/public/docs/reference/interfaces/modules/State.html +0 -897
- package/public/docs/reference/interfaces/modules/Text.html +0 -668
- package/public/docs/reference/interfaces/modules/Time.html +0 -684
- package/public/docs/reference/modules/Debugger.html +0 -579
- package/public/docs/reference/modules/DisplayRenderer.html +0 -557
- package/public/docs/reference/modules/Game.html +0 -909
- package/public/docs/reference/modules/GameControl.html +0 -716
- package/public/docs/reference/modules/GameGrid.html +0 -1910
- package/public/docs/reference/modules/GameHudGrid.html +0 -508
- package/public/docs/reference/modules/GameMenu.html +0 -538
- package/public/docs/reference/modules/GameRenderer.html +0 -589
- package/public/docs/reference/modules/GameScore.html +0 -664
- package/public/docs/reference/modules/GameSession.html +0 -533
- package/public/docs/reference/modules/GameSound.html +0 -636
- package/public/docs/reference/modules/GameState.html +0 -922
- package/public/docs/reference/modules/GameText.html +0 -701
- package/public/docs/reference/modules/GameTime.html +0 -696
- package/public/docs/reference/modules/HudRenderer.html +0 -568
- package/public/docs/reference/modules/InitialStateSnapshot.html +0 -557
- package/public/docs/reference/modules/SessionModal.html +0 -520
- package/public/docs/reference/types/Axis.html +0 -505
- package/public/docs/reference/types/Cell.html +0 -514
- package/public/docs/reference/types/ControlCallback.html +0 -488
- package/public/docs/reference/types/Coordinate.html +0 -510
- package/public/docs/reference/types/GameEntry.html +0 -514
- package/public/docs/reference/types/GameEvent.html +0 -514
- package/public/docs/reference/types/Piece.html +0 -506
- package/public/docs/reference/types/RendererMetrics.html +0 -514
- package/public/docs/reference/types/Vector.html +0 -509
- package/public/docs/testing_best_practices.html +0 -770
- package/public/favicon.ico +0 -0
- package/public/fonts/digital-7.monoitalic.ttf +0 -0
- package/public/images/cell.svg +0 -32
- package/public/images/close.png +0 -0
- package/public/images/games.png +0 -0
- package/public/images/github.png +0 -0
- package/public/images/letter-a.png +0 -0
- package/public/images/letter-d.png +0 -0
- package/public/images/letter-j.png +0 -0
- package/public/images/letter-s.png +0 -0
- package/public/images/letter-w.png +0 -0
- package/public/images/meta-image.png +0 -0
- package/public/images/number-1.png +0 -0
- package/public/images/number-2.png +0 -0
- package/public/images/number-3.png +0 -0
- package/public/images/number-4.png +0 -0
- package/public/images/number-5.png +0 -0
- package/public/images/number-6.png +0 -0
- package/public/images/splash.gif +0 -0
- package/public/index.html +0 -15
- package/public/sounds/sound_00.wav +0 -0
- package/public/sounds/sound_01.wav +0 -0
- package/public/sounds/sound_02.wav +0 -0
- package/public/sounds/sound_03.wav +0 -0
- package/public/sounds/sound_04.wav +0 -0
- package/public/sounds/sound_05.wav +0 -0
- package/public/sounds/sound_06.wav +0 -0
- package/public/sounds/sound_07.wav +0 -0
- package/public/sounds/sound_08.wav +0 -0
- package/public/sounds/sound_09.wav +0 -0
- package/public/sounds/sound_10.wav +0 -0
- package/public/sounds/sound_11.wav +0 -0
- package/public/sounds/sound_12.wav +0 -0
- package/public/sounds/sound_13.wav +0 -0
- package/public/sounds/sound_14.wav +0 -0
- package/public/sounds/sound_15.wav +0 -0
- package/public/style/body.css +0 -86
- package/public/style/buttons.css +0 -233
- package/public/style/debugger.css +0 -117
- package/public/style/sessionModal.css +0 -155
- package/public/style/sourceCodeAndCommands.css +0 -74
- package/public/style/splash.css +0 -13
- package/public/style/theme.css +0 -137
- /package/dist/{bootstrap.d.ts → types/bootstrap.d.ts} +0 -0
- /package/dist/{bootstrap.test.d.ts → types/bootstrap.test.d.ts} +0 -0
- /package/dist/{config → types/config}/configs.d.ts +0 -0
- /package/dist/{config → types/config}/configs.test.d.ts +0 -0
- /package/dist/{core → types/core}/Game.d.ts +0 -0
- /package/dist/{core → types/core}/Game.test.d.ts +0 -0
- /package/dist/{core → types/core}/InitialStateSnapshot.d.ts +0 -0
- /package/dist/{core → types/core}/InitialStateSnapshot.test.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/CellHelper.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/CellHelper.test.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/ControlInputHandlerHelper.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/ControlInputHandlerHelper.test.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/CoordinateHelper.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/CoordinateHelper.test.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/InterfaceIdentifierHelper.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/InterfaceIdentifierHelper.test.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/RelativeValuesHelper.d.ts +0 -0
- /package/dist/{core → types/core}/helpers/RelativeValuesHelper.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/control/GameControl.d.ts +0 -0
- /package/dist/{core → types/core}/module/control/GameControl.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/control/GameControlKeyBinding.d.ts +0 -0
- /package/dist/{core → types/core}/module/control/GameControlKeyBinding.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/GameGrid.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/GameGrid.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/GameHudGrid.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/GameHudGrid.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridAnalysisEngine.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridAnalysisEngine.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridLineEngine.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridLineEngine.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridMovementEngine.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridMovementEngine.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridRegionEngine.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridRegionEngine.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridTransformEngine.d.ts +0 -0
- /package/dist/{core → types/core}/module/grid/engines/GridTransformEngine.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/DisplayRenderer.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/DisplayRenderer.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/GameRenderer.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/GameRenderer.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/HudRenderer.d.ts +0 -0
- /package/dist/{core → types/core}/module/renderer/HudRenderer.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/score/GameScore.d.ts +0 -0
- /package/dist/{core → types/core}/module/score/GameScore.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/session/GameSession.d.ts +0 -0
- /package/dist/{core → types/core}/module/session/GameSession.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/sound/GameSound.d.ts +0 -0
- /package/dist/{core → types/core}/module/sound/GameSound.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/state/GameState.d.ts +0 -0
- /package/dist/{core → types/core}/module/state/GameState.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/text/GameText.d.ts +0 -0
- /package/dist/{core → types/core}/module/text/GameText.test.d.ts +0 -0
- /package/dist/{core → types/core}/module/time/GameTime.d.ts +0 -0
- /package/dist/{core → types/core}/module/time/GameTime.test.d.ts +0 -0
- /package/dist/{core → types/core}/types/Interfaces.d.ts +0 -0
- /package/dist/{core → types/core}/types/Types.d.ts +0 -0
- /package/dist/{core → types/core}/types/enums.d.ts +0 -0
- /package/dist/{core → types/core}/types/modules.d.ts +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{main.d.ts → types/main.d.ts} +0 -0
- /package/dist/{menu → types/menu}/GameMenu.d.ts +0 -0
- /package/dist/{menu → types/menu}/GameMenu.test.d.ts +0 -0
- /package/dist/{menu → types/menu}/GameMenuSingleton.d.ts +0 -0
- /package/dist/{menu → types/menu}/GameMenuSingleton.test.d.ts +0 -0
- /package/dist/{menu → types/menu}/GameRepository.d.ts +0 -0
- /package/dist/{menu → types/menu}/GameRepository.test.d.ts +0 -0
- /package/dist/{menu → types/menu}/manager/GameManager.d.ts +0 -0
- /package/dist/{menu → types/menu}/manager/GameManager.test.d.ts +0 -0
- /package/dist/types/{interfaces.d.ts → types/interfaces.d.ts} +0 -0
- /package/dist/{view → types/view}/Debugger.d.ts +0 -0
- /package/dist/{view → types/view}/Debugger.test.d.ts +0 -0
- /package/dist/{view → types/view}/GameView.d.ts +0 -0
- /package/dist/{view → types/view}/GameView.test.d.ts +0 -0
- /package/dist/{view → types/view}/SessionModal.d.ts +0 -0
- /package/dist/{view → types/view}/SessionModal.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/ButtonLayout.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/ButtonLayout.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/ContainerLayout.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/ContainerLayout.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/FrameLayout.d.ts +0 -0
- /package/dist/{view → types/view}/components/layout/FrameLayout.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/BigButton.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/BigButton.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/Button.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/Button.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/Canvas.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/Canvas.test.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/SmallButton.d.ts +0 -0
- /package/dist/{view → types/view}/components/ui/SmallButton.test.d.ts +0 -0
- /package/dist/{view → types/view}/theme/applyColors.d.ts +0 -0
- /package/dist/{view → types/view}/theme/applyColors.test.d.ts +0 -0
- /package/dist/{view → types/view}/theme/dimensions.d.ts +0 -0
- /package/dist/{view → types/view}/theme/dimensions.test.d.ts +0 -0
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
= Grid Reference
|
|
2
|
-
:description: Interface defining the behaviors of a 2D grid of cells.
|
|
3
|
-
:keywords: grid, cells, matrix, collision-detection
|
|
4
|
-
:toc: left
|
|
5
|
-
:toclevels: 3
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectlinks:
|
|
8
|
-
:icons: font
|
|
9
|
-
:source-highlighter: highlight.js
|
|
10
|
-
:reproducible:
|
|
11
|
-
:experimental:
|
|
12
|
-
:idprefix:
|
|
13
|
-
:idseparator: -
|
|
14
|
-
|
|
15
|
-
Interface defining the behaviors of a 2D grid of cells.
|
|
16
|
-
|
|
17
|
-
== Properties
|
|
18
|
-
|
|
19
|
-
[cols="1,1,3"]
|
|
20
|
-
|===
|
|
21
|
-
|Name |Type |Description
|
|
22
|
-
|`width` |`number` |The number of columns in the grid.
|
|
23
|
-
|`height` |`number` |The number of rows in the grid.
|
|
24
|
-
|===
|
|
25
|
-
|
|
26
|
-
== Methods
|
|
27
|
-
|
|
28
|
-
=== `getGrid(): xref:../../types/Cell.adoc[Cell][][]`
|
|
29
|
-
|
|
30
|
-
Returns the raw 2D array of `xref:../../types/Cell.adoc[Cell]` objects representing the grid state.
|
|
31
|
-
|
|
32
|
-
**Returns**
|
|
33
|
-
|
|
34
|
-
`xref:../../types/Cell.adoc[Cell][][]` - The matrix representing the grid state.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'''
|
|
38
|
-
|
|
39
|
-
=== `resetGrid(): void`
|
|
40
|
-
|
|
41
|
-
Clears all cell values and resets colors to `xref:../../enums/Color.adoc[DEFAULT]`.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'''
|
|
45
|
-
|
|
46
|
-
=== `forEach(callback: (cell: xref:../../types/Cell.adoc[Cell]) => void): void`
|
|
47
|
-
|
|
48
|
-
Iterates over every cell in the grid, executing the provided callback.
|
|
49
|
-
|
|
50
|
-
**Parameters**
|
|
51
|
-
|
|
52
|
-
[cols="1,1,3"]
|
|
53
|
-
|===
|
|
54
|
-
|Name |Type |Description
|
|
55
|
-
|`callback` |`(cell: xref:../../types/Cell.adoc[Cell]) => void` |Function to execute for each cell.
|
|
56
|
-
|===
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'''
|
|
60
|
-
|
|
61
|
-
=== `isValidCoordinate(coordinate: xref:../../types/Coordinate.adoc[Coordinate]): boolean`
|
|
62
|
-
|
|
63
|
-
Returns `true` if the given coordinate falls within the grid boundaries.
|
|
64
|
-
|
|
65
|
-
**Parameters**
|
|
66
|
-
|
|
67
|
-
[cols="1,1,3"]
|
|
68
|
-
|===
|
|
69
|
-
|Name |Type |Description
|
|
70
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |The `{x, y}` point to validate.
|
|
71
|
-
|===
|
|
72
|
-
|
|
73
|
-
**Returns**
|
|
74
|
-
|
|
75
|
-
`boolean` - `true` if valid, `false` otherwise.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'''
|
|
79
|
-
|
|
80
|
-
=== `getCell(coordinate: xref:../../types/Coordinate.adoc[Coordinate]): xref:../../types/Cell.adoc[Cell] | null`
|
|
81
|
-
|
|
82
|
-
Retrieves the `xref:../../types/Cell.adoc[Cell]` object at the specified coordinate.
|
|
83
|
-
|
|
84
|
-
**Parameters**
|
|
85
|
-
|
|
86
|
-
[cols="1,1,3"]
|
|
87
|
-
|===
|
|
88
|
-
|Name |Type |Description
|
|
89
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |The `{x, y}` position to query.
|
|
90
|
-
|===
|
|
91
|
-
|
|
92
|
-
**Returns**
|
|
93
|
-
|
|
94
|
-
`xref:../../types/Cell.adoc[Cell] | null` - The cell object, or `null` if the coordinate is out of bounds.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
'''
|
|
98
|
-
|
|
99
|
-
=== `setCellValue(coordinate: xref:../../types/Coordinate.adoc[Coordinate], value: number): void`
|
|
100
|
-
|
|
101
|
-
Updates the numeric value of the cell at the given coordinate.
|
|
102
|
-
|
|
103
|
-
**Parameters**
|
|
104
|
-
|
|
105
|
-
[cols="1,1,3"]
|
|
106
|
-
|===
|
|
107
|
-
|Name |Type |Description
|
|
108
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |Target position.
|
|
109
|
-
|`value` |`number` |New status value (0 for inactive, >0 for active).
|
|
110
|
-
|===
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
'''
|
|
114
|
-
|
|
115
|
-
=== `setCellColor(coordinate: xref:../../types/Coordinate.adoc[Coordinate], color: xref:../../enums/Color.adoc[Color]): void`
|
|
116
|
-
|
|
117
|
-
Updates the visual color of the cell at the given coordinate.
|
|
118
|
-
|
|
119
|
-
**Parameters**
|
|
120
|
-
|
|
121
|
-
[cols="1,1,3"]
|
|
122
|
-
|===
|
|
123
|
-
|Name |Type |Description
|
|
124
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |Target position.
|
|
125
|
-
|`color` |`xref:../../enums/Color.adoc[Color]` |Enum value representing the new color.
|
|
126
|
-
|===
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
'''
|
|
130
|
-
|
|
131
|
-
=== `isCellActive(coordinate: xref:../../types/Coordinate.adoc[Coordinate]): boolean`
|
|
132
|
-
|
|
133
|
-
Returns `true` if the cell's value is greater than `0`.
|
|
134
|
-
|
|
135
|
-
**Parameters**
|
|
136
|
-
|
|
137
|
-
[cols="1,1,3"]
|
|
138
|
-
|===
|
|
139
|
-
|Name |Type |Description
|
|
140
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |Point to check.
|
|
141
|
-
|===
|
|
142
|
-
|
|
143
|
-
**Returns**
|
|
144
|
-
|
|
145
|
-
`boolean` - `true` if the cell value is greater than 0.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
'''
|
|
149
|
-
|
|
150
|
-
=== `isCellInactive(coordinate: xref:../../types/Coordinate.adoc[Coordinate]): boolean`
|
|
151
|
-
|
|
152
|
-
Returns `true` if the cell's value is `0`.
|
|
153
|
-
|
|
154
|
-
**Parameters**
|
|
155
|
-
|
|
156
|
-
[cols="1,1,3"]
|
|
157
|
-
|===
|
|
158
|
-
|Name |Type |Description
|
|
159
|
-
|`coordinate` |`xref:../../types/Coordinate.adoc[Coordinate]` |Point to check.
|
|
160
|
-
|===
|
|
161
|
-
|
|
162
|
-
**Returns**
|
|
163
|
-
|
|
164
|
-
`boolean` - `true` if the cell value is exactly 0.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
'''
|
|
168
|
-
|
|
169
|
-
=== `isRowFull(y: number): boolean`
|
|
170
|
-
|
|
171
|
-
Returns `true` if every cell in the specified row `y` is active.
|
|
172
|
-
|
|
173
|
-
**Parameters**
|
|
174
|
-
|
|
175
|
-
[cols="1,1,3"]
|
|
176
|
-
|===
|
|
177
|
-
|Name |Type |Description
|
|
178
|
-
|`y` |`number` |Row index to check.
|
|
179
|
-
|===
|
|
180
|
-
|
|
181
|
-
**Returns**
|
|
182
|
-
|
|
183
|
-
`boolean` - `true` if full.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
'''
|
|
187
|
-
|
|
188
|
-
=== `isRowEmpty(y: number): boolean`
|
|
189
|
-
|
|
190
|
-
Returns `true` if every cell in the specified row `y` is inactive.
|
|
191
|
-
|
|
192
|
-
**Parameters**
|
|
193
|
-
|
|
194
|
-
[cols="1,1,3"]
|
|
195
|
-
|===
|
|
196
|
-
|Name |Type |Description
|
|
197
|
-
|`y` |`number` |Row index to check.
|
|
198
|
-
|===
|
|
199
|
-
|
|
200
|
-
**Returns**
|
|
201
|
-
|
|
202
|
-
`boolean` - `true` if empty.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
'''
|
|
206
|
-
|
|
207
|
-
=== `clearRow(y: number): void`
|
|
208
|
-
|
|
209
|
-
Resets all cells in row `y` to their inactive state.
|
|
210
|
-
|
|
211
|
-
**Parameters**
|
|
212
|
-
|
|
213
|
-
[cols="1,1,3"]
|
|
214
|
-
|===
|
|
215
|
-
|Name |Type |Description
|
|
216
|
-
|`y` |`number` |Row index to clear.
|
|
217
|
-
|===
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
'''
|
|
221
|
-
|
|
222
|
-
=== `shiftRowsDown(fromY: number): void`
|
|
223
|
-
|
|
224
|
-
Moves all rows above (and including) `fromY` down by one position.
|
|
225
|
-
|
|
226
|
-
**Parameters**
|
|
227
|
-
|
|
228
|
-
[cols="1,1,3"]
|
|
229
|
-
|===
|
|
230
|
-
|Name |Type |Description
|
|
231
|
-
|`fromY` |`number` |The row index to start shifting from.
|
|
232
|
-
|===
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
'''
|
|
236
|
-
|
|
237
|
-
=== `shiftRowsUp(fromY: number): void`
|
|
238
|
-
|
|
239
|
-
Moves all rows below (and including) `fromY` up by one position.
|
|
240
|
-
|
|
241
|
-
**Parameters**
|
|
242
|
-
|
|
243
|
-
[cols="1,1,3"]
|
|
244
|
-
|===
|
|
245
|
-
|Name |Type |Description
|
|
246
|
-
|`fromY` |`number` |The row index to start shifting from.
|
|
247
|
-
|===
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
'''
|
|
251
|
-
|
|
252
|
-
=== `clearFullRows(): number`
|
|
253
|
-
|
|
254
|
-
Detects, clears, and shifts rows for all full rows in the grid.
|
|
255
|
-
|
|
256
|
-
**Returns**
|
|
257
|
-
|
|
258
|
-
`number` - The total count of cleared rows.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
'''
|
|
262
|
-
|
|
263
|
-
=== `isColumnFull(x: number): boolean`
|
|
264
|
-
|
|
265
|
-
Returns `true` if every cell in column `x` is active.
|
|
266
|
-
|
|
267
|
-
**Parameters**
|
|
268
|
-
|
|
269
|
-
[cols="1,1,3"]
|
|
270
|
-
|===
|
|
271
|
-
|Name |Type |Description
|
|
272
|
-
|`x` |`number` |Column index to check.
|
|
273
|
-
|===
|
|
274
|
-
|
|
275
|
-
**Returns**
|
|
276
|
-
|
|
277
|
-
`boolean` - `true` if full.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
'''
|
|
281
|
-
|
|
282
|
-
=== `isColumnEmpty(x: number): boolean`
|
|
283
|
-
|
|
284
|
-
Returns `true` if every cell in column `x` is inactive.
|
|
285
|
-
|
|
286
|
-
**Parameters**
|
|
287
|
-
|
|
288
|
-
[cols="1,1,3"]
|
|
289
|
-
|===
|
|
290
|
-
|Name |Type |Description
|
|
291
|
-
|`x` |`number` |Column index to check.
|
|
292
|
-
|===
|
|
293
|
-
|
|
294
|
-
**Returns**
|
|
295
|
-
|
|
296
|
-
`boolean` - `true` if empty.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
'''
|
|
300
|
-
|
|
301
|
-
=== `clearColumn(x: number): void`
|
|
302
|
-
|
|
303
|
-
Resets all cells in column `x` to their inactive state.
|
|
304
|
-
|
|
305
|
-
**Parameters**
|
|
306
|
-
|
|
307
|
-
[cols="1,1,3"]
|
|
308
|
-
|===
|
|
309
|
-
|Name |Type |Description
|
|
310
|
-
|`x` |`number` |Column index to clear.
|
|
311
|
-
|===
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
'''
|
|
315
|
-
|
|
316
|
-
=== `shiftColumnsRight(fromX: number): void`
|
|
317
|
-
|
|
318
|
-
Moves all columns to the left of `fromX` one position to the right.
|
|
319
|
-
|
|
320
|
-
**Parameters**
|
|
321
|
-
|
|
322
|
-
[cols="1,1,3"]
|
|
323
|
-
|===
|
|
324
|
-
|Name |Type |Description
|
|
325
|
-
|`fromX` |`number` |The column index to start shifting from.
|
|
326
|
-
|===
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
'''
|
|
330
|
-
|
|
331
|
-
=== `shiftColumnsLeft(fromX: number): void`
|
|
332
|
-
|
|
333
|
-
Moves all columns to the right of `fromX` one position to the left.
|
|
334
|
-
|
|
335
|
-
**Parameters**
|
|
336
|
-
|
|
337
|
-
[cols="1,1,3"]
|
|
338
|
-
|===
|
|
339
|
-
|Name |Type |Description
|
|
340
|
-
|`fromX` |`number` |The column index to start shifting from.
|
|
341
|
-
|===
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
'''
|
|
345
|
-
|
|
346
|
-
=== `clearFullColumns(): number`
|
|
347
|
-
|
|
348
|
-
Detects and clears all full columns.
|
|
349
|
-
|
|
350
|
-
**Returns**
|
|
351
|
-
|
|
352
|
-
`number` - The total count of cleared columns.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
'''
|
|
356
|
-
|
|
357
|
-
=== `isAreaOccupied(coordinates: xref:../../types/Coordinate.adoc[Coordinate][]): boolean`
|
|
358
|
-
|
|
359
|
-
Returns `true` if any of the provided coordinates are already active in the grid. Used for collision detection.
|
|
360
|
-
|
|
361
|
-
**Parameters**
|
|
362
|
-
|
|
363
|
-
[cols="1,1,3"]
|
|
364
|
-
|===
|
|
365
|
-
|Name |Type |Description
|
|
366
|
-
|`coordinates` |`xref:../../types/Coordinate.adoc[Coordinate][]` |Array of `{x, y}` points representing a shape or piece.
|
|
367
|
-
|===
|
|
368
|
-
|
|
369
|
-
**Returns**
|
|
370
|
-
|
|
371
|
-
`boolean` - `true` if occupied.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
'''
|
|
375
|
-
|
|
376
|
-
=== `fillArea(start: xref:../../types/Coordinate.adoc[Coordinate], end: xref:../../types/Coordinate.adoc[Coordinate], value: number, color: xref:../../enums/Color.adoc[Color]): void`
|
|
377
|
-
|
|
378
|
-
Batch updates a rectangular area defined by `start` and `end` with the given value and color.
|
|
379
|
-
|
|
380
|
-
**Parameters**
|
|
381
|
-
|
|
382
|
-
[cols="1,1,3"]
|
|
383
|
-
|===
|
|
384
|
-
|Name |Type |Description
|
|
385
|
-
|`start` |`xref:../../types/Coordinate.adoc[Coordinate]` |Top-left corner of the rectangle.
|
|
386
|
-
|`end` |`xref:../../types/Coordinate.adoc[Coordinate]` |Bottom-right corner of the rectangle.
|
|
387
|
-
|`value` |`number` |Value to apply to all cells in the area.
|
|
388
|
-
|`color` |`xref:../../enums/Color.adoc[Color]` |Color to apply to all cells in the area.
|
|
389
|
-
|===
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
'''
|
|
393
|
-
|
|
394
|
-
=== `stampPiece(coordinates: xref:../../types/Coordinate.adoc[Coordinate][], value: number, color: xref:../../enums/Color.adoc[Color]): void`
|
|
395
|
-
|
|
396
|
-
Applies the specified value and color to multiple discrete coordinates simultaneously.
|
|
397
|
-
|
|
398
|
-
**Parameters**
|
|
399
|
-
|
|
400
|
-
[cols="1,1,3"]
|
|
401
|
-
|===
|
|
402
|
-
|Name |Type |Description
|
|
403
|
-
|`coordinates` |`xref:../../types/Coordinate.adoc[Coordinate][]` |Points to update.
|
|
404
|
-
|`value` |`number` |New cell value.
|
|
405
|
-
|`color` |`xref:../../enums/Color.adoc[Color]` |New cell color.
|
|
406
|
-
|===
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
== General Usage
|
|
410
|
-
|
|
411
|
-
The `Grid` interface is implemented by both the main `xref:../../modules/GameGrid.adoc[GameGrid]` and the `xref:../../modules/GameHudGrid.adoc[GameHudGrid]`.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
= Renderer Reference
|
|
2
|
-
:description: Defines the core drawing contract for engine visual layers.
|
|
3
|
-
:keywords: rendering, drawing, graphics, canvas
|
|
4
|
-
:toc: left
|
|
5
|
-
:toclevels: 3
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectlinks:
|
|
8
|
-
:icons: font
|
|
9
|
-
:source-highlighter: highlight.js
|
|
10
|
-
:reproducible:
|
|
11
|
-
:experimental:
|
|
12
|
-
:idprefix:
|
|
13
|
-
:idseparator: -
|
|
14
|
-
|
|
15
|
-
Defines the core drawing contract for engine visual layers.
|
|
16
|
-
|
|
17
|
-
== Methods
|
|
18
|
-
|
|
19
|
-
=== `render(grid: xref:../../types/Cell.adoc[Cell][][], modules: xref:../GameModules.adoc[GameModules]): void`
|
|
20
|
-
|
|
21
|
-
Executes the drawing logic for a single frame.
|
|
22
|
-
|
|
23
|
-
**Parameters**
|
|
24
|
-
|
|
25
|
-
[cols="1,1,3"]
|
|
26
|
-
|===
|
|
27
|
-
|Name |Type |Description
|
|
28
|
-
|`grid` |`xref:../../types/Cell.adoc[Cell][][]` |The current state of the game grid.
|
|
29
|
-
|`modules` |`xref:../GameModules.adoc[GameModules]` |Registry of all game modules.
|
|
30
|
-
|===
|
|
31
|
-
|
|
32
|
-
== General Usage
|
|
33
|
-
|
|
34
|
-
Implemented by `xref:../../modules/DisplayRenderer.adoc[DisplayRenderer]` and `xref:../../modules/HudRenderer.adoc[HudRenderer]`. The engine's composite renderer iterates through all registered `Renderer` implementations and calls their `render` method 60 times per second.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
= RendererComposite Reference
|
|
2
|
-
:description: An advanced renderer that manages a collection of individual layers.
|
|
3
|
-
:keywords: renderer, composite, layers, graphics, canvas
|
|
4
|
-
:toc: left
|
|
5
|
-
:toclevels: 3
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectlinks:
|
|
8
|
-
:icons: font
|
|
9
|
-
:source-highlighter: highlight.js
|
|
10
|
-
:reproducible:
|
|
11
|
-
:experimental:
|
|
12
|
-
:idprefix:
|
|
13
|
-
:idseparator: -
|
|
14
|
-
|
|
15
|
-
An advanced renderer that manages a collection of individual layers.
|
|
16
|
-
|
|
17
|
-
== Properties
|
|
18
|
-
|
|
19
|
-
[cols="1,1,3"]
|
|
20
|
-
|===
|
|
21
|
-
|Name |Type |Description
|
|
22
|
-
|`rendererMetrics` |xref:../../types/RendererMetrics.adoc[RendererMetrics] |The geometric source of truth.
|
|
23
|
-
|===
|
|
24
|
-
|
|
25
|
-
== Methods
|
|
26
|
-
|
|
27
|
-
=== `addRenderer(renderer: xref:Renderer.adoc[Renderer]): void`
|
|
28
|
-
|
|
29
|
-
Attaches a new visual layer.
|
|
30
|
-
|
|
31
|
-
**Parameters**
|
|
32
|
-
|
|
33
|
-
[cols="1,1,3"]
|
|
34
|
-
|===
|
|
35
|
-
|Name |Type |Description
|
|
36
|
-
|`renderer` |`xref:Renderer.adoc[Renderer]` |The renderer instance to add (e.g., Grid, HUD).
|
|
37
|
-
|===
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
'''
|
|
41
|
-
|
|
42
|
-
=== `render(grid: xref:../../types/Cell.adoc[Cell][][], modules: xref:../GameModules.adoc[GameModules]): void`
|
|
43
|
-
|
|
44
|
-
Orchestrates the rendering call for all layers.
|
|
45
|
-
|
|
46
|
-
**Parameters**
|
|
47
|
-
|
|
48
|
-
[cols="1,1,3"]
|
|
49
|
-
|===
|
|
50
|
-
|Name |Type |Description
|
|
51
|
-
|`grid` |`xref:../../types/Cell.adoc[Cell][][]` |The current state of the game grid.
|
|
52
|
-
|`modules` |`xref:../GameModules.adoc[GameModules]` |Registry of all game modules.
|
|
53
|
-
|===
|
|
54
|
-
|
|
55
|
-
== General Usage
|
|
56
|
-
|
|
57
|
-
This interface is the entry point for the visual system. It ensures that the background, the game grid, and the HUD are drawn in the correct order and with synchronized metrics.
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
= Score Reference
|
|
2
|
-
:description: Interface for tracking session performance, multipliers, and levels.
|
|
3
|
-
:keywords: score, tracking, levels, metrics, multipliers
|
|
4
|
-
:toc: left
|
|
5
|
-
:toclevels: 3
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectlinks:
|
|
8
|
-
:icons: font
|
|
9
|
-
:source-highlighter: highlight.js
|
|
10
|
-
:reproducible:
|
|
11
|
-
:experimental:
|
|
12
|
-
:idprefix:
|
|
13
|
-
:idseparator: -
|
|
14
|
-
|
|
15
|
-
Interface for tracking session performance, multipliers, and levels.
|
|
16
|
-
|
|
17
|
-
== Properties
|
|
18
|
-
|
|
19
|
-
[cols="1,1,3"]
|
|
20
|
-
|===
|
|
21
|
-
|Name |Type |Description
|
|
22
|
-
|`score` |`number` |The current total score for the session.
|
|
23
|
-
|`multiplier` |`number` |The current points multiplier.
|
|
24
|
-
|`level` |`number` |The current game difficulty level.
|
|
25
|
-
|`maxLevel` |`number` |The maximum level achievable.
|
|
26
|
-
|===
|
|
27
|
-
|
|
28
|
-
== Methods
|
|
29
|
-
|
|
30
|
-
=== `increaseScore(amount: number): void`
|
|
31
|
-
|
|
32
|
-
Adds points to the total, automatically applying any active multipliers.
|
|
33
|
-
|
|
34
|
-
**Parameters**
|
|
35
|
-
|
|
36
|
-
[cols="1,1,3"]
|
|
37
|
-
|===
|
|
38
|
-
|Name |Type |Description
|
|
39
|
-
|`amount` |`number` |The base points to add before multiplier.
|
|
40
|
-
|===
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'''
|
|
44
|
-
|
|
45
|
-
=== `resetScore(): void`
|
|
46
|
-
|
|
47
|
-
Resets the session score to `0`.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'''
|
|
51
|
-
|
|
52
|
-
=== `getFormattedScore(digits?: number): string`
|
|
53
|
-
|
|
54
|
-
Returns a string representation of the score padded with leading zeros (defaulting to 6 digits).
|
|
55
|
-
|
|
56
|
-
**Parameters**
|
|
57
|
-
|
|
58
|
-
[cols="1,1,3"]
|
|
59
|
-
|===
|
|
60
|
-
|Name |Type |Description
|
|
61
|
-
|`digits` |`number` |(Optional) The total length of the string. Defaults to 6.
|
|
62
|
-
|===
|
|
63
|
-
|
|
64
|
-
**Returns**
|
|
65
|
-
|
|
66
|
-
`string` - The formatted score (e.g., "001500").
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'''
|
|
70
|
-
|
|
71
|
-
=== `increaseLevel(amount: number): void`
|
|
72
|
-
|
|
73
|
-
Increments the current game level up to `maxLevel`.
|
|
74
|
-
|
|
75
|
-
**Parameters**
|
|
76
|
-
|
|
77
|
-
[cols="1,1,3"]
|
|
78
|
-
|===
|
|
79
|
-
|Name |Type |Description
|
|
80
|
-
|`amount` |`number` |Levels to increase by.
|
|
81
|
-
|===
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
'''
|
|
85
|
-
|
|
86
|
-
=== `resetLevel(): void`
|
|
87
|
-
|
|
88
|
-
Resets the game difficulty level to its initial value.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'''
|
|
92
|
-
|
|
93
|
-
=== `setState(state: xref:State.adoc[State]): void`
|
|
94
|
-
|
|
95
|
-
Internal setup method to link the score module with high-score persistence logic.
|
|
96
|
-
|
|
97
|
-
**Parameters**
|
|
98
|
-
|
|
99
|
-
[cols="1,1,3"]
|
|
100
|
-
|===
|
|
101
|
-
|Name |Type |Description
|
|
102
|
-
|`state` |`xref:State.adoc[State]` |The global state manager.
|
|
103
|
-
|===
|
|
104
|
-
|
|
105
|
-
== General Usage
|
|
106
|
-
|
|
107
|
-
Implemented by `xref:../../modules/GameScore.adoc[GameScore]`. It handles the numeric progression of the game and formats the data for display on the HUD.
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
= Session Interface Reference
|
|
2
|
-
:description: Defines the contract for the module responsible for managing game sessions and restoring serializable data.
|
|
3
|
-
:keywords: interface, session, storage, save, serialization
|
|
4
|
-
:toc: left
|
|
5
|
-
:toclevels: 3
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectlinks:
|
|
8
|
-
:icons: font
|
|
9
|
-
|
|
10
|
-
The `Session` interface defines the core contract for the game's session orchestration. It handles restoring persistent `xref:../Serializable.adoc[Serializable]` data (such as progressive scores or active level states) and presenting UI mechanisms to the user when playing an existing session.
|
|
11
|
-
|
|
12
|
-
This module is a core part of the `xref:GameModules.adoc[GameModules]` composite.
|
|
13
|
-
|
|
14
|
-
== Attributes / Properties / Values
|
|
15
|
-
|
|
16
|
-
[cols="1,1,3"]
|
|
17
|
-
|===
|
|
18
|
-
|Name |Type |Description
|
|
19
|
-
|`gameId` |`string` |The unique identifier of the game, provided by `xref:../../modules/Game.adoc[Game.gameId]`, used to prefix the LocalStorage entries.
|
|
20
|
-
|===
|
|
21
|
-
|
|
22
|
-
== API Reference
|
|
23
|
-
|
|
24
|
-
'''
|
|
25
|
-
|
|
26
|
-
=== `register(serializable: Serializable): void`
|
|
27
|
-
|
|
28
|
-
Appends a module or instance that implements `Serializable` to the session's watch list.
|
|
29
|
-
|
|
30
|
-
**Parameters**
|
|
31
|
-
|
|
32
|
-
[cols="1,1,3"]
|
|
33
|
-
|===
|
|
34
|
-
|Name |Type |Description
|
|
35
|
-
|`serializable` |`xref:../Serializable.adoc[Serializable]` |The instance implementing serialization capability.
|
|
36
|
-
|===
|
|
37
|
-
|
|
38
|
-
'''
|
|
39
|
-
|
|
40
|
-
=== `saveSession(): void`
|
|
41
|
-
|
|
42
|
-
Persists the current state of all registered `xref:../Serializable.adoc[Serializable]` instances to `localStorage`.
|
|
43
|
-
|
|
44
|
-
'''
|
|
45
|
-
|
|
46
|
-
=== `clearSession(): void`
|
|
47
|
-
|
|
48
|
-
Clears out the active session data from `localStorage`, functionally resetting the user's progress for the given `gameId`.
|
|
49
|
-
|
|
50
|
-
'''
|
|
51
|
-
|
|
52
|
-
=== `setShowModalFunction(showModal: (onConfirm: () => void, onCancel: () => void) => void): void`
|
|
53
|
-
|
|
54
|
-
Registers the callback that triggers the session recovery UI element.
|
|
55
|
-
|
|
56
|
-
**Parameters**
|
|
57
|
-
|
|
58
|
-
[cols="1,1,3"]
|
|
59
|
-
|===
|
|
60
|
-
|Name |Type |Description
|
|
61
|
-
|`showModal` |`Function` |The callback that is executed, receiving the internal `onConfirm` and `onCancel` closure functions as arguments.
|
|
62
|
-
|===
|
|
63
|
-
|
|
64
|
-
== General Usage
|
|
65
|
-
|
|
66
|
-
The `Session` module subscribes to the `GameState` lifecycle. Upon detecting a transition to the `PLAYING` state, if previous active records exist in `localStorage`, it invokes the modal logic set via `setShowModalFunction`. The engine's `Game` orchestrates this by default.
|