@urso/core 0.3.2 → 0.3.3

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.
@@ -151,7 +151,7 @@ object-assign
151
151
  */
152
152
 
153
153
  /*!
154
- * GSAP 3.9.0
154
+ * GSAP 3.8.0
155
155
  * https://greensock.com
156
156
  *
157
157
  * @license Copyright 2008-2021, GreenSock. All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -27,6 +27,16 @@ class ModulesStatesManagerController {
27
27
 
28
28
  _iteratorConstructor() {
29
29
  let nextIndex = 0;
30
+
31
+
32
+ const getNextStateByOrder = () => {
33
+ let statesArray = Object.keys(this._configStates);
34
+
35
+ if (nextIndex === statesArray.length)
36
+ nextIndex = 0;
37
+
38
+ return statesArray[nextIndex++];
39
+ }
30
40
 
31
41
  return {
32
42
  next: (() => {
@@ -36,7 +46,7 @@ class ModulesStatesManagerController {
36
46
  if (this._currentState) {
37
47
  const currentState = this._configStates[this._currentState];
38
48
 
39
- if (this.checkStateGuard(this._currentState) && currentState.nextState) { //nextState: ["PICK_GAME2", "PICK_GAME1", "IDLE"]
49
+ if (currentState.nextState) { //nextState: ["PICK_GAME2", "PICK_GAME1", "IDLE"]
40
50
  for (const stateKey of currentState.nextState) {
41
51
  if (this.checkStateGuard(stateKey)) {
42
52
  nextIndex = statesArray.indexOf(stateKey) + 1;
@@ -52,11 +62,14 @@ class ModulesStatesManagerController {
52
62
  }
53
63
  }
54
64
 
55
- //regular round logic
56
- if (nextIndex === statesArray.length)
57
- nextIndex = 0;
65
+ //go next state by order
66
+ let stateName;
58
67
 
59
- return statesArray[nextIndex++];
68
+ do {
69
+ stateName = getNextStateByOrder();
70
+ } while (!this.checkStateGuard(stateName));
71
+
72
+ return stateName;
60
73
  }).bind(this)
61
74
  }
62
75
  }
@@ -71,10 +84,6 @@ class ModulesStatesManagerController {
71
84
  let config = this._configStates[this._currentState];
72
85
  let classInstance = this.getInstance('Helper').getActionByConfig(config);
73
86
 
74
- //state guard
75
- if (!this.checkStateGuard(this._currentState))
76
- return this._nextState();
77
-
78
87
  //actions instances guard
79
88
  if (!classInstance.guard())
80
89
  return this._nextState();