()
| 734 | } |
| 735 | |
| 736 | loadAllRasterTextureAtlases () { |
| 737 | if (this.loadingRasterAtlas || this.loadedRasterAtlas) { return } |
| 738 | if (!this.get('rasterAtlasAnimations')) { return } |
| 739 | this.loadingRasterAtlas = true |
| 740 | const keys = Object.keys(this.get('rasterAtlasAnimations')) |
| 741 | |
| 742 | const loadingPromises = keys |
| 743 | .map(key => _.merge({ key }, this.get('rasterAtlasAnimations')[key])) |
| 744 | .filter(({ movieClip, textureAtlases }) => !(movieClip && (textureAtlases > 0))) |
| 745 | .map(({ movieClip, textureAtlases, key }) => { |
| 746 | const createJsFetch = loadCreateJs(`/file/${movieClip}`) |
| 747 | |
| 748 | const textureAtlasImages = textureAtlases |
| 749 | .map(url => $(`<img crossOrigin='Anonymous', src='/file/${url}' />`)) |
| 750 | .map(tag => { |
| 751 | return new Promise((resolve, reject) => tag.one('load', () => resolve(tag[0]))) |
| 752 | }) |
| 753 | |
| 754 | return Promise.all([createJsFetch].concat(textureAtlasImages)) |
| 755 | .then(result => { |
| 756 | const { lib, ss, ssMetadata } = result.slice(0, 1)[0] |
| 757 | const images = result.slice(1) |
| 758 | return this.textureAtlases.set(key, { lib, ss, ssMetadata, images }) |
| 759 | }) |
| 760 | .catch(error => { |
| 761 | return console.error(`There was an error loading ThangType: '${this.get('name')}':`, error) |
| 762 | }) |
| 763 | }) |
| 764 | |
| 765 | if ((loadingPromises.length || []) >= 1) { |
| 766 | return Promise.all(loadingPromises) |
| 767 | .then(() => { |
| 768 | this.loadedRasterAtlas = true |
| 769 | this.loadingRasterAtlas = false |
| 770 | return this.trigger('texture-atlas-loaded') |
| 771 | }) |
| 772 | .catch(error => { |
| 773 | return console.error('Error loading all ThangType raster animations:', error) |
| 774 | }) |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | // Returns the sprite data parsed from the adobe animate's texture-atlas export |
| 779 | getRasterAtlasSpriteData (action) { |
nothing calls this directly
no test coverage detected