import FireEventObserver from '../framework/FireEventObserver';
import SubHallManger from '../view/subHallManger'

cc.Class({
    extends: SubHallManger,

    properties: {
        gamesNode:cc.Node,
        content:cc.Node,
        listView:cc.ScrollView,
    },
    init(){
        this.SceneLevel = 2
    },
    showNeedGames(games)
    {
        this.listView.scrollToOffset(cc.v2(0,0),0)
        if ("object" == typeof(games)) {
            this.content.children.forEach(item =>{
                item.active = false
            })
            if (games && games.length >=1) {
                games.forEach(element => {
                    var itemname = 'item'+element
                    this.content.getChildByName(itemname).active = true
                });
            }
            else{
                this.content.children.forEach(item =>{
                    item.active = true
                })
            }
            this.content.children.forEach(item =>{
                console.log(item.name+"..............."+item.active)
            })
            // this.content.parent.width = games.length>0?450*Math.ceil(games.length/2) - 94:4162
            // this.content.widht + 30
        }
    },

    onClickedubGame(){
        cc.director.loadScene('sports');
    }
    
});


