@safe-engine/cocos 2.3.4 → 2.3.5

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 (80) hide show
  1. package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
  2. package/dist/box2d-wasm/PhysicsComponent.js +3 -0
  3. package/dist/box2d-wasm/PhysicsSprite.d.ts.map +1 -1
  4. package/dist/box2d-wasm/PhysicsSprite.js +2 -1
  5. package/dist/box2d-wasm/PhysicsSystem.d.ts +1 -0
  6. package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
  7. package/dist/box2d-wasm/PhysicsSystem.js +20 -16
  8. package/dist/box2d-wasm/debugDraw.d.ts +0 -15
  9. package/dist/box2d-wasm/debugDraw.d.ts.map +1 -1
  10. package/dist/box2d-wasm/debugDraw.js +8 -20
  11. package/dist/box2d-wasm/index.d.ts +19 -1
  12. package/dist/box2d-wasm/index.d.ts.map +1 -1
  13. package/dist/box2d-wasm/index.js +2 -2
  14. package/dist/core/index.d.ts +6 -0
  15. package/dist/core/index.d.ts.map +1 -0
  16. package/dist/core/index.js +5 -0
  17. package/dist/dragonbones/PixiDragonBonesSprite.d.ts +19 -0
  18. package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +1 -0
  19. package/dist/dragonbones/PixiDragonBonesSprite.js +75 -0
  20. package/dist/dragonbones/db-cocos/CocosFactory.d.ts +2 -3
  21. package/dist/dragonbones/db-cocos/CocosFactory.d.ts.map +1 -1
  22. package/dist/dragonbones/db-cocos/CocosFactory.js +4 -8
  23. package/dist/dragonbones/db-cocos/CocosSlot.d.ts +4 -1
  24. package/dist/dragonbones/db-cocos/CocosSlot.d.ts.map +1 -1
  25. package/dist/dragonbones/db-cocos/CocosSlot.js +35 -38
  26. package/dist/dragonbones/db-cocos/CocosTextureAtlasData.d.ts +1 -1
  27. package/dist/dragonbones/db-cocos/CocosTextureAtlasData.d.ts.map +1 -1
  28. package/dist/dragonbones/db-cocos/CocosTextureAtlasData.js +6 -6
  29. package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts +36 -0
  30. package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts.map +1 -0
  31. package/dist/dragonbones/db-cocos/SimpleMeshNode.js +354 -0
  32. package/dist/gworld/EnhancedComponent.d.ts +22 -0
  33. package/dist/gworld/EnhancedComponent.d.ts.map +1 -0
  34. package/dist/gworld/EnhancedComponent.js +44 -0
  35. package/dist/gworld/NodeComp.d.ts +153 -0
  36. package/dist/gworld/NodeComp.d.ts.map +1 -0
  37. package/dist/gworld/NodeComp.js +337 -0
  38. package/dist/gworld/NodePool.d.ts +9 -0
  39. package/dist/gworld/NodePool.d.ts.map +1 -0
  40. package/dist/gworld/NodePool.js +23 -0
  41. package/dist/gworld/Scene.d.ts +5 -0
  42. package/dist/gworld/Scene.d.ts.map +1 -0
  43. package/dist/gworld/Scene.js +14 -0
  44. package/dist/gworld/decorator.d.ts +8 -0
  45. package/dist/gworld/decorator.d.ts.map +1 -0
  46. package/dist/gworld/decorator.js +12 -0
  47. package/dist/gworld/index.d.ts +8 -0
  48. package/dist/gworld/index.d.ts.map +1 -0
  49. package/dist/gworld/index.js +14 -0
  50. package/dist/render/TiledSprite.d.ts +13 -0
  51. package/dist/render/TiledSprite.d.ts.map +1 -0
  52. package/dist/render/TiledSprite.js +69 -0
  53. package/dist/safex.d.ts +10 -0
  54. package/dist/safex.d.ts.map +1 -0
  55. package/dist/safex.js +1 -0
  56. package/dist/spine/CCSkeleton.d.ts +189 -0
  57. package/dist/spine/CCSkeleton.d.ts.map +1 -0
  58. package/dist/spine/CCSkeleton.js +320 -0
  59. package/dist/spine/CCSkeletonAnimation.d.ts +146 -0
  60. package/dist/spine/CCSkeletonAnimation.d.ts.map +1 -0
  61. package/dist/spine/CCSkeletonAnimation.js +311 -0
  62. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +2 -0
  63. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -0
  64. package/dist/spine/CCSkeletonCanvasRenderCmd.js +228 -0
  65. package/dist/spine/CCSkeletonTexture.d.ts +25 -0
  66. package/dist/spine/CCSkeletonTexture.d.ts.map +1 -0
  67. package/dist/spine/CCSkeletonTexture.js +60 -0
  68. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +28 -0
  69. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +1 -0
  70. package/dist/spine/CCSkeletonWebGLRenderCmd.js +277 -0
  71. package/dist/spine/PixiSpineSprite.d.ts +19 -0
  72. package/dist/spine/PixiSpineSprite.d.ts.map +1 -0
  73. package/dist/spine/PixiSpineSprite.js +72 -0
  74. package/dist/spine/spine-cocos/CCSkeletonAnimation.d.ts +2 -1
  75. package/dist/spine/spine-cocos/CCSkeletonAnimation.d.ts.map +1 -1
  76. package/dist/spine/spine-cocos/CCSkeletonAnimation.js +1 -1
  77. package/dist/spine/spine-cocos/CCSkeletonTexture.d.ts +12 -1
  78. package/dist/spine/spine-cocos/CCSkeletonTexture.d.ts.map +1 -1
  79. package/dist/spine/spine-cocos/CCSkeletonTexture.js +18 -19
  80. package/package.json +3 -3
@@ -0,0 +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
+ ****************************************************************************/
27
+ export declare const _atlasLoader: {
28
+ spAtlasFile: any;
29
+ setAtlasFile: (spAtlasFile: any) => void;
30
+ load: (line: any) => any;
31
+ unload: () => void;
32
+ };
33
+ /**
34
+ * The skeleton animation of spine. It updates animation's state and skeleton's world transform.
35
+ * @class
36
+ * @extends Skeleton
37
+ */
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
+ }
146
+ //# sourceMappingURL=CCSkeletonAnimation.d.ts.map
@@ -0,0 +1 @@
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,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM;IAU5E;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM;IAI7B;;OAEG;IACH,WAAW;IAIX;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM;IAI7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM;IAUjB;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,GAAG;IAI9B;;;OAGG;IACH,oBAAoB,CAAC,QAAQ,EAAE,GAAG;IAIlC;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,GAAG;IAI5B;;;OAGG;IACH,kBAAkB,CAAC,QAAQ,EAAE,GAAG;IAIhC,mBAAmB,CAAC,QAAQ,EAAE,GAAG;IAIjC,gBAAgB,CAAC,QAAQ,EAAE,GAAG;IAI9B,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAI/C,yBAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAInD,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAI7C,uBAAuB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAIjD,wBAAwB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAIlD,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAI/C,QAAQ;IAIR;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM;IAI/E,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM;CAGpE"}
@@ -0,0 +1,311 @@
1
+ import * as spine from '@esotericsoftware/spine-core';
2
+ import { Skeleton } from './CCSkeleton';
3
+ import { SkeletonTexture } from './CCSkeletonTexture';
4
+ /****************************************************************************
5
+ Copyright (c) 2011-2012 cocos2d-x.org
6
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
7
+ Copyright (c) 2014 Shengxiang Chen (Nero Chan)
8
+
9
+ http://www.cocos2d-x.org
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+ ****************************************************************************/
29
+ export const _atlasLoader = {
30
+ spAtlasFile: null,
31
+ setAtlasFile: function (spAtlasFile) {
32
+ this.spAtlasFile = spAtlasFile;
33
+ },
34
+ load: function (line) {
35
+ const texturePath = cc.path.join(cc.path.dirname(this.spAtlasFile), line);
36
+ const texture = cc.textureCache.addImage(texturePath);
37
+ const tex = new SkeletonTexture({ width: texture.getPixelsWide(), height: texture.getPixelsHigh() });
38
+ tex.setRealTexture(texture);
39
+ return tex;
40
+ },
41
+ unload: function () { },
42
+ };
43
+ /**
44
+ * The event type of spine skeleton animation. It contains event types: START(0), END(1), COMPLETE(2), EVENT(3).
45
+ * @constant
46
+ * @type {{START: number, END: number, COMPLETE: number, EVENT: number}}
47
+ */
48
+ const ANIMATION_EVENT_TYPE = {
49
+ START: 0,
50
+ INTERRUPT: 1,
51
+ END: 2,
52
+ DISPOSE: 3,
53
+ COMPLETE: 4,
54
+ EVENT: 5,
55
+ };
56
+ const TrackEntryListeners = function (startListener, endListener, completeListener, eventListener, interruptListener, disposeListener) {
57
+ this.startListener = startListener || null;
58
+ this.endListener = endListener || null;
59
+ this.completeListener = completeListener || null;
60
+ this.eventListener = eventListener || null;
61
+ this.interruptListener = interruptListener || null;
62
+ this.disposeListener = disposeListener || null;
63
+ this.callback = null;
64
+ this.callbackTarget = null;
65
+ this.skeletonNode = null;
66
+ };
67
+ const proto = TrackEntryListeners.prototype;
68
+ proto.start = function (trackEntry) {
69
+ if (this.startListener) {
70
+ this.startListener(trackEntry);
71
+ }
72
+ if (this.callback) {
73
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.START, null, 0);
74
+ }
75
+ };
76
+ proto.interrupt = function (trackEntry) {
77
+ if (this.interruptListener) {
78
+ this.interruptListener(trackEntry);
79
+ }
80
+ if (this.callback) {
81
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.INTERRUPT, null, 0);
82
+ }
83
+ };
84
+ proto.end = function (trackEntry) {
85
+ if (this.endListener) {
86
+ this.endListener(trackEntry);
87
+ }
88
+ if (this.callback) {
89
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.END, null, 0);
90
+ }
91
+ };
92
+ proto.dispose = function (trackEntry) {
93
+ if (this.disposeListener) {
94
+ this.disposeListener(trackEntry);
95
+ }
96
+ if (this.callback) {
97
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.DISPOSE, null, 0);
98
+ }
99
+ };
100
+ proto.complete = function (trackEntry) {
101
+ const loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
102
+ if (this.completeListener) {
103
+ this.completeListener(trackEntry, loopCount);
104
+ }
105
+ if (this.callback) {
106
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.COMPLETE, null, loopCount);
107
+ }
108
+ };
109
+ proto.event = function (trackEntry, event) {
110
+ if (this.eventListener) {
111
+ this.eventListener(trackEntry, event);
112
+ }
113
+ if (this.callback) {
114
+ this.callback.call(this.callbackTarget, this.skeletonNode, trackEntry, ANIMATION_EVENT_TYPE.EVENT, event, 0);
115
+ }
116
+ };
117
+ TrackEntryListeners.getListeners = function (entry) {
118
+ if (!entry.listener) {
119
+ entry.listener = new TrackEntryListeners();
120
+ }
121
+ return entry.listener;
122
+ };
123
+ /**
124
+ * The skeleton animation of spine. It updates animation's state and skeleton's world transform.
125
+ * @class
126
+ * @extends Skeleton
127
+ */
128
+ export class SkeletonAnimation extends Skeleton {
129
+ _state = null;
130
+ _ownsAnimationStateData = false;
131
+ _listener = null;
132
+ constructor(skeletonDataFile, atlasFile, scale) {
133
+ super(skeletonDataFile, atlasFile, scale);
134
+ this._ownsAnimationStateData = true;
135
+ this.setAnimationStateData(new spine.AnimationStateData(this._skeleton.data));
136
+ }
137
+ /**
138
+ * Sets animation state data to SkeletonAnimation.
139
+ * @param {spine.AnimationStateData} stateData
140
+ */
141
+ setAnimationStateData(stateData) {
142
+ const state = new spine.AnimationState(stateData);
143
+ this._listener = new TrackEntryListeners();
144
+ state.addListener(this._listener);
145
+ this._state = state;
146
+ }
147
+ /**
148
+ * Mix applies all keyframe values, interpolated for the specified time and mixed with the current values.
149
+ * @param {String} fromAnimation
150
+ * @param {String} toAnimation
151
+ * @param {Number} duration
152
+ */
153
+ setMix(fromAnimation, toAnimation, duration) {
154
+ this._state.data.setMixWith(fromAnimation, toAnimation, duration);
155
+ }
156
+ /**
157
+ * Sets event listener of SkeletonAnimation.
158
+ * @param {Object} target
159
+ * @param {Function} callback
160
+ */
161
+ setAnimationListener(target, callback) {
162
+ this._listener.callbackTarget = target;
163
+ this._listener.callback = callback;
164
+ this._listener.skeletonNode = this;
165
+ }
166
+ /**
167
+ * Set the current animation. Any queued animations are cleared.
168
+ * @param {Number} trackIndex
169
+ * @param {String} name
170
+ * @param {Boolean} loop
171
+ * @returns {spine.TrackEntry|null}
172
+ */
173
+ setAnimation(trackIndex, name, loop) {
174
+ const animation = this._skeleton.data.findAnimation(name);
175
+ if (!animation) {
176
+ cc.log(`Spine: Animation not found: ${name}`);
177
+ return null;
178
+ }
179
+ return this._state.setAnimationWith(trackIndex, animation, loop);
180
+ }
181
+ /**
182
+ * Adds an animation to be played delay seconds after the current or last queued animation.
183
+ * @param {Number} trackIndex
184
+ * @param {String} name
185
+ * @param {Boolean} loop
186
+ * @param {Number} [delay=0]
187
+ * @returns {spine.TrackEntry|null}
188
+ */
189
+ addAnimation(trackIndex, name, loop, delay) {
190
+ delay = delay == null ? 0 : delay;
191
+ const animation = this._skeleton.data.findAnimation(name);
192
+ if (!animation) {
193
+ cc.log(`Spine: Animation not found:${name}`);
194
+ return null;
195
+ }
196
+ return this._state.addAnimationWith(trackIndex, animation, loop, delay);
197
+ }
198
+ /**
199
+ * Find animation with specified name
200
+ * @param {String} name
201
+ * @returns {spine.Animation|null}
202
+ */
203
+ findAnimation(name) {
204
+ return this._skeleton.data.findAnimation(name);
205
+ }
206
+ /**
207
+ * Returns track entry by trackIndex.
208
+ * @param trackIndex
209
+ * @returns {spine.TrackEntry|null}
210
+ */
211
+ getCurrent(trackIndex) {
212
+ return this._state.getCurrent(trackIndex);
213
+ }
214
+ /**
215
+ * Clears all tracks of animation state.
216
+ */
217
+ clearTracks() {
218
+ this._state.clearTracks();
219
+ }
220
+ /**
221
+ * Clears track of animation state by trackIndex.
222
+ * @param {Number} trackIndex
223
+ */
224
+ clearTrack(trackIndex) {
225
+ this._state.clearTrack(trackIndex);
226
+ }
227
+ /**
228
+ * Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".
229
+ * It updates animation's state and skeleton's world transform.
230
+ * @param {Number} dt Delta time since last update
231
+ * @override
232
+ */
233
+ update(dt) {
234
+ super.update(dt);
235
+ dt *= this._timeScale;
236
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);
237
+ this._state.update(dt);
238
+ this._state.apply(this._skeleton);
239
+ this._skeleton.updateWorldTransform(true);
240
+ this._renderCmd._updateChild();
241
+ }
242
+ /**
243
+ * Set the start event listener.
244
+ * @param {function} listener
245
+ */
246
+ setStartListener(listener) {
247
+ this._listener.startListener = listener;
248
+ }
249
+ /**
250
+ * Set the interrupt listener
251
+ * @param {function} listener
252
+ */
253
+ setInterruptListener(listener) {
254
+ this._listener.interruptListener = listener;
255
+ }
256
+ /**
257
+ * Set the end event listener.
258
+ * @param {function} listener
259
+ */
260
+ setEndListener(listener) {
261
+ this._listener.endListener = listener;
262
+ }
263
+ /**
264
+ * Set the dispose listener
265
+ * @param {function} listener
266
+ */
267
+ setDisposeListener(listener) {
268
+ this._listener.disposeListener = listener;
269
+ }
270
+ setCompleteListener(listener) {
271
+ this._listener.completeListener = listener;
272
+ }
273
+ setEventListener(listener) {
274
+ this._listener.eventListener = listener;
275
+ }
276
+ setTrackStartListener(entry, listener) {
277
+ TrackEntryListeners.getListeners(entry).startListener = listener;
278
+ }
279
+ setTrackInterruptListener(entry, listener) {
280
+ TrackEntryListeners.getListeners(entry).interruptListener = listener;
281
+ }
282
+ setTrackEndListener(entry, listener) {
283
+ TrackEntryListeners.getListeners(entry).endListener = listener;
284
+ }
285
+ setTrackDisposeListener(entry, listener) {
286
+ TrackEntryListeners.getListeners(entry).disposeListener = listener;
287
+ }
288
+ setTrackCompleteListener(entry, listener) {
289
+ TrackEntryListeners.getListeners(entry).completeListener = listener;
290
+ }
291
+ setTrackEventListener(entry, listener) {
292
+ TrackEntryListeners.getListeners(entry).eventListener = listener;
293
+ }
294
+ getState() {
295
+ return this._state;
296
+ }
297
+ /**
298
+ * Creates a skeleton animation object.
299
+ * @deprecated since v3.0, please use new SkeletonAnimation(skeletonDataFile, atlasFile, scale) instead.
300
+ * @param {spine.SkeletonData|String} skeletonDataFile
301
+ * @param {String|spine.Atlas|spine.SkeletonData} atlasFile atlas filename or atlas data or owns SkeletonData
302
+ * @param {Number} [scale]
303
+ * @returns {SkeletonAnimation}
304
+ */
305
+ static createWithJsonFile(skeletonDataFile, atlasFile, scale) {
306
+ return new SkeletonAnimation(skeletonDataFile, atlasFile, scale);
307
+ }
308
+ static create(skeletonDataFile, atlasFile, scale) {
309
+ return new SkeletonAnimation(skeletonDataFile, atlasFile, scale);
310
+ }
311
+ }
@@ -0,0 +1,2 @@
1
+ export declare const CanvasRenderCmd: any;
2
+ //# sourceMappingURL=CCSkeletonCanvasRenderCmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CCSkeletonCanvasRenderCmd.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonCanvasRenderCmd.ts"],"names":[],"mappings":"AA2PA,eAAO,MAAM,eAAe,KAAyB,CAAA"}