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