@urso/core 0.6.12 → 0.7.1
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');
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
class ComponentsEditorApi {
|
|
2
|
+
|
|
3
|
+
constructor() {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//styles
|
|
8
|
+
//TODO
|
|
9
|
+
addStyle() {
|
|
10
|
+
//TODO
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getCurrentStyles() {
|
|
14
|
+
const template = Urso.template.get();
|
|
15
|
+
return template.styles;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
//assets
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* returns types list and keys to create new asset
|
|
23
|
+
* @returns { types, keys }
|
|
24
|
+
*/
|
|
25
|
+
getAssetTypes() {
|
|
26
|
+
const types = Urso.types.assets;
|
|
27
|
+
return { types, keys: this._assetsKeys };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* get current assets list
|
|
32
|
+
* @returns {Array} assets list
|
|
33
|
+
*/
|
|
34
|
+
getCurrentAssets() {
|
|
35
|
+
const template = Urso.template.get();
|
|
36
|
+
return template.assets;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* add new asset into game
|
|
41
|
+
* @param {String} assetModel
|
|
42
|
+
* @param {Function} callback
|
|
43
|
+
*/
|
|
44
|
+
addAsset(assetModel, callback) {
|
|
45
|
+
Urso.assets.preload([assetModel], callback);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
//objects
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* get current objects list
|
|
53
|
+
* @returns {Array} objects list
|
|
54
|
+
*/
|
|
55
|
+
getCurrentObjects() {
|
|
56
|
+
const template = Urso.template.get();
|
|
57
|
+
return template.objects;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* returns types list and keys to create new object
|
|
62
|
+
* @returns { types, keys }
|
|
63
|
+
*/
|
|
64
|
+
getObjectsTypes() {
|
|
65
|
+
const types = Urso.types.objects;
|
|
66
|
+
return { types, keys: this._objectsKeys };
|
|
67
|
+
}
|
|
68
|
+
|
|
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);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//settings
|
|
79
|
+
editObject(id, key, value) {
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//////////////// sys
|
|
84
|
+
|
|
85
|
+
_assetsKeys = {
|
|
86
|
+
ATLAS: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
87
|
+
BITMAPFONT: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
88
|
+
CONTAINER: [{ name: 'key', type: 'text' }],
|
|
89
|
+
FONT: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
90
|
+
IMAGE: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
91
|
+
JSON: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
92
|
+
SPINE: [{ name: 'key', type: 'text' }, { name: 'path', type: 'file' }], // path to json file
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
_commonObjectsKeys = [
|
|
96
|
+
{ name: 'id', type: 'text' },
|
|
97
|
+
{ name: 'name', type: 'text' },
|
|
98
|
+
{ name: 'class', type: 'text' },
|
|
99
|
+
{ name: 'x', type: 'number' },
|
|
100
|
+
{ name: 'y', type: 'number' },
|
|
101
|
+
{ name: 'z', type: 'number' },
|
|
102
|
+
{ name: 'anchorX', type: 'number', range: [-1, 1] },
|
|
103
|
+
{ name: 'anchorY', type: 'number', range: [-1, 1] },
|
|
104
|
+
{ name: 'scaleX', type: 'number' },
|
|
105
|
+
{ name: 'scaleY', type: 'number' },
|
|
106
|
+
{ name: 'angle', type: 'number', range: [0, 360] },
|
|
107
|
+
{ name: 'alpha', type: 'number', range: [0, 1] },
|
|
108
|
+
{ name: 'visible', type: 'boolean' },
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
_objectsKeys = {
|
|
112
|
+
BITMAPTEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'text', type: 'text' }, { name: 'fontName', type: 'text' }, { name: 'fontSize', type: 'text' }]),
|
|
113
|
+
COMPONENT: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'componentName', type: 'text' }]),
|
|
114
|
+
CONTAINER: this._commonObjectsKeys,
|
|
115
|
+
GROUP: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'groupName', type: 'text' }]),
|
|
116
|
+
IMAGE: Urso.helper.mergeArrays(this._commonObjectsKeys, [{ name: 'assetKey', type: 'text' }]),
|
|
117
|
+
TEXT: Urso.helper.mergeArrays(this._commonObjectsKeys, [
|
|
118
|
+
{ name: 'text', type: 'text' },
|
|
119
|
+
{ name: 'fontFamily', type: 'text' },
|
|
120
|
+
{ name: 'fontSize', type: 'text' },
|
|
121
|
+
{ name: 'fill', type: 'text' },
|
|
122
|
+
{ name: 'stroke', type: 'text' }
|
|
123
|
+
])
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
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
|
+
Urso.helper.recursiveSet('_dev.editorApi', this._api, Urso);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = ComponentsEditorController;
|
|
@@ -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
|
}
|