feat: integrate room framework and isolated subgame bundles
Complete room UI and protocol integration, move game definitions and resources behind bundle entries, publish authoritative version XML, and document single-game builds. Include all current resource changes and experiment artifacts.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const fs=require('fs'),path=require('path');
|
||||
const root=path.resolve(__dirname,'../../cocoscreator_projects/docs/framework');
|
||||
function edit(file,pairs,append=''){const p=path.join(root,file);let s=fs.readFileSync(p,'utf8');for(const [a,b]of pairs)s=s.replaceAll(a,b);fs.writeFileSync(p,s+append);}
|
||||
edit('integration/README.md',[
|
||||
['前端应用注册表的查找键','子游戏入口和 Bundle 的选择键'],
|
||||
['通过应用注册表建立关联','通过子游戏入口定义和 Bundle 名称建立关联'],
|
||||
['目录名 = gameKey = 注册表键 = definition.key','目录名 = gameKey = definition.key'],
|
||||
['game-definitions.ts # 应用注册:引用各游戏实现','game-definitions.ts # 通用入口解析,不引用具体游戏'],
|
||||
['SubgameAssets.ts # 应用选择、资源绑定和版本加载','SubgameAssets.ts # 动态加载目标游戏及版本'],
|
||||
[' game-config.ts # 只定位版本 XML',' game-config.ts # 定位版本 XML 和私有资源根\n game-definition.ts # 本游戏定义\n GameEntry.ts # 注册 GameEntry_mygame'],
|
||||
[" versionResource: 'mygame/version',"," versionResource: 'mygame/version',\n assetRoot: 'games/mygame',"],
|
||||
['在 [game-definitions.ts](../sdk/contracts.md) 导入自己的工厂、配置、聊天配置,并添加注册项。','在自己的 `assets/games/mygame/game-definition.ts` 导入本游戏工厂、配置和聊天配置,导出只包含本游戏的 `GAME_DEFINITIONS`。公共应用层不添加注册项。'],
|
||||
['- `chat`:','- `roomMenu`:显式提供 mainSceneButton、vipInfinite 两个布尔策略。\n- `chat`:'],
|
||||
['**当前这些资源路径描述不会自动给启动组件赋值。**','**createRoom 和 room 按定义从目标游戏 Bundle 自动加载,不再绑定到启动场景。**'],
|
||||
['及绑定 prefab','及在游戏 prefab 挂载组件'],
|
||||
['1. `gameKey`:注册表中的目标键。','1. `gameKey`:目标游戏键。'],
|
||||
['2. `createRoom`:目标游戏创建页面 prefab,根节点挂自己的 CreateRoomPage 子类。','2. 创建页面 prefab 在本游戏定义中声明,根节点挂自己的 CreateRoomPage 子类。'],
|
||||
['3. `room`:目标游戏房间 prefab,根节点挂匹配 roomViewClass 的组件。','3. 房间 prefab 在本游戏定义中声明,根节点挂匹配 roomViewClass 的组件。'],
|
||||
],'\n## 7. Bundle 入口\n\n游戏根目录设置为 `game-<gameKey>` Bundle;版本子目录保持 `version-<gameKey>` Bundle。\n\n```ts\nimport {_decorator} from \'cc\';\nimport {GAME_DEFINITIONS} from \'./game-definition.ts\';\n@_decorator.ccclass(\'GameEntry_mygame\')\nexport class MyGameEntry {\n static readonly definition = GAME_DEFINITIONS.mygame;\n}\n```\n\n启动等待目标 Bundle 加载完成,通过公开类注册 API 读取入口定义,然后加载私有 prefab 和版本 XML。入口缺失、键不匹配、资源越界或加载失败均显式报错,不回退到其他游戏。新增游戏不修改 app/framework/scripts 或公共资源。\n');
|
||||
edit('build/version-and-build.md',[
|
||||
['绑定 ErqiwangCreateRoom.prefab、ErqiwangRoom.prefab,以及当前承载场景 TemplateRoom.scene','保留公共承载场景 TemplateRoom.scene;两份私有 prefab 由入口自动加载'],
|
||||
['并保留所选版本 bundle','Bundle 列表取消全选,仅保留 game-erqiwang 和 version-erqiwang(main/internal 为公共包)'],
|
||||
['- gameKey 选择已生效,但 createRoom/room/roomScene 仍需手动绑定;注册表中的路径描述不会自动替换 Inspector 引用。','- gameKey 选择游戏入口和私有 prefab;roomScene 保持公共承载场景绑定。'],
|
||||
['- 尚未实现完整的未选游戏代码和资源裁剪。当前实测构建仍包含两款游戏的版本 bundle,注册表也引用两款游戏代码。','- 公共应用层已解除具体游戏静态导入。构建需显式只选择目标游戏和目标版本 Bundle;gameKey 尚未自动同步构建面板勾选项。'],
|
||||
['`Unknown game definition`:场景 gameKey 不在应用注册表。','`Missing subgame entry`:目标 Bundle 未注册 GameEntry_<gameKey>。'],
|
||||
['检查 SubgameAssets 的实际 prefab 绑定。','检查本游戏 definition.resources 与 gameKey。'],
|
||||
]);
|
||||
edit('build/README.md',[['绑定目标创建页、房间和承载场景','自动加载目标创建页和房间,绑定公共承载场景']]);
|
||||
edit('integration/create-room.md',[['并在 SubgameAssets 绑定 room 与 roomScene','在本游戏定义中声明 room 路径,在 SubgameAssets 保留公共 roomScene 绑定']]);
|
||||
Reference in New Issue
Block a user