feat(client): wire InventionsPanel into GameScene

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-09 00:46:21 +00:00
parent e27f2381eb
commit d5ad7d5f7f
+21
View File
@@ -7,6 +7,7 @@ import { CommandPanel } from '../ui/CommandPanel.js';
import { SuperlativesPanel } from '../ui/SuperlativesPanel.js';
import { LeftPanel } from '../ui/LeftPanel.js';
import { EventsFeed } from '../ui/EventsFeed.js';
import { InventionsPanel } from '../ui/InventionsPanel.js';
import { InteractionEmojiManager } from '../ui/InteractionEmoji.js';
import type { WorldState, StateUpdate, EntityState, Appearance, NarrationEvent, MemoryEvent } from '@dflike/shared';
import { TILE_SIZE, SPRITE_FRAME_WIDTH, SPRITE_FRAME_HEIGHT, SPRITE_COLS, Direction, Terrain, TILESET_TILE_SIZE, TILESET_SCALE, DAY_HOURS, TOTAL_HOURS, SUNSET_DURATION_HOURS, SUNRISE_DURATION_HOURS, NIGHT_DARKNESS } from '@dflike/shared';
@@ -37,6 +38,7 @@ export class GameScene extends Phaser.Scene {
private superlativesPanel!: SuperlativesPanel;
private leftPanel!: LeftPanel;
private eventsFeed!: EventsFeed;
private inventionsPanel!: InventionsPanel;
private highlightEnabled = false;
private highlightedSpriteId: number | null = null;
private dayNightOverlay!: Phaser.GameObjects.Graphics;
@@ -72,15 +74,26 @@ export class GameScene extends Phaser.Scene {
this.superlativesPanel = new SuperlativesPanel();
this.eventsFeed = new EventsFeed();
this.inventionsPanel = new InventionsPanel();
this.leftPanel = new LeftPanel(
this.superlativesPanel.getElement(),
this.eventsFeed.getElement(),
this.inventionsPanel.getElement(),
);
this.inventionsPanel.onUnseenChanged = (hasUnseen) => {
if (hasUnseen && this.leftPanel.getActiveTab() !== 'inventions') {
this.leftPanel.showNotificationDot();
}
};
document.addEventListener('left-panel-opened', ((e: CustomEvent) => {
if (e.detail.tab === 'stats') {
this.client.subscribeSuperlatives();
}
if (e.detail.tab === 'inventions') {
this.inventionsPanel.clearUnseen();
}
}) as EventListener);
document.addEventListener('left-panel-closed', () => {
@@ -235,6 +248,14 @@ export class GameScene extends Phaser.Scene {
}
};
this.client.onInventionEvent = (data) => {
this.inventionsPanel.addInvention(data);
};
this.client.onInventionHistory = (data) => {
this.inventionsPanel.loadHistory(data);
};
document.addEventListener('narration-follow', ((e: CustomEvent) => {
const { entityId } = e.detail;
const npcIds = this.getNpcIds();