Files
youle_cocos/docs/development-local-config.md

34 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 开发测试配置来源
唯一开关在 `cocoscreator_projects/YouleNexus/assets/framework/config/profiles.ts` 的 `STARTUP_CONFIG`:
```ts
mode: 'debug',
configSource: 'local', // local:项目 txt;remote:gameserver 地址
localConfigResource: 'dev-config/update_jsonv2', // resources 相对路径,不带 .txt
```
本地文件为 `cocoscreator_projects/YouleNexus/assets/resources/dev-config/update_jsonv2.txt`。
初始内容取自 2026-09-06 当前 `gameserver` 的完整配置快照,不会自动与远程同步。
修改并保存 profiles.ts 或 txt 后,切回 Creator,等待资源导入和脚本编译完成,再启动预览。
仅刷新浏览器不保证 Creator 已完成文件扫描;如日志仍显示旧 source,需在 Creator
资源管理器中刷新对应 profiles.ts 和 txt,再重新预览。
文件扩展名是 `.txt`,内容必须是合法 JSON,不能添加注释或尾逗号。
默认仍为 `configSource: 'remote'`。本地模式跳过远程请求及 `gameconfig` 地址覆盖;
渠道身份仍按原规则解析。两种来源共用原工程 `get_paravalue` 的层级取值规则,
修改某个键时需留意 agent/game/channel/market 中的对应值。
控制台 `[PlatformStartup] login-config` 的 `source` 和 `gameserver` 显示实际读取来源。
`configSource` 只决定配置内容从哪里读取;`useLocalServer` 独立决定 WebSocket
是否使用 `localServers`,切换配置来源不会隐式切换游戏服务器。
本地模式同时要求 `mode: 'debug'` 和 Cocos 开发预览/调试构建。
发布模式或非调试构建会明确拒绝本地读取;文件缺失、JSON 错误也直接报错,绝不回退远程。
## 已验证的预览缓存问题(2026-09-06)
曾复现磁盘 profiles.ts 已为 local,但新浏览器预览仍输出 remote。通过 Creator
asset-db 刷新 profiles.ts 和本地 txt 后,日志恢复为 local,且读取到 marketid=4
下的 deviceLogin=true,手机登录按钮正常显示。无需修改配置内容或 get_paravalue。