@urso/core 0.3.5 → 0.3.9

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.3.5",
3
+ "version": "0.3.9",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -2,5 +2,6 @@ Urso.Core.Components.Debug = {
2
2
  Controller: require('./controller.js'),
3
3
  Coords: require('./coords.js'),
4
4
  Fps: require('./fps.js'),
5
- Template: require('./template.js')
5
+ Template: require('./template.js'),
6
+ Timescale: require('./timescale.js')
6
7
  };
@@ -5,7 +5,7 @@ class ComponentsDebugController extends ComponentsBaseController {
5
5
  super(params);
6
6
 
7
7
  this._logicBlocks = [
8
- 'coords', 'fps', /*'renderStats', 'resolution'*/ //TODO
8
+ 'coords', 'fps', 'timescale' /*'renderStats', 'resolution'*/ //TODO
9
9
  ];
10
10
 
11
11
  this._visible = true;
@@ -22,6 +22,28 @@ class ComponentsDebugTemplate {
22
22
  fontFamily: 'Helvetica',
23
23
  fontSize: 15,
24
24
  fill: '#00FF00'
25
+ },
26
+ {
27
+ type: Urso.types.objects.TEXT,
28
+ name: 'debugTimescaleValue',
29
+ text: '1',
30
+ x: '50%',
31
+ y: '30%',
32
+ visible: false,
33
+ anchorX: 0.5,
34
+ anchorY: 0.5,
35
+ fontFamily: 'Verdana',
36
+ fontSize: 100,
37
+ fontStyle: 'italic',
38
+ fontWeight: 'bold',
39
+ fill: ['#ffffff', '#00ff99'], // gradient
40
+ stroke: '#4a1850',
41
+ strokeThickness: 5,
42
+ dropShadow: true,
43
+ dropShadowColor: '#000000',
44
+ dropShadowBlur: 4,
45
+ dropShadowAngle: Math.PI / 6,
46
+ dropShadowDistance: 6,
25
47
  }
26
48
  ]
27
49
  }
@@ -0,0 +1,60 @@
1
+ class ComponentsDebugTimescale {
2
+
3
+ constructor() {
4
+ this._timescaleText;
5
+
6
+ this.create = this.create.bind(this);
7
+
8
+ this.scaleStep = 0.5;
9
+ this.scaleInfoDuration = 2000;
10
+
11
+ this._minusButtonsCodes = [109, 189];
12
+ this._plusButtonsCodes = [107, 187];
13
+ this._hideId;
14
+ }
15
+
16
+ create() {
17
+ document.addEventListener('keydown', this.keyPressTest.bind(this));
18
+ this._timescaleText = this.common.findOne('^debugTimescaleValue');
19
+ return true;
20
+ };
21
+
22
+ keyPressTest(e) {
23
+ const evtobj = window.event ? event : e;
24
+
25
+ if (!evtobj.altKey) //alt and +/-
26
+ return;
27
+
28
+ let factor = 0;
29
+
30
+ if (this._minusButtonsCodes.includes(evtobj.keyCode)) {
31
+ factor = -1;
32
+ }
33
+
34
+ if (this._plusButtonsCodes.includes(evtobj.keyCode)) {
35
+ factor = 1;
36
+ }
37
+
38
+ if (!factor)
39
+ return;
40
+
41
+ const timescaleDiff = Urso.scenes.timeScale >= 1 ? this.scaleStep * factor : (this.scaleStep * factor) * 0.1;
42
+ let timescaleNewValue = Urso.scenes.timeScale + timescaleDiff;
43
+
44
+ if (timescaleNewValue < 0.1)
45
+ timescaleNewValue = 0.1;
46
+
47
+ Urso.scenes.timeScale = Urso.math.roundToDigits(timescaleNewValue, 2);
48
+
49
+ this._timescaleText.text = Urso.scenes.timeScale;
50
+ this._timescaleText.visible = true;
51
+
52
+ if (this._hideId)
53
+ clearTimeout(this._hideId);
54
+
55
+ this._hideId = setTimeout(() => this._timescaleText.visible = false, this.scaleInfoDuration);
56
+ }
57
+
58
+ }
59
+
60
+ module.exports = ComponentsDebugTimescale;
@@ -23,6 +23,13 @@ class ComponentsStateDrivenController extends ComponentsBaseController {
23
23
  //system callbacks storage
24
24
  _finishCallbacks = {};
25
25
 
26
+ _callbacksCache = {
27
+ stateGuards: {},
28
+ actionTerminates: {},
29
+ actionGuards: {},
30
+ actionRuns: {}
31
+ };
32
+
26
33
 
27
34
  /**
28
35
  * caller for delayed finish callback
@@ -40,7 +47,8 @@ class ComponentsStateDrivenController extends ComponentsBaseController {
40
47
 
41
48
  _processStates() {
42
49
  for (const stateKey in this.configStates) {
43
- Urso.statesManager.setStateGuard(stateKey, this.configStates[stateKey].guard.bind(this));
50
+ this._callbacksCache.stateGuards[stateKey] = this.configStates[stateKey].guard.bind(this);
51
+ Urso.statesManager.setStateGuard(stateKey, this._callbacksCache.stateGuards[stateKey]);
44
52
  }
45
53
  }
46
54
 
@@ -50,21 +58,27 @@ class ComponentsStateDrivenController extends ComponentsBaseController {
50
58
  //const actionCfg = this.getInstance('ActionConfig', this.configActions[actionKey]);
51
59
  const actionCfg = this.configActions[actionKey];
52
60
 
53
- if (actionCfg.run)
54
- Urso.statesManager.addActionRun(actionKey, (finish) => {
61
+ if (actionCfg.run) {
62
+ this._callbacksCache.actionRuns[actionKey] = (finish) => {
55
63
  this._saveFinish(actionKey, finish);
56
64
  actionCfg.run(() => this.callFinish(actionKey));
57
- });
58
- else {
65
+ };
66
+
67
+ Urso.statesManager.addActionRun(actionKey, this._callbacksCache.actionRuns[actionKey]);
68
+ } else {
59
69
  Urso.logger.error('ComponentsStateDrivenController: no run function in config', actionKey, this);
60
70
  continue;
61
71
  }
62
72
 
63
- if (actionCfg.terminate)
64
- Urso.statesManager.addActionTerminate(actionKey, actionCfg.terminate.bind(this));
73
+ if (actionCfg.terminate) {
74
+ this._callbacksCache.actionTerminates[actionKey] = actionCfg.terminate.bind(this);
75
+ Urso.statesManager.addActionTerminate(actionKey, this._callbacksCache.actionTerminates[actionKey]);
76
+ }
65
77
 
66
- if (actionCfg.guard)
67
- Urso.statesManager.addActionGuard(actionKey, actionCfg.guard.bind(this));
78
+ if (actionCfg.guard) {
79
+ this._callbacksCache.actionGuards[actionKey] = actionCfg.guard.bind(this);
80
+ Urso.statesManager.addActionGuard(actionKey, this._callbacksCache.actionGuards[actionKey]);
81
+ }
68
82
  }
69
83
  }
70
84
 
@@ -86,9 +100,17 @@ class ComponentsStateDrivenController extends ComponentsBaseController {
86
100
  this._processActions();
87
101
  }
88
102
 
89
- //todo
90
103
  destroy() {
91
- Urso.logger.error('ComponentsStateDrivenController will remove States and Actions by configs');
104
+ this._removeCallback(Urso.statesManager.removeStateGuard, this._callbacksCache.stateGuards);
105
+ this._removeCallback(Urso.statesManager.removeActionGuard, this._callbacksCache.actionGuards);
106
+ this._removeCallback(Urso.statesManager.removeActionTerminate, this._callbacksCache.actionTerminates);
107
+ this._removeCallback(Urso.statesManager.removeActionRun, this._callbacksCache.actionRuns);
108
+ }
109
+
110
+ _removeCallback(remover, cacheObject) {
111
+ for (let cacheKey in cacheObject) {
112
+ remover(cacheKey, cacheObject[cacheKey]);
113
+ }
92
114
  }
93
115
 
94
116
  }
@@ -12,6 +12,7 @@ require("pixi-text-input");
12
12
 
13
13
  import { gsap } from 'gsap';
14
14
  window.gsap = gsap;
15
+ require('./setTimeout');
15
16
 
16
17
  import Howler from 'howler';
17
18
  window.Howler = Howler;
@@ -7,6 +7,8 @@ class ExtraBrowserEvents {
7
7
  this.resizeHandler = this.resizeHandler.bind(this);
8
8
  this.visibilitychangeHandler = this.visibilitychangeHandler.bind(this);
9
9
 
10
+ this._resizeTimeoutId;
11
+
10
12
  this.init();
11
13
  }
12
14
 
@@ -25,7 +27,11 @@ class ExtraBrowserEvents {
25
27
  }
26
28
 
27
29
  resizeHandler() {
28
- this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_RESIZE, false, this.RESIZE_DELAY);
30
+ if (this._resizeTimeoutId)
31
+ Urso.clearTimeout(this._resizeTimeoutId)
32
+
33
+ this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_PRE_RESIZE);
34
+ this._resizeTimeoutId = Urso.setTimeout(() => this.emit(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_RESIZE), this.RESIZE_DELAY);
29
35
  }
30
36
  }
31
37
 
@@ -0,0 +1,7 @@
1
+ Urso.setTimeout = (callback, delay) => {
2
+ return gsap.delayedCall(delay / 1000, callback);
3
+ }
4
+
5
+ Urso.clearTimeout = (tween) => {
6
+ tween.kill();
7
+ }
@@ -11,6 +11,8 @@ class LibCache {
11
11
  texture: {},
12
12
  file: {}
13
13
  };
14
+
15
+ this.globalAtlas = new PIXI.spine.TextureAtlas();
14
16
  };
15
17
 
16
18
  addFile(key, someData) {
@@ -47,6 +49,7 @@ class LibCache {
47
49
 
48
50
  addTexture(key, someData) {
49
51
  this.assetsList.texture[key] = someData;
52
+ this.globalAtlas.addTexture(key, someData);
50
53
  };
51
54
 
52
55
  addSpine(key, someData) {
@@ -93,6 +96,10 @@ class LibCache {
93
96
  return this.assetsList.texture[key];
94
97
  };
95
98
 
99
+ getGlobalAtlas() {
100
+ return this.globalAtlas;
101
+ }
102
+
96
103
  };
97
104
 
98
105
  module.exports = LibCache;
@@ -2,7 +2,7 @@ class LibLoader {
2
2
  constructor() {
3
3
  this._isRunning = false;
4
4
  this._assetsQuery = [];
5
- this._onLoadUpdate = () => {};
5
+ this._onLoadUpdate = () => { };
6
6
  };
7
7
 
8
8
  isRunning() {
@@ -20,10 +20,10 @@ class LibLoader {
20
20
  /**
21
21
  * gets part of loading path
22
22
  */
23
- _getLoadPath(asset){
23
+ _getLoadPath(asset) {
24
24
  const { path } = asset;
25
25
 
26
- if(!Urso.config.useBinPath) {
26
+ if (!Urso.config.useBinPath) {
27
27
  return `assets/${path}`;
28
28
  }
29
29
 
@@ -33,7 +33,7 @@ class LibLoader {
33
33
  if (splitted[0] === 'images') {
34
34
  splitted.splice(1, 0, quality);
35
35
  }
36
-
36
+
37
37
  return `bin/${splitted.join('/')}`;
38
38
  };
39
39
 
@@ -79,8 +79,8 @@ class LibLoader {
79
79
  * setup onload callback
80
80
  * @param {Function} onLoad
81
81
  */
82
- setOnLoadUpdate(onLoadUpdate){
83
- if(onLoadUpdate)
82
+ setOnLoadUpdate(onLoadUpdate) {
83
+ if (onLoadUpdate)
84
84
  this._onLoadUpdate = onLoadUpdate;
85
85
  }
86
86
 
@@ -98,21 +98,27 @@ class LibLoader {
98
98
  this._assetsQuery.forEach(asset => {
99
99
  // TODO: check to load
100
100
 
101
- const params = asset.params || false; // TODO: Set params field in base mode
101
+ let params = asset.params || false; // TODO: Set params field in base mode
102
+
103
+ if (asset.type === Urso.types.assets.SPINE && asset.noAtlas) {
104
+ if (!params)
105
+ params = {};
106
+
107
+ params.metadata = { spineAtlas: Urso.cache.getGlobalAtlas() };
108
+ }
109
+
102
110
  const loadPath = this._getLoadPath(asset);
103
111
  loader.add(asset.key, loadPath, params, (resource) => this._storeAsset(asset, resource)) //TODO set assets resolution instead _processLoadedImage baseTexture resolution
104
112
  });
105
113
 
106
- this._onLoadUpdate({progress: 0});
114
+ this._onLoadUpdate({ progress: 0 });
107
115
  loader.onProgress.add(this._onLoadUpdate);
108
116
 
109
117
  loader.load(function (loader, resources) {
110
- this._onLoadUpdate({progress: 100});
111
-
112
- callback();
113
-
118
+ this._onLoadUpdate({ progress: 100 });
114
119
  this._assetsQuery = [];
115
120
  this._isRunning = false;
121
+ callback();
116
122
  }.bind(this));
117
123
  };
118
124
 
@@ -16,6 +16,21 @@ class LibMath {
16
16
  getRandomIntBetween(min, max) {
17
17
  return Math.floor(Math.random() * (max - min + 1)) + min;
18
18
  }
19
+
20
+ /**
21
+ * round float number to digits count
22
+ * @param {Number} num
23
+ * @param {Number} digits - rounding digits count
24
+ * @returns {Number}
25
+ */
26
+ roundToDigits(num, digits) {
27
+ if (isNaN(num) || isNaN(digits))
28
+ return false;
29
+
30
+ const pow = Math.pow(10, digits);
31
+ return Math.round(num * pow) / pow;
32
+ }
33
+
19
34
  }
20
35
 
21
36
  module.exports = LibMath;
@@ -2,7 +2,6 @@ class ModulesAssetsModelsImage extends Urso.Core.Modules.Assets.BaseModel {
2
2
  constructor(params) {
3
3
  super(params);
4
4
  this.type = Urso.types.assets.IMAGE;
5
-
6
5
  }
7
6
 
8
7
  setupParams(params) {
@@ -4,6 +4,12 @@ class ModulesAssetsModelsSpine extends Urso.Core.Modules.Assets.BaseModel {
4
4
 
5
5
  this.type = Urso.types.assets.SPINE;
6
6
  }
7
+
8
+ setupParams(params) {
9
+ super.setupParams(params);
10
+
11
+ this.noAtlas = Urso.helper.recursiveGet('noAtlas', params, false);
12
+ }
7
13
  }
8
14
 
9
15
  module.exports = ModulesAssetsModelsSpine;
@@ -63,13 +63,39 @@ class ModulesAssetsService {
63
63
  _loadGroupRestAssets(group, callback) {
64
64
  let loader = Urso.getInstance('Lib.Loader');
65
65
  loader.setOnLoadUpdate(this.loadUpdate.bind(this));
66
+ const noAtlasSpines = [];
66
67
 
67
68
  for (let assetModel of this.assets[group])
68
69
  if (assetModel.type !== Urso.types.assets.ATLAS)
69
- if (!Urso.cache.getFile(assetModel.path))
70
- this._addAssetToLoader(assetModel, loader);
70
+ if (!Urso.cache.getFile(assetModel.path)) {
71
+ //filter noAtlas Spine files
72
+ if (assetModel.type === Urso.types.assets.SPINE && assetModel.noAtlas) {
73
+ noAtlasSpines.push(assetModel);
74
+ } else
75
+ this._addAssetToLoader(assetModel, loader);
76
+ }
77
+
78
+ loader.start(
79
+ () => {
80
+ this._processLoadedAssets(group);
81
+ this._loadNoAtlasSpines(noAtlasSpines, () => {
82
+ this.emit(Urso.events.MODULES_ASSETS_GROUP_LOADED, group);
83
+ callback();
84
+ });
85
+ }
86
+ );
87
+ }
88
+
89
+ _loadNoAtlasSpines(noAtlasSpines, callback) {
90
+ if (!noAtlasSpines.length)
91
+ return callback();
92
+
93
+ let loader = Urso.getInstance('Lib.Loader');
94
+
95
+ for (let assetModel of noAtlasSpines)
96
+ this._addAssetToLoader(assetModel, loader);
71
97
 
72
- loader.start(() => { this._processLoadedAssets(group); this.emit(Urso.events.MODULES_ASSETS_GROUP_LOADED, group); callback(); });
98
+ loader.start(callback);
73
99
  }
74
100
 
75
101
  _processLoadedAtlases(group) {
@@ -8,6 +8,7 @@ class ModulesObjectsModelsSlider extends Urso.Core.Modules.Objects.BaseModel {
8
8
  this._baseObject = null;
9
9
  this._handleIsPulling = false;
10
10
 
11
+ this._setVariables();
11
12
  this._addBaseObject();
12
13
  this._createSliderTextures();
13
14
  this._createValueText();
@@ -25,6 +26,17 @@ class ModulesObjectsModelsSlider extends Urso.Core.Modules.Objects.BaseModel {
25
26
  this.minValueTextModel = Urso.helper.recursiveGet('minValueTextModel', params, false);
26
27
  this.maxValueTextModel = Urso.helper.recursiveGet('maxValueTextModel', params, false);
27
28
  this.currentValueTextModel = Urso.helper.recursiveGet('currentValueTextModel', params, false);
29
+ this.isVertical = Urso.helper.recursiveGet('isVertical', params, false);
30
+ }
31
+
32
+ _setVariables() {
33
+ if(this.isVertical) {
34
+ this.positionKey = 'y';
35
+ this.targetObjParam = 'height';
36
+ }else {
37
+ this.positionKey = 'x';
38
+ this.targetObjParam = 'width';
39
+ }
28
40
  }
29
41
 
30
42
  _createSliderTextures() {
@@ -113,82 +125,94 @@ class ModulesObjectsModelsSlider extends Urso.Core.Modules.Objects.BaseModel {
113
125
  this._handleIsDragging = true;
114
126
  }
115
127
 
116
- _onPointerMove({ x }) {
128
+ _onPointerMove({ x, y }) {
117
129
  if (!this._handleIsDragging)
118
130
  return
119
131
 
120
- if (x < this.x)
121
- this._sliderHandle.x = 0;
122
- else if (x > this.x + this._sliderBg._baseObject.width)
123
- this._sliderHandle.x = this._sliderBg._baseObject.width;
132
+ const value = this.isVertical ? y : x;
133
+
134
+ if (value < this[this.positionKey])
135
+ this._sliderHandle[this.positionKey] = 0;
136
+ else if (value >= this[this.positionKey] + this._sliderBg._baseObject[this.targetObjParam])
137
+ this._sliderHandle[this.positionKey] = this._sliderBg._baseObject[this.targetObjParam];
124
138
  else
125
- this._sliderHandle.x = x - this.x;
139
+ this._sliderHandle[this.positionKey] = value - this[this.positionKey];
126
140
 
127
141
  this._setFillMask();
142
+
143
+ const data = { class: this.class, name: this.name, position: this._sliderHandle[this.positionKey] };
144
+ this.emit(Urso.events.MODULES_OBJECTS_SLIDER_HANDLE_MOVE, data)
128
145
  }
129
146
 
130
147
  _onPointerUp(obj) {
131
148
  this._handleIsDragging = false;
132
- let x;
149
+ let targetObj;
133
150
 
134
- if (obj.target === this._sliderBg._baseObject) {
135
- x = obj.data.getLocalPosition(obj.target).x;
136
- } else
137
- x = this._sliderHandle.x;
151
+ if (obj.target === this._sliderBg._baseObject)
152
+ targetObj = obj.data.getLocalPosition(obj.target)
153
+ else
154
+ targetObj = this._sliderHandle;
138
155
 
139
- this._dropHandle(x);
156
+ const {x, y} = targetObj;
157
+ const value = this.isVertical ? y : x;
158
+ this._dropHandle(value);
140
159
  }
141
160
 
142
161
  _setDefaultValue(){
143
162
  if(!this.points.includes(this.defaultValue))
144
163
  this.defaultValue = this.points[0];
145
164
 
146
- let x = this.points.indexOf(this.defaultValue) * this._sliderBg._baseObject.width / (this.points.length - 1);
165
+ let value = this.points.indexOf(this.defaultValue) *
166
+ this._sliderBg._baseObject[this.targetObjParam] / (this.points.length - 1);
147
167
 
148
- this._setNewValue(x, this.defaultValue);
168
+ this._setNewValue(value, this.defaultValue);
149
169
  }
150
170
 
151
- _dropHandle(x) {
171
+ _dropHandle(givenValue) {
152
172
  let value;
153
- let handleX;
173
+ let coord;
154
174
 
155
175
  if(this.points.length <= 2){
156
- handleX = x;
157
- value = ~~(100 / this._sliderBg._baseObject.width * x);
176
+ coord = givenValue;
177
+ value = ~~(100 / this._sliderBg._baseObject[this.targetObjParam] * givenValue);
158
178
  }
159
179
  // calculate closest point
160
180
  else{
161
181
  for (let i = 0; i < this.points.length; i++) {
162
- let pointX = i * this._sliderBg._baseObject.width / (this.points.length - 1);
182
+ let pointCoord = i * this._sliderBg._baseObject[this.targetObjParam] / (this.points.length - 1);
163
183
 
164
- if (typeof (handleX) === 'number' && x - pointX < handleX - x) {
165
- handleX = handleX;
184
+ if (typeof (coord) === 'number' && givenValue - pointCoord < coord - givenValue) {
185
+ coord = coord;
166
186
  } else {
167
- handleX = pointX;
187
+ coord = pointCoord;
168
188
  value = this.points[i];
169
189
  }
170
190
  }
171
191
  }
192
+ const data = { class: this.class, name: this.name, position: coord, value: value };
172
193
 
173
- this._setNewValue(handleX, value);
194
+ this.emit(Urso.events.MODULES_OBJECTS_SLIDER_HANDLE_DROP, data);
195
+ this._setNewValue(coord, value);
174
196
  }
175
197
 
176
198
  _setFillMask(){
177
199
  if(!this._fillMask)
178
200
  return
179
201
 
180
- const progress = (this._sliderHandle.x - this._sliderBg.x) * 100 / this._fillTexture._baseObject.width * 0.01;
181
- this._fillMask.scaleX = progress;
202
+ const progress = (this._sliderHandle[this.positionKey] - this._sliderBg[this.positionKey]) *
203
+ 100 / this._fillTexture._baseObject[this.targetObjParam] * 0.01;
204
+
205
+ const scaleKey = this.isVertical ? 'scaleY' : 'scaleX';
206
+ this._fillMask[scaleKey] = progress;
182
207
  }
183
208
 
184
- _setNewValue(x, value){
185
- this._sliderHandle.x = x;
209
+ _setNewValue(coord, value){
210
+ this._sliderHandle[this.positionKey] = coord;
186
211
 
187
212
  if (this.currentValueText)
188
213
  this.currentValueText.text = value;
189
214
 
190
215
  this._setFillMask();
191
- this.emit(Urso.events.MODULES_OBJECTS_SLIDER_SET_NEW_VALUE, { name: this.name, value: value, class: this.class });
192
216
  }
193
217
 
194
218
  _subscribeOnce() {
@@ -17,6 +17,8 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
17
17
  loop: Urso.helper.recursiveGet('animation.loop', params, false),
18
18
  onComplete: Urso.helper.recursiveGet('animation.onComplete', params, false)
19
19
  };
20
+
21
+ params.animation = this.animation; //we redefine original property here
20
22
  }
21
23
 
22
24
  play(animationName, loopFlag = false, track = 0) {
@@ -53,8 +55,8 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
53
55
  ...config
54
56
  };
55
57
 
56
- if (config.timeScale)
57
- this._baseObject.state.timeScale = config.timeScale;
58
+ /*if (config.timeScale)
59
+ this._baseObject.state.timeScale = config.timeScale;*/ //deprecated - now we use getTimeScale getter
58
60
 
59
61
  if (config.onComplete) {
60
62
  this._baseObject.state.clearListeners();
@@ -69,7 +71,8 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
69
71
  Urso.logger.error('ModulesObjectsModelsSpine assets error: no spine object ' + this.assetKey);
70
72
 
71
73
  this._baseObject = new PIXI.spine.Spine(spineAsset.spineData);
72
- this._baseObject.state.timeScale = this.animation.timeScale;
74
+ //this._baseObject.state.timeScale = this.animation.timeScale;
75
+ Object.defineProperty(this._baseObject.state, 'timeScale', { get: this.getTimeScale.bind(this) });
73
76
 
74
77
  if (this.animation.onComplete)
75
78
  this._baseObject.state.addListener({ complete: this.animation.onComplete });
@@ -77,6 +80,10 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
77
80
  if (this.animation.name)
78
81
  this.play(this.animation.name, this.animation.loop);
79
82
  };
83
+
84
+ getTimeScale() {
85
+ return Urso.scenes.timeScale * this.animation.timeScale;
86
+ }
80
87
  }
81
88
 
82
89
  module.exports = ModulesObjectsModelsSpine;
@@ -44,8 +44,11 @@ class ModulesObjectsProxy {
44
44
  safeSetValueToTarget(target, key, value) {
45
45
  this._safeFlag = true;
46
46
 
47
- const originalValue = target._originalModel[key];
47
+ const originalValue = target._originalModel[key]; // we need to save original value in the end
48
+
49
+ //setting value
48
50
  target[key] = value;
51
+
49
52
  target._originalModel[key] = originalValue;
50
53
 
51
54
  this._safeFlag = false;
@@ -9,7 +9,8 @@ class ModulesObserverConfig {
9
9
  MODULES_INSTANCES_MODES_CHANGED: 'modules.instances.modes.changed',
10
10
  MODULES_OBJECTS_BUTTON_PRESS: 'modules.objects.button.press',
11
11
  MODULES_OBJECTS_HIT_AREA_PRESS: 'modules.objects.hitArea.press',
12
- MODULES_OBJECTS_SLIDER_SET_NEW_VALUE: 'modules.objects.slider.setNewValue',
12
+ MODULES_OBJECTS_SLIDER_HANDLE_MOVE: 'modules.objects.slider.handleMove',
13
+ MODULES_OBJECTS_SLIDER_HANDLE_DROP: 'modules.objects.slider.handleDrop',
13
14
  MODULES_OBJECTS_TOGGLE_PRESS: 'modules.objects.toggle.press',
14
15
  MODULES_OBJECTS_TEXTINPUT_BLUR: 'modules.objects.textinput.blur',
15
16
  MODULES_OBJECTS_TEXTINPUT_INPUT: 'modules.objects.textinput.input',
@@ -27,6 +28,7 @@ class ModulesObserverConfig {
27
28
  MODULES_SCENES_DISPLAY_FINISHED: 'modules.scenes.display.finished',
28
29
  MODULES_SCENES_MOUSE_NEW_POSITION: 'modules.scenes.mouse.newPosition',
29
30
  MODULES_SCENES_UPDATE: 'modules.scenes.update',
31
+ EXTRA_BROWSEREVENTS_WINDOW_PRE_RESIZE: 'extra.browserEvents.window.pre.resize',
30
32
  EXTRA_BROWSEREVENTS_WINDOW_RESIZE: 'extra.browserEvents.window.resize',
31
33
  EXTRA_BROWSEREVENTS_WINDOW_VISIBILITYCHANGE: 'extra.browserEvents.window.visibilitychange'
32
34
  }
@@ -29,6 +29,14 @@ class ModulesScenesController {
29
29
  getMouseCoords() {
30
30
  return this.getInstance('PixiWrapper').getCachedMouseCoords();
31
31
  }
32
+
33
+ get timeScale() {
34
+ return this._service.timeScale;
35
+ }
36
+
37
+ set timeScale(value) {
38
+ return this._service.setTimeScale(value);
39
+ }
32
40
  }
33
41
 
34
42
  module.exports = ModulesScenesController;