@agent-os-lab/agent-game-sdk 0.1.12 → 0.1.14
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/package.json +1 -1
- package/src/avatar/canvas-view.ts +55 -7
- package/src/avatar/three-view.ts +1 -1
- package/src/core/agent-game-store.ts +5 -5
- package/src/core/agent-service-event-adapter.ts +2 -2
- package/src/core/assets.ts +2 -2
- package/src/core/event-adapter.ts +2 -2
- package/src/core/index.ts +23 -23
- package/src/core/life-presets.ts +2 -2
- package/src/core/movement.ts +4 -4
- package/src/core/office-building-layout.ts +6 -6
- package/src/core/office-layout.ts +1 -1
- package/src/core/pixel-character-avatar.ts +2 -2
- package/src/core/pixel-character.ts +1 -1
- package/src/core/realtime-events.ts +3 -3
- package/src/core/realtime-transport.ts +1 -1
- package/src/core/reducer.ts +4 -4
- package/src/core/scene.ts +1 -1
- package/src/core/schedule.ts +1 -1
- package/src/core/sequence.ts +1 -1
- package/src/core/state.ts +2 -2
- package/src/core/svg-pixel-avatar.ts +1 -1
- package/src/core/town-office-room-presets.ts +2 -2
- package/src/core/town-office-seat-layout.ts +3 -3
- package/src/graph.ts +1 -1
- package/src/phaser/agent-game-scene.ts +8 -8
- package/src/phaser/anchor-debug.ts +4 -4
- package/src/phaser/avatar-registry.ts +1 -1
- package/src/phaser/camera-controls.ts +1 -1
- package/src/phaser/create-agent-game.ts +8 -8
- package/src/phaser/debug-overlay.ts +3 -3
- package/src/phaser/index.ts +13 -13
- package/src/phaser/office-background.ts +3 -3
- package/src/phaser/office-building-renderer.ts +4 -4
- package/src/phaser/office-layout-renderer.ts +3 -3
- package/src/phaser/scene-reconciler.ts +4 -4
- package/src/phaser/scene-renderer.ts +6 -6
- package/src/phaser/town-office-business-props.ts +1 -1
- package/src/phaser/town-office-environment.ts +3 -3
- package/src/phaser/town-office-furniture.ts +1 -1
- package/src/phaser/town-office-primitives.ts +4 -4
- package/src/phaser/town-office-renderer.ts +9 -9
- package/src/phaser/types.ts +11 -11
package/package.json
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { AgentGameError } from "../core/errors";
|
|
2
|
+
|
|
3
|
+
const REQUIRED_AGENT_AVATAR_ANIMATIONS = [
|
|
4
|
+
"idle.down",
|
|
5
|
+
"idle.up",
|
|
6
|
+
"idle.left",
|
|
7
|
+
"idle.right",
|
|
8
|
+
"walk.down",
|
|
9
|
+
"walk.up",
|
|
10
|
+
"walk.left",
|
|
11
|
+
"walk.right",
|
|
12
|
+
"work.typing",
|
|
13
|
+
"emote.think",
|
|
14
|
+
"emote.talk",
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export type AgentAvatarAnimationName = (typeof REQUIRED_AGENT_AVATAR_ANIMATIONS)[number];
|
|
18
|
+
export type AgentAvatarAnimationFrames = string | string[];
|
|
19
|
+
export type AgentAvatarDefinition = {
|
|
20
|
+
id: string;
|
|
21
|
+
imageUrl: string;
|
|
22
|
+
atlasUrl: string;
|
|
23
|
+
animations: Partial<Record<AgentAvatarAnimationName, AgentAvatarAnimationFrames>> & Record<string, AgentAvatarAnimationFrames>;
|
|
24
|
+
};
|
|
8
25
|
|
|
9
26
|
export type AgentAvatarAtlasFrame = {
|
|
10
27
|
frame: {
|
|
@@ -195,6 +212,37 @@ function resolveAnimationFrameName(
|
|
|
195
212
|
return frames[index]!;
|
|
196
213
|
}
|
|
197
214
|
|
|
215
|
+
function validateAgentAvatarDefinition(avatar: AgentAvatarDefinition): AgentAvatarDefinition {
|
|
216
|
+
assertNonEmpty(avatar.id, "avatar id");
|
|
217
|
+
assertNonEmpty(avatar.imageUrl, "avatar image url");
|
|
218
|
+
assertNonEmpty(avatar.atlasUrl, "avatar atlas url");
|
|
219
|
+
|
|
220
|
+
for (const animation of REQUIRED_AGENT_AVATAR_ANIMATIONS) {
|
|
221
|
+
if (!avatar.animations[animation]) {
|
|
222
|
+
throw new AgentGameError("missing_animation", `Agent game avatar ${avatar.id} is missing animation: ${animation}`);
|
|
223
|
+
}
|
|
224
|
+
const frames = normalizeAgentAvatarAnimationFrames(avatar.animations[animation]);
|
|
225
|
+
if (frames.length === 0) {
|
|
226
|
+
throw new AgentGameError("missing_animation", `Agent game avatar ${avatar.id} is missing animation: ${animation}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return avatar;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function normalizeAgentAvatarAnimationFrames(frames: AgentAvatarAnimationFrames | undefined): string[] {
|
|
234
|
+
if (frames === undefined) {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
return Array.isArray(frames) ? frames : [frames];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function assertNonEmpty(value: string, field: string): void {
|
|
241
|
+
if (!value || value.trim().length === 0) {
|
|
242
|
+
throw new AgentGameError("invalid_asset_manifest", `Agent game ${field} must not be empty`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
198
246
|
function assertPositiveFiniteInteger(value: number, field: string): number {
|
|
199
247
|
if (!Number.isInteger(value) || value <= 0) {
|
|
200
248
|
throw new AgentGameError("invalid_asset_manifest", `Agent avatar canvas ${field} must be a positive integer`);
|
package/src/avatar/three-view.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
|
|
3
3
|
import type { AgentGameOfficeAgent, AgentGameOfficeSceneState } from "../office/core/types";
|
|
4
|
-
import { AgentGameError } from "../core";
|
|
4
|
+
import { AgentGameError } from "../core/errors";
|
|
5
5
|
import {
|
|
6
6
|
createAgentAvatar3DScene,
|
|
7
7
|
type ResolvedAgentAvatar3DState,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { applyAgentGameCommand, createAgentGameSnapshot } from "./reducer
|
|
2
|
-
import { validateAgentGameScene, type AgentGameSceneDefinition } from "./scene
|
|
3
|
-
import type { AgentGameCommand } from "./commands
|
|
4
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import { applyAgentGameCommand, createAgentGameSnapshot } from "./reducer";
|
|
2
|
+
import { validateAgentGameScene, type AgentGameSceneDefinition } from "./scene";
|
|
3
|
+
import type { AgentGameCommand } from "./commands";
|
|
4
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
5
5
|
import type {
|
|
6
6
|
AgentGameConnectionStatus,
|
|
7
7
|
AgentGameRealtimeCursor,
|
|
8
8
|
AgentGameRealtimeEvent,
|
|
9
9
|
AgentGameSnapshotPatch,
|
|
10
|
-
} from "./realtime-events
|
|
10
|
+
} from "./realtime-events";
|
|
11
11
|
|
|
12
12
|
export type AgentGameStoreListener = (snapshot: AgentGameSnapshot) => void;
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameRealtimeEvent } from "./realtime-events
|
|
2
|
-
import { mapAgentServiceEventToGameCommands, type AgentServiceEventLike } from "./event-adapter
|
|
1
|
+
import type { AgentGameRealtimeEvent } from "./realtime-events";
|
|
2
|
+
import { mapAgentServiceEventToGameCommands, type AgentServiceEventLike } from "./event-adapter";
|
|
3
3
|
|
|
4
4
|
export type MapAgentServiceEventToRealtimeEventsOptions = {
|
|
5
5
|
nextId: () => string;
|
package/src/core/assets.ts
CHANGED
package/src/core/index.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./assets
|
|
2
|
-
export * from "./agent-game-store
|
|
3
|
-
export * from "./agent-service-event-adapter
|
|
4
|
-
export * from "./commands
|
|
5
|
-
export * from "./event-adapter
|
|
6
|
-
export * from "./errors
|
|
7
|
-
export * from "./life-presets
|
|
8
|
-
export * from "./movement
|
|
9
|
-
export * from "./office-building-layout
|
|
10
|
-
export * from "./office-layout
|
|
11
|
-
export * from "./pixel-character-avatar
|
|
12
|
-
export * from "./pixel-character
|
|
13
|
-
export * from "./reducer
|
|
14
|
-
export * from "./realtime-events
|
|
15
|
-
export * from "./realtime-transport
|
|
16
|
-
export * from "./schedule
|
|
17
|
-
export * from "./scene
|
|
18
|
-
export * from "./sequence
|
|
19
|
-
export * from "./state
|
|
20
|
-
export * from "./svg-pixel-avatar
|
|
21
|
-
export * from "./town-office-assets
|
|
22
|
-
export * from "./town-office-room-presets
|
|
23
|
-
export * from "./town-office-seat-layout
|
|
1
|
+
export * from "./assets";
|
|
2
|
+
export * from "./agent-game-store";
|
|
3
|
+
export * from "./agent-service-event-adapter";
|
|
4
|
+
export * from "./commands";
|
|
5
|
+
export * from "./event-adapter";
|
|
6
|
+
export * from "./errors";
|
|
7
|
+
export * from "./life-presets";
|
|
8
|
+
export * from "./movement";
|
|
9
|
+
export * from "./office-building-layout";
|
|
10
|
+
export * from "./office-layout";
|
|
11
|
+
export * from "./pixel-character-avatar";
|
|
12
|
+
export * from "./pixel-character";
|
|
13
|
+
export * from "./reducer";
|
|
14
|
+
export * from "./realtime-events";
|
|
15
|
+
export * from "./realtime-transport";
|
|
16
|
+
export * from "./schedule";
|
|
17
|
+
export * from "./scene";
|
|
18
|
+
export * from "./sequence";
|
|
19
|
+
export * from "./state";
|
|
20
|
+
export * from "./svg-pixel-avatar";
|
|
21
|
+
export * from "./town-office-assets";
|
|
22
|
+
export * from "./town-office-room-presets";
|
|
23
|
+
export * from "./town-office-seat-layout";
|
package/src/core/life-presets.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameAnchor, AgentGameSceneDefinition } from "./scene
|
|
2
|
-
import { validateAgentGameScene } from "./scene
|
|
1
|
+
import type { AgentGameAnchor, AgentGameSceneDefinition } from "./scene";
|
|
2
|
+
import { validateAgentGameScene } from "./scene";
|
|
3
3
|
|
|
4
4
|
export type AgentGameLifeSceneKind = "home" | "cafe" | "commute" | "sleep";
|
|
5
5
|
|
package/src/core/movement.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgentGameError } from "./errors
|
|
2
|
-
import { findAgentGameAnchor } from "./scene
|
|
3
|
-
import type { AgentGameCommand } from "./commands
|
|
4
|
-
import type { AgentGameSnapshot } from "./state
|
|
1
|
+
import { AgentGameError } from "./errors";
|
|
2
|
+
import { findAgentGameAnchor } from "./scene";
|
|
3
|
+
import type { AgentGameCommand } from "./commands";
|
|
4
|
+
import type { AgentGameSnapshot } from "./state";
|
|
5
5
|
|
|
6
6
|
export type CreateAgentGameMovePathCommandsOptions = {
|
|
7
7
|
agentId: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AgentGameError } from "./errors
|
|
2
|
-
import type { OfficeObjectAtlasDefinition } from "./office-layout
|
|
1
|
+
import { AgentGameError } from "./errors";
|
|
2
|
+
import type { OfficeObjectAtlasDefinition } from "./office-layout";
|
|
3
3
|
import type {
|
|
4
4
|
AgentGameAnchor,
|
|
5
5
|
AgentGameAnchorKind,
|
|
6
6
|
AgentGameDirection,
|
|
7
7
|
AgentGameSceneDefinition,
|
|
8
|
-
} from "./scene
|
|
9
|
-
import { validateAgentGameScene } from "./scene
|
|
10
|
-
import { createTownOfficeRoomAnchors } from "./town-office-seat-layout
|
|
11
|
-
import { isTownOfficeRoomType, type TownOfficeRoomType } from "./town-office-assets
|
|
8
|
+
} from "./scene";
|
|
9
|
+
import { validateAgentGameScene } from "./scene";
|
|
10
|
+
import { createTownOfficeRoomAnchors } from "./town-office-seat-layout";
|
|
11
|
+
import { isTownOfficeRoomType, type TownOfficeRoomType } from "./town-office-assets";
|
|
12
12
|
|
|
13
13
|
export type OfficeBuildingGridRect = {
|
|
14
14
|
x: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentAvatarDefinition } from "./assets
|
|
2
|
-
import type { PixelCharacterSprite } from "./pixel-character
|
|
1
|
+
import type { AgentAvatarDefinition } from "./assets";
|
|
2
|
+
import type { PixelCharacterSprite } from "./pixel-character";
|
|
3
3
|
|
|
4
4
|
export type PixelCharacterAvatarAtlas = {
|
|
5
5
|
frames: Record<string, { frame: { x: number; y: number; w: number; h: number } }>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REQUIRED_AGENT_AVATAR_ANIMATIONS,
|
|
3
3
|
type AgentAvatarAnimationName,
|
|
4
|
-
} from "./assets
|
|
4
|
+
} from "./assets";
|
|
5
5
|
|
|
6
6
|
export type PixelCharacterRole = "engineer" | "manager" | "support" | string;
|
|
7
7
|
export type PixelCharacterStyle = "office" | "simple-chibi";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentGameCommand } from "./commands
|
|
2
|
-
import type { AgentGameSceneDefinition } from "./scene
|
|
3
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import type { AgentGameCommand } from "./commands";
|
|
2
|
+
import type { AgentGameSceneDefinition } from "./scene";
|
|
3
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
4
4
|
|
|
5
5
|
export type AgentGameRealtimeCursor = string;
|
|
6
6
|
|
package/src/core/reducer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentGameCommand } from "./commands
|
|
2
|
-
import { AgentGameError } from "./errors
|
|
3
|
-
import { findAgentGameAnchor, validateAgentGameScene, type AgentGameSceneDefinition } from "./scene
|
|
4
|
-
import type { AgentGameAgent, AgentGameSnapshot } from "./state
|
|
1
|
+
import type { AgentGameCommand } from "./commands";
|
|
2
|
+
import { AgentGameError } from "./errors";
|
|
3
|
+
import { findAgentGameAnchor, validateAgentGameScene, type AgentGameSceneDefinition } from "./scene";
|
|
4
|
+
import type { AgentGameAgent, AgentGameSnapshot } from "./state";
|
|
5
5
|
|
|
6
6
|
export function createAgentGameSnapshot(scene: AgentGameSceneDefinition): AgentGameSnapshot {
|
|
7
7
|
return {
|
package/src/core/scene.ts
CHANGED
package/src/core/schedule.ts
CHANGED
package/src/core/sequence.ts
CHANGED
package/src/core/state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentGameEmotion, AgentToolCallStatus } from "./commands
|
|
2
|
-
import type { AgentGameDirection, AgentGameSceneDefinition } from "./scene
|
|
1
|
+
import type { AgentGameEmotion, AgentToolCallStatus } from "./commands";
|
|
2
|
+
import type { AgentGameDirection, AgentGameSceneDefinition } from "./scene";
|
|
3
3
|
|
|
4
4
|
export type AgentGameActivity =
|
|
5
5
|
| { kind: "idle" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OfficeBuildingObjectDefinition } from "./office-building-layout
|
|
2
|
-
import type { TownOfficeObjectFrame, TownOfficeRoomType } from "./town-office-assets
|
|
1
|
+
import type { OfficeBuildingObjectDefinition } from "./office-building-layout";
|
|
2
|
+
import type { TownOfficeObjectFrame, TownOfficeRoomType } from "./town-office-assets";
|
|
3
3
|
|
|
4
4
|
export type TownOfficeRoomObjectsOptions = {
|
|
5
5
|
roomId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeBuildingAnchorDefinition } from "./office-building-layout
|
|
2
|
-
import type { AgentGameAnchorKind } from "./scene
|
|
3
|
-
import type { TownOfficeRoomType } from "./town-office-assets
|
|
1
|
+
import type { OfficeBuildingAnchorDefinition } from "./office-building-layout";
|
|
2
|
+
import type { AgentGameAnchorKind } from "./scene";
|
|
3
|
+
import type { TownOfficeRoomType } from "./town-office-assets";
|
|
4
4
|
|
|
5
5
|
export type TownOfficeRoomAnchorsOptions = {
|
|
6
6
|
roomId: string;
|
package/src/graph.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { AgentAvatarDefinition, AgentGameSceneDefinition, OfficeBuildingLayout, OfficeLayoutDefinition } from "../core/index
|
|
2
|
-
import { drawAnchorDebug } from "./anchor-debug
|
|
3
|
-
import { registerAgentAvatarAnimations } from "./avatar-registry
|
|
1
|
+
import type { AgentAvatarDefinition, AgentGameSceneDefinition, OfficeBuildingLayout, OfficeLayoutDefinition } from "../core/index";
|
|
2
|
+
import { drawAnchorDebug } from "./anchor-debug";
|
|
3
|
+
import { registerAgentAvatarAnimations } from "./avatar-registry";
|
|
4
4
|
import {
|
|
5
5
|
installCameraControls,
|
|
6
6
|
type AgentGameCameraControlsController,
|
|
7
7
|
type AgentGameCameraControlsOptions,
|
|
8
|
-
} from "./camera-controls
|
|
9
|
-
import type { AgentGameDebugOverlays } from "./debug-overlay
|
|
8
|
+
} from "./camera-controls";
|
|
9
|
+
import type { AgentGameDebugOverlays } from "./debug-overlay";
|
|
10
10
|
import {
|
|
11
11
|
createDefaultAgentGameSceneRendererRegistry,
|
|
12
12
|
type AgentGameRendererConfig,
|
|
13
13
|
type AgentGameSceneRendererRegistry,
|
|
14
|
-
} from "./scene-renderer
|
|
15
|
-
import type { AgentGameSceneReconciler, PhaserReconcilerSceneLike } from "./scene-reconciler
|
|
16
|
-
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer
|
|
14
|
+
} from "./scene-renderer";
|
|
15
|
+
import type { AgentGameSceneReconciler, PhaserReconcilerSceneLike } from "./scene-reconciler";
|
|
16
|
+
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer";
|
|
17
17
|
|
|
18
18
|
export const AGENT_GAME_PHASER_SCENE_KEY = "agent-game-scene";
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentGameSceneDefinition } from "../core/index
|
|
2
|
-
import { debugDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
4
|
-
import { crispTextStyle } from "./text-style
|
|
1
|
+
import type { AgentGameSceneDefinition } from "../core/index";
|
|
2
|
+
import { debugDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
4
|
+
import { crispTextStyle } from "./text-style";
|
|
5
5
|
|
|
6
6
|
export type AnchorDebugSceneLike = {
|
|
7
7
|
add: {
|
|
@@ -5,18 +5,18 @@ import {
|
|
|
5
5
|
validateAgentGameScene,
|
|
6
6
|
validateOfficeBuildingLayout,
|
|
7
7
|
validateOfficeLayoutDefinition,
|
|
8
|
-
} from "../core/index
|
|
9
|
-
import { createAgentGamePhaserSceneConfig } from "./agent-game-scene
|
|
8
|
+
} from "../core/index";
|
|
9
|
+
import { createAgentGamePhaserSceneConfig } from "./agent-game-scene";
|
|
10
10
|
import {
|
|
11
11
|
createSceneReconciler,
|
|
12
12
|
type AgentDomOverlayRoot,
|
|
13
13
|
type AgentGameSceneReconciler,
|
|
14
|
-
} from "./scene-reconciler
|
|
15
|
-
import type { AgentGameCameraControlsController } from "./camera-controls
|
|
16
|
-
import type { AgentGameRendererConfig } from "./scene-renderer
|
|
17
|
-
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer
|
|
18
|
-
import type { AgentGameController, AgentGamePhaserOptions, PhaserGameLike } from "./types
|
|
19
|
-
import { resolveAgentGameViewportSize } from "./viewport
|
|
14
|
+
} from "./scene-reconciler";
|
|
15
|
+
import type { AgentGameCameraControlsController } from "./camera-controls";
|
|
16
|
+
import type { AgentGameRendererConfig } from "./scene-renderer";
|
|
17
|
+
import type { TownOfficeDomOverlayRoot } from "./town-office-renderer";
|
|
18
|
+
import type { AgentGameController, AgentGamePhaserOptions, PhaserGameLike } from "./types";
|
|
19
|
+
import { resolveAgentGameViewportSize } from "./viewport";
|
|
20
20
|
|
|
21
21
|
type RuntimeDomOverlayRoot = HTMLElement & AgentDomOverlayRoot & TownOfficeDomOverlayRoot;
|
|
22
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseHexColor } from "../core/index
|
|
2
|
-
import type { TownOfficeSceneLike } from "./town-office-primitives
|
|
3
|
-
import { debugDepth } from "./render-layers
|
|
1
|
+
import { parseHexColor } from "../core/index";
|
|
2
|
+
import type { TownOfficeSceneLike } from "./town-office-primitives";
|
|
3
|
+
import { debugDepth } from "./render-layers";
|
|
4
4
|
|
|
5
5
|
export type AgentGameDebugOverlays = {
|
|
6
6
|
worldBounds?: boolean;
|
package/src/phaser/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from "./agent-game-scene
|
|
2
|
-
export * from "./avatar-registry
|
|
3
|
-
export * from "./camera-model
|
|
4
|
-
export * from "./camera-controls
|
|
5
|
-
export * from "./create-agent-game
|
|
6
|
-
export * from "./debug-overlay
|
|
7
|
-
export * from "./office-building-renderer
|
|
8
|
-
export * from "./office-layout-renderer
|
|
9
|
-
export * from "./scene-renderer
|
|
10
|
-
export * from "./scene-reconciler
|
|
11
|
-
export * from "./town-office-renderer
|
|
12
|
-
export * from "./types
|
|
13
|
-
export * from "./viewport
|
|
1
|
+
export * from "./agent-game-scene";
|
|
2
|
+
export * from "./avatar-registry";
|
|
3
|
+
export * from "./camera-model";
|
|
4
|
+
export * from "./camera-controls";
|
|
5
|
+
export * from "./create-agent-game";
|
|
6
|
+
export * from "./debug-overlay";
|
|
7
|
+
export * from "./office-building-renderer";
|
|
8
|
+
export * from "./office-layout-renderer";
|
|
9
|
+
export * from "./scene-renderer";
|
|
10
|
+
export * from "./scene-reconciler";
|
|
11
|
+
export * from "./town-office-renderer";
|
|
12
|
+
export * from "./types";
|
|
13
|
+
export * from "./viewport";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentGameSceneDefinition } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike } from "./scene-reconciler
|
|
1
|
+
import type { AgentGameSceneDefinition } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike } from "./scene-reconciler";
|
|
4
4
|
|
|
5
5
|
export type OfficeBackgroundSceneLike = {
|
|
6
6
|
add: {
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getOfficeRoomBounds,
|
|
3
3
|
parseHexColor,
|
|
4
4
|
type OfficeBuildingLayout,
|
|
5
|
-
} from "../core/index
|
|
6
|
-
import { officeDepth } from "./render-layers
|
|
7
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
8
|
-
import { crispTextStyle } from "./text-style
|
|
5
|
+
} from "../core/index";
|
|
6
|
+
import { officeDepth } from "./render-layers";
|
|
7
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
8
|
+
import { crispTextStyle } from "./text-style";
|
|
9
9
|
|
|
10
10
|
export type OfficeBuildingSceneLike = {
|
|
11
11
|
add: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeLayoutDefinition } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike } from "./scene-reconciler
|
|
1
|
+
import type { OfficeLayoutDefinition } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike } from "./scene-reconciler";
|
|
4
4
|
|
|
5
5
|
export type OfficeLayoutSceneLike = {
|
|
6
6
|
add: {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
type AgentGameAgent,
|
|
7
7
|
type AgentGameDirection,
|
|
8
8
|
type AgentGameSnapshot,
|
|
9
|
-
} from "../core/index
|
|
10
|
-
import { createMovementTweenConfig, type MovementTimingOptions } from "./movement-tween
|
|
11
|
-
import { agentDepth, agentUiDepth } from "./render-layers
|
|
12
|
-
import { crispTextStyle } from "./text-style
|
|
9
|
+
} from "../core/index";
|
|
10
|
+
import { createMovementTweenConfig, type MovementTimingOptions } from "./movement-tween";
|
|
11
|
+
import { agentDepth, agentUiDepth } from "./render-layers";
|
|
12
|
+
import { crispTextStyle } from "./text-style";
|
|
13
13
|
|
|
14
14
|
const SPRITE_AGENT_SCALE = 1;
|
|
15
15
|
const SPRITE_AGENT_FOOT_ORIGIN_Y = 1;
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
type AgentGameSceneDefinition,
|
|
4
4
|
type OfficeBuildingLayout,
|
|
5
5
|
type OfficeLayoutDefinition,
|
|
6
|
-
} from "../core/index
|
|
7
|
-
import { drawOfficeBackground } from "./office-background
|
|
8
|
-
import { drawOfficeBuildingLayout } from "./office-building-renderer
|
|
9
|
-
import { drawOfficeLayout } from "./office-layout-renderer
|
|
10
|
-
import type { PhaserReconcilerSceneLike } from "./scene-reconciler
|
|
11
|
-
import { drawTownOfficeBuildingLayout, type TownOfficeBuildingRenderOptions } from "./town-office-renderer
|
|
6
|
+
} from "../core/index";
|
|
7
|
+
import { drawOfficeBackground } from "./office-background";
|
|
8
|
+
import { drawOfficeBuildingLayout } from "./office-building-renderer";
|
|
9
|
+
import { drawOfficeLayout } from "./office-layout-renderer";
|
|
10
|
+
import type { PhaserReconcilerSceneLike } from "./scene-reconciler";
|
|
11
|
+
import { drawTownOfficeBuildingLayout, type TownOfficeBuildingRenderOptions } from "./town-office-renderer";
|
|
12
12
|
|
|
13
13
|
export type AgentGameSceneRenderer = {
|
|
14
14
|
preload?: (scene: PhaserReconcilerSceneLike) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rect, text, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import { rect, text, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
2
2
|
|
|
3
3
|
export function drawServerRack(scene: TownOfficeSceneLike, x: number, y: number, scale: number): void {
|
|
4
4
|
const s = scale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OfficeRoomBounds } from "../core/index
|
|
2
|
-
import { drawBookshelf, drawWhiteboard } from "./town-office-furniture
|
|
3
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import type { OfficeRoomBounds } from "../core/index";
|
|
2
|
+
import { drawBookshelf, drawWhiteboard } from "./town-office-furniture";
|
|
3
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
4
4
|
|
|
5
5
|
export type TownOfficeRoomStyle = {
|
|
6
6
|
floor: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
1
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
2
2
|
|
|
3
3
|
export function drawDesk(scene: TownOfficeSceneLike, x: number, y: number, scale: number, hasMonitor: boolean): void {
|
|
4
4
|
const s = 1.5 * scale;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { parseHexColor } from "../core/index
|
|
2
|
-
import { officeDepth } from "./render-layers
|
|
3
|
-
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler
|
|
4
|
-
import { crispTextStyle } from "./text-style
|
|
1
|
+
import { parseHexColor } from "../core/index";
|
|
2
|
+
import { officeDepth } from "./render-layers";
|
|
3
|
+
import type { PhaserDisplayObjectLike, PhaserTextLike } from "./scene-reconciler";
|
|
4
|
+
import { crispTextStyle } from "./text-style";
|
|
5
5
|
|
|
6
6
|
export type TownOfficeSceneLike = {
|
|
7
7
|
add: {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type OfficeBuildingLayout,
|
|
7
7
|
type OfficeBuildingObjectDefinition,
|
|
8
8
|
type OfficeRoomBounds,
|
|
9
|
-
} from "../core/index
|
|
9
|
+
} from "../core/index";
|
|
10
10
|
import {
|
|
11
11
|
drawBattery,
|
|
12
12
|
drawBeaker,
|
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
drawTree,
|
|
34
34
|
drawTV,
|
|
35
35
|
drawWindTurbine,
|
|
36
|
-
} from "./town-office-business-props
|
|
37
|
-
import { drawWorldBoundsDebugOverlay, type AgentGameDebugOverlays } from "./debug-overlay
|
|
36
|
+
} from "./town-office-business-props";
|
|
37
|
+
import { drawWorldBoundsDebugOverlay, type AgentGameDebugOverlays } from "./debug-overlay";
|
|
38
38
|
import {
|
|
39
39
|
drawAirConditioner,
|
|
40
40
|
drawDoor,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
drawSocket,
|
|
47
47
|
drawWindow,
|
|
48
48
|
type TownOfficeRoomStyle,
|
|
49
|
-
} from "./town-office-environment
|
|
49
|
+
} from "./town-office-environment";
|
|
50
50
|
import {
|
|
51
51
|
drawBench,
|
|
52
52
|
drawBookshelf,
|
|
@@ -70,12 +70,12 @@ import {
|
|
|
70
70
|
drawTrashCan,
|
|
71
71
|
drawVendingMachine,
|
|
72
72
|
drawWhiteboard,
|
|
73
|
-
} from "./town-office-furniture
|
|
74
|
-
import { rect, type TownOfficeSceneLike } from "./town-office-primitives
|
|
75
|
-
import { crispTextStyle } from "./text-style
|
|
76
|
-
import { officeDepth } from "./render-layers
|
|
73
|
+
} from "./town-office-furniture";
|
|
74
|
+
import { rect, type TownOfficeSceneLike } from "./town-office-primitives";
|
|
75
|
+
import { crispTextStyle } from "./text-style";
|
|
76
|
+
import { officeDepth } from "./render-layers";
|
|
77
77
|
|
|
78
|
-
export type { TownOfficeSceneLike } from "./town-office-primitives
|
|
78
|
+
export type { TownOfficeSceneLike } from "./town-office-primitives";
|
|
79
79
|
|
|
80
80
|
const HEADER_HEIGHT = 34;
|
|
81
81
|
const HEADER_TITLE_PADDING_X = 12;
|
package/src/phaser/types.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { AgentGameAssetManifest } from "../core/assets
|
|
2
|
-
import type { AgentGameCommand } from "../core/commands
|
|
3
|
-
import type { OfficeBuildingLayout } from "../core/office-building-layout
|
|
4
|
-
import type { OfficeLayoutDefinition, OfficeObjectAtlasDefinition } from "../core/office-layout
|
|
5
|
-
import type { AgentGameSceneDefinition } from "../core/scene
|
|
6
|
-
import type { AgentGameSnapshot } from "../core/state
|
|
7
|
-
import type { AgentGameStore } from "../core/agent-game-store
|
|
8
|
-
import type { AgentGameCameraControlsController, AgentGameCameraControlsOptions } from "./camera-controls
|
|
9
|
-
import type { AgentGameDebugOverlays } from "./debug-overlay
|
|
10
|
-
import type { AgentGameRendererConfig, AgentGameSceneRendererRegistry } from "./scene-renderer
|
|
11
|
-
import type { AgentGameViewportOptions } from "./viewport
|
|
1
|
+
import type { AgentGameAssetManifest } from "../core/assets";
|
|
2
|
+
import type { AgentGameCommand } from "../core/commands";
|
|
3
|
+
import type { OfficeBuildingLayout } from "../core/office-building-layout";
|
|
4
|
+
import type { OfficeLayoutDefinition, OfficeObjectAtlasDefinition } from "../core/office-layout";
|
|
5
|
+
import type { AgentGameSceneDefinition } from "../core/scene";
|
|
6
|
+
import type { AgentGameSnapshot } from "../core/state";
|
|
7
|
+
import type { AgentGameStore } from "../core/agent-game-store";
|
|
8
|
+
import type { AgentGameCameraControlsController, AgentGameCameraControlsOptions } from "./camera-controls";
|
|
9
|
+
import type { AgentGameDebugOverlays } from "./debug-overlay";
|
|
10
|
+
import type { AgentGameRendererConfig, AgentGameSceneRendererRegistry } from "./scene-renderer";
|
|
11
|
+
import type { AgentGameViewportOptions } from "./viewport";
|
|
12
12
|
|
|
13
13
|
export type PhaserGameLike = {
|
|
14
14
|
destroy(removeCanvas?: boolean): void;
|