"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) { 
 function r() { 
 this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
Object.defineProperty(exports, "__esModule", { value: true });
var sceneTypes_1 = require("./../types/sceneTypes");
var Panel_1 = require("../views/Panel");
var sceneCtrl_1 = require("../ctrls/sceneCtrl");
var Msg = (function (_super) {
    __extends(Msg, _super);
    function Msg() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(Msg.prototype, "message", {
        set: function (val) {
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Msg.prototype, "btnTxt", {
        set: function (val) {
        },
        enumerable: true,
        configurable: true
    });
    Msg.prototype.start = function (data) {
        this.data.message = data ? (data.msg ? data.msg : '网络出现问题请稍后再试~') : '网络出现问题请稍后再试~';
        this.data.type = data ? (data.type ? data.type : 'err') : 'err';
        this.data.title = data ? (data.title ? data.title : null) : null;
        this.data.closeFun = data ? (data.closeFun ? data.closeFun : null) : null;
        this['msgTxt'].text = "" + this.data.message;
        if (this.data.title) {
            if (this['msgTitle']) {
                this['msgTitle'].text = "" + this.data.title;
            }
        }
    };
    Object.defineProperty(Msg.prototype, "creditsOutBtns", {
        get: function () {
            return [this['creditsOutBtn']];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Msg.prototype, "closeBtns", {
        get: function () {
            return [this['closeBtn']];
        },
        enumerable: true,
        configurable: true
    });
    Msg.prototype.initEvents = function () {
        this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_closeBtn, this);
    };
    Msg.prototype.onTap_closeBtn = function (e) {
        this.hidePanel();
        if (this.data.closeFun) {
            this.data.closeFun();
        }
        else {
            switch (this.data.type) {
                case 'tips':
                    break;
                case 'err':
                    sceneCtrl_1.default.instance.change(sceneTypes_1.ModuleTypes.START_SCENE);
                    break;
                case 'creditsOut':
                    if (window['CFG'].appInfo && window['CFG'].appInfo.earnCreditsUrl) {
                        window.location.href = window['CFG'].appInfo.earnCreditsUrl;
                    }
                    else {
                        sceneCtrl_1.default.instance.change(sceneTypes_1.ModuleTypes.START_SCENE);
                    }
                    break;
                case 'requirelogin':
                    if (window['requirelogin']) {
                        window['requirelogin']();
                    }
                    else {
                        sceneCtrl_1.default.instance.change(sceneTypes_1.ModuleTypes.START_SCENE);
                    }
                    break;
                default:
                    sceneCtrl_1.default.instance.change(sceneTypes_1.ModuleTypes.START_SCENE);
                    break;
            }
        }
    };
    Object.defineProperty(Msg.prototype, "skinKey", {
        get: function () { return 'Msg'; },
        enumerable: true,
        configurable: true
    });
    return Msg;
}(Panel_1.default));
exports.default = Msg;
__reflect(Msg.prototype, "\"e:/zqty/egret/src/alert/Msg\".Msg");
//# sourceMappingURL=Msg.js.map