@urso/core 0.2.7 → 0.3.2
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/build/js/index.js.LICENSE.txt +75 -47
- package/package.json +4 -5
- package/src/js/app.js +3 -2
- package/src/js/config/main.js +2 -1
- package/src/js/extra/_info.js +1 -3
- package/src/js/lib/helper.js +17 -2
- package/src/js/modules/assets/controller.js +5 -3
- package/src/js/modules/assets/models/_info.js +0 -1
- package/src/js/modules/assets/service.js +19 -22
- package/src/js/modules/instances/controller.js +2 -1
- package/src/js/modules/logic/_info.js +0 -1
- package/src/js/modules/logic/config/_info.js +0 -1
- package/src/js/modules/objects/controller.js +6 -0
- package/src/js/modules/objects/create.js +33 -49
- package/src/js/modules/objects/models/_info.js +0 -1
- package/src/js/modules/objects/models/checkbox.js +1 -1
- package/src/js/modules/objects/models/slider.js +1 -1
- package/src/js/modules/objects/models/toggle.js +1 -1
- package/src/js/modules/observer/events.js +3 -0
- package/src/js/modules/scenes/resolutions.js +8 -1
- package/src/js/modules/statesManager/action.js +5 -0
- package/src/js/modules/statesManager/controller.js +2 -3
- package/src/js/modules/statesManager/race.js +3 -3
- package/src/js/modules/template/types.js +8 -10
- package/src/js/modules/transport/service.js +3 -1
- package/src/js/modules/assets/models/dragonBones.js +0 -27
- package/src/js/modules/logic/buttons.js +0 -120
- package/src/js/modules/logic/config/buttons.js +0 -63
- package/src/js/modules/objects/models/dragonBones.js +0 -250
|
@@ -27,127 +27,131 @@ object-assign
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
/*!
|
|
30
|
-
* @pixi/
|
|
31
|
-
* Compiled Mon,
|
|
30
|
+
* @pixi-spine/loader-base - v3.0.13
|
|
31
|
+
* Compiled Mon, 13 Sep 2021 16:46:34 UTC
|
|
32
|
+
*
|
|
33
|
+
* @pixi-spine/loader-base is licensed under the MIT License.
|
|
34
|
+
* http://www.opensource.org/licenses/mit-license
|
|
35
|
+
*
|
|
36
|
+
* Copyright 2019-2020, Ivan Igorevich Popelyshev <ivan.popelyshev@gmail.com>, All Rights Reserved
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*!
|
|
40
|
+
* @pixi-spine/runtime-3.8 - v3.0.13
|
|
41
|
+
* Compiled Mon, 13 Sep 2021 16:46:34 UTC
|
|
42
|
+
*
|
|
43
|
+
* @pixi-spine/runtime-3.8 is licensed under the MIT License.
|
|
44
|
+
* http://www.opensource.org/licenses/mit-license
|
|
45
|
+
*
|
|
46
|
+
* Copyright 2019-2020, Ivan Igorevich Popelyshev <ivan.popelyshev@gmail.com>, All Rights Reserved
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/*!
|
|
50
|
+
* @pixi/constants - v6.2.0
|
|
51
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
32
52
|
*
|
|
33
53
|
* @pixi/constants is licensed under the MIT License.
|
|
34
54
|
* http://www.opensource.org/licenses/mit-license
|
|
35
55
|
*/
|
|
36
56
|
|
|
37
57
|
/*!
|
|
38
|
-
* @pixi/core -
|
|
39
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
58
|
+
* @pixi/core - v6.2.0
|
|
59
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
40
60
|
*
|
|
41
61
|
* @pixi/core is licensed under the MIT License.
|
|
42
62
|
* http://www.opensource.org/licenses/mit-license
|
|
43
63
|
*/
|
|
44
64
|
|
|
45
65
|
/*!
|
|
46
|
-
* @pixi/display -
|
|
47
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
66
|
+
* @pixi/display - v6.2.0
|
|
67
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
48
68
|
*
|
|
49
69
|
* @pixi/display is licensed under the MIT License.
|
|
50
70
|
* http://www.opensource.org/licenses/mit-license
|
|
51
71
|
*/
|
|
52
72
|
|
|
53
73
|
/*!
|
|
54
|
-
* @pixi/extract -
|
|
55
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
74
|
+
* @pixi/extract - v6.2.0
|
|
75
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
56
76
|
*
|
|
57
77
|
* @pixi/extract is licensed under the MIT License.
|
|
58
78
|
* http://www.opensource.org/licenses/mit-license
|
|
59
79
|
*/
|
|
60
80
|
|
|
61
81
|
/*!
|
|
62
|
-
* @pixi/filter-displacement -
|
|
63
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
82
|
+
* @pixi/filter-displacement - v6.2.0
|
|
83
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
64
84
|
*
|
|
65
85
|
* @pixi/filter-displacement is licensed under the MIT License.
|
|
66
86
|
* http://www.opensource.org/licenses/mit-license
|
|
67
87
|
*/
|
|
68
88
|
|
|
69
89
|
/*!
|
|
70
|
-
* @pixi/loaders -
|
|
71
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
90
|
+
* @pixi/loaders - v6.2.0
|
|
91
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
72
92
|
*
|
|
73
93
|
* @pixi/loaders is licensed under the MIT License.
|
|
74
94
|
* http://www.opensource.org/licenses/mit-license
|
|
75
95
|
*/
|
|
76
96
|
|
|
77
97
|
/*!
|
|
78
|
-
* @pixi/math -
|
|
79
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
98
|
+
* @pixi/math - v6.2.0
|
|
99
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
80
100
|
*
|
|
81
101
|
* @pixi/math is licensed under the MIT License.
|
|
82
102
|
* http://www.opensource.org/licenses/mit-license
|
|
83
103
|
*/
|
|
84
104
|
|
|
85
105
|
/*!
|
|
86
|
-
* @pixi/
|
|
87
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
88
|
-
*
|
|
89
|
-
* @pixi/mesh-extras is licensed under the MIT License.
|
|
90
|
-
* http://www.opensource.org/licenses/mit-license
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/*!
|
|
94
|
-
* @pixi/mixin-get-child-by-name - v5.3.11
|
|
95
|
-
* Compiled Mon, 01 Nov 2021 16:10:12 UTC
|
|
106
|
+
* @pixi/mixin-get-child-by-name - v6.2.0
|
|
107
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
96
108
|
*
|
|
97
109
|
* @pixi/mixin-get-child-by-name is licensed under the MIT License.
|
|
98
110
|
* http://www.opensource.org/licenses/mit-license
|
|
99
111
|
*/
|
|
100
112
|
|
|
101
113
|
/*!
|
|
102
|
-
* @pixi/mixin-get-global-position -
|
|
103
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
114
|
+
* @pixi/mixin-get-global-position - v6.2.0
|
|
115
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
104
116
|
*
|
|
105
117
|
* @pixi/mixin-get-global-position is licensed under the MIT License.
|
|
106
118
|
* http://www.opensource.org/licenses/mit-license
|
|
107
119
|
*/
|
|
108
120
|
|
|
109
121
|
/*!
|
|
110
|
-
* @pixi/polyfill -
|
|
111
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
122
|
+
* @pixi/polyfill - v6.2.0
|
|
123
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
112
124
|
*
|
|
113
125
|
* @pixi/polyfill is licensed under the MIT License.
|
|
114
126
|
* http://www.opensource.org/licenses/mit-license
|
|
115
127
|
*/
|
|
116
128
|
|
|
117
129
|
/*!
|
|
118
|
-
* @pixi/prepare -
|
|
119
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
130
|
+
* @pixi/prepare - v6.2.0
|
|
131
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
120
132
|
*
|
|
121
133
|
* @pixi/prepare is licensed under the MIT License.
|
|
122
134
|
* http://www.opensource.org/licenses/mit-license
|
|
123
135
|
*/
|
|
124
136
|
|
|
125
137
|
/*!
|
|
126
|
-
* @pixi/runner -
|
|
127
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
138
|
+
* @pixi/runner - v6.2.0
|
|
139
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
128
140
|
*
|
|
129
141
|
* @pixi/runner is licensed under the MIT License.
|
|
130
142
|
* http://www.opensource.org/licenses/mit-license
|
|
131
143
|
*/
|
|
132
144
|
|
|
133
145
|
/*!
|
|
134
|
-
* @pixi/ticker -
|
|
135
|
-
* Compiled Mon, 01 Nov 2021 16:10
|
|
146
|
+
* @pixi/ticker - v6.2.0
|
|
147
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
136
148
|
*
|
|
137
149
|
* @pixi/ticker is licensed under the MIT License.
|
|
138
150
|
* http://www.opensource.org/licenses/mit-license
|
|
139
151
|
*/
|
|
140
152
|
|
|
141
153
|
/*!
|
|
142
|
-
*
|
|
143
|
-
* Compiled Mon, 01 Nov 2021 16:10:12 UTC
|
|
144
|
-
*
|
|
145
|
-
* @pixi/utils is licensed under the MIT License.
|
|
146
|
-
* http://www.opensource.org/licenses/mit-license
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
/*!
|
|
150
|
-
* GSAP 3.8.0
|
|
154
|
+
* GSAP 3.9.0
|
|
151
155
|
* https://greensock.com
|
|
152
156
|
*
|
|
153
157
|
* @license Copyright 2008-2021, GreenSock. All rights reserved.
|
|
@@ -164,6 +168,16 @@ object-assign
|
|
|
164
168
|
* http://www.opensource.org/licenses/mit-license
|
|
165
169
|
*/
|
|
166
170
|
|
|
171
|
+
/*!
|
|
172
|
+
* pixi-spine - v3.0.13
|
|
173
|
+
* Compiled Mon, 13 Sep 2021 16:46:43 UTC
|
|
174
|
+
*
|
|
175
|
+
* pixi-spine is licensed under the MIT License.
|
|
176
|
+
* http://www.opensource.org/licenses/mit-license
|
|
177
|
+
*
|
|
178
|
+
* Copyright 2019-2020, Ivan Igorevich Popelyshev <ivan.popelyshev@gmail.com>, All Rights Reserved
|
|
179
|
+
*/
|
|
180
|
+
|
|
167
181
|
/*!
|
|
168
182
|
* pixi-viewport - v4.34.3
|
|
169
183
|
* Compiled Wed, 01 Dec 2021 19:28:04 UTC
|
|
@@ -175,14 +189,28 @@ object-assign
|
|
|
175
189
|
*/
|
|
176
190
|
|
|
177
191
|
/*!
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* Compiled Tue, 02 Jul 2019 14:06:18 UTC
|
|
192
|
+
* pixi.js - v6.2.0
|
|
193
|
+
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
|
|
181
194
|
*
|
|
182
|
-
*
|
|
195
|
+
* pixi.js is licensed under the MIT License.
|
|
183
196
|
* http://www.opensource.org/licenses/mit-license
|
|
184
197
|
*/
|
|
185
198
|
|
|
199
|
+
/*! *****************************************************************************
|
|
200
|
+
Copyright (c) Microsoft Corporation.
|
|
201
|
+
|
|
202
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
203
|
+
purpose with or without fee is hereby granted.
|
|
204
|
+
|
|
205
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
206
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
207
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
208
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
209
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
210
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
211
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
212
|
+
***************************************************************************** */
|
|
213
|
+
|
|
186
214
|
/*! *****************************************************************************
|
|
187
215
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
188
216
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urso/core",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "HTML5 game engine",
|
|
5
5
|
"main": "build/js/index.js",
|
|
6
6
|
"author": "Megbrimef",
|
|
@@ -27,12 +27,11 @@
|
|
|
27
27
|
"howler": "^2.2.1",
|
|
28
28
|
"pixi-particles": "^4.3.0",
|
|
29
29
|
"pixi-projection": "0.3.15",
|
|
30
|
-
"pixi-spine": "^2.1.11",
|
|
31
|
-
"pixi.js": "^5.1.3",
|
|
32
|
-
"pixi5-dragonbones": "5.7.0-2",
|
|
33
30
|
"pixi-scrollbox": "^2.3.1",
|
|
31
|
+
"pixi-spine": "^3.0.13",
|
|
32
|
+
"pixi-text-input": "^1.0.6",
|
|
34
33
|
"pixi-viewport": "^4.34.0",
|
|
35
|
-
"pixi
|
|
34
|
+
"pixi.js": "^6.2.0"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@babel/core": "^7.12.10",
|
package/src/js/app.js
CHANGED
|
@@ -44,8 +44,6 @@ class App {
|
|
|
44
44
|
|
|
45
45
|
//Modules
|
|
46
46
|
Urso.assets = Urso.getInstance('Modules.Assets.Controller');
|
|
47
|
-
Urso.buttons = Urso.getInstance('Modules.Buttons.Controller');
|
|
48
|
-
// TODO: CHECK FOR EVENT TO START COMMUNICATION WITH SERVER
|
|
49
47
|
Urso.transport = Urso.getInstance('Modules.Transport.Controller');
|
|
50
48
|
Urso.logic = Urso.getInstance('Modules.Logic.Controller');
|
|
51
49
|
Urso.objects = Urso.getInstance('Modules.Objects.Controller');
|
|
@@ -57,6 +55,9 @@ class App {
|
|
|
57
55
|
//set title
|
|
58
56
|
document.title = Urso.config.title;
|
|
59
57
|
|
|
58
|
+
//device type mode
|
|
59
|
+
Urso.addInstancesMode(!Urso.helper.mobileAndTabletCheck() ? 'desktop' : 'mobile');
|
|
60
|
+
|
|
60
61
|
//App.run
|
|
61
62
|
Urso.device.whenReady(() => {
|
|
62
63
|
Urso.assets.updateQuality();
|
package/src/js/config/main.js
CHANGED
|
@@ -3,7 +3,8 @@ let ConfigMain = {
|
|
|
3
3
|
mode: "development", // development/production/testing
|
|
4
4
|
extendingChain: ['Urso.Core'], //chain that will be set as Urso.Game
|
|
5
5
|
defaultScene: 'play', //default scene to display
|
|
6
|
-
useBinPath: false
|
|
6
|
+
useBinPath: false, // use assets from bin directory
|
|
7
|
+
useTransport: false // use transport module for connetcting with server
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
module.exports = ConfigMain;
|
package/src/js/extra/_info.js
CHANGED
|
@@ -6,12 +6,10 @@ import { DropShadowFilter } from '@pixi/filter-drop-shadow';
|
|
|
6
6
|
PIXI.filters['DropShadowFilter'] = DropShadowFilter;
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
require("pixi-spine");
|
|
9
|
+
window.PIXI.spine = require("pixi-spine");
|
|
10
10
|
require("pixi-projection");
|
|
11
11
|
require("pixi-text-input");
|
|
12
12
|
|
|
13
|
-
Urso.DragonBones = require("pixi5-dragonbones");
|
|
14
|
-
|
|
15
13
|
import { gsap } from 'gsap';
|
|
16
14
|
window.gsap = gsap;
|
|
17
15
|
|
package/src/js/lib/helper.js
CHANGED
|
@@ -123,6 +123,21 @@ class LibHelper {
|
|
|
123
123
|
return c;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Swap key with value in object
|
|
128
|
+
* @param {Object} obj
|
|
129
|
+
* @returns {Object}
|
|
130
|
+
*/
|
|
131
|
+
objectFlip(obj) {
|
|
132
|
+
const ret = {};
|
|
133
|
+
|
|
134
|
+
Object.keys(obj).forEach(key => {
|
|
135
|
+
ret[obj[key]] = key;
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return ret;
|
|
139
|
+
}
|
|
140
|
+
|
|
126
141
|
/**
|
|
127
142
|
* recursive set value to object by key
|
|
128
143
|
* @param {String} key
|
|
@@ -208,8 +223,8 @@ class LibHelper {
|
|
|
208
223
|
*/
|
|
209
224
|
transpose(matrix) {
|
|
210
225
|
return Object.keys(matrix[0])
|
|
211
|
-
|
|
212
|
-
|
|
226
|
+
.map(colNumber => matrix
|
|
227
|
+
.map(rowNumber => rowNumber[colNumber]));
|
|
213
228
|
}
|
|
214
229
|
|
|
215
230
|
/**
|
|
@@ -6,16 +6,18 @@ class ModulesAssetsController {
|
|
|
6
6
|
/**
|
|
7
7
|
* Update quality
|
|
8
8
|
*/
|
|
9
|
-
updateQuality(){
|
|
10
|
-
if(Urso.config.useBinPath){
|
|
9
|
+
updateQuality() {
|
|
10
|
+
if (Urso.config.useBinPath) {
|
|
11
11
|
this.getInstance('Service').updateQuality();
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
console.log('[ASSETS] Quality set to', this.getInstance('Service').getQuality());
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Current quality getter
|
|
17
19
|
*/
|
|
18
|
-
getQuality(){
|
|
20
|
+
getQuality() {
|
|
19
21
|
this.getInstance('Service').getQuality();
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -3,7 +3,6 @@ Urso.Core.Modules.Assets.Models = {
|
|
|
3
3
|
Atlas: require('./atlas.js'),
|
|
4
4
|
BitmapFont: require('./bitmapFont.js'),
|
|
5
5
|
Container: require('./container.js'),
|
|
6
|
-
DragonBones: require('./dragonBones.js'),
|
|
7
6
|
Image: require('./image.js'),
|
|
8
7
|
Json: require('./json.js'),
|
|
9
8
|
Sound: require('./sound.js'),
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
class ModulesAssetsService {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.singleton = true;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
this.assets = {};
|
|
6
6
|
|
|
7
7
|
this._currentQuality = 'auto';
|
|
8
8
|
this._addedAssetsCache = [];
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
getQuality(){
|
|
11
|
+
getQuality() {
|
|
12
12
|
return this._currentQuality;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
updateQuality(){
|
|
15
|
+
updateQuality() {
|
|
16
16
|
this._currentQuality = this._detectQuality();
|
|
17
|
-
Urso.addInstancesMode(this._currentQuality);
|
|
17
|
+
Urso.addInstancesMode(this._currentQuality + 'Quality');
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
sortAssets(assets) {
|
|
@@ -74,7 +74,7 @@ class ModulesAssetsService {
|
|
|
74
74
|
|
|
75
75
|
_processLoadedAtlases(group) {
|
|
76
76
|
const atlases = this.assets[group].filter(assetModel => assetModel.type === Urso.types.assets.ATLAS);
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
for (let assetModel of atlases) {
|
|
79
79
|
const assetKey = assetModel.key;
|
|
80
80
|
let imageData = Urso.cache.getAtlas(assetKey);
|
|
@@ -85,7 +85,7 @@ class ModulesAssetsService {
|
|
|
85
85
|
let texture = imageData.textures[i];
|
|
86
86
|
let newFilename = frame.filename;
|
|
87
87
|
|
|
88
|
-
if(frame.filename.indexOf('/') === -1)
|
|
88
|
+
if (frame.filename.indexOf('/') === -1)
|
|
89
89
|
newFilename = folderPath + '/' + frame.filename;
|
|
90
90
|
|
|
91
91
|
Urso.cache.addFile(newFilename, texture);
|
|
@@ -146,7 +146,7 @@ class ModulesAssetsService {
|
|
|
146
146
|
if (!imageData) {
|
|
147
147
|
//from atlas ?!
|
|
148
148
|
let texture = Urso.cache.getFile(assetModel.path);
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
if (!texture)
|
|
151
151
|
return Urso.logger.error('ModulesAssetsService process Loaded Image error: no image ', assetModel);
|
|
152
152
|
|
|
@@ -189,9 +189,6 @@ class ModulesAssetsService {
|
|
|
189
189
|
case Urso.types.assets.CONTAINER:
|
|
190
190
|
model = this.getInstance('Models.Container', asset)
|
|
191
191
|
break;
|
|
192
|
-
case Urso.types.assets.DRAGONBONES:
|
|
193
|
-
model = this.getInstance('Models.DragonBones', asset)
|
|
194
|
-
break;
|
|
195
192
|
case Urso.types.assets.ATLAS:
|
|
196
193
|
model = this.getInstance('Models.Atlas', asset)
|
|
197
194
|
break;
|
|
@@ -221,7 +218,7 @@ class ModulesAssetsService {
|
|
|
221
218
|
//set loadingGroup
|
|
222
219
|
model.loadingGroup = loadingGroup || model.loadingGroup || this.getInstance('Config').loadingGroups.initial;
|
|
223
220
|
|
|
224
|
-
//check if container
|
|
221
|
+
//check if container
|
|
225
222
|
if (model.contents) {
|
|
226
223
|
for (let content of model.contents) {
|
|
227
224
|
this._addAsset(content, model.loadingGroup);
|
|
@@ -256,7 +253,7 @@ class ModulesAssetsService {
|
|
|
256
253
|
this.loadGroup(groupName, () => { this._continueLazyLoad(step + 1); })
|
|
257
254
|
}
|
|
258
255
|
|
|
259
|
-
_qualityReducer(qualityFactors, widthFactor){
|
|
256
|
+
_qualityReducer(qualityFactors, widthFactor) {
|
|
260
257
|
return [(acc, val) => {
|
|
261
258
|
if (acc === null) {
|
|
262
259
|
return val;
|
|
@@ -268,24 +265,24 @@ class ModulesAssetsService {
|
|
|
268
265
|
const nextQuality = (currentQuality > qualityFactor && qualityFactor >= widthFactor)
|
|
269
266
|
|| (qualityFactor >= widthFactor && widthFactor > currentQuality)
|
|
270
267
|
|| (widthFactor >= qualityFactor && qualityFactor > currentQuality);
|
|
271
|
-
|
|
268
|
+
|
|
272
269
|
return nextQuality ? val : acc;
|
|
273
|
-
|
|
270
|
+
|
|
274
271
|
}, null]
|
|
275
272
|
}
|
|
276
273
|
|
|
277
|
-
_detectQuality(){
|
|
274
|
+
_detectQuality() {
|
|
278
275
|
const { qualityFactors } = this.getInstance('Config');
|
|
279
276
|
const userQuality = Urso.helper.parseGetParams()['quality'];
|
|
280
|
-
|
|
281
|
-
if(userQuality && qualityFactors[userQuality]){
|
|
277
|
+
|
|
278
|
+
if (userQuality && qualityFactors[userQuality]) {
|
|
282
279
|
return userQuality;
|
|
283
280
|
}
|
|
284
|
-
|
|
281
|
+
|
|
285
282
|
return this._calculateQuality(qualityFactors);
|
|
286
283
|
}
|
|
287
284
|
|
|
288
|
-
_calculateQuality(qualityFactors){
|
|
285
|
+
_calculateQuality(qualityFactors) {
|
|
289
286
|
const { android, iOS, iPad, macOS } = Urso.device;
|
|
290
287
|
const isMobile = android || iOS || iPad;
|
|
291
288
|
|
|
@@ -293,12 +290,12 @@ class ModulesAssetsService {
|
|
|
293
290
|
return 'high';
|
|
294
291
|
}
|
|
295
292
|
|
|
296
|
-
if(macOS && iPad) {
|
|
293
|
+
if (macOS && iPad) {
|
|
297
294
|
return 'medium';
|
|
298
295
|
}
|
|
299
296
|
|
|
300
297
|
const resCfg = Urso.getInstance('Modules.Scenes.ResolutionsConfig').contents[0];
|
|
301
|
-
|
|
298
|
+
|
|
302
299
|
const { devicePixelRatio } = window;
|
|
303
300
|
let { width, height } = screen;
|
|
304
301
|
|
|
@@ -311,7 +308,7 @@ class ModulesAssetsService {
|
|
|
311
308
|
}
|
|
312
309
|
|
|
313
310
|
const widthFactor = width / resCfg.width;
|
|
314
|
-
|
|
311
|
+
|
|
315
312
|
return Object
|
|
316
313
|
.keys(qualityFactors)
|
|
317
314
|
.reduce(...this._qualityReducer(qualityFactors, widthFactor));
|
|
@@ -29,7 +29,7 @@ class ModulesInstancesController {
|
|
|
29
29
|
return false;
|
|
30
30
|
|
|
31
31
|
this._modes.push(mode);
|
|
32
|
-
|
|
32
|
+
Urso.observer.emit(Urso.events.MODULES_INSTANCES_MODES_CHANGED);
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -40,6 +40,7 @@ class ModulesInstancesController {
|
|
|
40
40
|
return false;
|
|
41
41
|
|
|
42
42
|
this._modes.splice(index, 1);
|
|
43
|
+
Urso.observer.emit(Urso.events.MODULES_INSTANCES_MODES_CHANGED);
|
|
43
44
|
return true;
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -8,6 +8,7 @@ class ModulesObjectsController {
|
|
|
8
8
|
|
|
9
9
|
this._newResolutionHandler = this._newResolutionHandler.bind(this);
|
|
10
10
|
this._resetWorld = this._resetWorld.bind(this);
|
|
11
|
+
this._applyClassesToWorld = this._applyClassesToWorld.bind(this);
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
create(objects, parent, doNotRefreshStylesFlag) { //TODO parse template for assets and objects (groups, components)
|
|
@@ -106,9 +107,14 @@ class ModulesObjectsController {
|
|
|
106
107
|
this.getInstance('Create').resetWorld();
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
_applyClassesToWorld() {
|
|
111
|
+
this.getInstance('Create').applyClassesToWorld();
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
_subscribeOnce() {
|
|
110
115
|
this.addListener(Urso.events.MODULES_SCENES_NEW_RESOLUTION, this._newResolutionHandler, true);
|
|
111
116
|
this.addListener(Urso.events.MODULES_SCENES_NEW_SCENE_INIT, this._resetWorld, true);
|
|
117
|
+
this.addListener(Urso.events.MODULES_INSTANCES_MODES_CHANGED, this._applyClassesToWorld, true);
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
|
|
@@ -4,6 +4,7 @@ class ModulesObjectsCreate {
|
|
|
4
4
|
|
|
5
5
|
this._world = null;
|
|
6
6
|
this._counter = 0;
|
|
7
|
+
this._objectsTypesFlipped;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
_checkWorld() {
|
|
@@ -23,6 +24,7 @@ class ModulesObjectsCreate {
|
|
|
23
24
|
|
|
24
25
|
this.updateWorldBounds({ template: Urso.scenes.getTemplateSize() })
|
|
25
26
|
this.getInstance('Cache').reset();
|
|
27
|
+
this.applyClassesToWorld();
|
|
26
28
|
this._addToCache(proxy);
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -34,6 +36,23 @@ class ModulesObjectsCreate {
|
|
|
34
36
|
Urso.objects._safeSetValueToTarget(this._world, 'height', params.template.height);
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
applyClassesToWorld() {
|
|
40
|
+
if (!this._world) {
|
|
41
|
+
return; //world do not created yet
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//remove old classes
|
|
45
|
+
if (this._world.class) {
|
|
46
|
+
this._world.class.split(' ').forEach((className) => this._world.removeClass(className, true));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//apply new classes
|
|
50
|
+
Urso.getInstancesModes().forEach((className) => this._world.addClass(className, true));
|
|
51
|
+
|
|
52
|
+
//refresh styles
|
|
53
|
+
Urso.objects.refreshStyles();
|
|
54
|
+
}
|
|
55
|
+
|
|
37
56
|
_getUid() {
|
|
38
57
|
this._counter++;
|
|
39
58
|
return 'object_' + this._counter;
|
|
@@ -56,71 +75,36 @@ class ModulesObjectsCreate {
|
|
|
56
75
|
object.contents = []; //clear contents. We will put here just correct models
|
|
57
76
|
}
|
|
58
77
|
|
|
78
|
+
if (!this._objectsTypesFlipped)
|
|
79
|
+
this._objectsTypesFlipped = Urso.helper.objectFlip(Urso.types.objects);
|
|
80
|
+
|
|
59
81
|
//set uid
|
|
60
82
|
object._uid = this._getUid();
|
|
61
83
|
|
|
62
84
|
switch (object.type) {
|
|
63
|
-
|
|
64
|
-
model = this.getInstance('Models.BitmapText', object);
|
|
65
|
-
break;
|
|
66
|
-
case Urso.types.objects.BUTTON:
|
|
67
|
-
model = this.getInstance('Models.Button', object);
|
|
68
|
-
break;
|
|
69
|
-
case Urso.types.objects.COMPONENT:
|
|
70
|
-
model = this.getInstance('Models.Component', object);
|
|
71
|
-
break;
|
|
72
|
-
case Urso.types.objects.CONTAINER:
|
|
73
|
-
model = this.getInstance('Models.Container', object);
|
|
74
|
-
break;
|
|
75
|
-
case Urso.types.objects.DRAGONBONES:
|
|
76
|
-
model = this.getInstance('Models.DragonBones', object);
|
|
77
|
-
break;
|
|
78
|
-
case Urso.types.objects.GROUP:
|
|
79
|
-
model = this.getInstance('Models.Group', object);
|
|
80
|
-
break;
|
|
81
|
-
case Urso.types.objects.IMAGE:
|
|
82
|
-
model = this.getInstance('Models.Image', object);
|
|
83
|
-
break;
|
|
85
|
+
//exceptions with camelCase namings
|
|
84
86
|
case Urso.types.objects.ATLASIMAGE:
|
|
85
87
|
model = this.getInstance('Models.AtlasImage', object);
|
|
86
88
|
break;
|
|
87
|
-
case Urso.types.objects.
|
|
88
|
-
model = this.getInstance('Models.
|
|
89
|
-
break;
|
|
90
|
-
case Urso.types.objects.MASK:
|
|
91
|
-
model = this.getInstance('Models.Mask', object);
|
|
92
|
-
break;
|
|
93
|
-
case Urso.types.objects.SPINE:
|
|
94
|
-
model = this.getInstance('Models.Spine', object);
|
|
95
|
-
break;
|
|
96
|
-
case Urso.types.objects.TEXT:
|
|
97
|
-
model = this.getInstance('Models.Text', object);
|
|
98
|
-
break;
|
|
99
|
-
case Urso.types.objects.GRAPHICS:
|
|
100
|
-
model = this.getInstance('Models.Graphics', object);
|
|
89
|
+
case Urso.types.objects.BITMAPTEXT:
|
|
90
|
+
model = this.getInstance('Models.BitmapText', object);
|
|
101
91
|
break;
|
|
102
92
|
case Urso.types.objects.HITAREA:
|
|
103
93
|
model = this.getInstance('Models.HitArea', object);
|
|
104
94
|
break;
|
|
105
|
-
case Urso.types.objects.
|
|
106
|
-
model = this.getInstance('Models.
|
|
107
|
-
break;
|
|
108
|
-
case Urso.types.objects.SLIDER:
|
|
109
|
-
model = this.getInstance('Models.Slider', object);
|
|
110
|
-
break;
|
|
111
|
-
case Urso.types.objects.TOGGLE:
|
|
112
|
-
model = this.getInstance('Models.Toggle', object);
|
|
113
|
-
break;
|
|
114
|
-
case Urso.types.objects.CHECKBOX:
|
|
115
|
-
model = this.getInstance('Models.Checkbox', object);
|
|
116
|
-
break;
|
|
117
|
-
case Urso.types.objects.SCROLLBOX:
|
|
118
|
-
model = this.getInstance('Models.Scrollbox', object);
|
|
95
|
+
case Urso.types.objects.IMAGES_ANIMATION:
|
|
96
|
+
model = this.getInstance('Models.ImagesAnimation', object);
|
|
119
97
|
break;
|
|
120
98
|
case Urso.types.objects.TEXTINPUT:
|
|
121
99
|
model = this.getInstance('Models.TextInput', object);
|
|
122
100
|
break;
|
|
101
|
+
|
|
123
102
|
default:
|
|
103
|
+
const objectName = Urso.helper.capitaliseFirstLetter(
|
|
104
|
+
this._objectsTypesFlipped[object.type].toLowerCase()
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
model = this.getInstance(`Models.${objectName}`, object);
|
|
124
108
|
break;
|
|
125
109
|
}
|
|
126
110
|
|
|
@@ -6,7 +6,6 @@ Urso.Core.Modules.Objects.Models = {
|
|
|
6
6
|
Collection: require('./collection.js'),
|
|
7
7
|
Component: require('./component.js'),
|
|
8
8
|
Container: require('./container.js'),
|
|
9
|
-
DragonBones: require('./dragonBones.js'),
|
|
10
9
|
Emitter: require('./emitter.js'),
|
|
11
10
|
Graphics: require('./graphics.js'),
|
|
12
11
|
Group: require('./group.js'),
|