@urso/core 0.4.38 → 0.4.41

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.4.38",
3
+ "version": "0.4.41",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -23,6 +23,10 @@ class LibLoader {
23
23
  _getLoadPath(asset) {
24
24
  const { path } = asset;
25
25
 
26
+ if (path.indexOf('http') === 0) { //if absolute path - just return
27
+ return path;
28
+ }
29
+
26
30
  if (!Urso.config.useBinPath) {
27
31
  return `assets/${path}`;
28
32
  }
@@ -6,6 +6,8 @@ class ModulesI18nController {
6
6
  * get text by localeId
7
7
  * @param {String} localeId
8
8
  * @param {Object} [localeVariables] - variables for locale string
9
+ *
10
+ * @example get('Some333 ${bet} " `test ${multi} text localized', {bet:12,multi:13})
9
11
  */
10
12
  get(localeId, localeVariables = {}) {
11
13
  if (this.#vocabulary && this.#vocabulary[localeId]) {
@@ -66,12 +68,11 @@ class ModulesI18nController {
66
68
  }
67
69
 
68
70
  _interpolate(string, params) {
69
- const names = Object.keys(params);
70
- const vals = Object.values(params);
71
- const encodedString = encodeURIComponent(string);
72
- const resultEncodedString = new Function(...names, `return \`${encodedString}\`;`)(...vals);
71
+ for (const [key, value] of Object.entries(params)) {
72
+ string = Urso.helper.stringReplace('${' + key + '}', value, string);
73
+ }
73
74
 
74
- return decodeURIComponent(resultEncodedString);
75
+ return string
75
76
  }
76
77
  }
77
78
 
@@ -36,14 +36,24 @@ class ModulesInstancesController {
36
36
  return true;
37
37
  }
38
38
 
39
- removeMode(mode) {
39
+ /**
40
+ * remove mode from system
41
+ * @param {String} mode
42
+ * @param {Boolean} passiveMode - do not refresh styles
43
+ * @returns
44
+ */
45
+ removeMode(mode, passiveMode) {
40
46
  let index = this._modes.indexOf(mode);
41
47
 
42
48
  if (index === -1)
43
49
  return false;
44
50
 
45
51
  this._modes.splice(index, 1);
46
- Urso.observer.emit(Urso.events.MODULES_INSTANCES_MODES_CHANGED);
52
+
53
+ if (!passiveMode) {
54
+ Urso.observer.emit(Urso.events.MODULES_INSTANCES_MODES_CHANGED);
55
+ }
56
+
47
57
  return true;
48
58
  }
49
59
 
@@ -198,7 +198,7 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
198
198
  * @param {string} name
199
199
  * @returns {Bone}
200
200
  */
201
- findSlot(name) {
201
+ findBone(name) {
202
202
  return this._baseObject.skeleton.findBone(name)
203
203
  }
204
204
 
@@ -55,7 +55,7 @@ class ModulesScenesResolutions {
55
55
  this._currentOrientation = this._templateSize.orientation;
56
56
 
57
57
  //update InstancesModes
58
- Object.values(Urso.device.ScreenOrientation).forEach((orientationValue) => Urso.removeInstancesMode(orientationValue + 'Orientation'));
58
+ Object.values(Urso.device.ScreenOrientation).forEach((orientationValue) => Urso.removeInstancesMode(orientationValue + 'Orientation', true));
59
59
  Urso.addInstancesMode(this._templateSize.orientation + 'Orientation');
60
60
 
61
61
  this.emit(Urso.events.MODULES_SCENES_ORIENTATION_CHANGE, this._templateSize.orientation);