feat: integrate erqiwang rooms and use spec-compliant Web compilation

This commit is contained in:
2026-09-07 22:36:24 +08:00
parent 30a1b4114c
commit a7ec8aa6a7
49 changed files with 11603 additions and 1183 deletions
@@ -1,7 +1,8 @@
import type {Roomtype} from './roomtype.ts';
/** Pre-room capability: a game owns its page and validated, opaque wire configuration. */
export interface CreateRoomPageContext {
readonly previousRoomtype:unknown;
submit(roomtype:readonly unknown[]):void;
submit(roomtype: Roomtype):void;
cancel():void;
reportError(message:string):void;
}
@@ -1,3 +1,4 @@
import type {Roomtype} from './roomtype.ts';
import type { GameModule } from './game-module.ts';
/** The one compile-time game identity and module factory for an app. */
@@ -6,6 +7,6 @@ export interface GameEntry {
readonly gameId: string | number;
readonly route: string;
/** Interprets this game's actual server roomtype; no synthetic/default input is required. */
resolveSeatCount(roomtype: readonly unknown[]): number;
resolveSeatCount(roomtype: Roomtype): number;
createModule(): GameModule;
}
@@ -5,3 +5,5 @@ export * from './game-module.ts';
export * from './game-seat-mapper.ts';
export * from './platform-events.ts';
export * from './snapshots.ts';
export type {Roomtype} from './roomtype.ts';
@@ -1,6 +1,7 @@
import type {Roomtype} from './roomtype.ts';
/** Platform lifecycle events delivered to the current game module. */
export type PlatformToGameEvent =
| { readonly type: 'room.entered'; readonly roomtype: readonly unknown[] }
| { readonly type: 'room.entered'; readonly roomtype: Roomtype }
| { readonly type: 'room.player-joined'; readonly seat: number }
| { readonly type: 'room.player-left'; readonly seat: number }
| { readonly type: 'room.player-ready'; readonly seat: number }
@@ -0,0 +1,2 @@
/** Opaque subgame wire configuration. The game defines its contents. */
export type Roomtype = string | readonly unknown[];
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "69bfa9e3-15e3-4ed5-a26a-1fda48ffc906",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,3 +1,4 @@
import type {Roomtype} from './roomtype.ts';
/** Public connection phases available to a game. */
export type PlatformGameConnectionPhase =
| 'connected'
@@ -20,7 +21,7 @@ export interface PlatformGameSelfSnapshot {
/** Plain public room projection. `roomtype` remains opaque server data. */
export interface PlatformGameRoomSnapshot {
readonly roomcode: string;
readonly roomtype: readonly unknown[];
readonly roomtype: Roomtype;
readonly stage: number;
readonly needprepare: number;
readonly infinite: number;
@@ -1,3 +1,4 @@
import type {Roomtype} from '../contracts/roomtype.ts';
import type { strict } from 'node:assert';
import type {
GameEntry,
@@ -16,7 +17,7 @@ export type GameContractHostFactory = () => GameContractHost;
/** The game owns each room configuration, its expected count and matching Host fixture. */
export interface GameContractSample {
readonly roomtype: readonly unknown[];
readonly roomtype: Roomtype;
readonly expectedSeatCount: number;
readonly makeHost: GameContractHostFactory;
}