开箱 随机buff 初步完成

This commit is contained in:
2025-08-02 09:59:25 +08:00
parent fef5480322
commit 4daac778a0
8 changed files with 316 additions and 443 deletions

View File

@@ -1,4 +1,6 @@
import { _decorator, Animation, Component, Node, tween, v3 } from 'cc';
import { _decorator, Animation, Component, Label, Node, resources, Sprite, SpriteAtlas, tween, v3 } from 'cc';
import { SuperCards, SuperCardsType } from '../common/config/CardSet';
import { SkillSet } from '../common/config/SkillSet';
const { ccclass, property } = _decorator;
@ccclass('LuckCardComp')
@@ -18,6 +20,22 @@ export class LuckCardComp extends Component {
this.timer=2
}
}
show_card(card:any){
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SuperCards[card.uuid].path);
});
this.node.getChildByName("name").getComponent(Label).string=SuperCards[card.uuid].name
switch(SuperCards[card.uuid].type){
case SuperCardsType.BUFF:
this.node.getChildByName("val").getComponent(Label).string="+"+SuperCards[card.uuid].value2
break
case SuperCardsType.AOE:
this.node.getChildByName("val").getComponent(Label).string=SkillSet[SuperCards[card.uuid].value1].name+"X"+SuperCards[card.uuid].value2
break
}
}
do_destroy(){
tween(this.node)
.to(0.2, {