import { LightComponent } from "./LightComponent";

export class MapComponent extends eui.Component {

    public mapList: eui.Group;
    public z_650000: eui.Rect;
    public z_620000: eui.Rect;
    public z_630000: eui.Rect;
    public z_540000: eui.Rect;
    public z_510000: eui.Rect;
    public z_530000: eui.Rect;
    public z_520000: eui.Rect;
    public z_450000: eui.Rect;
    public z_440000: eui.Rect;
    public z_810000: eui.Rect;
    public z_820000: eui.Rect;
    public z_460000: eui.Rect;
    public z_710000: eui.Rect;
    public z_360000: eui.Rect;
    public z_350000: eui.Rect;
    public z_330000: eui.Rect;
    public z_310000: eui.Rect;
    public z_320000: eui.Rect;
    public z_370000: eui.Rect;
    public z_130000: eui.Rect;
    public z_120000: eui.Rect;
    public z_110000: eui.Rect;
    public z_210000: eui.Rect;
    public z_220000: eui.Rect;
    public z_230000: eui.Rect;
    public z_340000: eui.Rect;
    public z_430000: eui.Rect;
    public z_500000: eui.Rect;
    public z_610000: eui.Rect;
    public z_640000: eui.Rect;
    public z_150000: eui.Rect;
    public z_140000: eui.Rect;
    public z_410000: eui.Rect;
    public z_420000: eui.Rect;



    //点击收取回调
    private clickCallBack: Function;

    /**
     * 
     */
    constructor(callBack: Function = null) {
        super();
        this.skinName = 'resource/skins/item/mapSkin.exml';
        this.clickCallBack = callBack;
        this.addEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
        if (this.skin) {
            this.onSkinComplete();
        }
    }

    private onSkinComplete(): void {

        for(let i=0;i<this.mapList.$children.length;i++){
            this.mapList.$children[i]["addChild"](new LightComponent())
        }


        this.removeEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
    }

    public removeEvent(): void {

    }

    private onClick(): void {
        if (this.clickCallBack) {
            this.clickCallBack(this);
        }
    }

    public playAct(start: number = 0): void {

    }

    public stopAct(): void {
        // this.act.stop();
    }
}