@urso/core 0.4.36 → 0.4.39
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
|
@@ -35,6 +35,21 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
35
35
|
this._baseObject.state.setAnimation(track, animationName, loopFlag);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* set skin by name
|
|
40
|
+
* @param {String} skinName
|
|
41
|
+
*/
|
|
42
|
+
setSkinByName(skinName) {
|
|
43
|
+
this._baseObject.skeleton.setSkinByName(skinName);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* reset animation to first frame
|
|
48
|
+
*/
|
|
49
|
+
setToSetupPose() {
|
|
50
|
+
this._baseObject.skeleton.setToSetupPose();
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
/**
|
|
39
54
|
* play spine animation and execute function after animation completes
|
|
40
55
|
* @param {String} animation - name of the animation to be played
|
|
@@ -50,8 +65,24 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
50
65
|
*/
|
|
51
66
|
playInSequence(animations) {
|
|
52
67
|
this.stop();
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
let removeSelf = () => { };
|
|
69
|
+
let animationCount = 0;
|
|
70
|
+
|
|
71
|
+
const completer = {
|
|
72
|
+
complete: () => {
|
|
73
|
+
animationCount++;
|
|
74
|
+
|
|
75
|
+
if (animations[animationCount])
|
|
76
|
+
this.play(animations[animationCount])
|
|
77
|
+
else {
|
|
78
|
+
removeSelf();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
removeSelf = () => this._baseObject.state.removeListener(completer);
|
|
84
|
+
this._baseObject.state.addListener(completer);
|
|
85
|
+
this.play(animations[0]);
|
|
55
86
|
}
|
|
56
87
|
|
|
57
88
|
/**
|
|
@@ -62,14 +93,16 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
62
93
|
playInSequenceAndThen(animations, func) {
|
|
63
94
|
let animationsLeft = animations.length;
|
|
64
95
|
let removeSelf = () => { };
|
|
96
|
+
|
|
65
97
|
let completer = {
|
|
66
98
|
complete: () => {
|
|
67
99
|
if (--animationsLeft === 0) {
|
|
68
|
-
func();
|
|
100
|
+
func && func();
|
|
69
101
|
removeSelf();
|
|
70
102
|
}
|
|
71
103
|
}
|
|
72
104
|
};
|
|
105
|
+
|
|
73
106
|
removeSelf = () => this._baseObject.state.removeListener(completer);
|
|
74
107
|
this._baseObject.state.addListener(completer);
|
|
75
108
|
this.playInSequence(animations);
|
|
@@ -142,6 +175,52 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
142
175
|
}
|
|
143
176
|
}
|
|
144
177
|
|
|
178
|
+
/**
|
|
179
|
+
* returns skeleton's child by it's name
|
|
180
|
+
* @param {string} name
|
|
181
|
+
* @returns {DisplayObject}
|
|
182
|
+
*/
|
|
183
|
+
getChildByName(name) {
|
|
184
|
+
return this.children[this._baseObject.skeleton.findSlotIndex(name)];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* returns skeleton's slot by it's name
|
|
189
|
+
* @param {string} name
|
|
190
|
+
* @returns {Slot}
|
|
191
|
+
*/
|
|
192
|
+
findSlot(name) {
|
|
193
|
+
return this._baseObject.skeleton.findSlot(name)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* returns skeleton's bone by it's name
|
|
198
|
+
* @param {string} name
|
|
199
|
+
* @returns {Bone}
|
|
200
|
+
*/
|
|
201
|
+
findBone(name) {
|
|
202
|
+
return this._baseObject.skeleton.findBone(name)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* returns animation from spineData by it's name
|
|
207
|
+
* @param {string} name
|
|
208
|
+
* @returns {Animation}
|
|
209
|
+
*/
|
|
210
|
+
findAnimation(name) {
|
|
211
|
+
return this._baseObject.spineData.findAnimation(name)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* returns event from spineData by it's name
|
|
217
|
+
* @param {string} name
|
|
218
|
+
* @returns {EventData}
|
|
219
|
+
*/
|
|
220
|
+
findEvent(name) {
|
|
221
|
+
return this._baseObject.spineData.findEvent(name)
|
|
222
|
+
}
|
|
223
|
+
|
|
145
224
|
/**
|
|
146
225
|
* system function
|
|
147
226
|
* add object to pixi tree
|
|
@@ -79,7 +79,7 @@ class ModulesTemplateService {
|
|
|
79
79
|
this._mergeStylesAndAssets({ styles: groupTemplate.styles, assets: groupTemplate.assets })
|
|
80
80
|
|
|
81
81
|
//objects
|
|
82
|
-
obj.contents = groupTemplate.objects;
|
|
82
|
+
obj.contents = groupTemplate.objects || [];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
_processComponent(obj) {
|