cc.Class({
    extends: cc.Component,

    properties: {
        score: cc.Label,
        reviveNum: cc.Label,
    },

    init (game) {
        this.game = game;
    },

    show () {
        this.node.active = true;
        this.getComponent(cc.Animation).play();
        this.score.string = this.game.inGameUI.score;
        if(window.Global.user) {
            this.reviveNum.string = window.Global.user.revivedCount;
        } else {
            this.reviveNum.string = 0;
        }
    },

    hide () {
        this.node.active = false;
        this.node.y = 700;
    },

    useRevive () {
        if(window.Global.user.revivedCount >= 1) {
            window.Global.useReviveCard()
            this.hide();
            this.game.gameContinue()
        } else {
            wx.showModal({
                title:"提示",
                content:"您的复活卡数量为0，把游戏分享给好友即可获得1张复活卡",
                showCancel:false,
                confirmText:"确认",
                success: () => {
                }
            })
        }
    },

    start () {

    },
});
