// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        // foo: {
        //     // ATTRIBUTES:
        //     default: null,        // The default value will be used only when the component attaching
        //                           // to a node for the first time
        //     type: cc.SpriteFrame, // optional, default is typeof default
        //     serializable: true,   // optional, default is true
        // },
        // bar: {
        //     get () {
        //         return this._bar;
        //     },
        //     set (value) {
        //         this._bar = value;
        //     }
        // },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},
    endLayer: null,
    bg: null,
    labelLoss: null,
    labelWin: null,
    start() {
        this.endLayer = cc.find("EndLayer", this.node);
        this.bg = cc.find("bg", this.endLayer);
        this.labelLoss = cc.find("labelBg/labelLoss", this.endLayer);
        this.labelWin = cc.find("labelBg/labelWin", this.endLayer);
    },

    showWin() {
        this.endLayer.active = true;
        cc.tween(this.bg).to(1, { opacity: 100 }).start();
        labelLoss.active = false;
    },

    showLoss() {
        this.endLayer.active = true;
        cc.tween(this.bg).to(1, { opacity: 100 }).start();
        labelWin.active = false;
    },

    // update (dt) {},
});
