@safe-engine/cocos 2.2.7 → 2.3.4
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/@types/index.d.ts +0 -61
- package/dist/app.d.ts +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +25 -23
- package/dist/box2d-wasm/PhysicsComponent.d.ts +1 -1
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.d.ts +21 -3
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideSystem.d.ts.map +1 -1
- package/dist/collider/CollideSystem.js +6 -5
- package/dist/core/EnhancedComponent.d.ts +1 -1
- package/dist/core/EnhancedComponent.d.ts.map +1 -1
- package/dist/core/NodeComp.d.ts +1 -1
- package/dist/core/NodeComp.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComp.d.ts +27 -0
- package/dist/dragonbones/DragonBonesComp.d.ts.map +1 -0
- package/dist/dragonbones/DragonBonesComp.js +29 -0
- package/dist/dragonbones/DragonBonesSystem.d.ts +9 -0
- package/dist/dragonbones/DragonBonesSystem.d.ts.map +1 -0
- package/dist/dragonbones/DragonBonesSystem.js +69 -0
- package/dist/dragonbones/db-cocos/CocosArmatureDisplay.d.ts +87 -0
- package/dist/dragonbones/db-cocos/CocosArmatureDisplay.d.ts.map +1 -0
- package/dist/dragonbones/db-cocos/CocosArmatureDisplay.js +240 -0
- package/dist/dragonbones/db-cocos/CocosFactory.d.ts +128 -0
- package/dist/dragonbones/db-cocos/CocosFactory.d.ts.map +1 -0
- package/dist/dragonbones/db-cocos/CocosFactory.js +190 -0
- package/dist/dragonbones/db-cocos/CocosSlot.d.ts +49 -0
- package/dist/dragonbones/db-cocos/CocosSlot.d.ts.map +1 -0
- package/dist/dragonbones/db-cocos/CocosSlot.js +368 -0
- package/dist/dragonbones/db-cocos/CocosTextureAtlasData.d.ts +53 -0
- package/dist/dragonbones/db-cocos/CocosTextureAtlasData.d.ts.map +1 -0
- package/dist/dragonbones/db-cocos/CocosTextureAtlasData.js +121 -0
- package/dist/dragonbones/index.d.ts +1 -35
- package/dist/dragonbones/index.d.ts.map +1 -1
- package/dist/dragonbones/index.js +2 -83
- package/dist/gui/GUIComponent.d.ts +1 -1
- package/dist/gui/GUIComponent.d.ts.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/polyfills.d.ts +1 -1
- package/dist/polyfills.d.ts.map +1 -1
- package/dist/polyfills.js +1 -2
- package/dist/render/RenderComponent.d.ts +1 -1
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +1 -0
- package/dist/render/RenderSystem.d.ts.map +1 -1
- package/dist/render/RenderSystem.js +34 -2
- package/dist/richtext/RichTextComp.d.ts +1 -1
- package/dist/richtext/RichTextComp.d.ts.map +1 -1
- package/dist/richtext/RichTextComp.js +1 -1
- package/dist/spine/SpineSkeleton.d.ts +22 -0
- package/dist/spine/SpineSkeleton.d.ts.map +1 -0
- package/dist/spine/SpineSkeleton.js +18 -0
- package/dist/spine/SpineSystem.d.ts +6 -0
- package/dist/spine/SpineSystem.d.ts.map +1 -0
- package/dist/spine/SpineSystem.js +34 -0
- package/dist/spine/index.d.ts +1 -24
- package/dist/spine/index.d.ts.map +1 -1
- package/dist/spine/index.js +16 -42
- package/dist/spine/spine-cocos/CCSkeleton.d.ts +86 -0
- package/dist/spine/spine-cocos/CCSkeleton.d.ts.map +1 -0
- package/dist/spine/{CCSkeleton.js → spine-cocos/CCSkeleton.js} +39 -128
- package/dist/spine/spine-cocos/CCSkeletonAnimation.d.ts +87 -0
- package/dist/spine/spine-cocos/CCSkeletonAnimation.d.ts.map +1 -0
- package/dist/spine/{CCSkeletonAnimation.js → spine-cocos/CCSkeletonAnimation.js} +37 -97
- package/dist/spine/spine-cocos/CCSkeletonCanvasRenderCmd.d.ts +28 -0
- package/dist/spine/spine-cocos/CCSkeletonCanvasRenderCmd.d.ts.map +1 -0
- package/dist/spine/spine-cocos/CCSkeletonCanvasRenderCmd.js +224 -0
- package/dist/spine/{CCSkeletonTexture.d.ts → spine-cocos/CCSkeletonTexture.d.ts} +1 -1
- package/dist/spine/spine-cocos/CCSkeletonTexture.d.ts.map +1 -0
- package/dist/spine/{CCSkeletonTexture.js → spine-cocos/CCSkeletonTexture.js} +5 -5
- package/dist/spine/spine-cocos/CCSkeletonWebGLRenderCmd.d.ts.map +1 -0
- package/dist/spine/{CCSkeletonWebGLRenderCmd.js → spine-cocos/CCSkeletonWebGLRenderCmd.js} +13 -13
- package/package.json +5 -6
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -5
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts +0 -15
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +0 -1
- package/dist/dragonbones/PixiDragonBonesSprite.js +0 -71
- package/dist/gworld/EnhancedComponent.d.ts +0 -22
- package/dist/gworld/EnhancedComponent.d.ts.map +0 -1
- package/dist/gworld/EnhancedComponent.js +0 -44
- package/dist/gworld/NodeComp.d.ts +0 -153
- package/dist/gworld/NodeComp.d.ts.map +0 -1
- package/dist/gworld/NodeComp.js +0 -337
- package/dist/gworld/NodePool.d.ts +0 -9
- package/dist/gworld/NodePool.d.ts.map +0 -1
- package/dist/gworld/NodePool.js +0 -23
- package/dist/gworld/Scene.d.ts +0 -5
- package/dist/gworld/Scene.d.ts.map +0 -1
- package/dist/gworld/Scene.js +0 -14
- package/dist/gworld/decorator.d.ts +0 -8
- package/dist/gworld/decorator.d.ts.map +0 -1
- package/dist/gworld/decorator.js +0 -12
- package/dist/gworld/index.d.ts +0 -8
- package/dist/gworld/index.d.ts.map +0 -1
- package/dist/gworld/index.js +0 -14
- package/dist/render/TiledSprite.d.ts +0 -13
- package/dist/render/TiledSprite.d.ts.map +0 -1
- package/dist/render/TiledSprite.js +0 -69
- package/dist/safex.d.ts +0 -10
- package/dist/safex.d.ts.map +0 -1
- package/dist/safex.js +0 -25
- package/dist/spine/CCSkeleton.d.ts +0 -189
- package/dist/spine/CCSkeleton.d.ts.map +0 -1
- package/dist/spine/CCSkeletonAnimation.d.ts +0 -146
- package/dist/spine/CCSkeletonAnimation.d.ts.map +0 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +0 -2
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +0 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.js +0 -228
- package/dist/spine/CCSkeletonTexture.d.ts.map +0 -1
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +0 -1
- package/dist/spine/PixiSpineSprite.d.ts +0 -15
- package/dist/spine/PixiSpineSprite.d.ts.map +0 -1
- package/dist/spine/PixiSpineSprite.js +0 -70
- /package/dist/spine/{CCSkeletonWebGLRenderCmd.d.ts → spine-cocos/CCSkeletonWebGLRenderCmd.d.ts} +0 -0
|
@@ -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 +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 +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"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Spine } from '@esotericsoftware/spine-pixi-v8';
|
|
2
|
-
import { Application } from 'pixi.js';
|
|
3
|
-
export declare function loadSpineAssets(skeleton: any, atlas: any, texture: any): Promise<any>;
|
|
4
|
-
export declare class PixiSpineSprite extends cc.Sprite {
|
|
5
|
-
_canvas: any;
|
|
6
|
-
_pixiApp: Application;
|
|
7
|
-
_texture: cc.Texture2D;
|
|
8
|
-
_config: any;
|
|
9
|
-
_armatureDisplay: Spine;
|
|
10
|
-
constructor(config: any);
|
|
11
|
-
_setupArmature(): void;
|
|
12
|
-
updateTexture(): void;
|
|
13
|
-
onExit(): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=PixiSpineSprite.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PixiSpineSprite.d.ts","sourceRoot":"","sources":["../../src/spine/PixiSpineSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,WAAW,EAAU,MAAM,SAAS,CAAA;AAE7C,wBAAgB,eAAe,CAAC,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,OAAO,KAAA,gBAEvD;AAED,qBAAa,eAAgB,SAAQ,EAAE,CAAC,MAAM;IAC5C,OAAO,EAAE,GAAG,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;IACrB,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAA;IACtB,OAAO,MAAA;IACP,gBAAgB,EAAE,KAAK,CAAA;gBACX,MAAM,KAAA;IAgClB,cAAc;IAmBd,aAAa;IASb,MAAM;CAMP"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Spine } from '@esotericsoftware/spine-pixi-v8';
|
|
2
|
-
import { Application, Assets } from 'pixi.js';
|
|
3
|
-
export function loadSpineAssets(skeleton, atlas, texture) {
|
|
4
|
-
return Assets.load([skeleton, atlas, texture]);
|
|
5
|
-
}
|
|
6
|
-
export class PixiSpineSprite extends cc.Sprite {
|
|
7
|
-
_canvas;
|
|
8
|
-
_pixiApp;
|
|
9
|
-
_texture;
|
|
10
|
-
_config;
|
|
11
|
-
_armatureDisplay;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
super();
|
|
14
|
-
super.ctor(); // always call this for compatibility with cocos2dx JS Javascript class system
|
|
15
|
-
// this.scheduleUpdate()
|
|
16
|
-
this._canvas = document.createElement('canvas');
|
|
17
|
-
this._canvas.width = config.width || 1024;
|
|
18
|
-
this._canvas.height = config.height || 1024;
|
|
19
|
-
this._pixiApp = new Application();
|
|
20
|
-
this._pixiApp.init({
|
|
21
|
-
view: this._canvas,
|
|
22
|
-
width: this._canvas.width,
|
|
23
|
-
height: this._canvas.height,
|
|
24
|
-
backgroundAlpha: 0, // nền trong suốt
|
|
25
|
-
// transparent: true, // bắt buộc để alpha hoạt động
|
|
26
|
-
clearBeforeRender: true, // xoá trước khi vẽ frame mới
|
|
27
|
-
preserveDrawingBuffer: true, // giúp lấy ảnh từ canvas
|
|
28
|
-
antialias: true,
|
|
29
|
-
});
|
|
30
|
-
this._texture = new cc.Texture2D();
|
|
31
|
-
this._texture.initWithElement(this._canvas);
|
|
32
|
-
this._texture.handleLoadedTexture();
|
|
33
|
-
this.initWithTexture(this._texture);
|
|
34
|
-
this._config = config;
|
|
35
|
-
this._armatureDisplay = null;
|
|
36
|
-
this._setupArmature();
|
|
37
|
-
// this.schedule(this.updateTexture, 1 / 30);
|
|
38
|
-
}
|
|
39
|
-
_setupArmature() {
|
|
40
|
-
const { skeleton, atlas, loop, skin, timeScale, animationName } = this._config;
|
|
41
|
-
const display = Spine.from({ skeleton, atlas });
|
|
42
|
-
if (!display) {
|
|
43
|
-
console.error('Cannot build armature:', skeleton);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (skin) {
|
|
47
|
-
display.skeleton.setSkin(skin);
|
|
48
|
-
}
|
|
49
|
-
display.state.setAnimation(0, animationName, loop);
|
|
50
|
-
display.x = this._canvas.width / 2;
|
|
51
|
-
display.y = this._canvas.height;
|
|
52
|
-
display.state.timeScale = timeScale;
|
|
53
|
-
this._pixiApp.stage.addChild(display);
|
|
54
|
-
this._armatureDisplay = display;
|
|
55
|
-
}
|
|
56
|
-
updateTexture() {
|
|
57
|
-
if (this._armatureDisplay && this._pixiApp.renderer) {
|
|
58
|
-
this._pixiApp.renderer.render(this._pixiApp.stage);
|
|
59
|
-
this._texture.initWithElement(this._canvas);
|
|
60
|
-
this._texture.handleLoadedTexture();
|
|
61
|
-
this.setTexture(this._texture);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
onExit() {
|
|
65
|
-
// this.unschedule(this.updateTexture);
|
|
66
|
-
this._pixiApp.destroy(true, { children: true });
|
|
67
|
-
this._canvas.remove();
|
|
68
|
-
super.onExit();
|
|
69
|
-
}
|
|
70
|
-
}
|
/package/dist/spine/{CCSkeletonWebGLRenderCmd.d.ts → spine-cocos/CCSkeletonWebGLRenderCmd.d.ts}
RENAMED
|
File without changes
|