Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

37 wiersze
535 B

  1. define([
  2. ], function (
  3. ) {
  4. return {
  5. pool: {},
  6. clean: function () {
  7. this.pool = {};
  8. },
  9. getSprite: function (type) {
  10. let list = this.pool[type];
  11. if (!list)
  12. return null;
  13. else if (list.length === 0)
  14. return null;
  15. return list.pop();
  16. },
  17. store: function (sprite) {
  18. let pool = this.pool;
  19. let type = sprite.type;
  20. if (sprite.scale.x < 0)
  21. type = 'flip' + type;
  22. let list = pool[type];
  23. if (!list)
  24. list = pool[type] = [];
  25. delete sprite.isFake;
  26. list.push(sprite);
  27. }
  28. };
  29. });