StoreGift.js 809 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. item: cc.Prefab,
  5. content: cc.Node
  6. },
  7. // LIFE-CYCLE CALLBACKS:
  8. // onLoad () {},
  9. init(content) {
  10. if (this._shops != undefined) {
  11. return;
  12. }
  13. this._shops = {};
  14. content.getShopsByType(4).then( (respondData) => {
  15. this._shops = respondData.shops;
  16. for (let i = 0; i < this._shops.length; ++ i) {
  17. let recomendItem = cc.instantiate(this.item);
  18. recomendItem.getComponent('StoreBigItem').init(this._shops[i], 18, 4, i);
  19. this.content.addChild(recomendItem);
  20. }
  21. }).catch((code, msg) => {
  22. console.log(code, msg);
  23. })
  24. },
  25. start () {
  26. },
  27. // update (dt) {},
  28. });