This commit is contained in:
pan
2024-08-14 17:47:33 +08:00
parent d28ebf723f
commit 0006a75db9
5 changed files with 1835 additions and 1555 deletions

View File

@@ -50,7 +50,7 @@ export class CardControllerComp extends CCComp {
let card = ecs.getEntity<HeroCard>(HeroCard);
let pos = v3(x,y)
card.load(pos,element[0],cards_node);
x=x+120
x=x+100
});
this.node.getChildByName("cards").getChildByName("active").active = false
}

View File

@@ -25,7 +25,7 @@ export class HeroCardViewComp extends CCComp {
pos_x=0;
pos_y=0;
protected onLoad(): void {
this.node.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
this.node.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
this.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this);
this.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this);
@@ -38,13 +38,16 @@ export class HeroCardViewComp extends CCComp {
// this.reset();
// }
}
onTouchMove(event: EventTouch) {
onTouch(){
smc.vm_data.cards.eid = this.ent.eid;
let parent = this.node.parent;
let active = parent.getChildByName("active");
active.setPosition(this.node.position.x,this.node.position.y)
active.setPosition(this.pos_x,this.pos_y)
active.active = true;
active.setPosition(this.node.position.x,this.node.position.y);
}
onTouchMove(event: EventTouch) {
smc.vm_data.cards.eid = this.ent.eid;
// if(this.ent.eid == smc.vm_data.cards.eid){
// this.node.getChildByName("active").active = true;
// }else{