"use strict";
cc._RF.push(module, '20e21rQL55IvouNdawHXzSk', 'lanuch');
// script/lanuch.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {

        listBlock: {
            type: cc.Node,
            default: null
        },

        myList: {
            type: cc.Node,
            default: null
        },

        listController: {
            type: cc.ScrollView,
            default: null
        }
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad: function onLoad() {

        F.common.initNodePool(this, F.prefab.rankListBlock);
        this.loadList();
        this.loadMySelf();
        // F.common.initNodePool(this, F.prefab.test);
        // this.loadTest();
    },
    genTestBlock: function genTestBlock(parent) {
        var poolName = F.prefab.test.name + "Pool";
        var pool = this[poolName];
        var newNode = F.common.genNewNode(pool, F.prefab.test.prefab, parent);
        return newNode;
    },
    loadList: function loadList() {
        var poolName = F.prefab.rankListBlock.name + "Pool";
        var pool = this[poolName];
        for (var i = 0; i < 100; i++) {
            var tempBlock = this.genListBlock(this.listBlock);
            if (i == 0) {
                tempBlock.getComponent("listBlock").first();
            } else {
                tempBlock.getComponent("listBlock").setNumber(i + 1);
            }
        }
        // console.log(this.listController)
        var self = this;
        // this.scheduleOnce(()=>{
        //     self.listController.scrollToTop(0);

        // }, 0.01);
    },
    genListBlock: function genListBlock(parent) {
        var poolName = F.prefab.rankListBlock.name + "Pool";
        var pool = this[poolName];
        var newNode = F.common.genNewNode(pool, F.prefab.rankListBlock.prefab, parent);
        return newNode;
    },
    loadMySelf: function loadMySelf() {
        var myList = this.genListBlock(this.myList);
        myList.getComponent("listBlock").setNumber("100+");
    },
    start: function start() {
        this.listController.scrollToTop(0);
    }
}

// update (dt) {},
);

cc._RF.pop();