@safe-engine/cocos 2.4.0 → 2.4.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 (61) hide show
  1. package/dist/chipmunk/PhysicsComponent.d.ts +1 -1
  2. package/dist/chipmunk/PhysicsComponent.d.ts.map +1 -1
  3. package/dist/chipmunk/PhysicsSystem.d.ts.map +1 -1
  4. package/dist/chipmunk/PhysicsSystem.js +15 -9
  5. package/dist/chipmunk/index.d.ts +2 -2
  6. package/dist/chipmunk/index.d.ts.map +1 -1
  7. package/dist/chipmunk/index.js +3 -2
  8. package/dist/core/Scene.d.ts.map +1 -1
  9. package/dist/core/Scene.js +4 -1
  10. package/dist/render/RenderSystem.d.ts +1 -2
  11. package/dist/render/RenderSystem.d.ts.map +1 -1
  12. package/dist/render/RenderSystem.js +0 -3
  13. package/package.json +2 -2
  14. package/dist/core/index.d.ts +0 -6
  15. package/dist/core/index.d.ts.map +0 -1
  16. package/dist/core/index.js +0 -5
  17. package/dist/dragonbones/PixiDragonBonesSprite.d.ts +0 -19
  18. package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +0 -1
  19. package/dist/dragonbones/PixiDragonBonesSprite.js +0 -75
  20. package/dist/gworld/EnhancedComponent.d.ts +0 -22
  21. package/dist/gworld/EnhancedComponent.d.ts.map +0 -1
  22. package/dist/gworld/EnhancedComponent.js +0 -44
  23. package/dist/gworld/NodeComp.d.ts +0 -153
  24. package/dist/gworld/NodeComp.d.ts.map +0 -1
  25. package/dist/gworld/NodeComp.js +0 -337
  26. package/dist/gworld/NodePool.d.ts +0 -9
  27. package/dist/gworld/NodePool.d.ts.map +0 -1
  28. package/dist/gworld/NodePool.js +0 -23
  29. package/dist/gworld/Scene.d.ts +0 -5
  30. package/dist/gworld/Scene.d.ts.map +0 -1
  31. package/dist/gworld/Scene.js +0 -14
  32. package/dist/gworld/decorator.d.ts +0 -8
  33. package/dist/gworld/decorator.d.ts.map +0 -1
  34. package/dist/gworld/decorator.js +0 -12
  35. package/dist/gworld/index.d.ts +0 -8
  36. package/dist/gworld/index.d.ts.map +0 -1
  37. package/dist/gworld/index.js +0 -14
  38. package/dist/render/TiledSprite.d.ts +0 -13
  39. package/dist/render/TiledSprite.d.ts.map +0 -1
  40. package/dist/render/TiledSprite.js +0 -69
  41. package/dist/safex.d.ts +0 -10
  42. package/dist/safex.d.ts.map +0 -1
  43. package/dist/safex.js +0 -1
  44. package/dist/spine/CCSkeleton.d.ts +0 -189
  45. package/dist/spine/CCSkeleton.d.ts.map +0 -1
  46. package/dist/spine/CCSkeleton.js +0 -320
  47. package/dist/spine/CCSkeletonAnimation.d.ts +0 -146
  48. package/dist/spine/CCSkeletonAnimation.d.ts.map +0 -1
  49. package/dist/spine/CCSkeletonAnimation.js +0 -311
  50. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +0 -2
  51. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +0 -1
  52. package/dist/spine/CCSkeletonCanvasRenderCmd.js +0 -228
  53. package/dist/spine/CCSkeletonTexture.d.ts +0 -25
  54. package/dist/spine/CCSkeletonTexture.d.ts.map +0 -1
  55. package/dist/spine/CCSkeletonTexture.js +0 -60
  56. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +0 -28
  57. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +0 -1
  58. package/dist/spine/CCSkeletonWebGLRenderCmd.js +0 -277
  59. package/dist/spine/PixiSpineSprite.d.ts +0 -19
  60. package/dist/spine/PixiSpineSprite.d.ts.map +0 -1
  61. package/dist/spine/PixiSpineSprite.js +0 -72
@@ -1,311 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export declare const CanvasRenderCmd: any;
2
- //# sourceMappingURL=CCSkeletonCanvasRenderCmd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CCSkeletonCanvasRenderCmd.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonCanvasRenderCmd.ts"],"names":[],"mappings":"AA2PA,eAAO,MAAM,eAAe,KAAyB,CAAA"}
@@ -1,228 +0,0 @@
1
- import * as spine from '@esotericsoftware/spine-core';
2
- /****************************************************************************
3
- Copyright (c) 2013-2014 Chukong Technologies Inc.
4
-
5
- http://www.cocos2d-x.org
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- ****************************************************************************/
25
- var gworld = gworld || {};
26
- (function () {
27
- gworld.CanvasRenderCmd = function (renderableObject) {
28
- this._rootCtor(renderableObject);
29
- this._needDraw = true;
30
- };
31
- const proto = (gworld.CanvasRenderCmd.prototype = Object.create(cc.Node.CanvasRenderCmd.prototype));
32
- proto.constructor = gworld.CanvasRenderCmd;
33
- proto.rendering = function (wrapper, scaleX, scaleY) {
34
- const node = this._node;
35
- let i, n, slot, slotNode;
36
- wrapper = wrapper || cc._renderContext;
37
- const locSkeleton = node._skeleton, drawOrder = locSkeleton.drawOrder;
38
- for (i = 0, n = drawOrder.length; i < n; i++) {
39
- slot = drawOrder[i];
40
- slotNode = slot._slotNode;
41
- if (slotNode._visible && slotNode._renderCmd && slot.currentSprite) {
42
- slotNode._renderCmd.transform(this, true);
43
- slot.currentSprite._renderCmd.rendering(wrapper, scaleX, scaleY);
44
- slotNode._renderCmd._dirtyFlag = slot.currentSprite._renderCmd._dirtyFlag = 0;
45
- }
46
- }
47
- if (!node._debugSlots && !node._debugBones)
48
- return;
49
- wrapper.setTransform(this._worldTransform, scaleX, scaleY);
50
- wrapper.setGlobalAlpha(1);
51
- let attachment;
52
- const drawingUtil = cc._drawingUtil;
53
- if (node._debugSlots) {
54
- // Slots.
55
- drawingUtil.setDrawColor(0, 0, 255, 255);
56
- drawingUtil.setLineWidth(1);
57
- const points = [];
58
- for (i = 0, n = locSkeleton.slots.length; i < n; i++) {
59
- slot = locSkeleton.drawOrder[i];
60
- if (!slot.attachment || !(slot.attachment instanceof spine.RegionAttachment))
61
- continue;
62
- attachment = slot.attachment;
63
- this._updateRegionAttachmentSlot(attachment, slot, points);
64
- drawingUtil.drawPoly(points, 4, true);
65
- }
66
- }
67
- if (node._debugBones) {
68
- // Bone lengths.
69
- let bone;
70
- drawingUtil.setLineWidth(2);
71
- drawingUtil.setDrawColor(255, 0, 0, 255);
72
- for (i = 0, n = locSkeleton.bones.length; i < n; i++) {
73
- bone = locSkeleton.bones[i];
74
- const x = bone.data.length * bone.a + bone.worldX;
75
- const y = bone.data.length * bone.c + bone.worldY;
76
- drawingUtil.drawLine({ x: bone.worldX, y: bone.worldY }, { x: x, y: y });
77
- }
78
- // Bone origins.
79
- const pointSize = 4;
80
- drawingUtil.setDrawColor(0, 0, 255, 255); // Root bone is blue.
81
- for (i = 0, n = locSkeleton.bones.length; i < n; i++) {
82
- bone = locSkeleton.bones[i];
83
- drawingUtil.drawPoint({ x: bone.worldX, y: bone.worldY }, pointSize);
84
- if (i === 0)
85
- drawingUtil.setDrawColor(0, 255, 0, 255);
86
- }
87
- }
88
- };
89
- proto.updateStatus = function () {
90
- this.originUpdateStatus();
91
- this._updateCurrentRegions();
92
- this._regionFlag = cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble;
93
- this._dirtyFlag &= ~cc.Node._dirtyFlags.contentDirty;
94
- };
95
- proto.getLocalBB = function () {
96
- return this._node.getBoundingBox();
97
- };
98
- proto._updateRegionAttachmentSlot = function (attachment, slot, points) {
99
- if (!points)
100
- return;
101
- const vertices = spine.Utils.setArraySize([], 8, 0);
102
- attachment.computeWorldVertices(slot, vertices, 0, 2);
103
- const VERTEX = spine.RegionAttachment;
104
- points.length = 0;
105
- points.push(cc.p(vertices[VERTEX.X1], vertices[VERTEX.Y1]));
106
- points.push(cc.p(vertices[VERTEX.X4], vertices[VERTEX.Y4]));
107
- points.push(cc.p(vertices[VERTEX.X3], vertices[VERTEX.Y3]));
108
- points.push(cc.p(vertices[VERTEX.X2], vertices[VERTEX.Y2]));
109
- };
110
- proto._createChildFormSkeletonData = function () {
111
- const node = this._node;
112
- const locSkeleton = node._skeleton;
113
- let spriteName, sprite;
114
- for (let i = 0, n = locSkeleton.slots.length; i < n; i++) {
115
- const slot = locSkeleton.slots[i], attachment = slot.attachment;
116
- const slotNode = new cc.Node();
117
- slot._slotNode = slotNode;
118
- if (attachment instanceof spine.RegionAttachment) {
119
- spriteName = attachment.name;
120
- sprite = this._createSprite(slot, attachment);
121
- slot.currentSprite = sprite;
122
- slot.currentSpriteName = spriteName;
123
- slotNode.addChild(sprite);
124
- }
125
- else if (attachment instanceof spine.MeshAttachment) {
126
- //todo for mesh
127
- }
128
- }
129
- };
130
- const loaded = function (sprite, texture, attachment) {
131
- const rendererObject = attachment.region;
132
- const rect = new cc.Rect(rendererObject.x, rendererObject.y, rendererObject.width, rendererObject.height);
133
- sprite.initWithTexture(texture, rect, rendererObject.rotate, false);
134
- sprite._rect.width = attachment.width;
135
- sprite._rect.height = attachment.height;
136
- sprite.setContentSize(attachment.width, attachment.height);
137
- sprite.setRotation(-attachment.rotation);
138
- sprite.setScale((rendererObject.width / rendererObject.originalWidth) * attachment.scaleX, (rendererObject.height / rendererObject.originalHeight) * attachment.scaleY);
139
- };
140
- proto._createSprite = function (slot, attachment) {
141
- const rendererObject = attachment.region;
142
- const texture = rendererObject.texture.getRealTexture();
143
- const sprite = new cc.Sprite();
144
- if (texture.isLoaded()) {
145
- loaded(sprite, texture, attachment);
146
- }
147
- else {
148
- texture.addEventListener('load', function () {
149
- loaded(sprite, texture, attachment);
150
- }, this);
151
- }
152
- slot.sprites = slot.sprites || {};
153
- slot.sprites[rendererObject.name] = sprite;
154
- return sprite;
155
- };
156
- proto._updateChild = function () {
157
- const locSkeleton = this._node._skeleton, slots = locSkeleton.slots;
158
- const color = this._displayedColor, opacity = this._displayedOpacity;
159
- let i, n, selSprite, ax, ay;
160
- let slot, attachment, slotNode;
161
- for (i = 0, n = slots.length; i < n; i++) {
162
- slot = slots[i];
163
- attachment = slot.attachment;
164
- slotNode = slot._slotNode;
165
- if (!attachment) {
166
- slotNode.setVisible(false);
167
- continue;
168
- }
169
- if (attachment instanceof spine.RegionAttachment) {
170
- if (attachment.region) {
171
- if (!slot.currentSpriteName || slot.currentSpriteName !== attachment.name) {
172
- const spriteName = attachment.name;
173
- if (slot.currentSprite !== undefined)
174
- slot.currentSprite.setVisible(false);
175
- slot.sprites = slot.sprites || {};
176
- if (slot.sprites[spriteName] !== undefined)
177
- slot.sprites[spriteName].setVisible(true);
178
- else {
179
- const sprite = this._createSprite(slot, attachment);
180
- slotNode.addChild(sprite);
181
- }
182
- slot.currentSprite = slot.sprites[spriteName];
183
- slot.currentSpriteName = spriteName;
184
- }
185
- }
186
- const bone = slot.bone;
187
- if (attachment.region.offsetX === 0 && attachment.region.offsetY === 0) {
188
- ax = attachment.x;
189
- ay = attachment.y;
190
- }
191
- else {
192
- //var regionScaleX = attachment.width / attachment.regionOriginalWidth * attachment.scaleX;
193
- //ax = attachment.x + attachment.regionOffsetX * regionScaleX - (attachment.width * attachment.scaleX - attachment.regionWidth * regionScaleX) / 2;
194
- ax = (attachment.offset[0] + attachment.offset[4]) * 0.5;
195
- ay = (attachment.offset[1] + attachment.offset[5]) * 0.5;
196
- }
197
- slotNode.setPosition(bone.worldX + ax * bone.a + ay * bone.b, bone.worldY + ax * bone.c + ay * bone.d);
198
- slotNode.setScale(bone.getWorldScaleX(), bone.getWorldScaleY());
199
- //set the color and opacity
200
- selSprite = slot.currentSprite;
201
- selSprite._flippedX = bone.skeleton.flipX;
202
- selSprite._flippedY = bone.skeleton.flipY;
203
- if (selSprite._flippedY || selSprite._flippedX) {
204
- slotNode.setRotation(bone.getWorldRotationX());
205
- selSprite.setRotation(attachment.rotation);
206
- }
207
- else {
208
- slotNode.setRotation(-bone.getWorldRotationX());
209
- selSprite.setRotation(-attachment.rotation);
210
- }
211
- //hack for sprite
212
- selSprite._renderCmd._displayedOpacity = 0 | (opacity * slot.color.a);
213
- const r = 0 | (color.r * slot.color.r), g = 0 | (color.g * slot.color.g), b = 0 | (color.b * slot.color.b);
214
- selSprite.setColor(cc.color(r, g, b));
215
- selSprite._renderCmd._updateColor();
216
- }
217
- else if (attachment instanceof spine.MeshAttachment) {
218
- // Can not render mesh
219
- }
220
- else {
221
- slotNode.setVisible(false);
222
- continue;
223
- }
224
- slotNode.setVisible(true);
225
- }
226
- };
227
- })();
228
- export const CanvasRenderCmd = gworld.CanvasRenderCmd;
@@ -1,25 +0,0 @@
1
- /****************************************************************************
2
- Copyright (c) 2017 Chukong Technologies Inc.
3
-
4
- http://www.cocos2d-x.org
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
- ****************************************************************************/
24
- export declare const SkeletonTexture: (image: any) => void;
25
- //# sourceMappingURL=CCSkeletonTexture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CCSkeletonTexture.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonTexture.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;8EAsB8E;AAE9E,eAAO,MAAM,eAAe,GAAa,UAAK,SAE7C,CAAA"}
@@ -1,60 +0,0 @@
1
- import * as spine from '@esotericsoftware/spine-core';
2
- /****************************************************************************
3
- Copyright (c) 2017 Chukong Technologies Inc.
4
-
5
- http://www.cocos2d-x.org
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- ****************************************************************************/
25
- export const SkeletonTexture = function (image) {
26
- // spine.Texture.call(this, image)
27
- };
28
- cc.inherits(SkeletonTexture, spine.Texture);
29
- cc.extend(SkeletonTexture.prototype, {
30
- name: 'gworld.SkeletonTexture',
31
- _texture: null,
32
- setRealTexture: function (tex) {
33
- this._texture = tex;
34
- },
35
- getRealTexture: function () {
36
- return this._texture;
37
- },
38
- setFilters: function (minFilter, magFilter) {
39
- if (cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
40
- const gl = cc._renderContext;
41
- this.bind();
42
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
43
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter);
44
- }
45
- },
46
- setWraps: function (uWrap, vWrap) {
47
- if (cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
48
- const gl = cc._renderContext;
49
- this.bind();
50
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, uWrap);
51
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, vWrap);
52
- }
53
- },
54
- dispose: function () { },
55
- bind: function () {
56
- if (cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
57
- cc.glBindTexture2D(this._texture);
58
- }
59
- },
60
- });
@@ -1,28 +0,0 @@
1
- /****************************************************************************
2
- Copyright (c) 2013-2014 Chukong Technologies Inc.
3
-
4
- http://www.cocos2d-x.org
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
- ****************************************************************************/
24
- export declare const WebGLRenderCmd: {
25
- (renderableObject: any): void;
26
- prototype: any;
27
- };
28
- //# sourceMappingURL=CCSkeletonWebGLRenderCmd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CCSkeletonWebGLRenderCmd.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeletonWebGLRenderCmd.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;8EAsB8E;AAE9E,eAAO,MAAM,cAAc;;;CAS1B,CAAA"}