"use strict";
cc._RF.push(module, '555afaRYPZJt5GsbBsisw2k', 'FadeMsg');
// scene/FadeMsg.js

"use strict";

// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/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;
        //     }
        // },
        bg: {
            default: null,
            type: cc.Node
        },
        msg: {
            default: null,
            type: cc.Label
        }
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad: function onLoad() {
        this.node.active = false;
        cc.game.addPersistRootNode(this.node);
    },
    start: function start() {},
    show: function show(msg, fadeTime) {
        this.node.active = true;
        this.node.opacity = 255;
        this.msg.string = msg;
        var t = 1.0;
        if (fadeTime != null) {
            t = fadeTime;
        }
        var self = this;
        this.node.stopAllActions();
        this.node.runAction(cc.sequence(cc.delayTime(t), cc.fadeOut(t), cc.callFunc(function () {
            self.node.active = false;
        })));
    }

    // update (dt) {},

});

cc._RF.pop();