31 lines
918 B
TypeScript
31 lines
918 B
TypeScript
import { instantiate, Prefab } from "cc";
|
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
import { ItemComp } from "./ItemComp";
|
|
|
|
/** Item 模块 */
|
|
@ecs.register(`Item`)
|
|
export class Item extends ecs.Entity {
|
|
|
|
protected init() {
|
|
// this.addComponents<ecs.Comp>();
|
|
}
|
|
load(uuid:number=1001,num:number=0,praent:any=null) {
|
|
var path = "game/gui/item";
|
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
var node = instantiate(prefab);
|
|
node.parent = praent
|
|
let iv = node.getComponent(ItemComp)!;
|
|
iv.i_uuid = uuid
|
|
iv.num=num
|
|
this.add(iv)
|
|
}
|
|
/** 模块资源释放 */
|
|
destroy() {
|
|
|
|
super.destroy();
|
|
}
|
|
}
|
|
|
|
/** Item 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
|