dd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator ,Vec2,NodeEventType,EventTouch} from "cc";
|
||||
import { _decorator ,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 { data } from "../data/data";
|
||||
@@ -15,7 +15,7 @@ export class HeroCardViewComp extends CCComp {
|
||||
card_name:string = "hero_card";
|
||||
card_type:string = "hero";
|
||||
card_uid:number = 1000;
|
||||
|
||||
in_destroy:boolean = false;
|
||||
|
||||
protected onLoad(): void {
|
||||
// this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
|
||||
@@ -65,6 +65,7 @@ export class HeroCardViewComp extends CCComp {
|
||||
|
||||
use_card(){
|
||||
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
|
||||
this.in_destroy = true;
|
||||
oops.message.dispatchEvent("do_add_hero",{uuid:this.card_uid})
|
||||
this.ent.destroy();
|
||||
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
|
||||
@@ -74,7 +75,8 @@ export class HeroCardViewComp extends CCComp {
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
|
||||
|
||||
this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = CardSet[this.card_uid].level.toString();
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +90,7 @@ export class HeroCardViewComp extends CCComp {
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.in_destroy = false;
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user