feat(scenes): 启动场景流 Loading → Login → MainMenu

Loading.scene:
- LaunchFlow_Node 挂 LaunchFlow.ts
- start(): 显示「Loading...」 → 1s 后 director.loadScene('Login')

Login.scene:
- 实例化 Login_Layer.prefab(微信/手机/游客登录按钮)
- LoginFlow_Node 挂 LoginFlow.ts
- start(): 2s 后假装登录成功 → director.loadScene('MainMenu')

MainMenu.scene:
- 实例化 PlayerInfoView.prefab + SceneStart_Node
- SceneStart.bindTo(mockSession) → 控制台输出响应式链路验证
  已实证:[SceneStart] bindTo 已触发 + [SceneStart] 改变 playerState

游戏启动流程与原 gameabc 工程对齐:
1. Loading 资源加载 → 2. Login 登录场景 → 3. MainMenu 大厅

Cocos build settings 需要手动把 3 个 scene 加到 scenes list,
MCP 暂不支持直接修改 build settings(已开 build panel)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-01 00:47:05 +08:00
co-authored by Claude Opus 5
parent c326be58ac
commit 02131fc2c7
10 changed files with 2100 additions and 0 deletions
@@ -0,0 +1,29 @@
import { _decorator, Component, director, Label } from 'cc';
const { ccclass, property } = _decorator;
/**
* LaunchFlow: 真机启动流编排器(仿 gameabc 启动流程)。
*
* 流程:
* 1. Loading 场景: 显示「Loading...」
* 2. 资源加载完成后 → director.loadScene('Login')
* 3. Login 场景: 调用 PlatformSession.startup() 拿配置 + 连 WS + login
* 4. login 成功后 → director.loadScene('MainMenu')
*
* 当前实现只覆盖 step 1→2(用 setTimeout 模拟加载完成);
* step 3/4 待 PlatformSession 接入后补全。
*/
@ccclass('LaunchFlow')
export class LaunchFlow extends Component {
@property(Label)
tipLabel: Label = null!;
start(): void {
if (this.tipLabel) this.tipLabel.string = 'Loading...';
// 模拟资源加载完成:1 秒后切到 Login 场景
this.scheduleOnce(() => {
director.loadScene('Login');
}, 1);
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "c1a71770-8e91-45cb-b6f2-9f4281e24110",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,24 @@
import { _decorator, Component, director } from 'cc';
const { ccclass } = _decorator;
/**
* LoginFlow: 登录场景编排器(仿 gameabc 启动流程 step 3)。
*
* 完整流程(后续接入 PlatformSession 后实现):
* 1. 显示 Login_Layer prefab(微信/手机/游客登录按钮)
* 2. 用户点击「游客登录」按钮 → PlatformSession.startup() 触发
* 3. bootstrap + WS connect + login 成功后,AppStore.phase = loggedIn
* 4. director.loadScene('MainMenu')
*
* 当前简化:2 秒后自动跳到 MainMenu,验证场景切换链路。
*/
@ccclass('LoginFlow')
export class LoginFlow extends Component {
start(): void {
// mock:2 秒后假装登录成功,切到 MainMenu
this.scheduleOnce(() => {
director.loadScene('MainMenu');
}, 2);
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bad5bb86-6a2b-4807-b882-ed07fe7a8881",
"files": [],
"subMetas": {},
"userData": {}
}