@safe-engine/cocos 1.9.5 → 1.10.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.
Files changed (60) hide show
  1. package/dist/app.d.ts +1 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +6 -7
  4. package/dist/core/NodeComp.d.ts +4 -11
  5. package/dist/core/NodeComp.d.ts.map +1 -1
  6. package/dist/core/NodeComp.js +18 -15
  7. package/dist/gui/GUIComponent.d.ts +6 -31
  8. package/dist/gui/GUIComponent.d.ts.map +1 -1
  9. package/dist/gui/GUIComponent.js +3 -22
  10. package/dist/gui/GUISystem.d.ts +0 -2
  11. package/dist/gui/GUISystem.d.ts.map +1 -1
  12. package/dist/gui/GUISystem.js +9 -17
  13. package/dist/helper/action.d.ts +2 -0
  14. package/dist/helper/action.d.ts.map +1 -1
  15. package/dist/helper/action.js +6 -0
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +0 -1
  19. package/dist/polyfills.d.ts +0 -1
  20. package/dist/polyfills.d.ts.map +1 -1
  21. package/dist/polyfills.js +0 -3
  22. package/dist/spine/CCSkeleton.d.ts +188 -1
  23. package/dist/spine/CCSkeleton.d.ts.map +1 -1
  24. package/dist/spine/CCSkeleton.js +103 -127
  25. package/dist/spine/CCSkeletonAnimation.d.ts +136 -6
  26. package/dist/spine/CCSkeletonAnimation.d.ts.map +1 -1
  27. package/dist/spine/CCSkeletonAnimation.js +95 -101
  28. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -1
  29. package/dist/spine/CCSkeletonCanvasRenderCmd.js +6 -3
  30. package/dist/spine/CCSkeletonTexture.d.ts +24 -1
  31. package/dist/spine/CCSkeletonTexture.d.ts.map +1 -1
  32. package/dist/spine/CCSkeletonTexture.js +4 -6
  33. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +27 -1
  34. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +1 -1
  35. package/dist/spine/CCSkeletonWebGLRenderCmd.js +243 -247
  36. package/dist/spine/index.d.ts +4 -8
  37. package/dist/spine/index.d.ts.map +1 -1
  38. package/dist/spine/index.js +5 -11
  39. package/package.json +3 -1
  40. package/dist/core/index.d.ts +0 -6
  41. package/dist/core/index.d.ts.map +0 -1
  42. package/dist/core/index.js +0 -5
  43. package/dist/gworld/EnhancedComponent.d.ts +0 -22
  44. package/dist/gworld/EnhancedComponent.d.ts.map +0 -1
  45. package/dist/gworld/EnhancedComponent.js +0 -44
  46. package/dist/gworld/NodeComp.d.ts +0 -153
  47. package/dist/gworld/NodeComp.d.ts.map +0 -1
  48. package/dist/gworld/NodeComp.js +0 -337
  49. package/dist/gworld/NodePool.d.ts +0 -9
  50. package/dist/gworld/NodePool.d.ts.map +0 -1
  51. package/dist/gworld/NodePool.js +0 -23
  52. package/dist/gworld/Scene.d.ts +0 -5
  53. package/dist/gworld/Scene.d.ts.map +0 -1
  54. package/dist/gworld/Scene.js +0 -14
  55. package/dist/gworld/decorator.d.ts +0 -8
  56. package/dist/gworld/decorator.d.ts.map +0 -1
  57. package/dist/gworld/decorator.js +0 -12
  58. package/dist/gworld/index.d.ts +0 -8
  59. package/dist/gworld/index.d.ts.map +0 -1
  60. package/dist/gworld/index.js +0 -14
@@ -1 +1 @@
1
- {"version":3,"file":"CCSkeleton.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeleton.ts"],"names":[],"mappings":"AAkaA,eAAO,MAAM,QAAQ,KAAkB,CAAA"}
1
+ {"version":3,"file":"CCSkeleton.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeleton.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;8EAwB8E;AAE9E;;;;GAIG;AACH;;;;;;;;;GASG;AACH,qBAAa,QAAS,SAAQ,EAAE,CAAC,IAAI;IACnC,SAAS,MAAO;IAChB,SAAS,MAAO;IAChB,UAAU,SAAI;IACd,WAAW,UAAQ;IAC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AIG;IACH,eAAe,CAAC,YAAY,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG;IAcxD;;;;OAIG;IACH,eAAe,CAAC,gBAAgB,EAAE,GAAG;IAIrC;;;OAGG;IACH,YAAY,IAAI,GAAG;IAUnB;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG;IAKhC;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM;IAKjB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAG1E"}
@@ -31,9 +31,8 @@ import { WebGLRenderCmd } from './CCSkeletonWebGLRenderCmd';
31
31
  /**
32
32
  * The main namespace of Spine, all classes, functions, properties and constants of Spine are defined in this namespace
33
33
  * @namespace
34
- * @name gworld
34
+ * @name
35
35
  */
36
- var gworld = gworld || {};
37
36
  /**
38
37
  * <p>
39
38
  * The skeleton of Spine. <br/>
@@ -44,107 +43,96 @@ var gworld = gworld || {};
44
43
  * @class
45
44
  * @extends cc.Node
46
45
  */
47
- gworld.Skeleton = cc.Node.extend(
48
- /** @lends gworld.Skeleton# */ {
49
- _skeleton: null,
50
- _rootBone: null,
51
- _timeScale: 1,
52
- _debugSlots: false,
53
- _debugBones: false,
54
- _premultipliedAlpha: false,
55
- _ownsSkeletonData: null,
56
- _atlas: null,
57
- /**
58
- * The constructor of gworld.Skeleton. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
59
- */
60
- ctor: function (skeletonDataFile, atlasFile, scale) {
61
- cc.Node.prototype.ctor.call(this);
62
- if (arguments.length === 0)
63
- this.init();
64
- else
65
- this.initWithArgs(skeletonDataFile, atlasFile, scale);
66
- },
67
- _createRenderCmd: function () {
46
+ export class Skeleton extends cc.Node {
47
+ _skeleton = null;
48
+ _rootBone = null;
49
+ _timeScale = 1;
50
+ _debugSlots = false;
51
+ _debugBones = false;
52
+ _premultipliedAlpha;
53
+ _ownsSkeletonData = null;
54
+ _atlas = null;
55
+ constructor(skeletonDataFile, atlasFile, scale) {
56
+ super();
57
+ super.init();
58
+ this._premultipliedAlpha = cc._renderType === cc.game.RENDER_TYPE_WEBGL && cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA;
59
+ this.initWithArgs(skeletonDataFile, atlasFile, scale);
60
+ }
61
+ _createRenderCmd() {
68
62
  if (cc._renderType === cc.game.RENDER_TYPE_CANVAS)
69
63
  return new CanvasRenderCmd(this);
70
64
  else
71
65
  return new WebGLRenderCmd(this);
72
- },
73
- /**
74
- * Initializes a gworld.Skeleton. please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
75
- */
76
- init: function () {
77
- cc.Node.prototype.init.call(this);
78
- this._premultipliedAlpha = cc._renderType === cc.game.RENDER_TYPE_WEBGL && cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA;
79
- },
80
- onEnter: function () {
81
- cc.Node.prototype.onEnter.call(this);
66
+ }
67
+ onEnter() {
68
+ super.onEnter();
82
69
  this.scheduleUpdate();
83
- },
84
- onExit: function () {
70
+ }
71
+ onExit() {
85
72
  this.unscheduleUpdate();
86
- cc.Node.prototype.onExit.call(this);
87
- },
73
+ super.onExit();
74
+ }
88
75
  /**
89
76
  * Sets whether open debug slots.
90
77
  * @param {boolean} enable true to open, false to close.
91
78
  */
92
- setDebugSolots: function (enable) {
79
+ setDebugSolots(enable) {
93
80
  this._debugSlots = enable;
94
- },
81
+ }
95
82
  /**
96
83
  * Sets whether open debug bones.
97
84
  * @param {boolean} enable
98
85
  */
99
- setDebugBones: function (enable) {
86
+ setDebugBones(enable) {
100
87
  this._debugBones = enable;
101
- },
88
+ }
102
89
  /**
103
90
  * Sets whether open debug slots.
104
91
  * @param {boolean} enabled true to open, false to close.
105
92
  */
106
- setDebugSlotsEnabled: function (enabled) {
93
+ setDebugSlotsEnabled(enabled) {
107
94
  this._debugSlots = enabled;
108
- },
95
+ }
109
96
  /**
110
97
  * Gets whether open debug slots.
111
98
  * @returns {boolean} true to open, false to close.
112
99
  */
113
- getDebugSlotsEnabled: function () {
100
+ getDebugSlotsEnabled() {
114
101
  return this._debugSlots;
115
- },
102
+ }
116
103
  /**
117
104
  * Sets whether open debug bones.
118
105
  * @param {boolean} enabled
119
106
  */
120
- setDebugBonesEnabled: function (enabled) {
107
+ setDebugBonesEnabled(enabled) {
121
108
  this._debugBones = enabled;
122
- },
109
+ }
123
110
  /**
124
111
  * Gets whether open debug bones.
125
112
  * @returns {boolean} true to open, false to close.
126
113
  */
127
- getDebugBonesEnabled: function () {
114
+ getDebugBonesEnabled() {
128
115
  return this._debugBones;
129
- },
116
+ }
130
117
  /**
131
- * Sets the time scale of gworld.Skeleton.
118
+ * Sets the time scale of Skeleton.
132
119
  * @param {Number} scale
133
120
  */
134
- setTimeScale: function (scale) {
121
+ setTimeScale(scale) {
135
122
  this._timeScale = scale;
136
- },
137
- getTimeScale: function () {
123
+ }
124
+ getTimeScale() {
138
125
  return this._timeScale;
139
- },
126
+ }
140
127
  /**
141
- * Initializes gworld.Skeleton with Data.
142
- * @param {gworld.spine.SkeletonData|String} skeletonDataFile
128
+ * Initializes Skeleton with Data.
129
+ * @param {.spine.SkeletonData|String} skeletonDataFile
143
130
  * @param {String|spine.Atlas|spine.SkeletonData} atlasFile atlas filename or atlas data or owns SkeletonData
144
131
  * @param {Number} [scale] scale can be specified on the JSON or binary loader which will scale the bone positions, image sizes, and animation translations.
145
132
  */
146
- initWithArgs: function (skeletonDataFile, atlasFile, scale) {
147
- let argSkeletonFile = skeletonDataFile, argAtlasFile = atlasFile, skeletonData, atlas, ownsSkeletonData;
133
+ initWithArgs(skeletonDataFile, atlasFile, scale) {
134
+ const argSkeletonFile = skeletonDataFile, argAtlasFile = atlasFile;
135
+ let skeletonData, atlas, ownsSkeletonData;
148
136
  if (cc.isString(argSkeletonFile)) {
149
137
  if (cc.isString(argAtlasFile)) {
150
138
  const data = cc.loader.getRes(argAtlasFile);
@@ -170,14 +158,15 @@ gworld.Skeleton = cc.Node.extend(
170
158
  }
171
159
  this.setSkeletonData(skeletonData, ownsSkeletonData);
172
160
  this.init();
173
- },
161
+ }
174
162
  /**
175
- * Returns the bounding box of gworld.Skeleton.
163
+ * Returns the bounding box of Skeleton.
176
164
  * @returns {cc.Rect}
177
165
  */
178
- getBoundingBox: function () {
166
+ getBoundingBox() {
179
167
  let minX = cc.FLT_MAX, minY = cc.FLT_MAX, maxX = cc.FLT_MIN, maxY = cc.FLT_MIN;
180
- let scaleX = this.getScaleX(), scaleY = this.getScaleY(), vertices, slots = this._skeleton.slots, VERTEX = spine.RegionAttachment;
168
+ const scaleX = this.getScaleX(), scaleY = this.getScaleY(), slots = this._skeleton.slots, VERTEX = spine.RegionAttachment;
169
+ let vertices;
181
170
  for (let i = 0, slotCount = slots.length; i < slotCount; ++i) {
182
171
  const slot = slots[i];
183
172
  const attachment = slot.attachment;
@@ -192,92 +181,92 @@ gworld.Skeleton = cc.Node.extend(
192
181
  }
193
182
  const position = this.getPosition();
194
183
  return cc.rect(position.x + minX, position.y + minY, maxX - minX, maxY - minY);
195
- },
184
+ }
196
185
  /**
197
186
  * Computes the world SRT from the local SRT for each bone.
198
187
  */
199
- updateWorldTransform: function () {
188
+ updateWorldTransform() {
200
189
  this._skeleton.updateWorldTransform(true);
201
- },
190
+ }
202
191
  /**
203
192
  * Sets the bones and slots to the setup pose.
204
193
  */
205
- setToSetupPose: function () {
194
+ setToSetupPose() {
206
195
  this._skeleton.setToSetupPose();
207
- },
196
+ }
208
197
  /**
209
198
  * Sets the bones to the setup pose, using the values from the `BoneData` list in the `SkeletonData`.
210
199
  */
211
- setBonesToSetupPose: function () {
200
+ setBonesToSetupPose() {
212
201
  this._skeleton.setBonesToSetupPose();
213
- },
202
+ }
214
203
  /**
215
204
  * Sets the slots to the setup pose, using the values from the `SlotData` list in the `SkeletonData`.
216
205
  */
217
- setSlotsToSetupPose: function () {
206
+ setSlotsToSetupPose() {
218
207
  this._skeleton.setSlotsToSetupPose();
219
- },
208
+ }
220
209
  /**
221
210
  * Finds a bone by name. This does a string comparison for every bone.
222
211
  * @param {String} boneName
223
- * @returns {gworld.spine.Bone}
212
+ * @returns {.spine.Bone}
224
213
  */
225
- findBone: function (boneName) {
214
+ findBone(boneName) {
226
215
  return this._skeleton.findBone(boneName);
227
- },
216
+ }
228
217
  /**
229
218
  * Finds a slot by name. This does a string comparison for every slot.
230
219
  * @param {String} slotName
231
- * @returns {gworld.spine.Slot}
220
+ * @returns {.spine.Slot}
232
221
  */
233
- findSlot: function (slotName) {
222
+ findSlot(slotName) {
234
223
  return this._skeleton.findSlot(slotName);
235
- },
224
+ }
236
225
  /**
237
226
  * Finds a skin by name and makes it the active skin. This does a string comparison for every skin. Note that setting the skin does not change which attachments are visible.
238
227
  * @param {string} skinName
239
- * @returns {gworld.spine.Skin}
228
+ * @returns {.spine.Skin}
240
229
  */
241
- setSkin: function (skinName) {
230
+ setSkin(skinName) {
242
231
  return this._skeleton.setSkinByName(skinName);
243
- },
232
+ }
244
233
  /**
245
234
  * Returns the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.
246
235
  * @param {String} slotName
247
236
  * @param {String} attachmentName
248
- * @returns {gworld.spine.Attachment}
237
+ * @returns {.spine.Attachment}
249
238
  */
250
- getAttachment: function (slotName, attachmentName) {
239
+ getAttachment(slotName, attachmentName) {
251
240
  return this._skeleton.getAttachmentByName(slotName, attachmentName);
252
- },
241
+ }
253
242
  /**
254
243
  * Sets the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.
255
244
  * @param {String} slotName
256
245
  * @param {String} attachmentName
257
246
  */
258
- setAttachment: function (slotName, attachmentName) {
247
+ setAttachment(slotName, attachmentName) {
259
248
  this._skeleton.setAttachment(slotName, attachmentName);
260
- },
249
+ }
261
250
  /**
262
- * Sets the premultiplied alpha value to gworld.Skeleton.
251
+ * Sets the premultiplied alpha value to Skeleton.
263
252
  * @param {Number} alpha
264
253
  */
265
- setPremultipliedAlpha: function (premultiplied) {
254
+ setPremultipliedAlpha(premultiplied) {
266
255
  this._premultipliedAlpha = premultiplied;
267
- },
256
+ }
268
257
  /**
269
258
  * Returns whether to enable premultiplied alpha.
270
259
  * @returns {boolean}
271
260
  */
272
- isPremultipliedAlpha: function () {
261
+ isPremultipliedAlpha() {
273
262
  return this._premultipliedAlpha;
274
- },
263
+ }
275
264
  /**
276
- * Sets skeleton data to gworld.Skeleton.
277
- * @param {gworld.spine.SkeletonData} skeletonData
278
- * @param {gworld.spine.SkeletonData} ownsSkeletonData
265
+ * Sets skeleton data to Skeleton.
266
+ * @param {.spine.SkeletonData} skeletonData
267
+ * @param {.spine.SkeletonData} ownsSkeletonData
279
268
  */
280
- setSkeletonData: function (skeletonData, ownsSkeletonData) {
269
+ setSkeletonData(skeletonData, ownsSkeletonData) {
281
270
  if (skeletonData.width != null && skeletonData.height != null)
282
271
  this.setContentSize(skeletonData.width / cc.director.getContentScaleFactor(), skeletonData.height / cc.director.getContentScaleFactor());
283
272
  this._skeleton = new spine.Skeleton(skeletonData);
@@ -285,20 +274,20 @@ gworld.Skeleton = cc.Node.extend(
285
274
  this._rootBone = this._skeleton.getRootBone();
286
275
  this._ownsSkeletonData = ownsSkeletonData;
287
276
  this._renderCmd._createChildFormSkeletonData();
288
- },
277
+ }
289
278
  /**
290
279
  * Return the renderer of attachment.
291
- * @param {gworld.spine.RegionAttachment|gworld.spine.BoundingBoxAttachment} regionAttachment
292
- * @returns {gworld.spine.TextureAtlasRegion}
280
+ * @param {.spine.RegionAttachment|.spine.BoundingBoxAttachment} regionAttachment
281
+ * @returns {.spine.TextureAtlasRegion}
293
282
  */
294
- getTextureAtlas: function (regionAttachment) {
283
+ getTextureAtlas(regionAttachment) {
295
284
  return regionAttachment.region;
296
- },
285
+ }
297
286
  /**
298
- * Returns the blendFunc of gworld.Skeleton.
287
+ * Returns the blendFunc of Skeleton.
299
288
  * @returns {cc.BlendFunc}
300
289
  */
301
- getBlendFunc: function () {
290
+ getBlendFunc() {
302
291
  const slot = this._skeleton.drawOrder[0];
303
292
  if (slot) {
304
293
  const blend = this._renderCmd._getBlendFunc(slot.data.blendMode, this._premultipliedAlpha);
@@ -307,38 +296,25 @@ gworld.Skeleton = cc.Node.extend(
307
296
  else {
308
297
  return {};
309
298
  }
310
- },
311
- /**
312
- * Sets the blendFunc of gworld.Skeleton, it won't have any effect for skeleton, skeleton is using slot's data to determine the blend function.
313
- * @param {cc.BlendFunc|Number} src
314
- * @param {Number} [dst]
315
- */
316
- setBlendFunc: function (src, dst) {
299
+ }
300
+ setBlendFunc() {
317
301
  return;
318
- },
302
+ }
319
303
  /**
320
304
  * Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".
321
305
  * @param {Number} dt Delta time since last update
322
306
  */
323
- update: function (dt) {
307
+ update(dt) {
324
308
  this._skeleton.update(dt);
325
- },
326
- });
327
- cc.defineGetterSetter(gworld.Skeleton.prototype, 'opacityModifyRGB', gworld.Skeleton.prototype.isOpacityModifyRGB);
309
+ }
310
+ // Static create method
311
+ static create(skeletonDataFile, atlasFile, scale) {
312
+ return new Skeleton(skeletonDataFile, atlasFile, scale);
313
+ }
314
+ }
315
+ cc.defineGetterSetter(Skeleton.prototype, 'opacityModifyRGB', Skeleton.prototype.isOpacityModifyRGB);
328
316
  // For renderer webgl to identify skeleton's default texture and blend function
329
- cc.defineGetterSetter(gworld.Skeleton.prototype, '_blendFunc', gworld.Skeleton.prototype.getBlendFunc);
330
- cc.defineGetterSetter(gworld.Skeleton.prototype, '_texture', function () {
317
+ cc.defineGetterSetter(Skeleton.prototype, '_blendFunc', Skeleton.prototype.getBlendFunc);
318
+ cc.defineGetterSetter(Skeleton.prototype, '_texture', function () {
331
319
  return this._renderCmd._currTexture;
332
320
  });
333
- /**
334
- * Creates a skeleton object.
335
- * @deprecated since v3.0, please use new gworld.Skeleton(skeletonDataFile, atlasFile, scale) instead.
336
- * @param {spine.SkeletonData|String} skeletonDataFile
337
- * @param {String|spine.Atlas|spine.SkeletonData} atlasFile atlas filename or atlas data or owns SkeletonData
338
- * @param {Number} [scale] scale can be specified on the JSON or binary loader which will scale the bone positions, image sizes, and animation translations.
339
- * @returns {gworld.Skeleton}
340
- */
341
- gworld.Skeleton.create = function (skeletonDataFile, atlasFile /* or atlas*/, scale) {
342
- return new gworld.Skeleton(skeletonDataFile, atlasFile, scale);
343
- };
344
- export const Skeleton = gworld.Skeleton;
@@ -1,16 +1,146 @@
1
+ import { Skeleton } from './CCSkeleton';
2
+ /****************************************************************************
3
+ Copyright (c) 2011-2012 cocos2d-x.org
4
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
5
+ Copyright (c) 2014 Shengxiang Chen (Nero Chan)
6
+
7
+ http://www.cocos2d-x.org
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+ ****************************************************************************/
1
27
  export declare const _atlasLoader: {
2
28
  spAtlasFile: any;
3
29
  setAtlasFile: (spAtlasFile: any) => void;
4
30
  load: (line: any) => any;
5
- unload: (obj: any) => void;
31
+ unload: () => void;
6
32
  };
7
33
  /**
8
34
  * The skeleton animation of spine. It updates animation's state and skeleton's world transform.
9
35
  * @class
10
- * @extends gworld.Skeleton
11
- * @example
12
- * var spineBoy = new SkeletonAnimation('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
13
- * this.addChild(spineBoy, 4);
36
+ * @extends Skeleton
14
37
  */
15
- export declare const SkeletonAnimation: any;
38
+ export declare class SkeletonAnimation extends Skeleton {
39
+ _state: any;
40
+ _ownsAnimationStateData: boolean;
41
+ _listener: any;
42
+ constructor(skeletonDataFile?: any, atlasFile?: any, scale?: number);
43
+ /**
44
+ * Sets animation state data to SkeletonAnimation.
45
+ * @param {spine.AnimationStateData} stateData
46
+ */
47
+ setAnimationStateData(stateData: any): void;
48
+ /**
49
+ * Mix applies all keyframe values, interpolated for the specified time and mixed with the current values.
50
+ * @param {String} fromAnimation
51
+ * @param {String} toAnimation
52
+ * @param {Number} duration
53
+ */
54
+ setMix(fromAnimation: string, toAnimation: string, duration: number): void;
55
+ /**
56
+ * Sets event listener of SkeletonAnimation.
57
+ * @param {Object} target
58
+ * @param {Function} callback
59
+ */
60
+ setAnimationListener(target: any, callback: any): void;
61
+ /**
62
+ * Set the current animation. Any queued animations are cleared.
63
+ * @param {Number} trackIndex
64
+ * @param {String} name
65
+ * @param {Boolean} loop
66
+ * @returns {spine.TrackEntry|null}
67
+ */
68
+ setAnimation(trackIndex: number, name: string, loop: boolean): any;
69
+ /**
70
+ * Adds an animation to be played delay seconds after the current or last queued animation.
71
+ * @param {Number} trackIndex
72
+ * @param {String} name
73
+ * @param {Boolean} loop
74
+ * @param {Number} [delay=0]
75
+ * @returns {spine.TrackEntry|null}
76
+ */
77
+ addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): any;
78
+ /**
79
+ * Find animation with specified name
80
+ * @param {String} name
81
+ * @returns {spine.Animation|null}
82
+ */
83
+ findAnimation(name: string): any;
84
+ /**
85
+ * Returns track entry by trackIndex.
86
+ * @param trackIndex
87
+ * @returns {spine.TrackEntry|null}
88
+ */
89
+ getCurrent(trackIndex: number): any;
90
+ /**
91
+ * Clears all tracks of animation state.
92
+ */
93
+ clearTracks(): void;
94
+ /**
95
+ * Clears track of animation state by trackIndex.
96
+ * @param {Number} trackIndex
97
+ */
98
+ clearTrack(trackIndex: number): void;
99
+ /**
100
+ * Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".
101
+ * It updates animation's state and skeleton's world transform.
102
+ * @param {Number} dt Delta time since last update
103
+ * @override
104
+ */
105
+ update(dt: number): void;
106
+ /**
107
+ * Set the start event listener.
108
+ * @param {function} listener
109
+ */
110
+ setStartListener(listener: any): void;
111
+ /**
112
+ * Set the interrupt listener
113
+ * @param {function} listener
114
+ */
115
+ setInterruptListener(listener: any): void;
116
+ /**
117
+ * Set the end event listener.
118
+ * @param {function} listener
119
+ */
120
+ setEndListener(listener: any): void;
121
+ /**
122
+ * Set the dispose listener
123
+ * @param {function} listener
124
+ */
125
+ setDisposeListener(listener: any): void;
126
+ setCompleteListener(listener: any): void;
127
+ setEventListener(listener: any): void;
128
+ setTrackStartListener(entry: any, listener: any): void;
129
+ setTrackInterruptListener(entry: any, listener: any): void;
130
+ setTrackEndListener(entry: any, listener: any): void;
131
+ setTrackDisposeListener(entry: any, listener: any): void;
132
+ setTrackCompleteListener(entry: any, listener: any): void;
133
+ setTrackEventListener(entry: any, listener: any): void;
134
+ getState(): any;
135
+ /**
136
+ * Creates a skeleton animation object.
137
+ * @deprecated since v3.0, please use new SkeletonAnimation(skeletonDataFile, atlasFile, scale) instead.
138
+ * @param {spine.SkeletonData|String} skeletonDataFile
139
+ * @param {String|spine.Atlas|spine.SkeletonData} atlasFile atlas filename or atlas data or owns SkeletonData
140
+ * @param {Number} [scale]
141
+ * @returns {SkeletonAnimation}
142
+ */
143
+ static createWithJsonFile(skeletonDataFile: any, atlasFile: any, scale?: number): SkeletonAnimation;
144
+ static create(skeletonDataFile: any, atlasFile: any, scale?: number): SkeletonAnimation;
145
+ }
16
146
  //# sourceMappingURL=CCSkeletonAnimation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CCSkeletonAnimation.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonAnimation.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,YAAY;;;;;CAaxB,CAAA;AA2FD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,KAuM5B,CAAA"}
1
+ {"version":3,"file":"CCSkeletonAnimation.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;8EAwB8E;AAE9E,eAAO,MAAM,YAAY;;;;;CAaxB,CAAA;AAkGD;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,MAAM,EAAE,GAAG,CAAO;IAClB,uBAAuB,UAAQ;IAC/B,SAAS,EAAE,GAAG,CAAO;gBAET,gBAAgB,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM;IAMnE;;;OAGG;IACH,qBAAqB,CAAC,SAAS,EAAE,GAAG;IAOpC;;;;;OAKG;IACH,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAInE;;;;OAIG;IACH,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAM/C;;;;;;OAMG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAS5D;;;;;;;OAOG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EA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