Files
youle_cocos/cocoscreator_projects/YouleNexus/assets/scripts/LaunchFlow.ts
T
joywayerandClaude Opus 5 02131fc2c7 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>
2026-09-01 00:47:05 +08:00

29 lines
907 B
TypeScript

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);
}
}