Files
pixelheros/assets/script/game/map/MGetComp.ts
panw ce6b7bce1e feat(map): 新增可动态加载的收集物UI组件
- 添加 MGetComp 组件用于管理单个收集物的显示逻辑
- 创建 get.prefab 预制体作为收集物UI模板
- 重构 MissionGetsComp,移除硬编码节点引用,改为动态加载
- 支持通过 load_hui 方法按需加载收集物UI实例
2026-01-27 15:44:48 +08:00

38 lines
1.1 KiB
TypeScript

import { _decorator, Node, Label } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MGetsCompComp')
@ecs.register('MGetsComp', false)
export class MGetsCompComp extends CCComp {
get:any = {};
start() {
oops.message.on(GameEvent.UpdateCollection, this.updateView, this);
this.updateView();
}
onDestroy() {
oops.message.off(GameEvent.UpdateCollection, this.updateView, this);
}
private updateView() {
}
private updateNodeNum(node: Node, num: number) {
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}