@safe-engine/cocos 1.4.11 → 1.5.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.
Files changed (74) hide show
  1. package/@types/index.d.ts +0 -7
  2. package/dist/app.d.ts +13 -2
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +6 -10
  5. package/dist/collider/CollideComponent.d.ts +64 -0
  6. package/dist/collider/CollideComponent.d.ts.map +1 -0
  7. package/dist/collider/CollideComponent.js +265 -0
  8. package/dist/collider/CollideSystem.d.ts +21 -0
  9. package/dist/collider/CollideSystem.d.ts.map +1 -0
  10. package/dist/collider/CollideSystem.js +181 -0
  11. package/dist/collider/index.d.ts +2 -0
  12. package/dist/collider/index.d.ts.map +1 -0
  13. package/dist/collider/index.js +10 -0
  14. package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +1 -1
  15. package/dist/dragonbones/PixiDragonBonesSprite.js +11 -11
  16. package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +77 -0
  17. package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +1 -0
  18. package/dist/dragonbones/cocos/CocosArmatureDisplay.js +227 -0
  19. package/dist/dragonbones/cocos/CocosFactory.d.ts +128 -0
  20. package/dist/dragonbones/cocos/CocosFactory.d.ts.map +1 -0
  21. package/dist/dragonbones/cocos/CocosFactory.js +231 -0
  22. package/dist/dragonbones/cocos/CocosSlot.d.ts +49 -0
  23. package/dist/dragonbones/cocos/CocosSlot.d.ts.map +1 -0
  24. package/dist/dragonbones/cocos/CocosSlot.js +385 -0
  25. package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +53 -0
  26. package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +1 -0
  27. package/dist/dragonbones/cocos/CocosTextureAtlasData.js +158 -0
  28. package/dist/dragonbones/dragonBones.d.ts +3 -0
  29. package/dist/dragonbones/dragonBones.d.ts.map +1 -0
  30. package/dist/dragonbones/dragonBones.js +4788 -0
  31. package/dist/dragonbones/index.d.ts +3 -2
  32. package/dist/dragonbones/index.d.ts.map +1 -1
  33. package/dist/dragonbones/index.js +9 -9
  34. package/dist/gworld/components/CollideComponent.d.ts +3 -3
  35. package/dist/gworld/components/GUIComponent.d.ts +0 -4
  36. package/dist/gworld/components/GUIComponent.d.ts.map +1 -1
  37. package/dist/gworld/components/GUIComponent.js +1 -39
  38. package/dist/gworld/components/NodeComp.d.ts +2 -2
  39. package/dist/gworld/components/NodeComp.d.ts.map +1 -1
  40. package/dist/gworld/components/RenderComponent.d.ts.map +1 -1
  41. package/dist/gworld/systems/CollideSystem.d.ts +2 -1
  42. package/dist/gworld/systems/CollideSystem.d.ts.map +1 -1
  43. package/dist/gworld/systems/CollideSystem.js +12 -2
  44. package/dist/gworld/systems/GUISystem.d.ts +0 -1
  45. package/dist/gworld/systems/GUISystem.d.ts.map +1 -1
  46. package/dist/gworld/systems/GUISystem.js +0 -11
  47. package/dist/gworld/systems/RenderSystem.d.ts.map +1 -1
  48. package/dist/gworld/systems/RenderSystem.js +0 -15
  49. package/dist/helper/NodePool.d.ts +9 -0
  50. package/dist/helper/NodePool.d.ts.map +1 -0
  51. package/dist/helper/NodePool.js +29 -0
  52. package/dist/helper/action.d.ts +1 -1
  53. package/dist/helper/utils.d.ts +1 -2
  54. package/dist/helper/utils.d.ts.map +1 -1
  55. package/dist/helper/utils.js +0 -10
  56. package/dist/index.d.ts +1 -5
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +1 -5
  59. package/dist/richtext/RichTextComp.d.ts +13 -0
  60. package/dist/richtext/RichTextComp.d.ts.map +1 -0
  61. package/dist/richtext/RichTextComp.js +57 -0
  62. package/dist/richtext/RichTextSystem.d.ts +7 -0
  63. package/dist/richtext/RichTextSystem.d.ts.map +1 -0
  64. package/dist/richtext/RichTextSystem.js +28 -0
  65. package/dist/richtext/html-text-parser.d.ts +30 -0
  66. package/dist/richtext/html-text-parser.d.ts.map +1 -0
  67. package/dist/richtext/html-text-parser.js +354 -0
  68. package/dist/richtext/index.d.ts +2 -0
  69. package/dist/richtext/index.d.ts.map +1 -0
  70. package/dist/richtext/index.js +9 -0
  71. package/dist/spine/index.d.ts +31 -0
  72. package/dist/spine/index.d.ts.map +1 -0
  73. package/dist/spine/index.js +74 -0
  74. package/package.json +1 -1
@@ -12,15 +12,15 @@ exports.SharedDragonBonesManager = {
12
12
  }
13
13
  var loader = new PIXI.Loader();
14
14
  loader
15
- .add("ske" + key, key)
16
- .add("texJson" + key, texJsonUrl)
17
- .add("texPng" + key, texPngUrl)
15
+ .add("ske".concat(key), key)
16
+ .add("texJson".concat(key), texJsonUrl)
17
+ .add("texPng".concat(key), texPngUrl)
18
18
  .load(function (loader, resources) {
19
- var dragonData = _this.factory.parseDragonBonesData(resources["ske" + key].data, key);
20
- _this.factory.parseTextureAtlasData(resources["texJson" + key].data, resources["texPng" + key].texture, key);
19
+ var dragonData = _this.factory.parseDragonBonesData(resources["ske".concat(key)].data, key);
20
+ _this.factory.parseTextureAtlasData(resources["texJson".concat(key)].data, resources["texPng".concat(key)].texture, key);
21
21
  _this.assets[key] = {
22
22
  dragonData: dragonData,
23
- texture: resources["texPng" + key].texture
23
+ texture: resources["texPng".concat(key)].texture,
24
24
  };
25
25
  });
26
26
  },
@@ -29,12 +29,12 @@ exports.SharedDragonBonesManager = {
29
29
  var armatureNames = this.assets[key].dragonData.armatureNames;
30
30
  var armatureName = armatureNames[0];
31
31
  return this.factory.buildArmatureDisplay(armatureName, key);
32
- }
32
+ },
33
33
  };
34
34
  exports.PixiDragonBonesSprite = cc.Sprite.extend({
35
35
  ctor: function (config) {
36
36
  this._super();
37
- this._canvas = document.createElement("canvas");
37
+ this._canvas = document.createElement('canvas');
38
38
  this._canvas.width = config.width || 1024;
39
39
  this._canvas.height = config.height || 1024;
40
40
  this._pixiApp = new PIXI.Application({
@@ -45,7 +45,7 @@ exports.PixiDragonBonesSprite = cc.Sprite.extend({
45
45
  transparent: true, // bắt buộc để alpha hoạt động
46
46
  clearBeforeRender: true, // xoá trước khi vẽ frame mới
47
47
  preserveDrawingBuffer: true, // giúp lấy ảnh từ canvas
48
- antialias: true
48
+ antialias: true,
49
49
  });
50
50
  this._texture = new cc.Texture2D();
51
51
  this._texture.initWithElement(this._canvas);
@@ -59,7 +59,7 @@ exports.PixiDragonBonesSprite = cc.Sprite.extend({
59
59
  _setupArmature: function () {
60
60
  var display = exports.SharedDragonBonesManager.buildArmatureDisplay(this._config.ske);
61
61
  if (!display) {
62
- console.error("Không thể build armature:", this._config.armatureName);
62
+ console.error('Không thể build armature:', this._config.armatureName);
63
63
  return;
64
64
  }
65
65
  display.animation.play(this._config.animationName, 0, this._config.playTimes);
@@ -82,5 +82,5 @@ exports.PixiDragonBonesSprite = cc.Sprite.extend({
82
82
  this._pixiApp.destroy(true, { children: true });
83
83
  this._canvas.remove();
84
84
  this._super();
85
- }
85
+ },
86
86
  });
@@ -0,0 +1,77 @@
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 { Armature, EventObject, EventStringType, IArmatureProxy } from '@cocos/dragonbones-js';
24
+ export declare class CocosArmatureDisplay extends cc.Sprite implements IArmatureProxy {
25
+ /**
26
+ * @private
27
+ */
28
+ debugDraw: boolean;
29
+ private _debugDraw;
30
+ private _armature;
31
+ private _debugDrawer;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ dbInit(armature: Armature): void;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ dbClear(): void;
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ dbUpdate(): void;
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ dispose(disposeProxy?: boolean): void;
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ destroy(): void;
52
+ /**
53
+ * @private
54
+ */
55
+ dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ hasDBEventListener(type: EventStringType): boolean;
60
+ /**
61
+ * @inheritDoc
62
+ */
63
+ addDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void;
64
+ /**
65
+ * @inheritDoc
66
+ */
67
+ removeDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void;
68
+ /**
69
+ * @inheritDoc
70
+ */
71
+ get armature(): Armature;
72
+ /**
73
+ * @inheritDoc
74
+ */
75
+ get animation(): Animation;
76
+ }
77
+ //# sourceMappingURL=CocosArmatureDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CocosArmatureDisplay.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/cocos/CocosArmatureDisplay.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAgC,WAAW,EAAE,eAAe,EAAE,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AAErJ,qBAAa,oBAAqB,SAAQ,EAAE,CAAC,MAAO,YAAW,cAAc;IAC3E;;OAEG;IACI,SAAS,UAAS;IACzB,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,YAAY,CAA0B;IAC9C;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAGvC;;OAEG;IACI,OAAO,IAAI,IAAI;IAUtB;;OAEG;IACI,QAAQ,IAAI,IAAI;IAyGvB;;OAEG;IACI,OAAO,CAAC,YAAY,UAAO,GAAG,IAAI;IAQzC;;OAEG;IACI,OAAO,IAAI,IAAI;IAGtB;;OAEG;IACI,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI;IAG7E;;OAEG;IACI,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO;IAIzD;;OAEG;IACI,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAG3G;;OAEG;IACI,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAG9G;;OAEG;IACH,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IACD;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;CACF"}
@@ -0,0 +1,227 @@
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.CocosArmatureDisplay = void 0;
42
+ var dragonbones_js_1 = require("@cocos/dragonbones-js");
43
+ var CocosArmatureDisplay = /** @class */ (function (_super) {
44
+ __extends(CocosArmatureDisplay, _super);
45
+ function CocosArmatureDisplay() {
46
+ var _this = _super !== null && _super.apply(this, arguments) || this;
47
+ /**
48
+ * @private
49
+ */
50
+ _this.debugDraw = false;
51
+ _this._debugDraw = false;
52
+ // private _disposeProxy: boolean = false;
53
+ _this._armature = null;
54
+ _this._debugDrawer = null;
55
+ return _this;
56
+ }
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ CocosArmatureDisplay.prototype.dbInit = function (armature) {
61
+ this._armature = armature;
62
+ };
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ CocosArmatureDisplay.prototype.dbClear = function () {
67
+ if (this._debugDrawer !== null) {
68
+ this._debugDrawer.removeFromParent();
69
+ }
70
+ this._armature = null;
71
+ this._debugDrawer = null;
72
+ _super.prototype.removeFromParent.call(this);
73
+ };
74
+ /**
75
+ * @inheritDoc
76
+ */
77
+ CocosArmatureDisplay.prototype.dbUpdate = function () {
78
+ var drawed = dragonbones_js_1.DragonBones.debugDraw || this.debugDraw;
79
+ if (drawed || this._debugDraw) {
80
+ this._debugDraw = drawed;
81
+ if (this._debugDraw) {
82
+ if (this._debugDrawer === null) {
83
+ this._debugDrawer = new cc.Sprite();
84
+ var boneDrawer_1 = new cc.DrawNode();
85
+ this._debugDrawer.addChild(boneDrawer_1);
86
+ }
87
+ this.addChild(this._debugDrawer);
88
+ var boneDrawer = this._debugDrawer.children[0];
89
+ boneDrawer.clear();
90
+ var bones = this._armature.getBones();
91
+ for (var i = 0, l = bones.length; i < l; ++i) {
92
+ var bone = bones[i];
93
+ var boneLength = bone.boneData.length;
94
+ var startX = bone.globalTransformMatrix.tx;
95
+ var startY = bone.globalTransformMatrix.ty;
96
+ var endX = startX + bone.globalTransformMatrix.a * boneLength;
97
+ var endY = startY + bone.globalTransformMatrix.b * boneLength;
98
+ boneDrawer.setLineWidth(2.0);
99
+ boneDrawer.setColor(cc.color('0x00FFFF'));
100
+ boneDrawer.drawSegment(cc.p(startX, startY), cc.p(endX, endY));
101
+ // boneDrawer.lineStyle(0.0, 0, 0.0);
102
+ // boneDrawer.beginFill(0x00FFFF, 0.7);
103
+ boneDrawer.drawCircle(cc.p(startX, startY), 3.0, Math.PI * 2, 64);
104
+ // boneDrawer.endFill();
105
+ }
106
+ var slots = this._armature.getSlots();
107
+ for (var i = 0, l = slots.length; i < l; ++i) {
108
+ var slot = slots[i];
109
+ var boundingBoxData = slot.boundingBoxData;
110
+ if (boundingBoxData) {
111
+ var child = this._debugDrawer.getChildByName(slot.name);
112
+ if (!child) {
113
+ child = new cc.DrawNode();
114
+ child.name = slot.name;
115
+ this._debugDrawer.addChild(child);
116
+ }
117
+ child.clear();
118
+ child.lineStyle(2.0, 0xFF00FF, 0.7);
119
+ switch (boundingBoxData.type) {
120
+ case dragonbones_js_1.BoundingBoxType.Rectangle:
121
+ child.drawRect(-boundingBoxData.width * 0.5, -boundingBoxData.height * 0.5, boundingBoxData.width, boundingBoxData.height);
122
+ break;
123
+ case dragonbones_js_1.BoundingBoxType.Ellipse:
124
+ child.drawEllipse(-boundingBoxData.width * 0.5, -boundingBoxData.height * 0.5, boundingBoxData.width, boundingBoxData.height);
125
+ break;
126
+ case dragonbones_js_1.BoundingBoxType.Polygon:
127
+ var vertices = boundingBoxData.vertices;
128
+ for (var i_1 = 0, l_1 = vertices.length; i_1 < l_1; i_1 += 2) {
129
+ var x = vertices[i_1];
130
+ var y = vertices[i_1 + 1];
131
+ if (i_1 === 0) {
132
+ child.moveTo(x, y);
133
+ }
134
+ else {
135
+ child.lineTo(x, y);
136
+ }
137
+ }
138
+ child.lineTo(vertices[0], vertices[1]);
139
+ break;
140
+ default:
141
+ break;
142
+ }
143
+ child.endFill();
144
+ slot.updateTransformAndMatrix();
145
+ slot.updateGlobalTransform();
146
+ var transform = slot.global;
147
+ child.setTransform(transform.x, transform.y, transform.scaleX, transform.scaleY, transform.rotation, transform.skew, 0.0, slot._pivotX, slot._pivotY);
148
+ }
149
+ else {
150
+ var child = this._debugDrawer.getChildByName(slot.name);
151
+ if (child) {
152
+ this._debugDrawer.removeChild(child);
153
+ }
154
+ }
155
+ }
156
+ }
157
+ else if (this._debugDrawer !== null && this._debugDrawer.parent === this) {
158
+ this.removeChild(this._debugDrawer);
159
+ }
160
+ }
161
+ };
162
+ /**
163
+ * @inheritDoc
164
+ */
165
+ CocosArmatureDisplay.prototype.dispose = function (disposeProxy) {
166
+ if (disposeProxy === void 0) { disposeProxy = true; }
167
+ // tslint:disable-next-line:no-unused-expression
168
+ disposeProxy;
169
+ if (this._armature !== null) {
170
+ this._armature.dispose();
171
+ this._armature = null;
172
+ }
173
+ };
174
+ /**
175
+ * @inheritDoc
176
+ */
177
+ CocosArmatureDisplay.prototype.destroy = function () {
178
+ this.dispose();
179
+ };
180
+ /**
181
+ * @private
182
+ */
183
+ CocosArmatureDisplay.prototype.dispatchDBEvent = function (type, eventObject) {
184
+ this.emit(type, eventObject);
185
+ };
186
+ /**
187
+ * @inheritDoc
188
+ */
189
+ CocosArmatureDisplay.prototype.hasDBEventListener = function (type) {
190
+ // return this.listenerCount(type) > 0;
191
+ return false;
192
+ };
193
+ /**
194
+ * @inheritDoc
195
+ */
196
+ CocosArmatureDisplay.prototype.addDBEventListener = function (type, listener, target) {
197
+ this.addListener(type, listener, target);
198
+ };
199
+ /**
200
+ * @inheritDoc
201
+ */
202
+ CocosArmatureDisplay.prototype.removeDBEventListener = function (type, listener, target) {
203
+ this.removeListener(type, listener, target);
204
+ };
205
+ Object.defineProperty(CocosArmatureDisplay.prototype, "armature", {
206
+ /**
207
+ * @inheritDoc
208
+ */
209
+ get: function () {
210
+ return this._armature;
211
+ },
212
+ enumerable: false,
213
+ configurable: true
214
+ });
215
+ Object.defineProperty(CocosArmatureDisplay.prototype, "animation", {
216
+ /**
217
+ * @inheritDoc
218
+ */
219
+ get: function () {
220
+ return this._armature.animation;
221
+ },
222
+ enumerable: false,
223
+ configurable: true
224
+ });
225
+ return CocosArmatureDisplay;
226
+ }(cc.Sprite));
227
+ exports.CocosArmatureDisplay = CocosArmatureDisplay;
@@ -0,0 +1,128 @@
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 { Armature, BaseFactory, BuildArmaturePackage, DataParser, Slot, SlotData } from '@cocos/dragonbones-js';
24
+ import { CocosArmatureDisplay } from './CocosArmatureDisplay';
25
+ import { CocosTextureAtlasData } from './CocosTextureAtlasData';
26
+ /**
27
+ * - The PixiJS factory.
28
+ * @version DragonBones 3.0
29
+ * @language en_US
30
+ */
31
+ /**
32
+ * - PixiJS 工厂。
33
+ * @version DragonBones 3.0
34
+ * @language zh_CN
35
+ */
36
+ export declare class CocosFactory extends BaseFactory {
37
+ private static _dragonBonesInstance;
38
+ private static _factory;
39
+ private static _clockHandler;
40
+ static advanceTime(passedTime: number): void;
41
+ static useSharedTicker: boolean;
42
+ /**
43
+ * - A global factory instance that can be used directly.
44
+ * @version DragonBones 4.7
45
+ * @language en_US
46
+ */
47
+ /**
48
+ * - 一个可以直接使用的全局工厂实例。
49
+ * @version DragonBones 4.7
50
+ * @language zh_CN
51
+ */
52
+ static get factory(): CocosFactory;
53
+ /**
54
+ * - 一个获取全局工厂实例(单例)的方法, 和get factory相比, 优点是可以传参数。
55
+ * @version DragonBones 4.7
56
+ * @language zh_CN
57
+ */
58
+ static newInstance(useSharedTicker?: boolean): CocosFactory;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ constructor(dataParser?: DataParser | null, useSharedTicker?: boolean);
63
+ protected _buildTextureAtlasData(textureAtlasData: CocosTextureAtlasData | null, textureAtlas: cc.Texture2D | null): CocosTextureAtlasData;
64
+ protected _buildArmature(dataPackage: BuildArmaturePackage): Armature;
65
+ protected _buildSlot(_dataPackage: BuildArmaturePackage, slotData: SlotData, armature: Armature): Slot;
66
+ /**
67
+ * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances, then use the {@link #clock} to update it.
68
+ * The difference is that the armature created by {@link #buildArmature} is not WorldClock instance update.
69
+ * @param armatureName - The armature data name.
70
+ * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature)
71
+ * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data)
72
+ * @returns The armature display container.
73
+ * @see dragonBones.IArmatureProxy
74
+ * @see dragonBones.BaseFactory#buildArmature
75
+ * @version DragonBones 4.5
76
+ * @example
77
+ * <pre>
78
+ * let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
79
+ * </pre>
80
+ * @language en_US
81
+ */
82
+ /**
83
+ * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架,并用 {@link #clock} 更新该骨架。
84
+ * 区别在于由 {@link #buildArmature} 创建的骨架没有 WorldClock 实例驱动。
85
+ * @param armatureName - 骨架数据名称。
86
+ * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
87
+ * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据。 (如果未设置,则使用默认的皮肤数据)
88
+ * @returns 骨架的显示容器。
89
+ * @see dragonBones.IArmatureProxy
90
+ * @see dragonBones.BaseFactory#buildArmature
91
+ * @version DragonBones 4.5
92
+ * @example
93
+ * <pre>
94
+ * let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
95
+ * </pre>
96
+ * @language zh_CN
97
+ */
98
+ buildArmatureDisplay(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): CocosArmatureDisplay | null;
99
+ /**
100
+ * - Create the display object with the specified texture.
101
+ * @param textureName - The texture data name.
102
+ * @param textureAtlasName - The texture atlas data name (Of not set, all texture atlas data will be searched)
103
+ * @version DragonBones 3.0
104
+ * @language en_US
105
+ */
106
+ /**
107
+ * - 创建带有指定贴图的显示对象。
108
+ * @param textureName - 贴图数据名称。
109
+ * @param textureAtlasName - 贴图集数据名称。 (如果未设置,将检索所有的贴图集数据)
110
+ * @version DragonBones 3.0
111
+ * @language zh_CN
112
+ */
113
+ getTextureDisplay(textureName: string, textureAtlasName?: string | null): cc.Sprite | null;
114
+ /**
115
+ * - A global sound event manager.
116
+ * Sound events can be listened to uniformly from the manager.
117
+ * @version DragonBones 4.5
118
+ * @language en_US
119
+ */
120
+ /**
121
+ * - 全局声音事件管理器。
122
+ * 声音事件可以从该管理器统一侦听。
123
+ * @version DragonBones 4.5
124
+ * @language zh_CN
125
+ */
126
+ get soundEventManager(): CocosArmatureDisplay;
127
+ }
128
+ //# sourceMappingURL=CocosFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CocosFactory.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/cocos/CocosFactory.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAc,oBAAoB,EAAE,UAAU,EAAe,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEzI,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAoB,MAAM,yBAAyB,CAAC;AAElF;;;;GAIG;AACH;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAA4B;IAC/D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IACpD,OAAO,CAAC,MAAM,CAAC,aAAa;WAOd,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAOnD,OAAc,eAAe,UAAQ;IAErC;;;;OAIG;IACH;;;;OAIG;IACH,WAAkB,OAAO,IAAI,YAAY,CAMxC;IAED;;;;OAIG;WACW,WAAW,CAAC,eAAe,UAAO,GAAG,YAAY;IAO/D;;OAEG;gBACgB,UAAU,GAAE,UAAU,GAAG,IAAW,EAAE,eAAe,UAAO;IAc/E,SAAS,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,qBAAqB,GAAG,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,qBAAqB;IAc1I,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,oBAAoB,GAAG,QAAQ;IAYrE,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAStG;;;;;;;;;;;;;;;OAeG;IACH;;;;;;;;;;;;;;;OAeG;IACI,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,SAAK,EAAE,QAAQ,SAAK,EAAE,gBAAgB,SAAK,GAAG,oBAAoB,GAAG,IAAI;IAU1I;;;;;;OAMG;IACH;;;;;;OAMG;IACI,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAM,GAAG,IAAW,GAAG,EAAE,CAAC,MAAM,GAAG,IAAI;IAQvG;;;;;OAKG;IACH;;;;;OAKG;IACH,IAAW,iBAAiB,IAAI,oBAAoB,CAEnD;CACF"}