@eva/plugin-renderer-dragonbone 2.0.2 → 2.1.0-beta.2
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/EVA.plugin.renderer.dragonbone.js +1 -1
- package/dist/EVA.plugin.renderer.dragonbone.min.js +1 -1
- package/dist/plugin-renderer-dragonbone.cjs.js +81 -14
- package/dist/plugin-renderer-dragonbone.cjs.prod.js +1 -1
- package/dist/plugin-renderer-dragonbone.esm.js +67 -13
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type } from '@eva/inspector-decorator';
|
|
2
2
|
import { Component, resource, RESOURCE_TYPE, OBSERVER_TYPE, decorators } from '@eva/eva.js';
|
|
3
|
-
import
|
|
3
|
+
import * as PIXIImport from 'pixi.js';
|
|
4
|
+
import { Texture } from 'pixi.js';
|
|
4
5
|
import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
5
6
|
|
|
6
7
|
/******************************************************************************
|
|
@@ -25,6 +26,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
25
26
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
function __metadata(metadataKey, metadataValue) {
|
|
30
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
29
34
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
35
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -158,26 +163,73 @@ class DragonBone$3 extends Component {
|
|
|
158
163
|
/** 组件名称 */
|
|
159
164
|
DragonBone$3.componentName = 'DragonBone';
|
|
160
165
|
__decorate([
|
|
161
|
-
type('string')
|
|
166
|
+
type('string'),
|
|
167
|
+
__metadata("design:type", String)
|
|
162
168
|
], DragonBone$3.prototype, "resource", void 0);
|
|
163
169
|
__decorate([
|
|
164
|
-
type('string')
|
|
170
|
+
type('string'),
|
|
171
|
+
__metadata("design:type", String)
|
|
165
172
|
], DragonBone$3.prototype, "armatureName", void 0);
|
|
166
173
|
__decorate([
|
|
167
|
-
type('string')
|
|
174
|
+
type('string'),
|
|
175
|
+
__metadata("design:type", String)
|
|
168
176
|
], DragonBone$3.prototype, "animationName", void 0);
|
|
169
177
|
__decorate([
|
|
170
|
-
type('boolean')
|
|
178
|
+
type('boolean'),
|
|
179
|
+
__metadata("design:type", Boolean)
|
|
171
180
|
], DragonBone$3.prototype, "autoPlay", void 0);
|
|
172
181
|
|
|
182
|
+
// PixiJS v8 移除了 DisplayObject.setTransform,dragonbones runtime 还在用,
|
|
183
|
+
// 给 Container 原型打回 polyfill,行为对齐 v7。
|
|
184
|
+
if (PIXIImport.Container && !PIXIImport.Container.prototype.setTransform) {
|
|
185
|
+
PIXIImport.Container.prototype.setTransform = function (
|
|
186
|
+
x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY,
|
|
187
|
+
) {
|
|
188
|
+
if (x !== undefined) this.position.set(x, y || 0);
|
|
189
|
+
if (scaleX !== undefined) this.scale.set(scaleX, scaleY === undefined ? scaleX : scaleY);
|
|
190
|
+
if (rotation !== undefined) this.rotation = rotation;
|
|
191
|
+
if (skewX !== undefined && this.skew) this.skew.set(skewX, skewY || 0);
|
|
192
|
+
if (pivotX !== undefined) this.pivot.set(pivotX, pivotY || 0);
|
|
193
|
+
return this;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
173
197
|
const PIXI = {
|
|
174
|
-
Texture,
|
|
175
|
-
Rectangle,
|
|
176
|
-
Sprite,
|
|
177
|
-
Graphics,
|
|
178
|
-
BLEND_MODES
|
|
179
|
-
|
|
180
|
-
|
|
198
|
+
Texture: PIXIImport.Texture,
|
|
199
|
+
Rectangle: PIXIImport.Rectangle,
|
|
200
|
+
Sprite: PIXIImport.Sprite,
|
|
201
|
+
Graphics: PIXIImport.Graphics,
|
|
202
|
+
BLEND_MODES: PIXIImport.BLEND_MODES || {
|
|
203
|
+
NORMAL: 'normal',
|
|
204
|
+
ADD: 'add',
|
|
205
|
+
DARKEN: 'darken',
|
|
206
|
+
DIFFERENCE: 'difference',
|
|
207
|
+
HARD_LIGHT: 'hard-light',
|
|
208
|
+
LIGHTEN: 'lighten',
|
|
209
|
+
MULTIPLY: 'multiply',
|
|
210
|
+
OVERLAY: 'overlay',
|
|
211
|
+
SCREEN: 'screen',
|
|
212
|
+
},
|
|
213
|
+
// PixiJS v8 不再导出 mesh / ticker namespace,这里给 dragonbones runtime
|
|
214
|
+
// 提供一个最小 stub:把 Mesh 用 Container 替身(无 skinned mesh 变形,但
|
|
215
|
+
// 大部分骨骼动画走 Sprite 渲染,fallback 到 Sprite 也可见效果)。
|
|
216
|
+
mesh: (PIXIImport.mesh) || {
|
|
217
|
+
Mesh: /** @class */ (function () {
|
|
218
|
+
// PixiJS v8 不再有 mesh.Mesh,这里只为让 dragonbones runtime 不爆错
|
|
219
|
+
// 提供 vertices/uvs/indices 数组占位。无真实 skinned mesh 渲染,
|
|
220
|
+
// 但 sprite-only 的 dragonbones 资源仍能正常显示。
|
|
221
|
+
function MeshStub() {
|
|
222
|
+
var s = new PIXIImport.Sprite();
|
|
223
|
+
s.vertices = [];
|
|
224
|
+
s.uvs = [];
|
|
225
|
+
s.indices = [];
|
|
226
|
+
return s;
|
|
227
|
+
}
|
|
228
|
+
MeshStub.DRAW_MODES = { TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6 };
|
|
229
|
+
return MeshStub;
|
|
230
|
+
})(),
|
|
231
|
+
},
|
|
232
|
+
ticker: PIXIImport.ticker || {},
|
|
181
233
|
};
|
|
182
234
|
var dragonBones;
|
|
183
235
|
var __extends =
|
|
@@ -16213,7 +16265,9 @@ if (!Date.now) {
|
|
|
16213
16265
|
var PixiArmatureDisplay = /** @class */ (function (_super) {
|
|
16214
16266
|
__extends(PixiArmatureDisplay, _super);
|
|
16215
16267
|
function PixiArmatureDisplay() {
|
|
16216
|
-
|
|
16268
|
+
// PixiJS v8 把 Sprite 改为 ES class,不能用 _super.apply(this, ...)。
|
|
16269
|
+
// 改用 Reflect.construct 在 _super 上构造一个新实例,再把当前 prototype 链挂回去。
|
|
16270
|
+
var _this = (_super !== null && Reflect.construct(_super, arguments, this.constructor)) || this;
|
|
16217
16271
|
/**
|
|
16218
16272
|
* @private
|
|
16219
16273
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-dragonbone",
|
|
3
|
-
"version": "2.0.2",
|
|
3
|
+
"version": "2.1.0-beta.2",
|
|
4
4
|
"description": "@eva/plugin-renderer-dragonbone",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-dragonbone.esm.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/inspector-decorator": "^0.0.
|
|
22
|
-
"@eva/plugin-renderer": "2.0.2",
|
|
23
|
-
"@eva/eva.js": "2.0.2",
|
|
21
|
+
"@eva/inspector-decorator": "^2.0.0-beta.0",
|
|
22
|
+
"@eva/plugin-renderer": "2.1.0-beta.2",
|
|
23
|
+
"@eva/eva.js": "2.1.0-beta.2",
|
|
24
24
|
"pixi.js": "^8.17.0"
|
|
25
25
|
}
|
|
26
26
|
}
|