@safe-engine/cocos 1.6.5 → 1.7.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.
- package/dist/app.d.ts +2 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +36 -26
- package/dist/box2d-wasm/PhysicsComponent.d.ts +2 -0
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsComponent.js +16 -3
- package/dist/box2d-wasm/PhysicsSprite.d.ts +1 -0
- package/dist/box2d-wasm/PhysicsSprite.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSprite.js +3 -4
- package/dist/box2d-wasm/PhysicsSystem.d.ts +1 -2
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.js +33 -29
- package/dist/gworld/components/AnimationComponent.d.ts +2 -2
- package/dist/gworld/components/CollideComponent.d.ts +3 -3
- package/dist/gworld/systems/CollideSystem.d.ts +1 -2
- package/dist/gworld/systems/CollideSystem.d.ts.map +1 -1
- package/dist/gworld/systems/CollideSystem.js +2 -12
- package/package.json +1 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +0 -77
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.js +0 -227
- package/dist/dragonbones/cocos/CocosFactory.d.ts +0 -128
- package/dist/dragonbones/cocos/CocosFactory.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosFactory.js +0 -231
- package/dist/dragonbones/cocos/CocosSlot.d.ts +0 -49
- package/dist/dragonbones/cocos/CocosSlot.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosSlot.js +0 -385
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +0 -53
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosTextureAtlasData.js +0 -158
- package/dist/dragonbones/dragonBones.d.ts +0 -3
- package/dist/dragonbones/dragonBones.d.ts.map +0 -1
- package/dist/dragonbones/dragonBones.js +0 -4788
- package/dist/helper/NodePool.d.ts +0 -9
- package/dist/helper/NodePool.d.ts.map +0 -1
- package/dist/helper/NodePool.js +0 -29
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
/**
|
|
4
|
-
* The MIT License (MIT)
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2012-2018 DragonBones team and other contributors
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
9
|
-
* this software and associated documentation files (the "Software"), to deal in
|
|
10
|
-
* the Software without restriction, including without limitation the rights to
|
|
11
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
12
|
-
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
-
* subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
20
|
-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
21
|
-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
22
|
-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
23
|
-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
var __extends = (this && this.__extends) || (function () {
|
|
26
|
-
var extendStatics = function (d, b) {
|
|
27
|
-
extendStatics = Object.setPrototypeOf ||
|
|
28
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
29
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
30
|
-
return extendStatics(d, b);
|
|
31
|
-
};
|
|
32
|
-
return function (d, b) {
|
|
33
|
-
if (typeof b !== "function" && b !== null)
|
|
34
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
35
|
-
extendStatics(d, b);
|
|
36
|
-
function __() { this.constructor = d; }
|
|
37
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.CocosSlot = void 0;
|
|
42
|
-
var dragonbones_js_1 = require("@cocos/dragonbones-js");
|
|
43
|
-
var CocosTextureAtlasData_1 = require("./CocosTextureAtlasData");
|
|
44
|
-
var CocosSlot = /** @class */ (function (_super) {
|
|
45
|
-
__extends(CocosSlot, _super);
|
|
46
|
-
function CocosSlot() {
|
|
47
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
|
-
}
|
|
49
|
-
CocosSlot.prototype._updateGlueMesh = function () {
|
|
50
|
-
};
|
|
51
|
-
CocosSlot.toString = function () {
|
|
52
|
-
return '[class dragonBones.CocosSlot]';
|
|
53
|
-
};
|
|
54
|
-
CocosSlot.prototype._onClear = function () {
|
|
55
|
-
_super.prototype._onClear.call(this);
|
|
56
|
-
this._textureScale = 1.0;
|
|
57
|
-
this._renderDisplay = null;
|
|
58
|
-
// this._updateTransform = cc[0] === '3' ? this._updateTransformV3 : this._updateTransformV4;
|
|
59
|
-
};
|
|
60
|
-
CocosSlot.prototype._initDisplay = function (value, isRetain) {
|
|
61
|
-
// tslint:disable-next-line:no-unused-expression
|
|
62
|
-
value;
|
|
63
|
-
// tslint:disable-next-line:no-unused-expression
|
|
64
|
-
isRetain;
|
|
65
|
-
};
|
|
66
|
-
CocosSlot.prototype._disposeDisplay = function (value, isRelease) {
|
|
67
|
-
// tslint:disable-next-line:no-unused-expression
|
|
68
|
-
value;
|
|
69
|
-
if (!isRelease) {
|
|
70
|
-
value.destroy();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
CocosSlot.prototype._onUpdateDisplay = function () {
|
|
74
|
-
this._renderDisplay = (this._display ? this._display : this._rawDisplay);
|
|
75
|
-
};
|
|
76
|
-
CocosSlot.prototype._addDisplay = function () {
|
|
77
|
-
var container = this._armature.display;
|
|
78
|
-
container.addChild(this._renderDisplay);
|
|
79
|
-
};
|
|
80
|
-
CocosSlot.prototype._replaceDisplay = function (value) {
|
|
81
|
-
var container = this._armature.display;
|
|
82
|
-
var prevDisplay = value;
|
|
83
|
-
container.addChild(this._renderDisplay);
|
|
84
|
-
container.swapChildren(this._renderDisplay, prevDisplay);
|
|
85
|
-
container.removeChild(prevDisplay);
|
|
86
|
-
this._textureScale = 1.0;
|
|
87
|
-
};
|
|
88
|
-
CocosSlot.prototype._removeDisplay = function () {
|
|
89
|
-
this._renderDisplay.parent.removeChild(this._renderDisplay);
|
|
90
|
-
};
|
|
91
|
-
CocosSlot.prototype._updateZOrder = function () {
|
|
92
|
-
if (this._renderDisplay.getLocalZOrder() === this._zOrder) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
this._renderDisplay.setLocalZOrder(this._zOrder);
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
CocosSlot.prototype._updateVisible = function () {
|
|
101
|
-
this._renderDisplay.visible = this._parent.visible && this._visible;
|
|
102
|
-
};
|
|
103
|
-
CocosSlot.prototype._updateBlendMode = function () {
|
|
104
|
-
if (this._renderDisplay instanceof cc.Sprite) {
|
|
105
|
-
}
|
|
106
|
-
// TODO child armature.
|
|
107
|
-
};
|
|
108
|
-
CocosSlot.prototype._updateColor = function () {
|
|
109
|
-
var alpha = this._colorTransform.alphaMultiplier * this._globalAlpha;
|
|
110
|
-
this._renderDisplay.alpha = alpha;
|
|
111
|
-
if (this._renderDisplay instanceof cc.Sprite || this._renderDisplay instanceof Cocos.SimpleMesh) {
|
|
112
|
-
var color = (Math.round(this._colorTransform.redMultiplier * 0xFF) << 16) + (Math.round(this._colorTransform.greenMultiplier * 0xFF) << 8) + Math.round(this._colorTransform.blueMultiplier * 0xFF);
|
|
113
|
-
this._renderDisplay.tint = color;
|
|
114
|
-
}
|
|
115
|
-
// TODO child armature.
|
|
116
|
-
};
|
|
117
|
-
CocosSlot.prototype._updateFrame = function () {
|
|
118
|
-
var currentTextureData = this._textureData;
|
|
119
|
-
if (this._displayIndex >= 0 && this._display !== null && currentTextureData !== null) {
|
|
120
|
-
var currentTextureAtlasData = currentTextureData.parent;
|
|
121
|
-
if (this._armature.replacedTexture !== null) { // Update replaced texture atlas.
|
|
122
|
-
if (this._armature._replaceTextureAtlasData === null) {
|
|
123
|
-
currentTextureAtlasData = dragonbones_js_1.BaseObject.borrowObject(CocosTextureAtlasData_1.CocosTextureAtlasData);
|
|
124
|
-
currentTextureAtlasData.copyFrom(currentTextureData.parent);
|
|
125
|
-
currentTextureAtlasData.renderTexture = this._armature.replacedTexture;
|
|
126
|
-
this._armature._replaceTextureAtlasData = currentTextureAtlasData;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
currentTextureAtlasData = this._armature._replaceTextureAtlasData;
|
|
130
|
-
}
|
|
131
|
-
currentTextureData = currentTextureAtlasData.getTexture(currentTextureData.name);
|
|
132
|
-
}
|
|
133
|
-
var renderTexture = currentTextureData.renderTexture;
|
|
134
|
-
if (renderTexture !== null) {
|
|
135
|
-
if (this._geometryData) { // Mesh.
|
|
136
|
-
var data = this._geometryData.data;
|
|
137
|
-
var intArray = data.intArray;
|
|
138
|
-
var floatArray = data.floatArray;
|
|
139
|
-
var vertexCount = intArray[this._geometryData.offset + dragonbones_js_1.BinaryOffset.GeometryVertexCount];
|
|
140
|
-
var triangleCount = intArray[this._geometryData.offset + dragonbones_js_1.BinaryOffset.GeometryTriangleCount];
|
|
141
|
-
var vertexOffset = intArray[this._geometryData.offset + dragonbones_js_1.BinaryOffset.GeometryFloatOffset];
|
|
142
|
-
if (vertexOffset < 0) {
|
|
143
|
-
vertexOffset += 65536; // Fixed out of bouds bug.
|
|
144
|
-
}
|
|
145
|
-
var uvOffset = vertexOffset + vertexCount * 2;
|
|
146
|
-
var scale = this._armature._armatureData.scale;
|
|
147
|
-
var meshDisplay = this._renderDisplay;
|
|
148
|
-
var vertices = new Float32Array(vertexCount * 2);
|
|
149
|
-
var uvs = new Float32Array(vertexCount * 2);
|
|
150
|
-
var indices = new Uint16Array(triangleCount * 3);
|
|
151
|
-
for (var i = 0, l = vertexCount * 2; i < l; ++i) {
|
|
152
|
-
vertices[i] = floatArray[vertexOffset + i] * scale;
|
|
153
|
-
}
|
|
154
|
-
for (var i = 0; i < triangleCount * 3; ++i) {
|
|
155
|
-
indices[i] = intArray[this._geometryData.offset + dragonbones_js_1.BinaryOffset.GeometryVertexIndices + i];
|
|
156
|
-
}
|
|
157
|
-
for (var i = 0, l = vertexCount * 2; i < l; i += 2) {
|
|
158
|
-
var u = floatArray[uvOffset + i];
|
|
159
|
-
var v = floatArray[uvOffset + i + 1];
|
|
160
|
-
if (currentTextureData.rotated) {
|
|
161
|
-
uvs[i] = 1 - v;
|
|
162
|
-
uvs[i + 1] = u;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
uvs[i] = u;
|
|
166
|
-
uvs[i + 1] = v;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
this._textureScale = 1.0;
|
|
170
|
-
meshDisplay.texture = renderTexture;
|
|
171
|
-
meshDisplay.vertices = vertices;
|
|
172
|
-
meshDisplay.uvBuffer.update(uvs);
|
|
173
|
-
meshDisplay.geometry.addIndex(indices);
|
|
174
|
-
var isSkinned = this._geometryData.weight !== null;
|
|
175
|
-
var isSurface = this._parent._boneData.type !== dragonbones_js_1.BoneType.Bone;
|
|
176
|
-
if (isSkinned || isSurface) {
|
|
177
|
-
this._identityTransform();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
// Normal texture.
|
|
182
|
-
this._textureScale = currentTextureData.parent.scale * this._armature._armatureData.scale;
|
|
183
|
-
var normalDisplay = this._renderDisplay;
|
|
184
|
-
normalDisplay.setSpriteFrame(renderTexture);
|
|
185
|
-
}
|
|
186
|
-
this._visibleDirty = true;
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (this._geometryData) {
|
|
191
|
-
var meshDisplay = this._renderDisplay;
|
|
192
|
-
meshDisplay.texture = null;
|
|
193
|
-
meshDisplay.x = 0.0;
|
|
194
|
-
meshDisplay.y = 0.0;
|
|
195
|
-
meshDisplay.visible = false;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
var normalDisplay = this._renderDisplay;
|
|
199
|
-
normalDisplay.texture = null;
|
|
200
|
-
normalDisplay.x = 0.0;
|
|
201
|
-
normalDisplay.y = 0.0;
|
|
202
|
-
normalDisplay.visible = false;
|
|
203
|
-
}
|
|
204
|
-
this._renderDisplay.setPosition(0.0, 0.0);
|
|
205
|
-
};
|
|
206
|
-
CocosSlot.prototype._updateMesh = function () {
|
|
207
|
-
var scale = this._armature._armatureData.scale;
|
|
208
|
-
var deformVertices = this._displayFrame.deformVertices;
|
|
209
|
-
var bones = this._geometryBones;
|
|
210
|
-
var geometryData = this._geometryData;
|
|
211
|
-
var weightData = geometryData.weight;
|
|
212
|
-
var hasDeform = deformVertices.length > 0 && geometryData.inheritDeform;
|
|
213
|
-
var meshDisplay = this._renderDisplay.getComponent(cc.Sprite)._sgNode; // as cc.Scale9Sprite;
|
|
214
|
-
var polygonInfo = meshDisplay.getMeshPolygonInfo();
|
|
215
|
-
if (!polygonInfo) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
var verticesAndUVs = polygonInfo.triangles.verts;
|
|
219
|
-
var boundsRect = cc.rect(999999.0, 999999.0, -999999.0, -999999.0);
|
|
220
|
-
if (weightData !== null) {
|
|
221
|
-
var data = geometryData.data;
|
|
222
|
-
var intArray = data.intArray;
|
|
223
|
-
var floatArray = data.floatArray;
|
|
224
|
-
var vertexCount = intArray[geometryData.offset + dragonbones_js_1.BinaryOffset.MeshVertexCount];
|
|
225
|
-
var weightFloatOffset = intArray[weightData.offset + dragonbones_js_1.BinaryOffset.WeigthFloatOffset];
|
|
226
|
-
if (weightFloatOffset < 0) {
|
|
227
|
-
weightFloatOffset += 65536; // Fixed out of bouds bug.
|
|
228
|
-
}
|
|
229
|
-
for (var i = 0, iB = weightData.offset + dragonbones_js_1.BinaryOffset.WeigthBoneIndices + bones.length, iV = weightFloatOffset, iF = 0; i < vertexCount; ++i) {
|
|
230
|
-
var boneCount = intArray[iB++];
|
|
231
|
-
var xG = 0.0, yG = 0.0;
|
|
232
|
-
for (var j = 0; j < boneCount; ++j) {
|
|
233
|
-
var boneIndex = intArray[iB++];
|
|
234
|
-
var bone = bones[boneIndex];
|
|
235
|
-
if (bone !== null) {
|
|
236
|
-
var matrix = bone.globalTransformMatrix;
|
|
237
|
-
var weight = floatArray[iV++];
|
|
238
|
-
var xL = floatArray[iV++] * scale;
|
|
239
|
-
var yL = floatArray[iV++] * scale;
|
|
240
|
-
if (hasDeform) {
|
|
241
|
-
xL += deformVertices[iF++];
|
|
242
|
-
yL += deformVertices[iF++];
|
|
243
|
-
}
|
|
244
|
-
xG += (matrix.a * xL + matrix.c * yL + matrix.tx) * weight;
|
|
245
|
-
yG += (matrix.b * xL + matrix.d * yL + matrix.ty) * weight;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
var vertex = verticesAndUVs[i];
|
|
249
|
-
vertex.x = xG;
|
|
250
|
-
vertex.y = yG;
|
|
251
|
-
if (boundsRect.x > xG) {
|
|
252
|
-
boundsRect.x = xG;
|
|
253
|
-
}
|
|
254
|
-
if (boundsRect.width < xG) {
|
|
255
|
-
boundsRect.width = xG;
|
|
256
|
-
}
|
|
257
|
-
if (boundsRect.y > yG) {
|
|
258
|
-
boundsRect.y = yG;
|
|
259
|
-
}
|
|
260
|
-
if (boundsRect.height < yG) {
|
|
261
|
-
boundsRect.height = yG;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
var isSurface = this._parent._boneData.type !== dragonbones_js_1.BoneType.Bone;
|
|
267
|
-
var data = geometryData.data;
|
|
268
|
-
var intArray = data.intArray;
|
|
269
|
-
var floatArray = data.floatArray;
|
|
270
|
-
var vertexCount = intArray[geometryData.offset + dragonbones_js_1.BinaryOffset.MeshVertexCount];
|
|
271
|
-
var vertexOffset = intArray[geometryData.offset + dragonbones_js_1.BinaryOffset.MeshFloatOffset];
|
|
272
|
-
if (vertexOffset < 0) {
|
|
273
|
-
vertexOffset += 65536; // Fixed out of bouds bug.
|
|
274
|
-
}
|
|
275
|
-
for (var i = 0, l = vertexCount * 2; i < l; i += 2) {
|
|
276
|
-
var iH = i / 2; // int.
|
|
277
|
-
var x = floatArray[vertexOffset + i] * scale;
|
|
278
|
-
var y = floatArray[vertexOffset + i + 1] * scale;
|
|
279
|
-
if (hasDeform) {
|
|
280
|
-
x += deformVertices[i];
|
|
281
|
-
y += deformVertices[i + 1];
|
|
282
|
-
}
|
|
283
|
-
var vertex = verticesAndUVs[iH];
|
|
284
|
-
if (isSurface) {
|
|
285
|
-
var matrix = (this._parent)._getGlobalTransformMatrix(x, y);
|
|
286
|
-
vertex.x = matrix.a * x + matrix.c * y + matrix.tx;
|
|
287
|
-
vertex.y = matrix.b * x + matrix.d * y + matrix.ty;
|
|
288
|
-
//
|
|
289
|
-
x = vertex.x;
|
|
290
|
-
y = vertex.y;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
vertex.x = x;
|
|
294
|
-
y = vertex.y = -y;
|
|
295
|
-
}
|
|
296
|
-
if (boundsRect.x > x) {
|
|
297
|
-
boundsRect.x = x;
|
|
298
|
-
}
|
|
299
|
-
if (boundsRect.width < x) {
|
|
300
|
-
boundsRect.width = x;
|
|
301
|
-
}
|
|
302
|
-
if (boundsRect.y > y) {
|
|
303
|
-
boundsRect.y = y;
|
|
304
|
-
}
|
|
305
|
-
if (boundsRect.height < y) {
|
|
306
|
-
boundsRect.height = y;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
boundsRect.width -= boundsRect.x;
|
|
311
|
-
boundsRect.height -= boundsRect.y;
|
|
312
|
-
polygonInfo.rect = boundsRect;
|
|
313
|
-
meshDisplay.setContentSize(cc.size(boundsRect.width, boundsRect.height));
|
|
314
|
-
meshDisplay.setMeshPolygonInfo(polygonInfo);
|
|
315
|
-
if (weightData !== null) {
|
|
316
|
-
this._identityTransform();
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
var transform = this.global;
|
|
320
|
-
var globalTransformMatrix = this.globalTransformMatrix;
|
|
321
|
-
this._renderDisplay.x = transform.x - (globalTransformMatrix.a * this._pivotX - globalTransformMatrix.c * this._pivotY);
|
|
322
|
-
this._renderDisplay.y = transform.y - (globalTransformMatrix.b * this._pivotX - globalTransformMatrix.d * this._pivotY);
|
|
323
|
-
this._renderDisplay.rotationX = -(transform.rotation + transform.skew) * dragonbones_js_1.Transform.RAD_DEG;
|
|
324
|
-
this._renderDisplay.rotationY = -transform.rotation * dragonbones_js_1.Transform.RAD_DEG;
|
|
325
|
-
this._renderDisplay.scaleX = transform.scaleX * this._textureScale;
|
|
326
|
-
this._renderDisplay.scaleY = -transform.scaleY * this._textureScale;
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
CocosSlot.prototype._updateTransform = function () {
|
|
330
|
-
this.updateGlobalTransform();
|
|
331
|
-
var transform = this.global;
|
|
332
|
-
// const globalTransformMatrix = this.globalTransformMatrix;
|
|
333
|
-
// if (this._renderDisplay === this._rawDisplay || this._renderDisplay === this._meshDisplay) {
|
|
334
|
-
// this._renderDisplay.x = transform.x - (globalTransformMatrix.a * this._pivotX - globalTransformMatrix.c * this._pivotY);
|
|
335
|
-
// this._renderDisplay.y = transform.y - (globalTransformMatrix.b * this._pivotX - globalTransformMatrix.d * this._pivotY);
|
|
336
|
-
// }
|
|
337
|
-
// else {
|
|
338
|
-
this._renderDisplay.x = transform.x;
|
|
339
|
-
this._renderDisplay.y = transform.y;
|
|
340
|
-
// }
|
|
341
|
-
this._renderDisplay.rotationX = -(transform.rotation + transform.skew) * dragonbones_js_1.Transform.RAD_DEG;
|
|
342
|
-
this._renderDisplay.rotationY = -transform.rotation * dragonbones_js_1.Transform.RAD_DEG;
|
|
343
|
-
this._renderDisplay.scaleX = transform.scaleX * this._textureScale;
|
|
344
|
-
this._renderDisplay.scaleY = -transform.scaleY * this._textureScale;
|
|
345
|
-
};
|
|
346
|
-
CocosSlot.prototype._updateTransformV3 = function () {
|
|
347
|
-
this.updateGlobalTransform(); // Update transform.
|
|
348
|
-
var transform = this.global;
|
|
349
|
-
if (this._renderDisplay === this._rawDisplay || this._renderDisplay === this._meshDisplay) {
|
|
350
|
-
var x = transform.x - (this.globalTransformMatrix.a * this._pivotX + this.globalTransformMatrix.c * this._pivotY);
|
|
351
|
-
var y = transform.y - (this.globalTransformMatrix.b * this._pivotX + this.globalTransformMatrix.d * this._pivotY);
|
|
352
|
-
// this._renderDisplay.transform = new cc.AffineTransform(
|
|
353
|
-
// x, y,
|
|
354
|
-
// transform.scaleX * this._textureScale, transform.scaleY * this._textureScale,
|
|
355
|
-
// transform.rotation,
|
|
356
|
-
// transform.skew, 0.0,
|
|
357
|
-
// );
|
|
358
|
-
this._renderDisplay.setPosition(x, y);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
this._renderDisplay.setPosition(transform.x, transform.y);
|
|
362
|
-
this._renderDisplay.rotation = transform.rotation;
|
|
363
|
-
this._renderDisplay.skewX = transform.skew;
|
|
364
|
-
this._renderDisplay.setScale(transform.scaleX, transform.scaleY);
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
CocosSlot.prototype._identityTransform = function () {
|
|
368
|
-
// const helpMatrix = TransformObject._helpMatrix;
|
|
369
|
-
// helpMatrix.a = 1.0;
|
|
370
|
-
// helpMatrix.b = 0.0;
|
|
371
|
-
// helpMatrix.c = -0.0;
|
|
372
|
-
// helpMatrix.d = -1.0;
|
|
373
|
-
// helpMatrix.tx = 0.0;
|
|
374
|
-
// helpMatrix.ty = 0.0;
|
|
375
|
-
// (this._renderDisplay as any)._renderCmd.setNodeToParentTransform(helpMatrix);
|
|
376
|
-
this._renderDisplay.x = 0.0;
|
|
377
|
-
this._renderDisplay.y = 0.0;
|
|
378
|
-
this._renderDisplay.rotationX = 0.0;
|
|
379
|
-
this._renderDisplay.rotationY = 0.0;
|
|
380
|
-
this._renderDisplay.scaleX = 1.0;
|
|
381
|
-
this._renderDisplay.scaleY = 1.0;
|
|
382
|
-
};
|
|
383
|
-
return CocosSlot;
|
|
384
|
-
}(dragonbones_js_1.Slot));
|
|
385
|
-
exports.CocosSlot = CocosSlot;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2012-2018 DragonBones team and other contributors
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
7
|
-
* this software and associated documentation files (the "Software"), to deal in
|
|
8
|
-
* the Software without restriction, including without limitation the rights to
|
|
9
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
10
|
-
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* 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, FITNESS
|
|
18
|
-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
20
|
-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
21
|
-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
*/
|
|
23
|
-
import { TextureAtlasData, TextureData } from '@cocos/dragonbones-js';
|
|
24
|
-
export declare class CocosTextureAtlasData extends TextureAtlasData {
|
|
25
|
-
static toString(): string;
|
|
26
|
-
private _renderTexture;
|
|
27
|
-
protected _onClear(): void;
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
createTexture(): TextureData;
|
|
32
|
-
/**
|
|
33
|
-
* - The CocosJS texture.
|
|
34
|
-
* @version DragonBones 3.0
|
|
35
|
-
* @language en_US
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* - CocosJS 贴图。
|
|
39
|
-
* @version DragonBones 3.0
|
|
40
|
-
* @language zh_CN
|
|
41
|
-
*/
|
|
42
|
-
get renderTexture(): cc.Texture2D | null;
|
|
43
|
-
set renderTexture(value: cc.Texture2D | null);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
export declare class CocosTextureData extends TextureData {
|
|
49
|
-
static toString(): string;
|
|
50
|
-
renderTexture: cc.SpriteFrame | null;
|
|
51
|
-
protected _onClear(): void;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=CocosTextureAtlasData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CocosTextureAtlasData.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/cocos/CocosTextureAtlasData.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAc,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAElF,qBAAa,qBAAsB,SAAQ,gBAAgB;WAC3C,QAAQ,IAAI,MAAM;IAIhC,OAAO,CAAC,cAAc,CAA6B;IAEnD,SAAS,CAAC,QAAQ,IAAI,IAAI;IAS1B;;OAEG;IACI,aAAa,IAAI,WAAW;IAGnC;;;;OAIG;IACH;;;;OAIG;IACH,IAAW,aAAa,IAAI,EAAE,CAAC,SAAS,GAAG,IAAI,CAE9C;IACD,IAAW,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,GAAG,IAAI,EAsDlD;CACF;AACD;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;WACjC,QAAQ,IAAI,MAAM;IAIzB,aAAa,EAAE,EAAE,CAAC,WAAW,GAAG,IAAI,CAAQ;IAEnD,SAAS,CAAC,QAAQ,IAAI,IAAI;CAS3B"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
/**
|
|
4
|
-
* The MIT License (MIT)
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2012-2018 DragonBones team and other contributors
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
9
|
-
* this software and associated documentation files (the "Software"), to deal in
|
|
10
|
-
* the Software without restriction, including without limitation the rights to
|
|
11
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
12
|
-
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
-
* subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
20
|
-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
21
|
-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
22
|
-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
23
|
-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
var __extends = (this && this.__extends) || (function () {
|
|
26
|
-
var extendStatics = function (d, b) {
|
|
27
|
-
extendStatics = Object.setPrototypeOf ||
|
|
28
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
29
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
30
|
-
return extendStatics(d, b);
|
|
31
|
-
};
|
|
32
|
-
return function (d, b) {
|
|
33
|
-
if (typeof b !== "function" && b !== null)
|
|
34
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
35
|
-
extendStatics(d, b);
|
|
36
|
-
function __() { this.constructor = d; }
|
|
37
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.CocosTextureData = exports.CocosTextureAtlasData = void 0;
|
|
42
|
-
var dragonbones_js_1 = require("@cocos/dragonbones-js");
|
|
43
|
-
var CocosTextureAtlasData = /** @class */ (function (_super) {
|
|
44
|
-
__extends(CocosTextureAtlasData, _super);
|
|
45
|
-
function CocosTextureAtlasData() {
|
|
46
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
47
|
-
_this._renderTexture = null; // Initial value.
|
|
48
|
-
return _this;
|
|
49
|
-
}
|
|
50
|
-
CocosTextureAtlasData.toString = function () {
|
|
51
|
-
return '[class dragonBones.CocosTextureAtlasData]';
|
|
52
|
-
};
|
|
53
|
-
CocosTextureAtlasData.prototype._onClear = function () {
|
|
54
|
-
_super.prototype._onClear.call(this);
|
|
55
|
-
if (this._renderTexture !== null) {
|
|
56
|
-
// this._renderTexture.dispose();
|
|
57
|
-
}
|
|
58
|
-
this._renderTexture = null;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* @inheritDoc
|
|
62
|
-
*/
|
|
63
|
-
CocosTextureAtlasData.prototype.createTexture = function () {
|
|
64
|
-
return dragonbones_js_1.BaseObject.borrowObject(CocosTextureData);
|
|
65
|
-
};
|
|
66
|
-
Object.defineProperty(CocosTextureAtlasData.prototype, "renderTexture", {
|
|
67
|
-
/**
|
|
68
|
-
* - The CocosJS texture.
|
|
69
|
-
* @version DragonBones 3.0
|
|
70
|
-
* @language en_US
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* - CocosJS 贴图。
|
|
74
|
-
* @version DragonBones 3.0
|
|
75
|
-
* @language zh_CN
|
|
76
|
-
*/
|
|
77
|
-
get: function () {
|
|
78
|
-
return this._renderTexture;
|
|
79
|
-
},
|
|
80
|
-
set: function (value) {
|
|
81
|
-
if (this._renderTexture === value) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
this._renderTexture = value;
|
|
85
|
-
if (this._renderTexture !== null) {
|
|
86
|
-
for (var k in this.textures) {
|
|
87
|
-
var textureData = this.textures[k];
|
|
88
|
-
if (textureData.renderTexture !== null) {
|
|
89
|
-
textureData.renderTexture.destroy();
|
|
90
|
-
}
|
|
91
|
-
// console.log('textureData', this._renderTexture, textureData)
|
|
92
|
-
// console.log('this._renderTexture', this._renderTexture)
|
|
93
|
-
var x = textureData.region.x;
|
|
94
|
-
var y = textureData.region.y;
|
|
95
|
-
var rotated = textureData.rotated;
|
|
96
|
-
var width = rotated ? textureData.region.height : textureData.region.width;
|
|
97
|
-
var height = rotated ? textureData.region.width : textureData.region.height;
|
|
98
|
-
var rect = cc.rect(x, y, width, height);
|
|
99
|
-
var offset = cc.p(0, 0);
|
|
100
|
-
var originSize = cc.size(width, height);
|
|
101
|
-
if (textureData.frame) {
|
|
102
|
-
var px = -textureData.frame.x;
|
|
103
|
-
var py = -textureData.frame.y;
|
|
104
|
-
originSize.width = textureData.frame.width;
|
|
105
|
-
originSize.height = textureData.frame.height;
|
|
106
|
-
// offset = sprite center - trimed texture center
|
|
107
|
-
var cx1 = px + rect.width / 2;
|
|
108
|
-
var cy1 = originSize.height - py - rect.height / 2;
|
|
109
|
-
var cx2 = originSize.width / 2;
|
|
110
|
-
var cy2 = originSize.height / 2;
|
|
111
|
-
offset.x = cx2 - cx1;
|
|
112
|
-
offset.y = cy2 - cy1;
|
|
113
|
-
}
|
|
114
|
-
// sprite
|
|
115
|
-
var spriteFrame = new cc.SpriteFrame(this._renderTexture, rect, textureData.rotated, offset, originSize);
|
|
116
|
-
// console.log('sf', sf)
|
|
117
|
-
textureData.renderTexture = spriteFrame;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
for (var k in this.textures) {
|
|
122
|
-
var textureData = this.textures[k];
|
|
123
|
-
if (textureData.renderTexture !== null) {
|
|
124
|
-
textureData.renderTexture.destroy();
|
|
125
|
-
}
|
|
126
|
-
textureData.renderTexture = null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
enumerable: false,
|
|
131
|
-
configurable: true
|
|
132
|
-
});
|
|
133
|
-
return CocosTextureAtlasData;
|
|
134
|
-
}(dragonbones_js_1.TextureAtlasData));
|
|
135
|
-
exports.CocosTextureAtlasData = CocosTextureAtlasData;
|
|
136
|
-
/**
|
|
137
|
-
* @internal
|
|
138
|
-
*/
|
|
139
|
-
var CocosTextureData = /** @class */ (function (_super) {
|
|
140
|
-
__extends(CocosTextureData, _super);
|
|
141
|
-
function CocosTextureData() {
|
|
142
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
143
|
-
_this.renderTexture = null; // Initial value.
|
|
144
|
-
return _this;
|
|
145
|
-
}
|
|
146
|
-
CocosTextureData.toString = function () {
|
|
147
|
-
return '[class dragonBones.CocosTextureData]';
|
|
148
|
-
};
|
|
149
|
-
CocosTextureData.prototype._onClear = function () {
|
|
150
|
-
_super.prototype._onClear.call(this);
|
|
151
|
-
if (this.renderTexture !== null) {
|
|
152
|
-
this.renderTexture.destroy();
|
|
153
|
-
}
|
|
154
|
-
this.renderTexture = null;
|
|
155
|
-
};
|
|
156
|
-
return CocosTextureData;
|
|
157
|
-
}(dragonbones_js_1.TextureData));
|
|
158
|
-
exports.CocosTextureData = CocosTextureData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dragonBones.d.ts","sourceRoot":"","sources":["../../src/dragonbones/dragonBones.ts"],"names":[],"mappings":"AAEA,QAAA,IAAI,WAAW,KAAoB,CAAC;AAkzKpC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|