@urso/core 0.9.4-dev → 0.9.5-dev
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/.claude/settings.local.json +15 -0
- package/build/js/index.js +20061 -11016
- package/index.html +63 -0
- package/package.json +8 -6
- package/src/js/components/debug/template.js +3 -3
- package/src/js/components/loader/controller.js +31 -52
- package/src/js/components/loader/template.js +66 -54
- package/src/js/config/load.js +308 -298
- package/src/js/extra/browserEvents.js +4 -2
- package/src/js/extra/main.js +33 -9
- package/src/js/lib/cache.js +59 -16
- package/src/js/lib/tween.js +283 -69
- package/src/js/modules/assets/service.js +7 -1
- package/src/js/modules/i18n/controller.js +1 -1
- package/src/js/modules/logic/sounds.js +1 -1
- package/src/js/modules/objects/baseModel.js +4 -0
- package/src/js/modules/objects/models/emitterFx.js +8 -8
- package/src/js/modules/objects/models/graphics.js +1 -0
- package/src/js/modules/objects/models/spine.js +24 -23
- package/src/js/modules/objects/models/text.js +110 -52
- package/src/js/modules/objects/propertyAdapter.js +1 -0
- package/src/js/modules/objects/proxy.js +10 -8
- package/src/js/modules/objects/service.js +1 -1
- package/src/js/modules/objects/styles.js +1 -1
- package/src/js/modules/scenes/pixiWrapper.js +44 -28
- package/src/js/modules/scenes/resolutions.js +1 -1
- package/src/js/modules/soundManager/soundSprite.js +1 -1
- package/src/js/modules/template/service.js +1 -1
- package/vite.config.js +1 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ModulesObjectsBaseModel from './../baseModel';
|
|
2
|
-
|
|
2
|
+
import * as particlesFx from '@urso/revolt-fx';
|
|
3
3
|
|
|
4
4
|
class ModulesObjectsModelsEmitterFx extends ModulesObjectsBaseModel {
|
|
5
5
|
constructor(params) {
|
|
@@ -76,16 +76,16 @@ class ModulesObjectsModelsEmitterFx extends ModulesObjectsBaseModel {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
_createBundle() {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
this._bundle = new particlesFx.FX();
|
|
80
|
+
let fx_settings_data = Urso.cache.getJson(this.cfg);
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
if (this.spritesheetFilter)
|
|
83
|
+
fx_settings_data.spritesheetFilter = this.spritesheetFilter;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
this._defaultEmitterName = fx_settings_data.emitters[0].name;
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
this._bundle.initBundle(fx_settings_data);
|
|
88
|
+
this.autostart && this.play();
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
_subscribeOnce() {
|
|
@@ -87,9 +87,10 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
87
87
|
* play spine animation and execute function after animation completes
|
|
88
88
|
* @param {String} animation - name of the animation to be played
|
|
89
89
|
* @param {Function} func - function to be executed
|
|
90
|
+
* @param {Number} [track] - you can define track number for current animation
|
|
90
91
|
*/
|
|
91
|
-
playAndThen(animation, func) {
|
|
92
|
-
this.playInSequenceAndThen([animation], func);
|
|
92
|
+
playAndThen(animation, func, track) {
|
|
93
|
+
this.playInSequenceAndThen([animation], func, track);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
/**
|
|
@@ -104,17 +105,19 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
104
105
|
* play spine animations in sequence and execute function after last animation completes
|
|
105
106
|
* @param {String[]} animations - names of the animations to be played
|
|
106
107
|
* @param {Function} func - function to be executed
|
|
108
|
+
* @param {Number} [track] - you can define track number for current animation
|
|
107
109
|
*/
|
|
108
|
-
playInSequenceAndThen(animations, func) {
|
|
109
|
-
this._playInSequenceAndThen(animations, func);
|
|
110
|
+
playInSequenceAndThen(animations, func, track) {
|
|
111
|
+
this._playInSequenceAndThen(animations, func, track);
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
/**
|
|
113
115
|
* play spine animations in sequence and execute function after last animation completes
|
|
114
116
|
* @param {String[]} animations - names of the animations to be played
|
|
115
117
|
* @param {Function} func - function to be executed
|
|
118
|
+
* @param {Number} [track] - you can define track number for current animation
|
|
116
119
|
*/
|
|
117
|
-
_playInSequenceAndThen(animations, func) {
|
|
120
|
+
_playInSequenceAndThen(animations, func, track) {
|
|
118
121
|
this.stop();
|
|
119
122
|
let removeSelf = () => { };
|
|
120
123
|
let animationCount = 0;
|
|
@@ -124,7 +127,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
124
127
|
animationCount++;
|
|
125
128
|
|
|
126
129
|
if (animations[animationCount])
|
|
127
|
-
this.play(animations[animationCount])
|
|
130
|
+
this.play(animations[animationCount], false, track)
|
|
128
131
|
else {
|
|
129
132
|
func && func();
|
|
130
133
|
removeSelf();
|
|
@@ -134,7 +137,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
134
137
|
|
|
135
138
|
removeSelf = () => this._baseObject.state.removeListener(completer);
|
|
136
139
|
this._baseObject.state.addListener(completer);
|
|
137
|
-
this.play(animations[0]);
|
|
140
|
+
this.play(animations[0], false, track);
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
/**
|
|
@@ -289,8 +292,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
289
292
|
const parser = spineAsset instanceof Uint8Array ?
|
|
290
293
|
new spine.SkeletonBinary(attachmentLoader) :
|
|
291
294
|
new spine.SkeletonJson(attachmentLoader);
|
|
292
|
-
|
|
293
|
-
parser.scale = 1;
|
|
295
|
+
|
|
294
296
|
const skeletonData = parser.readSkeletonData(spineAsset);
|
|
295
297
|
|
|
296
298
|
this._baseObject = new spine.Spine({
|
|
@@ -312,7 +314,7 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
312
314
|
this._baseObject.state.addListener({ event: this._eventHandler.bind(this) });
|
|
313
315
|
};
|
|
314
316
|
|
|
315
|
-
_eventHandler(
|
|
317
|
+
_eventHandler(_, event) {
|
|
316
318
|
this.emit(Urso.events.MODULES_OBJECTS_SPINE_EVENT, { eventName: event.data.name, name: this.name, class: this.class });
|
|
317
319
|
}
|
|
318
320
|
|
|
@@ -323,23 +325,22 @@ class ModulesObjectsModelsSpine extends ModulesObjectsBaseModel {
|
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
const spine = this._baseObject;
|
|
326
|
-
|
|
327
|
-
const currentSlot = spine.slotContainers[slotIndex];
|
|
328
|
+
|
|
328
329
|
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
const currentSlot = spine.skeleton.findSlot(slotName);
|
|
331
|
+
|
|
332
|
+
if (!currentSlot)
|
|
333
|
+
return console.error('ModulesObjectsModelsSpine _addToSlot slotName: ' + slotName + ', object: ', spine);
|
|
334
|
+
|
|
335
|
+
object._baseObject.scale.y = -1;
|
|
331
336
|
|
|
332
|
-
|
|
337
|
+
Urso.objects.removeChild(object.parent, object, true);
|
|
333
338
|
|
|
334
|
-
|
|
335
|
-
|
|
339
|
+
if (replaceSlotContents)
|
|
340
|
+
currentSlot.setAttachment(null); //todo check if its proxy and reset parent
|
|
336
341
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Urso.objects.refreshStyles();
|
|
340
|
-
} else {
|
|
341
|
-
Urso.logger.warn('ModulesObjectsModelsSpine _addToSlot error: no spine slot ' + slotName);
|
|
342
|
-
}
|
|
342
|
+
this.addChild(object);
|
|
343
|
+
spine.addSlotObject(currentSlot, object._baseObject);
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
/**
|
|
@@ -1,70 +1,128 @@
|
|
|
1
1
|
import ModulesObjectsBaseModel from './../baseModel';
|
|
2
2
|
|
|
3
3
|
class ModulesObjectsModelsText extends ModulesObjectsBaseModel {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor(params) {
|
|
5
|
+
super(params);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
this.type = Urso.types.objects.TEXT;
|
|
8
|
+
this._addBaseObject();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setupParams(params) {
|
|
12
|
+
super.setupParams(params);
|
|
13
|
+
|
|
14
|
+
this.text = Urso.helper.recursiveGet('text', params, false);
|
|
15
|
+
this.localeId = Urso.helper.recursiveGet('localeId', params, false); //you can use this instead text for localization
|
|
16
|
+
|
|
17
|
+
this.localeVariables = Urso.helper.recursiveGet('localeVariables', params, {}); //optional variables for localization by localeId
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
this.lineHeight = Urso.helper.recursiveGet('lineHeight', params, 0);
|
|
20
|
+
this.fontFamily = Urso.helper.recursiveGet('fontFamily', params, 'Arial');
|
|
21
|
+
this.fontSize = Urso.helper.recursiveGet('fontSize', params, false);
|
|
22
|
+
//FIXME 'normal'
|
|
23
|
+
this.fontStyle = Urso.helper.recursiveGet('fontStyle', params, 'normal'); //'italic'
|
|
24
|
+
this.fontWeight = Urso.helper.recursiveGet('fontWeight', params, 'normal'); // 'bold'
|
|
25
|
+
|
|
26
|
+
this.fill = Urso.helper.recursiveGet('fill', params, '#000000'); // gradient ['#ffffff', '#00ff99']
|
|
27
|
+
this.fillCustomColors = Urso.helper.recursiveGet('fillCustomColors', params, false); //or array [{position:12,color:'#000000'},...]
|
|
28
|
+
this.stroke = Urso.helper.recursiveGet('stroke', params, 'black');
|
|
29
|
+
this.strokeThickness = Urso.helper.recursiveGet('strokeThickness', params, 0);
|
|
30
|
+
this.dropShadow = Urso.helper.recursiveGet('dropShadow', params, false);
|
|
31
|
+
this.dropShadowColor = Urso.helper.recursiveGet('dropShadowColor', params, '#000000');
|
|
32
|
+
this.dropShadowBlur = Urso.helper.recursiveGet('dropShadowBlur', params, 0);
|
|
33
|
+
this.dropShadowAngle = Urso.helper.recursiveGet('dropShadowAngle', params, 0); //Math.PI / 6
|
|
34
|
+
this.dropShadowDistance = Urso.helper.recursiveGet('dropShadowBlur', params, 0); // 6
|
|
35
|
+
this.wordWrap = Urso.helper.recursiveGet('wordWrap', params, false);
|
|
36
|
+
this.wordWrapWidth = Urso.helper.recursiveGet('wordWrapWidth', params, 100);
|
|
37
|
+
this.leading = Urso.helper.recursiveGet('leading', params, 0);
|
|
38
|
+
this.letterSpacing = Urso.helper.recursiveGet('letterSpacing', params, 0);
|
|
39
|
+
this.textAlign = Urso.helper.recursiveGet('textAlign', params, 'left');
|
|
40
|
+
this.fillGradientType = Urso.helper.recursiveGet('fillGradientType', params, 'vertical'); // 'horizontal' or 'vertical'
|
|
41
|
+
this.fillGradientStops = Urso.helper.recursiveGet('fillGradientStops', params, false); // [0, 1] or [0, 0.5, 1]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
modifyValue(key, val) {
|
|
45
|
+
switch (key) {
|
|
46
|
+
case 'fill':
|
|
47
|
+
return this._makeFill(val);
|
|
48
|
+
default:
|
|
49
|
+
return val;
|
|
38
50
|
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_calculatefillGradientStops() {
|
|
54
|
+
return this.fill.map((_, i, val) => {
|
|
55
|
+
if( i === 0) return 0;
|
|
56
|
+
if( i === val.length - 1) return 1;
|
|
57
|
+
return i / (val.length - 1);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_makeFill(val) {
|
|
62
|
+
|
|
63
|
+
if (!Array.isArray(val)) return val; //if not array, return value
|
|
39
64
|
|
|
40
|
-
|
|
41
|
-
if (this.localeId)
|
|
42
|
-
this._originalModel.text = this.text = Urso.i18n.get(this.localeId, this.localeVariables);
|
|
65
|
+
const fillGradientStops = (this.fillGradientStops && this.fillGradientStops.length) || this._calculatefillGradientStops();
|
|
43
66
|
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
const colorStops = fillGradientStops.map((stop, index) => {
|
|
68
|
+
return {
|
|
69
|
+
offset: stop, // Normalized offset between 0 and 1
|
|
70
|
+
color: val[index] || val[val.length - 1], // Use the color at this index or the last one if not enough colors
|
|
71
|
+
};
|
|
72
|
+
});
|
|
46
73
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
74
|
+
const gradientParams = {
|
|
75
|
+
type: 'linear',
|
|
76
|
+
start: { x: 0, y: 0 }, // Start at top
|
|
77
|
+
end: this.fillGradientType === 'horizontal' ? { x: 0, y: 1 } : { x: 1, y: 0 }, // End at bottom
|
|
78
|
+
colorStops,
|
|
79
|
+
textureSpace: 'local',
|
|
50
80
|
};
|
|
81
|
+
|
|
51
82
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return;
|
|
83
|
+
return new PIXI.FillGradient(gradientParams);
|
|
84
|
+
}
|
|
55
85
|
|
|
56
|
-
|
|
57
|
-
|
|
86
|
+
_addBaseObject() {
|
|
87
|
+
if (this.localeId)
|
|
88
|
+
this._originalModel.text = this.text = Urso.i18n.get(
|
|
89
|
+
this.localeId,
|
|
90
|
+
this.localeVariables
|
|
91
|
+
);
|
|
58
92
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
const styles = {
|
|
94
|
+
fontFamily: this.fontFamily,
|
|
95
|
+
leading: this.leading,
|
|
96
|
+
align: this.textAlign,
|
|
97
|
+
};
|
|
98
|
+
this._baseObject = new PIXI.Text(this.text, styles);
|
|
63
99
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.addListener(Urso.events.MODULES_I18N_NEW_LOCALE_WAS_SET, this._newLocaleHandler.bind(this));
|
|
100
|
+
if (this.fillCustomColors) {
|
|
101
|
+
this._baseObject.fillCustomColors = this.fillCustomColors;
|
|
67
102
|
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_newLocaleHandler() {
|
|
106
|
+
if (!this.proxyObject) return;
|
|
107
|
+
|
|
108
|
+
this.proxyObject.text = Urso.i18n.get(this.localeId, this.localeVariables);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_customDestroy() {
|
|
112
|
+
if (this.localeId)
|
|
113
|
+
this.removeListener(
|
|
114
|
+
Urso.events.MODULES_I18N_NEW_LOCALE_WAS_SET,
|
|
115
|
+
this._newLocaleHandler.bind(this)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_subscribeOnce() {
|
|
120
|
+
if (this.localeId)
|
|
121
|
+
this.addListener(
|
|
122
|
+
Urso.events.MODULES_I18N_NEW_LOCALE_WAS_SET,
|
|
123
|
+
this._newLocaleHandler.bind(this)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
68
126
|
}
|
|
69
127
|
|
|
70
128
|
export default ModulesObjectsModelsText;
|
|
@@ -62,6 +62,7 @@ class ModulesObjectsProxy {
|
|
|
62
62
|
_customGetLogic(object, key, reflectValue) {
|
|
63
63
|
const target = object.target;
|
|
64
64
|
const wrapKey = this._getAliases()[key];
|
|
65
|
+
|
|
65
66
|
const isReflectValueObject = typeof reflectValue !== 'undefined'; //&& typeof reflectValue !== 'boolean'; //it was for getting width and height
|
|
66
67
|
|
|
67
68
|
if ((isReflectValueObject && (typeof wrapKey != 'undefined')) || !wrapKey)
|
|
@@ -87,6 +88,7 @@ class ModulesObjectsProxy {
|
|
|
87
88
|
|
|
88
89
|
this._checkSelectorProperties(key);
|
|
89
90
|
|
|
91
|
+
value = target.modifyValue(key, value);
|
|
90
92
|
this._setProperty(target, propertyName, value, oldValue);
|
|
91
93
|
|
|
92
94
|
//if property is text - we will update it
|
|
@@ -233,7 +235,7 @@ class ModulesObjectsProxy {
|
|
|
233
235
|
_getAliases() {
|
|
234
236
|
return {
|
|
235
237
|
'id': 'id',
|
|
236
|
-
'name': 'name',
|
|
238
|
+
'name': 'name', //'name',
|
|
237
239
|
'class': 'class',
|
|
238
240
|
'x': 'x',
|
|
239
241
|
'y': 'y',
|
|
@@ -275,20 +277,20 @@ class ModulesObjectsProxy {
|
|
|
275
277
|
'fontWeight': 'style.fontWeight',
|
|
276
278
|
'fill': 'style.fill',
|
|
277
279
|
'fillCustomColors': 'fillCustomColors',
|
|
278
|
-
'stroke': 'style.stroke',
|
|
279
|
-
'strokeThickness': 'style.
|
|
280
|
+
'stroke': 'style.stroke.color',
|
|
281
|
+
'strokeThickness': 'style.stroke.width',
|
|
280
282
|
'dropShadow': 'style.dropShadow',
|
|
281
|
-
'dropShadowColor': 'style.
|
|
282
|
-
'dropShadowBlur': 'style.
|
|
283
|
-
'dropShadowAngle': 'style.
|
|
284
|
-
'dropShadowDistance': 'style.
|
|
283
|
+
'dropShadowColor': 'style.dropShadow.color',
|
|
284
|
+
'dropShadowBlur': 'style.dropShadow.blur',
|
|
285
|
+
'dropShadowAngle': 'style.dropShadow.angle',
|
|
286
|
+
'dropShadowDistance': 'style.dropShadow.distance',
|
|
285
287
|
'wordWrap': 'style.wordWrap',
|
|
286
288
|
'wordWrapWidth': 'style.wordWrapWidth',
|
|
287
289
|
'leading': 'style.leading',
|
|
288
290
|
'letterSpacing': 'style.letterSpacing',
|
|
289
291
|
'textAlign': 'style.align',
|
|
290
292
|
'enabled': 'input.enabled',
|
|
291
|
-
'cacheAsBitmap': '
|
|
293
|
+
'cacheAsBitmap': 'cacheAsTexture',
|
|
292
294
|
'ignoreParentMask': 'ignoreParentMask',
|
|
293
295
|
//baseObject functions
|
|
294
296
|
'toGlobal': 'toGlobal'
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as spine from '@esotericsoftware/spine-pixi-v8';
|
|
2
1
|
|
|
3
2
|
const NORMAL_FPS_COUNT = 60;
|
|
4
3
|
const LOW_PERFORMANCE_FPS_COUNT = 30;
|
|
5
4
|
|
|
6
|
-
|
|
7
5
|
class ModulesScenesPixiWrapper {
|
|
8
6
|
constructor() {
|
|
9
7
|
this.singleton = true;
|
|
@@ -39,19 +37,30 @@ class ModulesScenesPixiWrapper {
|
|
|
39
37
|
//define renderer
|
|
40
38
|
// PIXI.utils.skipHello();
|
|
41
39
|
// this._renderer = new PIXI.Renderer({ preserveDrawingBuffer: true, width: 1, height: 1 }); //FIXME
|
|
42
|
-
this._renderer = await PIXI.autoDetectRenderer({ preserveDrawingBuffer: true, width: 1, height: 1 })
|
|
43
|
-
document.body.appendChild(this._renderer.view.canvas);
|
|
44
|
-
|
|
40
|
+
// this._renderer = await PIXI.autoDetectRenderer({ preserveDrawingBuffer: true, width: 1, height: 1 })
|
|
41
|
+
// document.body.appendChild(this._renderer.view.canvas);
|
|
42
|
+
const app = new PIXI.Application();
|
|
43
|
+
window.__PIXI_APP__ = app;
|
|
45
44
|
//root and world
|
|
46
45
|
this._root = new PIXI.Container();
|
|
46
|
+
this._root.label = 'root';
|
|
47
47
|
this._createWorld();
|
|
48
|
-
|
|
48
|
+
const parent = document.querySelector(Urso.config.gameContainerSelector) || document.body;
|
|
49
|
+
await app.init({
|
|
50
|
+
background: "0x222222",
|
|
51
|
+
// resizeTo: parent,
|
|
52
|
+
resolution: 1
|
|
53
|
+
});
|
|
54
|
+
parent.appendChild(app.canvas);
|
|
55
|
+
app.stage.addChild(this._root)
|
|
56
|
+
this._app = app
|
|
57
|
+
this._app.ticker.add(this._loop);
|
|
49
58
|
// setup interaction
|
|
50
59
|
// this.interaction = Urso.helper.recursiveGet('plugins.interaction', this._renderer) //FIXME
|
|
51
60
|
// || new PIXI.InteractionManager(this._renderer); //FIXME
|
|
52
61
|
|
|
53
62
|
this._loaderScene = this.getInstance('Model');
|
|
54
|
-
this._requestAnimFrame(this._loop);
|
|
63
|
+
// this._requestAnimFrame(this._loop);
|
|
55
64
|
|
|
56
65
|
this.getInstance('Resolutions');
|
|
57
66
|
}
|
|
@@ -79,8 +88,8 @@ class ModulesScenesPixiWrapper {
|
|
|
79
88
|
resume() {
|
|
80
89
|
this._loopLastCall = Date.now();
|
|
81
90
|
this._loopPaused = false;
|
|
82
|
-
this._update();
|
|
83
91
|
//FIXME
|
|
92
|
+
// this._update();
|
|
84
93
|
// spine.settings.GLOBAL_AUTO_UPDATE = true;
|
|
85
94
|
}
|
|
86
95
|
|
|
@@ -90,21 +99,21 @@ class ModulesScenesPixiWrapper {
|
|
|
90
99
|
* @param {Number} height
|
|
91
100
|
*/
|
|
92
101
|
resize(width, height) {
|
|
93
|
-
this.
|
|
102
|
+
this._app.renderer.resize(width, height);
|
|
94
103
|
};
|
|
95
104
|
|
|
96
105
|
/**
|
|
97
106
|
* hide canvas
|
|
98
107
|
*/
|
|
99
108
|
hideCanvas() {
|
|
100
|
-
this.
|
|
109
|
+
this._app.canvas.style.display = 'none';
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
/**
|
|
104
113
|
* show canvas
|
|
105
114
|
*/
|
|
106
115
|
showCanvas() {
|
|
107
|
-
this.
|
|
116
|
+
this._app.canvas.style.display = '';
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
/**
|
|
@@ -122,7 +131,7 @@ class ModulesScenesPixiWrapper {
|
|
|
122
131
|
* @param {Number} val
|
|
123
132
|
*/
|
|
124
133
|
setCanvasWidth(val) {
|
|
125
|
-
this.
|
|
134
|
+
this._app.canvas.style.width = val + 'px';
|
|
126
135
|
};
|
|
127
136
|
|
|
128
137
|
/**
|
|
@@ -130,7 +139,7 @@ class ModulesScenesPixiWrapper {
|
|
|
130
139
|
* @param {Number} val
|
|
131
140
|
*/
|
|
132
141
|
setCanvasHeight(val) {
|
|
133
|
-
this.
|
|
142
|
+
this._app.canvas.style.height = val + 'px';
|
|
134
143
|
};
|
|
135
144
|
|
|
136
145
|
/**
|
|
@@ -138,7 +147,7 @@ class ModulesScenesPixiWrapper {
|
|
|
138
147
|
* @returns {Object} - PIXI.Renderer
|
|
139
148
|
*/
|
|
140
149
|
getRenderer() {
|
|
141
|
-
return this.
|
|
150
|
+
return this._app;
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
/**
|
|
@@ -191,7 +200,8 @@ class ModulesScenesPixiWrapper {
|
|
|
191
200
|
* @returns {Object} - pixi.Texture
|
|
192
201
|
*/
|
|
193
202
|
generateTexture(obj) {
|
|
194
|
-
|
|
203
|
+
//FIXME
|
|
204
|
+
// return this._renderer.generateTexture(obj);
|
|
195
205
|
}
|
|
196
206
|
|
|
197
207
|
_setPixiSettings() {
|
|
@@ -237,17 +247,17 @@ class ModulesScenesPixiWrapper {
|
|
|
237
247
|
};
|
|
238
248
|
|
|
239
249
|
_loop() {
|
|
240
|
-
if (this._loopStopped)
|
|
241
|
-
|
|
250
|
+
// if (this._loopStopped)
|
|
251
|
+
// return false;
|
|
242
252
|
|
|
243
|
-
this._requestAnimFrame(this._loop);
|
|
253
|
+
// this._requestAnimFrame(this._loop);
|
|
244
254
|
|
|
245
|
-
if (!this._loopPaused) {
|
|
246
|
-
if (!
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
255
|
+
// if (!this._loopPaused) {
|
|
256
|
+
// if (!)
|
|
257
|
+
// return;
|
|
258
|
+
this._fpsCheckAllowUpdate()
|
|
259
|
+
this._update();
|
|
260
|
+
// }
|
|
251
261
|
|
|
252
262
|
return true;
|
|
253
263
|
};
|
|
@@ -268,6 +278,8 @@ class ModulesScenesPixiWrapper {
|
|
|
268
278
|
return false;
|
|
269
279
|
|
|
270
280
|
this._lastUpdateTime = currentTime;
|
|
281
|
+
|
|
282
|
+
this._app.ticker.maxFPS = this._maxFPSLimit;
|
|
271
283
|
return true;
|
|
272
284
|
}
|
|
273
285
|
|
|
@@ -295,7 +307,10 @@ class ModulesScenesPixiWrapper {
|
|
|
295
307
|
|
|
296
308
|
this.currentScene.update(deltaTime);
|
|
297
309
|
this.currentScene.render();
|
|
298
|
-
|
|
310
|
+
//FIXME
|
|
311
|
+
//this._renderer.render(this._root);
|
|
312
|
+
// this.ticker.update(deltaTime);
|
|
313
|
+
// this._renderer.render(this._root);
|
|
299
314
|
};
|
|
300
315
|
|
|
301
316
|
_checkMouse() {
|
|
@@ -346,9 +361,10 @@ class ModulesScenesPixiWrapper {
|
|
|
346
361
|
}
|
|
347
362
|
|
|
348
363
|
this.passiveCallIntervalId = setInterval(() => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
364
|
+
//FIXME
|
|
365
|
+
// if (!this._loopStopped && !this._loopPaused) {
|
|
366
|
+
// this._update();
|
|
367
|
+
// }
|
|
352
368
|
}, 16);
|
|
353
369
|
}
|
|
354
370
|
|
|
@@ -161,7 +161,7 @@ class ModulesScenesResolutions {
|
|
|
161
161
|
|
|
162
162
|
this.getInstance('PixiWrapper').showCanvas();
|
|
163
163
|
this.getInstance('PixiWrapper').resize(canvasSize.width, canvasSize.height);
|
|
164
|
-
this.getInstance('PixiWrapper').setWorldScale(canvasSize.width / this._templateSize.width, canvasSize.height / this._templateSize.height);
|
|
164
|
+
this.getInstance('PixiWrapper').setWorldScale((canvasSize.width / this._templateSize.width), (canvasSize.height / this._templateSize.height));
|
|
165
165
|
this.getInstance('PixiWrapper').setCanvasWidth(resolution.width / dp);
|
|
166
166
|
this.getInstance('PixiWrapper').setCanvasHeight(resolution.height / dp);
|
|
167
167
|
|
|
@@ -23,7 +23,7 @@ class ModulesTemplateService {
|
|
|
23
23
|
|
|
24
24
|
this._parseAssets(this._currentTemplate.assets, template._templatePath);
|
|
25
25
|
this._parseObjects(this._currentTemplate.objects, template._templatePath);
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
if (additionalTemplateFlag) {
|
|
28
28
|
this._actualFullTemplate.assets = Urso.helper.mergeArrays(this._actualFullTemplate.assets, this._currentTemplate.assets);
|
|
29
29
|
this._actualFullTemplate.components = Urso.helper.mergeArrays(this._actualFullTemplate.components, this._currentTemplate.components);
|
package/vite.config.js
CHANGED
|
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
plugins: [],
|
|
5
5
|
build: {
|
|
6
|
+
minify: false,
|
|
6
7
|
outDir: 'build',
|
|
7
8
|
emptyOutDir: true,
|
|
8
9
|
lib: {
|
|
@@ -19,13 +20,5 @@ export default defineConfig({
|
|
|
19
20
|
inlineDynamicImports: true
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
|
-
minify: 'terser',
|
|
23
|
-
terserOptions: {
|
|
24
|
-
compress: true,
|
|
25
|
-
mangle: true,
|
|
26
|
-
format: {
|
|
27
|
-
comments: false
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
23
|
}
|
|
31
24
|
});
|