主要改动: - 切到 funplay-cocos-mcp v0.5.1 (用户级配置, 项目级 .mcp.json 删除) - 仓库文档/CLAUDE.md/.gitignore 等清理过时 cocos-mcp-server 引用 - memory 文件同步: cocos-mcp-setup/path/blocker/spriteframe-uuid/prefab-persist 等加 funplay 实测警告 - memory 新建 funplay-cocos-mcp-pending-verification.md (后已被实测覆盖) - spec/plan/data: - docs/superpowers/specs/2026-09-02-legacy-layer-migration-design.md - docs/superpowers/plans/2026-09-02-legacy-layer-migration.md - docs/superpowers/data/layer-spirit-summary.json - YouleNexus: profiles.ts / defaults.ts / PlayerInfoView.prefab / scene 改动 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { _decorator, Component, Label } from 'cc';
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/**
|
|
* PlayerInfoView: 自包含响应式视图组件(不依赖 framework/store-binder)。
|
|
*
|
|
* 设计:PlayerInfoView.ts 与 SceneStart.ts 配合工作。
|
|
* - PlayerInfoView 节点挂此脚本,声明 nicknameLabel/beanLabel/avatarSprite
|
|
* 三个 @property
|
|
* - SceneStart 构建 mock playerState,直接调用 view.applyPlayer() 触发
|
|
* 响应式更新(无需 binder 中间层)
|
|
*
|
|
* 此组件也接受 bindTo(session) API 形式(与之前兼容),内部创建极简
|
|
* signal 形式,避免依赖 framework/store-binder。
|
|
*/
|
|
|
|
@ccclass('PlayerInfoView')
|
|
export class PlayerInfoView extends Component {
|
|
@property(Label)
|
|
nicknameLabel: Label = null!;
|
|
|
|
@property(Label)
|
|
beanLabel: Label = null!;
|
|
|
|
/** avatar 暂不挂(简化版不展示头像) */
|
|
|
|
/** 公共方法:直接接受 player 数据,更新 Label */
|
|
applyPlayer(p: { nickname: string; bean: number }): void {
|
|
if (this.nicknameLabel) this.nicknameLabel.string = p.nickname ?? '';
|
|
if (this.beanLabel) this.beanLabel.string = String(p.bean ?? 0);
|
|
}
|
|
} |