@nanotoolkit/game-sdk 0.1.9 → 0.1.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.
@@ -1,7 +1,7 @@
1
1
  import { parseWireJSON, stringifyWireJSON } from './WireJSON.js';
2
2
  import { GameState } from './GameState.js';
3
3
 
4
- export const SDK_VERSION = '0.1.9';
4
+ export const SDK_VERSION = '0.1.10';
5
5
 
6
6
  const REQUEST_TIMEOUT_MS = 10000;
7
7
 
@@ -409,6 +409,7 @@ function ensureStateListeners() {
409
409
  const directory = roomDirectory ?? lastEntry;
410
410
  if (!directory || msg.rooms?.gameId !== directory.gameId || !Array.isArray(msg.rooms.rooms)) return;
411
411
  const known = new Map((directory.rooms ?? []).map((room) => [room.id, room]));
412
+ const updates = new Map(msg.rooms.rooms.map((room) => [room.id, room]));
412
413
  if (msg.rooms.rooms.some((room) => !known.has(room.id))) {
413
414
  getGameRooms().catch(() => {});
414
415
  return;
@@ -417,9 +418,10 @@ function ensureStateListeners() {
417
418
  ...directory,
418
419
  ...msg.rooms,
419
420
  topic: roomDirectory?.topic ?? lastEntry?.roomsTopic ?? 'game:' + directory.gameId,
420
- rooms: msg.rooms.rooms.map((room) => ({
421
- ...known.get(room.id),
421
+ rooms: (directory.rooms ?? []).filter((room) => updates.has(room.id)).map((room) => ({
422
422
  ...room,
423
+ onlineCount: updates.get(room.id).onlineCount,
424
+ targetTime: updates.get(room.id).targetTime,
423
425
  })),
424
426
  };
425
427
  if (lastEntry?.gameId === roomDirectory.gameId) lastEntry.rooms = roomDirectory.rooms;
package/index.d.ts CHANGED
@@ -83,6 +83,7 @@ export interface GameRoom {
83
83
  id: number;
84
84
  gameId: number;
85
85
  roomName: string;
86
+ roomIcon: string | null;
86
87
  position: number;
87
88
  onlineCount: number;
88
89
  targetTime: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanotoolkit/game-sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",