@eva/plugin-renderer-dragonbone 2.0.1-beta.9 → 2.0.2-beta.0
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.min.js +1 -1
- package/dist/plugin-renderer-dragonbone.cjs.js +73 -13
- package/dist/plugin-renderer-dragonbone.cjs.prod.js +1 -16
- package/dist/plugin-renderer-dragonbone.d.ts +55 -0
- package/dist/plugin-renderer-dragonbone.esm.js +73 -13
- package/package.json +4 -4
|
@@ -7,19 +7,19 @@ var eva_js = require('@eva/eva.js');
|
|
|
7
7
|
var pixi_js = require('pixi.js');
|
|
8
8
|
var pluginRenderer = require('@eva/plugin-renderer');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
Copyright (c) Microsoft Corporation.
|
|
12
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
13
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
14
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
/******************************************************************************
|
|
11
|
+
Copyright (c) Microsoft Corporation.
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
19
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
13
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
14
|
+
purpose with or without fee is hereby granted.
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
17
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
18
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
22
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
23
23
|
***************************************************************************** */
|
|
24
24
|
|
|
25
25
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -30,27 +30,86 @@ function __decorate(decorators, target, key, desc) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
33
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
35
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
36
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
37
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
38
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
39
|
});
|
|
39
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
43
|
+
var e = new Error(message);
|
|
44
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
45
|
+
};
|
|
40
46
|
|
|
47
|
+
/**
|
|
48
|
+
* DragonBones 骨骼动画组件
|
|
49
|
+
*
|
|
50
|
+
* DragonBone 组件用于播放 DragonBones 骨骼动画。
|
|
51
|
+
* DragonBones 是一个开源的 2D 骨骼动画解决方案,
|
|
52
|
+
* 支持复杂的角色动画、换装、动画融合等高级功能,
|
|
53
|
+
* 适用于游戏角色、UI 动效等需要骨骼动画的场景。
|
|
54
|
+
*
|
|
55
|
+
* 主要功能:
|
|
56
|
+
* - 播放 DragonBones 骨骼动画
|
|
57
|
+
* - 支持多个骨架(Armature)
|
|
58
|
+
* - 支持动画切换和融合
|
|
59
|
+
* - 支持骨骼和插槽操作
|
|
60
|
+
* - 支持换装和皮肤切换
|
|
61
|
+
* - 提供动画事件监听
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // 基础用法
|
|
66
|
+
* const character = new GameObject('character');
|
|
67
|
+
* character.addComponent(new DragonBone({
|
|
68
|
+
* resource: 'heroAnimation', // DragonBones 资源
|
|
69
|
+
* armatureName: 'Hero', // 骨架名称
|
|
70
|
+
* animationName: 'idle', // 默认动画
|
|
71
|
+
* autoPlay: true
|
|
72
|
+
* }));
|
|
73
|
+
*
|
|
74
|
+
* // 切换动画
|
|
75
|
+
* const dragonbone = character.getComponent('DragonBone');
|
|
76
|
+
* dragonbone.play('run'); // 播放跑步动画
|
|
77
|
+
* dragonbone.play('attack', 1); // 播放攻击动画 1 次
|
|
78
|
+
*
|
|
79
|
+
* // 停止动画
|
|
80
|
+
* dragonbone.stop();
|
|
81
|
+
* dragonbone.stop('walk'); // 停止指定动画
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
41
84
|
class DragonBone$3 extends eva_js.Component {
|
|
42
85
|
constructor() {
|
|
43
86
|
super(...arguments);
|
|
87
|
+
/** 等待播放标志 */
|
|
44
88
|
this.waitPlay = false;
|
|
89
|
+
/** 等待停止标志 */
|
|
45
90
|
this.waitStop = false;
|
|
91
|
+
/** 待播放的动画信息 */
|
|
46
92
|
this.waitPlayInfo = {
|
|
47
93
|
animationName: null,
|
|
48
94
|
};
|
|
95
|
+
/** DragonBones 资源名称 */
|
|
49
96
|
this.resource = '';
|
|
97
|
+
/** 骨架名称 */
|
|
50
98
|
this.armatureName = '';
|
|
99
|
+
/** 动画名称 */
|
|
51
100
|
this.animationName = '';
|
|
101
|
+
/** 是否自动播放 */
|
|
52
102
|
this.autoPlay = true;
|
|
53
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* 初始化组件
|
|
106
|
+
* @param obj - 初始化参数
|
|
107
|
+
* @param obj.resource - DragonBones 资源名称
|
|
108
|
+
* @param obj.armatureName - 骨架名称(必填)
|
|
109
|
+
* @param obj.animationName - 默认动画名称
|
|
110
|
+
* @param obj.autoPlay - 是否自动播放
|
|
111
|
+
* @throws 如果未提供 armatureName 则抛出错误
|
|
112
|
+
*/
|
|
54
113
|
init(obj) {
|
|
55
114
|
if (!obj)
|
|
56
115
|
return;
|
|
@@ -100,6 +159,7 @@ class DragonBone$3 extends eva_js.Component {
|
|
|
100
159
|
this.removeAllListeners();
|
|
101
160
|
}
|
|
102
161
|
}
|
|
162
|
+
/** 组件名称 */
|
|
103
163
|
DragonBone$3.componentName = 'DragonBone';
|
|
104
164
|
__decorate([
|
|
105
165
|
inspectorDecorator.type('string')
|