@urso/core 0.7.72 → 0.7.74

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.72",
3
+ "version": "0.7.74",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -1,4 +1,4 @@
1
- LibDevice = function () {
1
+ const LibDevice = function () {
2
2
 
3
3
  /**
4
4
  * The time the device became ready.
@@ -296,7 +296,7 @@ class ModulesAssetsService {
296
296
  type: Urso.types.objects.IMAGE,
297
297
  assetKey: assetKey,
298
298
  x: -10000, y: -10000
299
- }, false, true);
299
+ }, false, true, true);
300
300
 
301
301
  setTimeout(() => { tempOblect.destroy() }, 1)
302
302
  }
@@ -11,17 +11,25 @@ class ModulesObjectsController {
11
11
  this._applyClassesToWorld = this._applyClassesToWorld.bind(this);
12
12
  };
13
13
 
14
- create(objects, parent, doNotRefreshStylesFlag) {
14
+ /**
15
+ *
16
+ * @param {Array|ModulesObjectsBaseModel} objects - array of objects or single object model
17
+ * @param {Object} parent - parent object
18
+ * @param {boolean} doNotRefreshStylesFlag - create without refresh styles
19
+ * @param {boolean} _system - system create, do not use this in your code
20
+ * @returns
21
+ */
22
+ create(objects, parent, doNotRefreshStylesFlag, _system = false) {
15
23
  let result;
16
24
 
17
25
  if (Array.isArray(objects)) {
18
26
  result = [];
19
27
 
20
28
  for (const object of objects) {
21
- result.push(this._createSingleObject(object, parent, doNotRefreshStylesFlag));
29
+ result.push(this._createSingleObject(object, parent, doNotRefreshStylesFlag, _system));
22
30
  }
23
31
  } else
24
- result = this._createSingleObject(objects, parent, doNotRefreshStylesFlag);
32
+ result = this._createSingleObject(objects, parent, doNotRefreshStylesFlag, _system);
25
33
 
26
34
  if (!doNotRefreshStylesFlag)
27
35
  this.refreshStyles(parent);
@@ -29,9 +37,9 @@ class ModulesObjectsController {
29
37
  return result;
30
38
  }
31
39
 
32
- _createSingleObject(object, parent, doNotRefreshStylesFlag) {
40
+ _createSingleObject(object, parent, doNotRefreshStylesFlag, _system) {
33
41
  //parse template for assets and objects (groups, components) Urso.types.objects.COMPONENT Urso.types.objects.GROUP
34
- if (!object._parsed) { //todo only for objects, contains components && groups in future
42
+ if (!object._parsed && !_system) { //todo only for objects, contains components && groups in future
35
43
  return Urso.scenes.addObject(object, parent, doNotRefreshStylesFlag);
36
44
  }
37
45
 
@@ -1,4 +1,4 @@
1
- Race = require('./race.js');
1
+ const Race = require('./race.js');
2
2
 
3
3
  class ModulesStatesManagerAll extends Race {
4
4
  constructor(params) {
@@ -1,4 +1,4 @@
1
- Action = require('./action.js');
1
+ const Action = require('./action.js');
2
2
 
3
3
  class ModulesStatesManagerRace extends Action {
4
4
  constructor(params) {
@@ -67,7 +67,7 @@ class ModulesStatesManagerRace extends Action {
67
67
  }
68
68
 
69
69
  _onFinish() {
70
- if(this._forceDestroying)
70
+ if (this._forceDestroying)
71
71
  return;
72
72
 
73
73
  this.finished = true;
@@ -1,4 +1,4 @@
1
- All = require('./all.js');
1
+ const All = require('./all.js');
2
2
 
3
3
  class ModulesStatesManagerSequence extends All {
4
4
  constructor(params) {
@@ -15,7 +15,7 @@ class ModulesTransportService {
15
15
  };
16
16
 
17
17
  send(message) {
18
- if (!this._checkCommunicator() || !this._checkCommunicatorReady())
18
+ if (!this._checkCommunicatorReady())
19
19
  return false;
20
20
 
21
21
  const decoratedMessage = this.getInstance('Decorator', { callbacks: this._callbacks }).toServer(message);
@@ -36,7 +36,7 @@ class ModulesTransportService {
36
36
  };
37
37
 
38
38
  reconnect() {
39
- if (!this._checkCommunicator())
39
+ if (!this._checkCommunicatorReady())
40
40
  return false;
41
41
 
42
42
  this._communicator.reconnect(this._getAutoReconnetionDelay());
@@ -45,7 +45,7 @@ class ModulesTransportService {
45
45
  };
46
46
 
47
47
  close() {
48
- if (!this._checkCommunicator())
48
+ if (!this._checkCommunicatorReady())
49
49
  return false;
50
50
 
51
51
  this._communicator.close();
@@ -62,14 +62,11 @@ class ModulesTransportService {
62
62
  return result;
63
63
  };
64
64
 
65
- _checkCommunicator() {
66
- if (!this._communicator)
67
- Urso.logger.error('Communicator was not created!');
68
-
69
- return true;
70
- }
71
-
72
65
  _checkCommunicatorReady() {
66
+ if (!this._communicator) {
67
+ Urso.logger.error('Communicator was not created!');
68
+ return false;
69
+ }
73
70
  return this._communicator.readyCheck();
74
71
  };
75
72