12345678910111213141516171819202122232425262728293031323334353637 |
- cc.Class({
- extends: cc.Component,
- properties: {
- packItemPrefab: cc.Prefab,
- pageLayout: cc.Layout,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- },
- init() {
- for (var i = 0; i < 20; i++) {
- let item = cc.instantiate(this.packItemPrefab);
- this.pageLayout.node.addChild(item);
- }
- },
- onDisable () {
- for (let child of this.pageLayout.node.children) {
- if (cc.isValid(child)) {
- child.destroy();
- }
- }
- },
- start () {
- },
- // update (dt) {},
- });
|