
import Panel from "../views/Panel";
export default class MsgPanel extends Panel {
    private msgTxt: eui.Label;
    private msgTxt2: eui.Label;
    private d: any;
    private _time: number;

    public get skinKey() { return 'Msg' }
    // public get groupName() { return 'earnGold_panel'}

    constructor(data?, hasMash: boolean = false, time: number = 1500) {
        super(data, hasMash);
        this._time = time;
    }

    onSkinComplete(): void {
        super.onSkinComplete();
        this.msgTxt.touchEnabled = this.msgTxt2.touchEnabled = false;
        this.msgTxt.text = this.d[0];
        this.msgTxt2.text = this.d[1];
        if (this.d[1] && this.d[1].length > 0) {
            this.msgTxt.y = 35;
            this.msgTxt2.y = 75;
        } else {
            this.msgTxt.y = 52;
        }

        setTimeout(() => {
            this.hidePanel();
        }, this._time);
    }

    start(data?): void {
        this.percentHeight = 100;
        this.d = data;
    }

    // initEvents():void{
    //     this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.hidePanel, this);
    // }

    // removeEvents():void{
    //     this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.hidePanel, this);
    // }
}