dd
This commit is contained in:
@@ -13,7 +13,8 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('CardControllerComp')
|
||||
@ecs.register('CardController', false)
|
||||
export class CardControllerComp extends CCComp {
|
||||
card_level = 1;
|
||||
card_level:number = 1;
|
||||
in_load:boolean = false
|
||||
start() {
|
||||
this.load_cards()
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
@@ -34,7 +35,15 @@ export class CardControllerComp extends CCComp {
|
||||
this.load_cards()
|
||||
}
|
||||
}
|
||||
palyer_ref(){
|
||||
if (this.in_load) {
|
||||
return
|
||||
}
|
||||
this.load_cards()
|
||||
|
||||
}
|
||||
load_cards() {
|
||||
this.in_load = true
|
||||
let old_cards = ecs.query(ecs.allOf(HeroCardViewComp))
|
||||
if (old_cards.length > 0) {
|
||||
old_cards.forEach(element => {
|
||||
@@ -53,6 +62,8 @@ export class CardControllerComp extends CCComp {
|
||||
x=x+100
|
||||
});
|
||||
this.node.getChildByName("cards").getChildByName("active").active = false
|
||||
this.in_load = false;
|
||||
|
||||
}
|
||||
/** 转场 */
|
||||
protected update(dt: number): void {
|
||||
@@ -67,6 +78,7 @@ export class CardControllerComp extends CCComp {
|
||||
}
|
||||
return lists
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
|
||||
Reference in New Issue
Block a user