@urso/core 0.6.10 → 0.7.0
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/_info.js +1 -0
- package/src/js/components/editor/api.js +43 -8
- package/src/js/components/editor/controller.js +1 -1
- package/src/js/modules/scenes/pixiWrapper.js +1 -1
- package/src/js/modules/scenes/service.js +1 -1
- package/src/js/modules/template/service.js +1 -1
package/package.json
CHANGED
|
@@ -5,6 +5,15 @@ class ComponentsEditorApi {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//styles
|
|
8
|
+
//TODO
|
|
9
|
+
addStyle() {
|
|
10
|
+
//TODO
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getCurrentStyles() {
|
|
14
|
+
const template = Urso.template.get();
|
|
15
|
+
return template.styles;
|
|
16
|
+
}
|
|
8
17
|
|
|
9
18
|
|
|
10
19
|
//assets
|
|
@@ -29,25 +38,41 @@ class ComponentsEditorApi {
|
|
|
29
38
|
|
|
30
39
|
/**
|
|
31
40
|
* add new asset into game
|
|
32
|
-
* @param {String}
|
|
33
|
-
* @param {
|
|
41
|
+
* @param {String} assetModel
|
|
42
|
+
* @param {Function} callback
|
|
34
43
|
*/
|
|
35
|
-
addAsset(
|
|
36
|
-
|
|
44
|
+
addAsset(assetModel, callback) {
|
|
45
|
+
Urso.assets.preload([assetModel], callback);
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
|
|
40
49
|
//objects
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* get current objects list
|
|
53
|
+
* @returns {Array} objects list
|
|
54
|
+
*/
|
|
41
55
|
getCurrentObjects() {
|
|
42
|
-
|
|
56
|
+
const template = Urso.template.get();
|
|
57
|
+
return template.objects;
|
|
43
58
|
}
|
|
44
59
|
|
|
60
|
+
/**
|
|
61
|
+
* returns types list and keys to create new object
|
|
62
|
+
* @returns { types, keys }
|
|
63
|
+
*/
|
|
45
64
|
getObjectsTypes() {
|
|
46
|
-
|
|
65
|
+
const types = Urso.types.objects;
|
|
66
|
+
return { types, keys: this._objectsKeys };
|
|
47
67
|
}
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
/**
|
|
70
|
+
* add new object into game
|
|
71
|
+
* @param {Object} objectModel
|
|
72
|
+
* @param {Object} parent
|
|
73
|
+
*/
|
|
74
|
+
addObject(objectModel, parent) {
|
|
75
|
+
Urso.objects.create(objectModel, parent);
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
//settings
|
|
@@ -67,6 +92,16 @@ class ComponentsEditorApi {
|
|
|
67
92
|
SPINE: ['key', 'path'], // path to json file
|
|
68
93
|
}
|
|
69
94
|
|
|
95
|
+
_commonObjectsKeys = ['id', 'name', 'class', 'x', 'y', 'z', 'anchorX', 'anchorY', 'scaleX', 'scaleY', 'angle', 'visible', 'alpha'];
|
|
96
|
+
|
|
97
|
+
_objectsKeys = {
|
|
98
|
+
BITMAPTEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, ['text', 'fontName', 'fontSize']),
|
|
99
|
+
COMPONENT: Urso.helper.mergeArrays(this._commonObjectsKeys, ['componentName']),
|
|
100
|
+
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'])
|
|
104
|
+
}
|
|
70
105
|
}
|
|
71
106
|
|
|
72
107
|
module.exports = ComponentsEditorApi;
|
|
@@ -42,7 +42,7 @@ class ModulesScenesPixiWrapper {
|
|
|
42
42
|
this._createWorld();
|
|
43
43
|
|
|
44
44
|
// setup interaction
|
|
45
|
-
this.interaction = new PIXI.InteractionManager(this.renderer);
|
|
45
|
+
this.interaction = Urso.helper.recursiveGet('plugins.interaction', this.renderer) || new PIXI.InteractionManager(this.renderer);
|
|
46
46
|
|
|
47
47
|
this._loaderScene = this.getInstance('Model');
|
|
48
48
|
this._requestAnimFrame(this._loop);
|
|
@@ -58,7 +58,7 @@ class ModulesScenesService {
|
|
|
58
58
|
|
|
59
59
|
if (newTemplatePart.assets.length) {
|
|
60
60
|
Urso.assets.preload(newTemplatePart.assets, () => this._newTemplateAssetsLoadedHandler(newTemplatePart, parent, doNotRefreshStylesFlag));
|
|
61
|
-
return null; //objects will be created soon. Maybe we can return a promice
|
|
61
|
+
return null; //objects will be created soon. Maybe we can return a promice //todo
|
|
62
62
|
} else
|
|
63
63
|
return this._newTemplateAssetsLoadedHandler(newTemplatePart, parent, doNotRefreshStylesFlag);
|
|
64
64
|
}
|
|
@@ -87,7 +87,7 @@ class ModulesTemplateService {
|
|
|
87
87
|
let componentInstance = Urso.getInstance(path, obj.options);
|
|
88
88
|
|
|
89
89
|
if (!componentInstance) {
|
|
90
|
-
Urso.logger.error(`ModulesTemplateController Component error. Component ${obj.componentName} not found. Please check components _info.js file.`);
|
|
90
|
+
Urso.logger.error(`ModulesTemplateController Component error. Component "${obj.componentName}" not found. Please check components _info.js file.`);
|
|
91
91
|
Urso.logger.error(`To use only templates use Groups please.`);
|
|
92
92
|
}
|
|
93
93
|
|