@urso/core 0.4.44 → 0.4.48
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/build/js/index.js +1 -1
- package/package.json +1 -1
- package/src/js/components/editor/_info.js +4 -0
- package/src/js/components/editor/api.js +72 -0
- package/src/js/components/editor/controller.js +13 -0
- package/src/js/config/main.js +1 -0
- package/src/js/lib/loader.js +6 -1
- package/src/js/modules/objects/models/emitter.js +14 -1
- package/src/js/modules/objects/models/spine.js +21 -25
package/package.json
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class ComponentsEditorApi {
|
|
2
|
+
|
|
3
|
+
constructor() {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//styles
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
//assets
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* returns types list and keys to create new asset
|
|
14
|
+
* @returns { types, keys }
|
|
15
|
+
*/
|
|
16
|
+
getAssetTypes() {
|
|
17
|
+
const types = Urso.types.assets;
|
|
18
|
+
return { types, keys: this._assetsKeys };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* get current assets list
|
|
23
|
+
* @returns {Array} assets list
|
|
24
|
+
*/
|
|
25
|
+
getCurrentAssets() {
|
|
26
|
+
const template = Urso.template.get();
|
|
27
|
+
return template.assets;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* add new asset into game
|
|
32
|
+
* @param {String} type
|
|
33
|
+
* @param {Object} fields
|
|
34
|
+
*/
|
|
35
|
+
addAsset(type, fields) {
|
|
36
|
+
//return new asset system id
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
//objects
|
|
41
|
+
getCurrentObjects() {
|
|
42
|
+
return list;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getObjectsTypes() {
|
|
46
|
+
return list; // with fields keys
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
addObject() {
|
|
50
|
+
//return id
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//settings
|
|
54
|
+
editObject(id, key, value) {
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//////////////// sys
|
|
59
|
+
|
|
60
|
+
_assetsKeys = {
|
|
61
|
+
ATLAS: ['key', 'path'], // path to json file
|
|
62
|
+
BITMAPFONT: ['key', 'path'], // path to json file
|
|
63
|
+
CONTAINER: ['name'],
|
|
64
|
+
FONT: ['key', 'path'],
|
|
65
|
+
IMAGE: ['key', 'path'],
|
|
66
|
+
JSON: ['key', 'path'],
|
|
67
|
+
SPINE: ['key', 'path'], // path to json file
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = ComponentsEditorApi;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ComponentsBaseController = require('./../base/controller.js');
|
|
2
|
+
|
|
3
|
+
class ComponentsEditorController extends ComponentsBaseController {
|
|
4
|
+
constructor(params) {
|
|
5
|
+
super(params);
|
|
6
|
+
|
|
7
|
+
this._api = this.getInstance('Api');
|
|
8
|
+
window.api = this._api;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = ComponentsEditorController;
|
package/src/js/config/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
let ConfigMain = {
|
|
2
2
|
title: 'Urso', //game title
|
|
3
|
+
appVersion: 0, //app version, also used as anticache "appVersion=${appVersion}" when not 0
|
|
3
4
|
mode: "development", // development/production/testing
|
|
4
5
|
extendingChain: ['Urso.Core'], //chain that will be set as Urso.Game
|
|
5
6
|
defaultScene: 'play', //default scene to display
|
package/src/js/lib/loader.js
CHANGED
|
@@ -97,8 +97,13 @@ class LibLoader {
|
|
|
97
97
|
return false;
|
|
98
98
|
|
|
99
99
|
this._isRunning = true;
|
|
100
|
-
|
|
101
100
|
const loader = new PIXI.Loader();
|
|
101
|
+
const appVersion = Urso.config.appVersion;
|
|
102
|
+
|
|
103
|
+
if (appVersion) {
|
|
104
|
+
loader.defaultQueryString = `appVersion=${appVersion}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
this._assetsQuery.forEach(asset => {
|
|
103
108
|
// TODO: check to load
|
|
104
109
|
|
|
@@ -41,7 +41,20 @@ class ModulesObjectsModelsEmitter extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
41
41
|
if (texture)
|
|
42
42
|
textures.push(texture);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
if (textures.length > 1) {
|
|
46
|
+
const texturesOptions = {
|
|
47
|
+
framerate: 20,
|
|
48
|
+
loop: true,
|
|
49
|
+
textures
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
this.emitter = new PIXI.particles.Emitter(this._baseObject, texturesOptions, cfg.data);
|
|
53
|
+
this.emitter.particleConstructor = PIXI.particles.AnimatedParticle; //import { AnimatedParticle } from "pixi-particles";
|
|
54
|
+
} else {
|
|
55
|
+
this.emitter = new PIXI.particles.Emitter(this._baseObject, textures, cfg.data);
|
|
56
|
+
}
|
|
57
|
+
|
|
45
58
|
this.emitter.emit = this.autostart;
|
|
46
59
|
this.emitter.autoUpdate = true;
|
|
47
60
|
}
|
|
@@ -64,6 +64,24 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
64
64
|
* @param {String[]} animations - names of the animations to be played
|
|
65
65
|
*/
|
|
66
66
|
playInSequence(animations) {
|
|
67
|
+
this._playInSequenceAndThen(animations);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* play spine animations in sequence and execute function after last animation completes
|
|
72
|
+
* @param {String[]} animations - names of the animations to be played
|
|
73
|
+
* @param {Function} func - function to be executed
|
|
74
|
+
*/
|
|
75
|
+
playInSequenceAndThen(animations, func) {
|
|
76
|
+
this._playInSequenceAndThen(animations, func);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* play spine animations in sequence and execute function after last animation completes
|
|
81
|
+
* @param {String[]} animations - names of the animations to be played
|
|
82
|
+
* @param {Function} func - function to be executed
|
|
83
|
+
*/
|
|
84
|
+
_playInSequenceAndThen(animations, func) {
|
|
67
85
|
this.stop();
|
|
68
86
|
let removeSelf = () => { };
|
|
69
87
|
let animationCount = 0;
|
|
@@ -75,6 +93,7 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
75
93
|
if (animations[animationCount])
|
|
76
94
|
this.play(animations[animationCount])
|
|
77
95
|
else {
|
|
96
|
+
func && func();
|
|
78
97
|
removeSelf();
|
|
79
98
|
}
|
|
80
99
|
}
|
|
@@ -85,29 +104,6 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
85
104
|
this.play(animations[0]);
|
|
86
105
|
}
|
|
87
106
|
|
|
88
|
-
/**
|
|
89
|
-
* play spine animations in sequence and execute function after last animation completes
|
|
90
|
-
* @param {String[]} animations - names of the animations to be played
|
|
91
|
-
* @param {Function} func - function to be executed
|
|
92
|
-
*/
|
|
93
|
-
playInSequenceAndThen(animations, func) {
|
|
94
|
-
let animationsLeft = animations.length;
|
|
95
|
-
let removeSelf = () => { };
|
|
96
|
-
|
|
97
|
-
let completer = {
|
|
98
|
-
complete: () => {
|
|
99
|
-
if (--animationsLeft === 0) {
|
|
100
|
-
func && func();
|
|
101
|
-
removeSelf();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
removeSelf = () => this._baseObject.state.removeListener(completer);
|
|
107
|
-
this._baseObject.state.addListener(completer);
|
|
108
|
-
this.playInSequence(animations);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
107
|
/**
|
|
112
108
|
* stop track animation
|
|
113
109
|
* @param {Number} [track] - you can define track number to stop
|
|
@@ -192,7 +188,7 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
192
188
|
findSlot(name) {
|
|
193
189
|
return this._baseObject.skeleton.findSlot(name)
|
|
194
190
|
}
|
|
195
|
-
|
|
191
|
+
|
|
196
192
|
/**
|
|
197
193
|
* returns skeleton's bone by it's name
|
|
198
194
|
* @param {string} name
|
|
@@ -211,7 +207,7 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
211
207
|
return this._baseObject.spineData.findAnimation(name)
|
|
212
208
|
}
|
|
213
209
|
|
|
214
|
-
|
|
210
|
+
|
|
215
211
|
/**
|
|
216
212
|
* returns event from spineData by it's name
|
|
217
213
|
* @param {string} name
|