@urso/core 0.7.0 → 0.7.1

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.0",
3
+ "version": "0.7.1",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -14,7 +14,7 @@ class ComponentsEditorApi {
14
14
  const template = Urso.template.get();
15
15
  return template.styles;
16
16
  }
17
-
17
+
18
18
 
19
19
  //assets
20
20
 
@@ -83,24 +83,44 @@ class ComponentsEditorApi {
83
83
  //////////////// sys
84
84
 
85
85
  _assetsKeys = {
86
- ATLAS: ['key', 'path'], // path to json file
87
- BITMAPFONT: ['key', 'path'], // path to json file
88
- CONTAINER: ['name'],
89
- FONT: ['key', 'path'],
90
- IMAGE: ['key', 'path'],
91
- JSON: ['key', 'path'],
92
- SPINE: ['key', 'path'], // path to json file
86
+ ATLAS: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
87
+ BITMAPFONT: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
88
+ CONTAINER: [{ name: 'key', type: 'text' }],
89
+ FONT: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
90
+ IMAGE: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
91
+ JSON: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
92
+ SPINE: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
93
93
  }
94
94
 
95
- _commonObjectsKeys = ['id', 'name', 'class', 'x', 'y', 'z', 'anchorX', 'anchorY', 'scaleX', 'scaleY', 'angle', 'visible', 'alpha'];
95
+ _commonObjectsKeys = [
96
+ { name: 'id', type: 'text' },
97
+ { name: 'name', type: 'text' },
98
+ { name: 'class', type: 'text' },
99
+ { name: 'x', type: 'number' },
100
+ { name: 'y', type: 'number' },
101
+ { name: 'z', type: 'number' },
102
+ { name: 'anchorX', type: 'number', range: [-1, 1] },
103
+ { name: 'anchorY', type: 'number', range: [-1, 1] },
104
+ { name: 'scaleX', type: 'number' },
105
+ { name: 'scaleY', type: 'number' },
106
+ { name: 'angle', type: 'number', range: [0, 360] },
107
+ { name: 'alpha', type: 'number', range: [0, 1] },
108
+ { name: 'visible', type: 'boolean' },
109
+ ];
96
110
 
97
111
  _objectsKeys = {
98
- BITMAPTEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, ['text', 'fontName', 'fontSize']),
99
- COMPONENT: Urso.helper.mergeArrays(this._commonObjectsKeys, ['componentName']),
112
+ BITMAPTEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'text', type: 'text' }, { name: 'fontName', type: 'text' }, { name: 'fontSize', type: 'text' }]),
113
+ COMPONENT: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'componentName', type: 'text' }]),
100
114
  CONTAINER: this._commonObjectsKeys,
101
- GROUP: Urso.helper.mergeArrays(this._commonObjectsKeys, ['groupName']),
102
- IMAGE: Urso.helper.mergeArrays(this._commonObjectsKeys, ['assetKey']),
103
- TEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, ['text', 'fontFamily', 'fontSize', 'fill', 'stroke'])
115
+ GROUP: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'groupName', type: 'text' }]),
116
+ IMAGE: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'assetKey', type: 'text' }]),
117
+ TEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, [
118
+ { name: 'text', type: 'text' },
119
+ { name: 'fontFamily', type: 'text' },
120
+ { name: 'fontSize', type: 'text' },
121
+ { name: 'fill', type: 'text' },
122
+ { name: 'stroke', type: 'text' }
123
+ ])
104
124
  }
105
125
  }
106
126
 
@@ -3,6 +3,7 @@ class ModulesStatesManagerAction {
3
3
  constructor(name) {
4
4
  this.name = name;
5
5
 
6
+ this._running = false;
6
7
  this._terminating = false;
7
8
  this.finished = false;
8
9
  this._onFinishCallback = false;
@@ -12,10 +13,11 @@ class ModulesStatesManagerAction {
12
13
 
13
14
  //can we start this action?
14
15
  guard() {
15
- return this.getInstance('Controller').checkActionGuard(this.name);
16
+ return !this._running && this.getInstance('Controller').checkActionGuard(this.name);
16
17
  }
17
18
 
18
19
  run(onFinishCallback) {
20
+ this._running = true;
19
21
  log(`%c action run ---> ${this.name}`, 'color: blue');
20
22
 
21
23
  this.emit(Urso.events.MODULES_STATES_MANAGER_ACTION_START, this.name);
@@ -31,6 +33,11 @@ class ModulesStatesManagerAction {
31
33
  }
32
34
 
33
35
  terminate() {
36
+ if (!this._running) {
37
+ Urso.logger.warn('ModulesStatesManagerAction: action run from terminating', this.name);
38
+ this.run(() => { });
39
+ }
40
+
34
41
  if (this._terminating) {
35
42
  Urso.logger.error('ModulesStatesManagerAction: action alredy terminating', this.name);
36
43
  return;
@@ -47,11 +54,12 @@ class ModulesStatesManagerAction {
47
54
  return;
48
55
  }
49
56
 
57
+ this._running = false;
50
58
  this._terminating = false;
51
59
  this.finished = true;
52
60
 
53
61
  this.emit(Urso.events.MODULES_STATES_MANAGER_ACTION_FINISH, this.name);
54
-
62
+
55
63
  log(`%c action finish <--- ${this.name}`, 'color: blue');
56
64
  this._onFinishCallback();
57
65
  }