@urso/core 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -4,6 +4,14 @@ class ModulesAssetsModelsAtlas extends Urso.Core.Modules.Assets.BaseModel {
4
4
 
5
5
  this.type = Urso.types.assets.ATLAS;
6
6
  }
7
+
8
+ // cacheTextures: if true - add atlas parced textures in Urso textures cache with it's file name as asset key.
9
+ // Example - atlas texture with path 'atlasPath/image/image_01.png' will be saved in cache with a key 'image_01'.
10
+ setupParams(params) {
11
+ super.setupParams(params);
12
+
13
+ this.cacheTextures = Urso.helper.recursiveGet('cacheTextures', params, false);
14
+ }
7
15
  }
8
16
 
9
17
  module.exports = ModulesAssetsModelsAtlas;
@@ -117,6 +117,11 @@ class ModulesAssetsService {
117
117
  newFilename = folderPath + '/' + frame.filename;
118
118
 
119
119
  Urso.cache.addFile(newFilename, texture);
120
+
121
+ if(assetModel.cacheTextures) {
122
+ const textureKey = newFilename.split('/').pop().split('.')[0];
123
+ Urso.cache.addTexture(textureKey, texture);
124
+ }
120
125
  }
121
126
  }
122
127
  }
@@ -18,6 +18,7 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
18
18
  this.animation = {
19
19
  timeScale: Urso.helper.recursiveGet('animation.timeScale', params, 1),
20
20
  name: Urso.helper.recursiveGet('animation.name', params, false),
21
+ skinName: Urso.helper.recursiveGet('animation.skinName', params, false),
21
22
  loop: Urso.helper.recursiveGet('animation.loop', params, false),
22
23
  onComplete: Urso.helper.recursiveGet('animation.onComplete', params, false)
23
24
  };
@@ -256,6 +257,9 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
256
257
  if (this.animation.onComplete)
257
258
  this._baseObject.state.addListener({ complete: this.animation.onComplete });
258
259
 
260
+ if (this.animation.skinName)
261
+ this.setSkinByName(this.animation.skinName);
262
+
259
263
  if (this.animation.name)
260
264
  this.play(this.animation.name, this.animation.loop);
261
265