@urso/core 0.6.11 → 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/package.json
CHANGED
|
@@ -3,7 +3,7 @@ Urso.Core.Components = {};
|
|
|
3
3
|
require('./base/_info.js');
|
|
4
4
|
require('./debug/_info.js');
|
|
5
5
|
require('./deviceRotate/_info.js');
|
|
6
|
-
|
|
6
|
+
require('./editor/_info.js');
|
|
7
7
|
require('./fullscreen/_info.js');
|
|
8
8
|
require('./layersSwitcher/_info.js');
|
|
9
9
|
require('./loader/_info.js');
|
|
@@ -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;
|
|
@@ -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
|
}
|