import Sprite = FYGE.Sprite;
import CheckBtn from "./CheckBtn";
import { MapScene } from "./MapScene";
import Container = FYGE.Container;

export default class MapPart extends Container {


    protected data: any = null;

    public static totalCount: number = 0;

    protected btnPos: number[][] = [];

    protected bg: Sprite = null;

    constructor(data) {
        super();
        this.bg = this.addChild(new Sprite());
        this.data = data;
    }

    update() {
        super.update();
    }

    protected initIcon() {
        // 坑爹的头像，所以倒着加，可以解决层级问题
        for (let i = this.data.length - 1; i >= 0; i--) {
            const value = this.data[i];
            const nBtn = this.addChild(new CheckBtn(value));

            nBtn.position.set(this.btnPos[i][0], this.btnPos[i][1]);
            MapScene.checkArr[value.check] = nBtn;
        }
        // this.data.forEach((value, index) => {
        //     const nBtn = this.addChild(new CheckBtn(value));
        //
        //     nBtn.position.set(this.btnPos[index][0], this.btnPos[index][1]);
        //     MapScene.checkArr[value.check] = nBtn;
        // });
    }
}
