@urso/core 0.7.36 → 0.7.38

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.36",
3
+ "version": "0.7.38",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -17,7 +17,7 @@ class LibCache {
17
17
 
18
18
  _setDataToAssetsList(assetType, key, data) {
19
19
  if (this.assetsList[assetType][key])
20
- console.warn(`LibCache ${assetType}: key alredy exists: `, key, data);
20
+ console.warn(`LibCache ${assetType}: key already exists: `, key, data);
21
21
 
22
22
  this.assetsList[assetType][key] = data;
23
23
  }
@@ -1,5 +1,6 @@
1
1
  class LibLoader {
2
2
  constructor() {
3
+ this.RELOAD_DELAY = 250;
3
4
  this._isRunning = false;
4
5
  this._iterationNumber = 0;
5
6
  this._assetsQuery = [];
@@ -103,6 +104,7 @@ class LibLoader {
103
104
  return false;
104
105
 
105
106
  this._isRunning = true;
107
+ this._lastLoadFailed = false;
106
108
  this._iterationNumber++;
107
109
  const currentIteration = this._iterationNumber;
108
110
  this._completeCallback = callback;
@@ -134,7 +136,7 @@ class LibLoader {
134
136
  this._loader.onError.add(this._onError);
135
137
 
136
138
  this._loader.load(function (loader, resources) {
137
- if (currentIteration !== this._iterationNumber)
139
+ if (currentIteration !== this._iterationNumber || this._lastLoadFailed)
138
140
  return;
139
141
 
140
142
  this._onLoadUpdate({ progress: 100 });
@@ -146,9 +148,12 @@ class LibLoader {
146
148
 
147
149
 
148
150
  _onError(error) {
151
+ Urso.logger.warn('LibLoader file load error: ', error);
149
152
  this._loader.reset();
150
153
  this._isRunning = false;
151
- this.start(this._completeCallback);
154
+ this._lastLoadFailed = true;
155
+
156
+ this._resizeTimeoutId = Urso.setTimeout(() => this.start(this._completeCallback), this.RELOAD_DELAY);
152
157
  }
153
158
 
154
159
  };
@@ -4,6 +4,7 @@ class ModulesStatesManagerController {
4
4
 
5
5
  this._configStates;
6
6
  this._currentState;
7
+ this._forceNextStateKey = null;
7
8
  this._started = false;
8
9
  this._paused = false;
9
10
  this._pauseNeedResume = false;
@@ -42,6 +43,14 @@ class ModulesStatesManagerController {
42
43
  }
43
44
  }
44
45
 
46
+ setForceNextState(stateKey) {
47
+ if (!this._configStates[stateKey]) {
48
+ Urso.logger.error('ModulesStatesManagerController: setForceNextState name error', stateKey);
49
+ }
50
+
51
+ this._forceNextStateKey = stateKey
52
+ }
53
+
45
54
  _iteratorConstructor() {
46
55
  let nextIndex = 0;
47
56
 
@@ -57,6 +66,12 @@ class ModulesStatesManagerController {
57
66
 
58
67
  return {
59
68
  next: (() => {
69
+ if (this._forceNextStateKey) {
70
+ const forceNextStateKey = this._forceNextStateKey;
71
+ this._forceNextStateKey = null;
72
+ return forceNextStateKey;
73
+ }
74
+
60
75
  let statesArray = Object.keys(this._configStates);
61
76
 
62
77
  //nextState