去掉goods
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { instantiate, Prefab } from "cc";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { GoodsComp } from "./GoodsComp";
|
||||
|
||||
/** Goods 模块 */
|
||||
@ecs.register(`Goods`)
|
||||
export class Goods extends ecs.Entity {
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
|
||||
load(smc_index:number,praent:any){
|
||||
var path = "game/gui/goods";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent = praent
|
||||
let gc = node.getComponent(GoodsComp)!;
|
||||
gc.smc_index = smc_index
|
||||
gc.update_data()
|
||||
this.add(gc)
|
||||
}
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "31a2bcbb-10ac-4a10-b6cf-dd1991e30f4d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import { _decorator, instantiate, Label, Prefab } 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 { smc } from "../common/SingletonModuleComp";
|
||||
import { Item } from "./Item";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HChipComp } from "../hero/HChipComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('GoodsComp')
|
||||
@ecs.register('GoodsComp', false)
|
||||
export class GoodsComp extends CCComp {
|
||||
type:number=0;
|
||||
g_uuid:number=0;
|
||||
num:number=0;
|
||||
inventory:number=0;
|
||||
cost:number=0;
|
||||
smc_index:number=0;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
}
|
||||
update_data(){
|
||||
|
||||
}
|
||||
buy(){
|
||||
console.log("购买商品"+this.smc_index)
|
||||
|
||||
this.update_inventory()
|
||||
}
|
||||
|
||||
update_inventory(){
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "bbc0aec1-65da-473d-aff0-1b15312c912a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user