1
0

UserPackPage.js 598 B

12345678910111213141516171819202122232425262728293031323334353637
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. packItemPrefab: cc.Prefab,
  5. pageLayout: cc.Layout,
  6. },
  7. // LIFE-CYCLE CALLBACKS:
  8. onLoad () {
  9. },
  10. init() {
  11. for (var i = 0; i < 20; i++) {
  12. let item = cc.instantiate(this.packItemPrefab);
  13. this.pageLayout.node.addChild(item);
  14. }
  15. },
  16. onDisable () {
  17. for (let child of this.pageLayout.node.children) {
  18. if (cc.isValid(child)) {
  19. child.destroy();
  20. }
  21. }
  22. },
  23. start () {
  24. },
  25. // update (dt) {},
  26. });