开箱 随机buff 初步完成
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user