feat(map): 新增可动态加载的收集物UI组件
- 添加 MGetComp 组件用于管理单个收集物的显示逻辑 - 创建 get.prefab 预制体作为收集物UI模板 - 重构 MissionGetsComp,移除硬编码节点引用,改为动态加载 - 支持通过 load_hui 方法按需加载收集物UI实例
This commit is contained in:
37
assets/script/game/map/MGetComp.ts
Normal file
37
assets/script/game/map/MGetComp.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user