@almadar/ui 5.48.0 → 5.49.1
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/avl/index.cjs +4173 -1650
- package/dist/avl/index.css +504 -0
- package/dist/avl/index.js +3101 -579
- package/dist/components/core/templates/index.d.ts +3 -0
- package/dist/components/game/atoms/ActionButton.d.ts +4 -1
- package/dist/components/game/atoms/ControlButton.d.ts +4 -2
- package/dist/components/game/atoms/DamageNumber.d.ts +4 -1
- package/dist/components/game/atoms/ScoreDisplay.d.ts +4 -1
- package/dist/components/game/atoms/TurnIndicator.d.ts +4 -1
- package/dist/components/game/molecules/EnemyPlate.d.ts +4 -1
- package/dist/components/game/molecules/StatBadge.d.ts +4 -1
- package/dist/components/game/molecules/three/index.cjs +1371 -283
- package/dist/components/game/molecules/three/index.js +1372 -284
- package/dist/components/game/organisms/GameBoard3D.d.ts +62 -0
- package/dist/components/game/organisms/PlatformerBoard.d.ts +51 -0
- package/dist/components/game/organisms/RoguelikeBoard.d.ts +59 -0
- package/dist/components/game/organisms/TowerDefenseBoard.d.ts +64 -0
- package/dist/components/game/organisms/index.d.ts +4 -0
- package/dist/components/game/templates/GameCanvas3DBattleTemplate.d.ts +22 -35
- package/dist/components/game/templates/GameCanvas3DCastleTemplate.d.ts +23 -23
- package/dist/components/game/templates/GameCanvas3DWorldMapTemplate.d.ts +27 -29
- package/dist/components/game/templates/PlatformerTemplate.d.ts +26 -0
- package/dist/components/game/templates/RoguelikeTemplate.d.ts +23 -0
- package/dist/components/game/templates/TowerDefenseTemplate.d.ts +43 -0
- package/dist/components/index.cjs +3837 -1467
- package/dist/components/index.css +504 -0
- package/dist/components/index.js +2908 -546
- package/dist/docs/index.css +504 -0
- package/dist/providers/index.cjs +3826 -1603
- package/dist/providers/index.css +504 -0
- package/dist/providers/index.js +2915 -693
- package/dist/runtime/index.cjs +4025 -1502
- package/dist/runtime/index.css +504 -0
- package/dist/runtime/index.js +3068 -546
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GameBoard3D
|
|
3
|
+
*
|
|
4
|
+
* Controlled 3D tactics board organism. Reads all gameplay state
|
|
5
|
+
* (selectedUnitId, validMoves, attackTargets, phase, result) from the entity
|
|
6
|
+
* prop and renders <GameCanvas3D> with those controlled values.
|
|
7
|
+
* Emits user interactions via event bus so the parent Orbital trait drives
|
|
8
|
+
* all state transitions.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
14
|
+
import type { CameraMode } from '../molecules/GameCanvas3D';
|
|
15
|
+
import type { IsometricTile, IsometricFeature } from './types/isometric';
|
|
16
|
+
export interface GameBoard3DProps {
|
|
17
|
+
/** Entity row carrying all gameplay state (controlled). */
|
|
18
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
19
|
+
/** Static tile data (config default). */
|
|
20
|
+
tiles?: IsometricTile[];
|
|
21
|
+
/** Static feature data (config default). */
|
|
22
|
+
features?: IsometricFeature[];
|
|
23
|
+
/** Camera mode forwarded to GameCanvas3D. */
|
|
24
|
+
cameraMode?: CameraMode;
|
|
25
|
+
/** Background color forwarded to GameCanvas3D. */
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
/** Declarative tile click event emitted to the model. */
|
|
28
|
+
tileClickEvent?: EventEmit<{
|
|
29
|
+
tileId: string;
|
|
30
|
+
x: number;
|
|
31
|
+
z: number;
|
|
32
|
+
}>;
|
|
33
|
+
/** Declarative unit click event emitted to the model. */
|
|
34
|
+
unitClickEvent?: EventEmit<{
|
|
35
|
+
unitId: string;
|
|
36
|
+
x: number;
|
|
37
|
+
z: number;
|
|
38
|
+
}>;
|
|
39
|
+
/** Emits UI:{attackEvent} with { attackerId, targetId, damage } on attack. */
|
|
40
|
+
attackEvent?: EventEmit<{
|
|
41
|
+
attackerId: string;
|
|
42
|
+
targetId: string;
|
|
43
|
+
damage: number;
|
|
44
|
+
}>;
|
|
45
|
+
/** Emits UI:{endTurnEvent} with {} on end turn. */
|
|
46
|
+
endTurnEvent?: EventEmit<Record<string, never>>;
|
|
47
|
+
/** Emits UI:{cancelEvent} with {} on cancel. */
|
|
48
|
+
cancelEvent?: EventEmit<Record<string, never>>;
|
|
49
|
+
/** Emits UI:{playAgainEvent} with {} on play again / reset. */
|
|
50
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
51
|
+
/** Emits UI:{gameEndEvent} with { result } when win/loss is detected. */
|
|
52
|
+
gameEndEvent?: EventEmit<{
|
|
53
|
+
result: 'victory' | 'defeat';
|
|
54
|
+
}>;
|
|
55
|
+
/** Additional CSS class. */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function GameBoard3D({ entity, tiles, features, cameraMode, backgroundColor, tileClickEvent, unitClickEvent, attackEvent, endTurnEvent, cancelEvent, playAgainEvent, gameEndEvent, className, }: GameBoard3DProps): React.JSX.Element | null;
|
|
59
|
+
export declare namespace GameBoard3D {
|
|
60
|
+
var displayName: string;
|
|
61
|
+
}
|
|
62
|
+
export default GameBoard3D;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AssetUrl, EventEmit, EntityRow } from '@almadar/core';
|
|
3
|
+
import type { PlatformerPlatform, PlatformerPlayer } from '../molecules/PlatformerCanvas';
|
|
4
|
+
export interface PlatformerBoardProps {
|
|
5
|
+
/** Entity containing all board state (result, lives, score, level, player, platforms) */
|
|
6
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
7
|
+
/** Direct player state — takes priority over entity-derived player */
|
|
8
|
+
player?: PlatformerPlayer;
|
|
9
|
+
/** Direct platform data — takes priority over entity-derived platforms */
|
|
10
|
+
platforms?: PlatformerPlatform[];
|
|
11
|
+
/** Game result read from entity */
|
|
12
|
+
result?: 'none' | 'won' | 'lost';
|
|
13
|
+
/** Lives remaining */
|
|
14
|
+
lives?: number;
|
|
15
|
+
/** Current score */
|
|
16
|
+
score?: number;
|
|
17
|
+
/** Current level */
|
|
18
|
+
level?: number;
|
|
19
|
+
/** World/canvas dimensions */
|
|
20
|
+
worldWidth?: number;
|
|
21
|
+
worldHeight?: number;
|
|
22
|
+
canvasWidth?: number;
|
|
23
|
+
canvasHeight?: number;
|
|
24
|
+
/** Player sprite URL */
|
|
25
|
+
playerSprite?: AssetUrl;
|
|
26
|
+
/** Map of platform type to tile sprite URL */
|
|
27
|
+
tileSprites?: Record<string, AssetUrl>;
|
|
28
|
+
/** Canvas background color */
|
|
29
|
+
bgColor?: string;
|
|
30
|
+
/** Event names forwarded to PlatformerCanvas */
|
|
31
|
+
leftEvent?: EventEmit<{
|
|
32
|
+
direction: number;
|
|
33
|
+
}>;
|
|
34
|
+
rightEvent?: EventEmit<{
|
|
35
|
+
direction: number;
|
|
36
|
+
}>;
|
|
37
|
+
jumpEvent?: EventEmit<Record<string, never>>;
|
|
38
|
+
stopEvent?: EventEmit<Record<string, never>>;
|
|
39
|
+
/** Emits UI:{playAgainEvent} on restart */
|
|
40
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
41
|
+
/** Emits UI:{gameEndEvent} with { result } when result becomes won/lost */
|
|
42
|
+
gameEndEvent?: EventEmit<{
|
|
43
|
+
result: 'won' | 'lost';
|
|
44
|
+
}>;
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function PlatformerBoard({ entity, player: propPlayer, platforms: propPlatforms, result: propResult, lives: propLives, score: propScore, level: propLevel, worldWidth, worldHeight, canvasWidth, canvasHeight, playerSprite, tileSprites, bgColor, leftEvent, rightEvent, jumpEvent, stopEvent, playAgainEvent, gameEndEvent, className, }: PlatformerBoardProps): React.JSX.Element;
|
|
48
|
+
export declare namespace PlatformerBoard {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
51
|
+
export default PlatformerBoard;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AssetUrl, EventEmit, EntityRow } from '@almadar/core';
|
|
3
|
+
import type { DisplayStateProps } from '../../core/organisms/types';
|
|
4
|
+
import type { IsometricTile } from './types/isometric';
|
|
5
|
+
type PlayerPos = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
type EnemyRow = {
|
|
10
|
+
id: string;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
hp: number;
|
|
14
|
+
attack: number;
|
|
15
|
+
};
|
|
16
|
+
type ItemRow = {
|
|
17
|
+
id: string;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
kind: 'health_potion' | 'sword' | 'shield';
|
|
21
|
+
};
|
|
22
|
+
type RoguelikeAssetManifest = {
|
|
23
|
+
baseUrl?: AssetUrl;
|
|
24
|
+
terrains?: Record<string, AssetUrl>;
|
|
25
|
+
units?: Record<string, AssetUrl>;
|
|
26
|
+
features?: Record<string, AssetUrl>;
|
|
27
|
+
};
|
|
28
|
+
export interface RoguelikeBoardProps extends DisplayStateProps {
|
|
29
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
30
|
+
tiles?: IsometricTile[];
|
|
31
|
+
enemies?: EnemyRow[];
|
|
32
|
+
items?: ItemRow[];
|
|
33
|
+
player?: PlayerPos;
|
|
34
|
+
playerHp?: number;
|
|
35
|
+
playerMaxHp?: number;
|
|
36
|
+
playerAttack?: number;
|
|
37
|
+
depth?: number;
|
|
38
|
+
result?: 'none' | 'won' | 'lost';
|
|
39
|
+
phase?: string;
|
|
40
|
+
stairsX?: number;
|
|
41
|
+
stairsY?: number;
|
|
42
|
+
assetManifest?: RoguelikeAssetManifest;
|
|
43
|
+
scale?: number;
|
|
44
|
+
unitScale?: number;
|
|
45
|
+
moveEvent?: EventEmit<{
|
|
46
|
+
dx: number;
|
|
47
|
+
dy: number;
|
|
48
|
+
}>;
|
|
49
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
50
|
+
gameEndEvent?: EventEmit<{
|
|
51
|
+
result: string;
|
|
52
|
+
}>;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function RoguelikeBoard({ entity, tiles: propTiles, enemies: propEnemies, items: propItems, player: propPlayer, playerHp: propPlayerHp, playerMaxHp: propPlayerMaxHp, playerAttack: propPlayerAttack, depth: propDepth, result: propResult, phase: propPhase, stairsX: propStairsX, stairsY: propStairsY, assetManifest: propAssetManifest, scale, unitScale, moveEvent, playAgainEvent, gameEndEvent, className, }: RoguelikeBoardProps): React.JSX.Element;
|
|
56
|
+
export declare namespace RoguelikeBoard {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
export default RoguelikeBoard;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AssetUrl, EventEmit, EntityRow } from '@almadar/core';
|
|
3
|
+
import type { DisplayStateProps } from '../../core/organisms/types';
|
|
4
|
+
export interface TowerDefenseTile {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
terrain?: string;
|
|
8
|
+
terrainSprite?: AssetUrl;
|
|
9
|
+
passable?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface TowerDefensePathPoint {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TowerDefenseTower {
|
|
16
|
+
id: string;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
range: number;
|
|
20
|
+
damage: number;
|
|
21
|
+
cooldown: number;
|
|
22
|
+
lastFiredAt?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface TowerDefenseCreep {
|
|
25
|
+
id: string;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
hp: number;
|
|
29
|
+
maxHp: number;
|
|
30
|
+
pathIndex: number;
|
|
31
|
+
speed: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TowerDefenseBoardProps extends DisplayStateProps {
|
|
34
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
35
|
+
tiles?: TowerDefenseTile[];
|
|
36
|
+
path?: TowerDefensePathPoint[];
|
|
37
|
+
towers?: TowerDefenseTower[];
|
|
38
|
+
creeps?: TowerDefenseCreep[];
|
|
39
|
+
gold?: number;
|
|
40
|
+
lives?: number;
|
|
41
|
+
wave?: number;
|
|
42
|
+
maxWaves?: number;
|
|
43
|
+
result?: 'none' | 'won' | 'lost';
|
|
44
|
+
waveActive?: boolean;
|
|
45
|
+
towerCost?: number;
|
|
46
|
+
scale?: number;
|
|
47
|
+
placeTowerEvent?: EventEmit<{
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
}>;
|
|
51
|
+
startWaveEvent?: EventEmit<{
|
|
52
|
+
wave: number;
|
|
53
|
+
}>;
|
|
54
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
55
|
+
gameEndEvent?: EventEmit<{
|
|
56
|
+
result: 'won' | 'lost';
|
|
57
|
+
}>;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function TowerDefenseBoard({ entity, tiles: propTiles, path: propPath, towers: propTowers, creeps: propCreeps, gold: propGold, lives: propLives, wave: propWave, maxWaves: propMaxWaves, result: propResult, waveActive: propWaveActive, towerCost, scale, placeTowerEvent, startWaveEvent, playAgainEvent, gameEndEvent, className, }: TowerDefenseBoardProps): React.JSX.Element;
|
|
61
|
+
export declare namespace TowerDefenseBoard {
|
|
62
|
+
var displayName: string;
|
|
63
|
+
}
|
|
64
|
+
export default TowerDefenseBoard;
|
|
@@ -25,6 +25,10 @@ export { UncontrolledBattleBoard, type UncontrolledBattleBoardProps, } from './U
|
|
|
25
25
|
export { useBattleState, type BattleStateEventConfig, type BattleStateCallbacks, type BattleStateResult, } from './hooks/useBattleState';
|
|
26
26
|
export { WorldMapBoard, type WorldMapBoardProps, type WorldMapSlotContext, } from './WorldMapBoard';
|
|
27
27
|
export { CastleBoard, type CastleBoardProps, type CastleSlotContext, } from './CastleBoard';
|
|
28
|
+
export { PlatformerBoard, type PlatformerBoardProps, } from './PlatformerBoard';
|
|
29
|
+
export { TowerDefenseBoard, type TowerDefenseBoardProps, } from './TowerDefenseBoard';
|
|
30
|
+
export { RoguelikeBoard, type RoguelikeBoardProps, } from './RoguelikeBoard';
|
|
31
|
+
export { GameBoard3D, type GameBoard3DProps, } from './GameBoard3D';
|
|
28
32
|
export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from './TraitStateViewer';
|
|
29
33
|
export { TraitSlot, type TraitSlotProps, type SlotItemData, } from './TraitSlot';
|
|
30
34
|
export { CollapsibleSection, EditorSlider, EditorSelect, EditorCheckbox, EditorTextInput, StatusBar, TerrainPalette, EditorToolbar, TERRAIN_COLORS, FEATURE_TYPES, type EditorMode, type CollapsibleSectionProps, type EditorSliderProps, type EditorSelectProps, type EditorCheckboxProps, type EditorTextInputProps, type StatusBarProps, type TerrainPaletteProps, type EditorToolbarProps, } from './editor';
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GameCanvas3DBattleTemplate
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Declarative template for 3D battle/tactical combat.
|
|
5
|
+
* Delegates all interaction state (selectedUnitId, validMoves, attackTargets)
|
|
6
|
+
* to <GameBoard3D> so the model (not this template) owns gameplay state.
|
|
6
7
|
*
|
|
7
8
|
* Page: Battle3DPage
|
|
8
|
-
* Entity: Battle3D
|
|
9
|
+
* Entity: Battle3D / GameBoard3DItem
|
|
9
10
|
* ViewType: detail
|
|
10
11
|
*
|
|
11
12
|
* Events Emitted:
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* - UNIT_MOVE - When moving a unit
|
|
16
|
-
* - END_TURN - When ending turn
|
|
13
|
+
* - TILE_CLICK - When a tile is clicked
|
|
14
|
+
* - UNIT_CLICK - When a unit is clicked
|
|
15
|
+
* - END_TURN - When ending turn
|
|
17
16
|
* - EXIT_BATTLE - When exiting battle
|
|
18
17
|
*
|
|
19
18
|
* @packageDocumentation
|
|
20
19
|
*/
|
|
21
20
|
import React from 'react';
|
|
22
|
-
import type { IsometricTile,
|
|
21
|
+
import type { IsometricTile, IsometricFeature } from '../organisms/types/isometric';
|
|
23
22
|
import type { TemplateProps } from '../../core/templates/types';
|
|
24
23
|
export interface GameCanvas3DBattleTemplateProps extends TemplateProps {
|
|
25
24
|
/** Fallback tile data when no entity is present */
|
|
26
25
|
tiles?: IsometricTile[];
|
|
27
|
-
/** Fallback unit data when no entity is present */
|
|
28
|
-
units?: IsometricUnit[];
|
|
29
26
|
/** Fallback feature data when no entity is present */
|
|
30
27
|
features?: IsometricFeature[];
|
|
31
28
|
/** 3D camera mode - defaults to perspective for dramatic effect */
|
|
@@ -36,30 +33,22 @@ export interface GameCanvas3DBattleTemplateProps extends TemplateProps {
|
|
|
36
33
|
shadows?: boolean;
|
|
37
34
|
/** Background color - darker for battle atmosphere */
|
|
38
35
|
backgroundColor?: string;
|
|
39
|
-
/** Event name for tile clicks */
|
|
36
|
+
/** Event name for tile clicks — forwarded to the model */
|
|
40
37
|
tileClickEvent?: string;
|
|
41
|
-
/** Event name for unit clicks */
|
|
38
|
+
/** Event name for unit clicks — forwarded to the model */
|
|
42
39
|
unitClickEvent?: string;
|
|
43
|
-
/** Event name for unit attack */
|
|
44
|
-
unitAttackEvent?: string;
|
|
45
|
-
/** Event name for unit move */
|
|
46
|
-
unitMoveEvent?: string;
|
|
47
40
|
/** Event name for ending turn */
|
|
48
41
|
endTurnEvent?: string;
|
|
42
|
+
/** Event name for cancel/deselect */
|
|
43
|
+
cancelEvent?: string;
|
|
44
|
+
/** Event name for attack emission */
|
|
45
|
+
attackEvent?: string;
|
|
46
|
+
/** Event name for play again / reset */
|
|
47
|
+
playAgainEvent?: string;
|
|
48
|
+
/** Event name for game end detection */
|
|
49
|
+
gameEndEvent?: string;
|
|
49
50
|
/** Event name for exiting battle */
|
|
50
51
|
exitEvent?: string;
|
|
51
|
-
/** Currently selected unit ID */
|
|
52
|
-
selectedUnitId?: string | null;
|
|
53
|
-
/** Valid move positions */
|
|
54
|
-
validMoves?: Array<{
|
|
55
|
-
x: number;
|
|
56
|
-
z: number;
|
|
57
|
-
}>;
|
|
58
|
-
/** Valid attack targets */
|
|
59
|
-
attackTargets?: Array<{
|
|
60
|
-
x: number;
|
|
61
|
-
z: number;
|
|
62
|
-
}>;
|
|
63
52
|
/** Show turn indicator overlay */
|
|
64
53
|
showTurnIndicator?: boolean;
|
|
65
54
|
}
|
|
@@ -67,21 +56,19 @@ export interface GameCanvas3DBattleTemplateProps extends TemplateProps {
|
|
|
67
56
|
* GameCanvas3DBattleTemplate Component
|
|
68
57
|
*
|
|
69
58
|
* Template for 3D battle/tactical combat view.
|
|
59
|
+
* Interaction state lives in the entity (model), not in this component.
|
|
70
60
|
*
|
|
71
61
|
* @example
|
|
72
62
|
* ```tsx
|
|
73
63
|
* <GameCanvas3DBattleTemplate
|
|
74
64
|
* entity={battleEntity}
|
|
75
65
|
* cameraMode="perspective"
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* attackTargets={[{ x: 5, z: 5 }]}
|
|
79
|
-
* tileClickEvent="SELECT_TILE"
|
|
80
|
-
* unitClickEvent="SELECT_UNIT"
|
|
66
|
+
* tileClickEvent="TILE_CLICK"
|
|
67
|
+
* unitClickEvent="UNIT_CLICK"
|
|
81
68
|
* />
|
|
82
69
|
* ```
|
|
83
70
|
*/
|
|
84
|
-
export declare function GameCanvas3DBattleTemplate({ entity, tiles: propTiles,
|
|
71
|
+
export declare function GameCanvas3DBattleTemplate({ entity, tiles: propTiles, features: propFeatures, cameraMode, backgroundColor, tileClickEvent, unitClickEvent, endTurnEvent, cancelEvent, attackEvent, playAgainEvent, gameEndEvent, className, }: GameCanvas3DBattleTemplateProps): React.JSX.Element | null;
|
|
85
72
|
export declare namespace GameCanvas3DBattleTemplate {
|
|
86
73
|
var displayName: string;
|
|
87
74
|
}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GameCanvas3DCastleTemplate
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Declarative template for 3D castle/settlement view.
|
|
5
|
+
* Delegates interaction state (selectedUnitId, validMoves, attackTargets)
|
|
6
|
+
* to <GameBoard3D> so the model owns all gameplay state.
|
|
6
7
|
*
|
|
7
8
|
* Page: Castle3DPage, Settlement3DPage
|
|
8
|
-
* Entity: Castle3D
|
|
9
|
+
* Entity: Castle3D / GameBoard3DItem
|
|
9
10
|
* ViewType: detail
|
|
10
11
|
*
|
|
11
12
|
* Events Emitted:
|
|
12
13
|
* - BUILDING_SELECTED - When a building is clicked
|
|
13
|
-
* - UNIT_SELECTED
|
|
14
|
-
* - BUILD
|
|
15
|
-
* - RECRUIT
|
|
16
|
-
* - EXIT
|
|
14
|
+
* - UNIT_SELECTED - When a garrison unit is clicked
|
|
15
|
+
* - BUILD - When building/upgrading
|
|
16
|
+
* - RECRUIT - When recruiting units
|
|
17
|
+
* - EXIT - When exiting castle view
|
|
17
18
|
*
|
|
18
19
|
* @packageDocumentation
|
|
19
20
|
*/
|
|
20
21
|
import React from 'react';
|
|
21
|
-
import type { IsometricTile,
|
|
22
|
+
import type { IsometricTile, IsometricFeature } from '../organisms/types/isometric';
|
|
22
23
|
import type { TemplateProps } from '../../core/templates/types';
|
|
23
24
|
export interface GameCanvas3DCastleTemplateProps extends TemplateProps {
|
|
24
25
|
/** Fallback tile data when no entity is present */
|
|
25
26
|
tiles?: IsometricTile[];
|
|
26
|
-
/** Fallback unit data when no entity is present */
|
|
27
|
-
units?: IsometricUnit[];
|
|
28
27
|
/** Fallback feature data when no entity is present */
|
|
29
28
|
features?: IsometricFeature[];
|
|
30
29
|
/** 3D camera mode */
|
|
@@ -35,32 +34,34 @@ export interface GameCanvas3DCastleTemplateProps extends TemplateProps {
|
|
|
35
34
|
shadows?: boolean;
|
|
36
35
|
/** Background color */
|
|
37
36
|
backgroundColor?: string;
|
|
38
|
-
/** Event name for building clicks */
|
|
37
|
+
/** Event name for building (feature) clicks */
|
|
39
38
|
buildingClickEvent?: string;
|
|
40
39
|
/** Event name for unit clicks */
|
|
41
40
|
unitClickEvent?: string;
|
|
41
|
+
/** Event name for ending turn */
|
|
42
|
+
endTurnEvent?: string;
|
|
43
|
+
/** Event name for cancel/deselect */
|
|
44
|
+
cancelEvent?: string;
|
|
45
|
+
/** Event name for attack emission */
|
|
46
|
+
attackEvent?: string;
|
|
47
|
+
/** Event name for play again / reset */
|
|
48
|
+
playAgainEvent?: string;
|
|
49
|
+
/** Event name for game end detection */
|
|
50
|
+
gameEndEvent?: string;
|
|
42
51
|
/** Event name for build action */
|
|
43
52
|
buildEvent?: string;
|
|
44
53
|
/** Event name for recruit action */
|
|
45
54
|
recruitEvent?: string;
|
|
46
55
|
/** Event name for exit */
|
|
47
56
|
exitEvent?: string;
|
|
48
|
-
/** Currently selected building ID */
|
|
49
|
-
selectedBuildingId?: string | null;
|
|
50
|
-
/** Available build positions */
|
|
51
|
-
availableBuildSites?: Array<{
|
|
52
|
-
x: number;
|
|
53
|
-
z: number;
|
|
54
|
-
}>;
|
|
55
57
|
/** Show castle name header */
|
|
56
58
|
showHeader?: boolean;
|
|
57
|
-
/** Pre-computed selected tile IDs array */
|
|
58
|
-
selectedTileIds?: string[];
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* GameCanvas3DCastleTemplate Component
|
|
62
62
|
*
|
|
63
63
|
* Template for 3D castle/settlement management view.
|
|
64
|
+
* Interaction state lives in the entity (model), not in this component.
|
|
64
65
|
*
|
|
65
66
|
* @example
|
|
66
67
|
* ```tsx
|
|
@@ -68,12 +69,11 @@ export interface GameCanvas3DCastleTemplateProps extends TemplateProps {
|
|
|
68
69
|
* entity={castleEntity}
|
|
69
70
|
* cameraMode="isometric"
|
|
70
71
|
* showHeader={true}
|
|
71
|
-
* buildingClickEvent="
|
|
72
|
-
* buildEvent="BUILD_STRUCTURE"
|
|
72
|
+
* buildingClickEvent="UNIT_CLICK"
|
|
73
73
|
* />
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
export declare function GameCanvas3DCastleTemplate({ entity, tiles: propTiles,
|
|
76
|
+
export declare function GameCanvas3DCastleTemplate({ entity, tiles: propTiles, features: propFeatures, cameraMode, backgroundColor, buildingClickEvent, unitClickEvent, endTurnEvent, cancelEvent, attackEvent, playAgainEvent, gameEndEvent, showHeader, className, }: GameCanvas3DCastleTemplateProps): React.JSX.Element | null;
|
|
77
77
|
export declare namespace GameCanvas3DCastleTemplate {
|
|
78
78
|
var displayName: string;
|
|
79
79
|
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GameCanvas3DWorldMapTemplate
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Declarative template for 3D world map.
|
|
5
|
+
* Delegates interaction state (selectedUnitId, validMoves, attackTargets)
|
|
6
|
+
* to <GameBoard3D> so the model owns all gameplay state.
|
|
6
7
|
*
|
|
7
8
|
* Page: WorldMap3DPage
|
|
8
|
-
* Entity: WorldMap3D
|
|
9
|
+
* Entity: WorldMap3D / GameBoard3DItem
|
|
9
10
|
* ViewType: detail
|
|
10
11
|
*
|
|
11
12
|
* Events Emitted:
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* - TILE_LEAVE
|
|
17
|
-
* -
|
|
13
|
+
* - TILE_CLICK - When a tile is clicked ({ tileId, x, z, type })
|
|
14
|
+
* - UNIT_CLICK - When a unit is clicked ({ unitId, x, z, name })
|
|
15
|
+
* - FEATURE_CLICK - When a feature is clicked ({ featureId, x, z, type })
|
|
16
|
+
* - TILE_HOVER - When hovering over a tile ({ tileId, x, z })
|
|
17
|
+
* - TILE_LEAVE - When leaving a tile ({})
|
|
18
|
+
* - CAMERA_CHANGE - When camera position changes ({ position })
|
|
18
19
|
*
|
|
19
20
|
* @packageDocumentation
|
|
20
21
|
*/
|
|
21
22
|
import React from 'react';
|
|
22
|
-
import type { IsometricTile,
|
|
23
|
+
import type { IsometricTile, IsometricFeature } from '../organisms/types/isometric';
|
|
23
24
|
import type { TemplateProps } from '../../core/templates/types';
|
|
24
25
|
export interface GameCanvas3DWorldMapTemplateProps extends TemplateProps {
|
|
25
26
|
/** Fallback tile data when no entity is present */
|
|
26
27
|
tiles?: IsometricTile[];
|
|
27
|
-
/** Fallback unit data when no entity is present */
|
|
28
|
-
units?: IsometricUnit[];
|
|
29
28
|
/** Fallback feature data when no entity is present */
|
|
30
29
|
features?: IsometricFeature[];
|
|
31
30
|
/** 3D camera mode */
|
|
@@ -40,10 +39,20 @@ export interface GameCanvas3DWorldMapTemplateProps extends TemplateProps {
|
|
|
40
39
|
shadows?: boolean;
|
|
41
40
|
/** Background color */
|
|
42
41
|
backgroundColor?: string;
|
|
43
|
-
/** Event name for tile clicks */
|
|
42
|
+
/** Event name for tile clicks — forwarded to the model */
|
|
44
43
|
tileClickEvent?: string;
|
|
45
|
-
/** Event name for unit clicks */
|
|
44
|
+
/** Event name for unit clicks — forwarded to the model */
|
|
46
45
|
unitClickEvent?: string;
|
|
46
|
+
/** Event name for ending turn */
|
|
47
|
+
endTurnEvent?: string;
|
|
48
|
+
/** Event name for cancel/deselect */
|
|
49
|
+
cancelEvent?: string;
|
|
50
|
+
/** Event name for attack emission */
|
|
51
|
+
attackEvent?: string;
|
|
52
|
+
/** Event name for play again / reset */
|
|
53
|
+
playAgainEvent?: string;
|
|
54
|
+
/** Event name for game end detection */
|
|
55
|
+
gameEndEvent?: string;
|
|
47
56
|
/** Event name for feature clicks */
|
|
48
57
|
featureClickEvent?: string;
|
|
49
58
|
/** Event name for tile hover */
|
|
@@ -54,36 +63,25 @@ export interface GameCanvas3DWorldMapTemplateProps extends TemplateProps {
|
|
|
54
63
|
cameraChangeEvent?: string;
|
|
55
64
|
/** Exit/back event name */
|
|
56
65
|
exitEvent?: string;
|
|
57
|
-
/** Currently selected unit ID */
|
|
58
|
-
selectedUnitId?: string | null;
|
|
59
|
-
/** Valid move positions for selected unit */
|
|
60
|
-
validMoves?: Array<{
|
|
61
|
-
x: number;
|
|
62
|
-
z: number;
|
|
63
|
-
}>;
|
|
64
|
-
/** Attack target positions */
|
|
65
|
-
attackTargets?: Array<{
|
|
66
|
-
x: number;
|
|
67
|
-
z: number;
|
|
68
|
-
}>;
|
|
69
66
|
}
|
|
70
67
|
/**
|
|
71
68
|
* GameCanvas3DWorldMapTemplate Component
|
|
72
69
|
*
|
|
73
70
|
* Template for 3D world map view.
|
|
71
|
+
* Interaction state lives in the entity (model), not in this component.
|
|
74
72
|
*
|
|
75
73
|
* @example
|
|
76
74
|
* ```tsx
|
|
77
75
|
* <GameCanvas3DWorldMapTemplate
|
|
78
76
|
* entity={worldMapEntity}
|
|
79
77
|
* cameraMode="isometric"
|
|
80
|
-
* tileClickEvent="
|
|
81
|
-
* unitClickEvent="
|
|
78
|
+
* tileClickEvent="TILE_CLICK"
|
|
79
|
+
* unitClickEvent="UNIT_CLICK"
|
|
82
80
|
* showCoordinates={true}
|
|
83
81
|
* />
|
|
84
82
|
* ```
|
|
85
83
|
*/
|
|
86
|
-
export declare function GameCanvas3DWorldMapTemplate({ entity, tiles: propTiles,
|
|
84
|
+
export declare function GameCanvas3DWorldMapTemplate({ entity, tiles: propTiles, features: propFeatures, cameraMode, backgroundColor, tileClickEvent, unitClickEvent, endTurnEvent, cancelEvent, attackEvent, playAgainEvent, gameEndEvent, className, }: GameCanvas3DWorldMapTemplateProps): React.JSX.Element | null;
|
|
87
85
|
export declare namespace GameCanvas3DWorldMapTemplate {
|
|
88
86
|
var displayName: string;
|
|
89
87
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TemplateProps } from '../../core/templates/types';
|
|
3
|
+
import type { PlatformerBoardProps } from '../organisms/PlatformerBoard';
|
|
4
|
+
export interface PlatformerTemplateProps extends TemplateProps {
|
|
5
|
+
/** Level geometry forwarded to PlatformerBoard */
|
|
6
|
+
platforms?: PlatformerBoardProps['platforms'];
|
|
7
|
+
/** World dimensions */
|
|
8
|
+
worldWidth?: number;
|
|
9
|
+
worldHeight?: number;
|
|
10
|
+
/** Canvas display size */
|
|
11
|
+
canvasWidth?: number;
|
|
12
|
+
canvasHeight?: number;
|
|
13
|
+
/** Player sprite URL */
|
|
14
|
+
playerSprite?: string;
|
|
15
|
+
/** Map of platform type to tile sprite URL */
|
|
16
|
+
tileSprites?: Record<string, string>;
|
|
17
|
+
/** Canvas background color */
|
|
18
|
+
bgColor?: string;
|
|
19
|
+
/** Forwarded to PlatformerBoard to emit GAME_END into the FSM */
|
|
20
|
+
gameEndEvent?: PlatformerBoardProps['gameEndEvent'];
|
|
21
|
+
}
|
|
22
|
+
export declare function PlatformerTemplate({ entity, platforms, worldWidth, worldHeight, canvasWidth, canvasHeight, playerSprite, tileSprites, bgColor, gameEndEvent, className, }: PlatformerTemplateProps): React.JSX.Element | null;
|
|
23
|
+
export declare namespace PlatformerTemplate {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
26
|
+
export default PlatformerTemplate;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EventEmit } from '@almadar/core';
|
|
3
|
+
import type { TemplateProps } from '../../core/templates/types';
|
|
4
|
+
import type { RoguelikeBoardProps } from '../organisms/RoguelikeBoard';
|
|
5
|
+
import type { IsometricTile } from '../organisms/types/isometric';
|
|
6
|
+
export interface RoguelikeTemplateProps extends TemplateProps {
|
|
7
|
+
scale?: number;
|
|
8
|
+
unitScale?: number;
|
|
9
|
+
tiles?: IsometricTile[];
|
|
10
|
+
enemies?: RoguelikeBoardProps['enemies'];
|
|
11
|
+
items?: RoguelikeBoardProps['items'];
|
|
12
|
+
stairsX?: number;
|
|
13
|
+
stairsY?: number;
|
|
14
|
+
assetManifest?: RoguelikeBoardProps['assetManifest'];
|
|
15
|
+
gameEndEvent?: EventEmit<{
|
|
16
|
+
result: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export declare function RoguelikeTemplate({ entity, scale, unitScale, tiles, enemies, items, stairsX, stairsY, assetManifest, gameEndEvent, className, }: RoguelikeTemplateProps): React.JSX.Element | null;
|
|
20
|
+
export declare namespace RoguelikeTemplate {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
export default RoguelikeTemplate;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TowerDefenseTemplate
|
|
3
|
+
*
|
|
4
|
+
* Thin template wrapper: titled header + TowerDefenseBoard.
|
|
5
|
+
* All game state is driven by the entity prop (passed through from the orbital trait).
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { TemplateProps } from '../../core/templates/types';
|
|
9
|
+
import type { TowerDefenseTile, TowerDefensePathPoint, TowerDefenseTower } from '../organisms/TowerDefenseBoard';
|
|
10
|
+
import type { EventEmit } from '@almadar/core';
|
|
11
|
+
export interface TowerDefenseTemplateProps extends TemplateProps {
|
|
12
|
+
title?: string;
|
|
13
|
+
tiles?: TowerDefenseTile[];
|
|
14
|
+
path?: TowerDefensePathPoint[];
|
|
15
|
+
towers?: TowerDefenseTower[];
|
|
16
|
+
gold?: number;
|
|
17
|
+
lives?: number;
|
|
18
|
+
maxWaves?: number;
|
|
19
|
+
towerCost?: number;
|
|
20
|
+
towerRange?: number;
|
|
21
|
+
towerDamage?: number;
|
|
22
|
+
creepsPerWave?: number;
|
|
23
|
+
creepBaseHp?: number;
|
|
24
|
+
goldPerKill?: number;
|
|
25
|
+
scale?: number;
|
|
26
|
+
placeTowerEvent?: EventEmit<{
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}>;
|
|
30
|
+
startWaveEvent?: EventEmit<{
|
|
31
|
+
wave: number;
|
|
32
|
+
}>;
|
|
33
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
34
|
+
gameEndEvent?: EventEmit<{
|
|
35
|
+
result: 'won' | 'lost';
|
|
36
|
+
}>;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function TowerDefenseTemplate({ entity, title, tiles, path, towers, gold, lives, maxWaves, towerCost, scale, placeTowerEvent, startWaveEvent, playAgainEvent, gameEndEvent, className, }: TowerDefenseTemplateProps): React.JSX.Element;
|
|
40
|
+
export declare namespace TowerDefenseTemplate {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
export default TowerDefenseTemplate;
|