No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

36 líneas
518 B

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