import Panel from "../views/Panel";

export default class SharePanel extends Panel {

    public panelGroup:eui.Group;


    private mdata:any;

    public get skinKey() { return 'SharePanel' }
    public get groupName() { return 'share_panel' }

    constructor(data?) {
        super(data);
        this.mdata = data;
    }

    initEvents() {
        this.panelGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_close,this);
    }

    removeEvents() {
        super.removeEvents();
        this.panelGroup.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_close,this);
    }

    protected onSkinComplete(): void {
        super.onSkinComplete();

        // this.mainbg.texture = this.bgtexture;

        this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
        if (this.stage) {
            this.onLoad();
        }
    }

    private bgtexture: egret.Texture;
    protected async preLoadRes() {
       
        return new Promise(function (resolve, reject) {
            resolve();
        });
    }

    start(data?) {
        super.start(data);
        // this.timer = new egret.Timer(1000);
        this.percentHeight = 100;
    }

    private onLoad(): void {
        this.showAct();
        this.initUI();
    }

    private initUI(): void {
        console.log(this.panelGroup)
        
    }

    onTap_close(){
        this.hidePanel();
    }
}