@safe-engine/pixi 8.8.2 → 8.8.3
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 +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +20 -1
- package/dist/dragonbones/DragonBonesComponent.d.ts +1 -1
- package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComponent.js +1 -1
- package/dist/dragonbones/DragonBonesSystem.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesSystem.js +1 -1
- package/dist/dragonbones/db-pixi/PixiArmatureDisplay.d.ts +59 -0
- package/dist/dragonbones/db-pixi/PixiArmatureDisplay.d.ts.map +1 -0
- package/dist/dragonbones/db-pixi/PixiArmatureDisplay.js +180 -0
- package/dist/dragonbones/db-pixi/PixiFactory.d.ts +87 -0
- package/dist/dragonbones/db-pixi/PixiFactory.d.ts.map +1 -0
- package/dist/dragonbones/db-pixi/PixiFactory.js +159 -0
- package/dist/dragonbones/db-pixi/PixiSlot.d.ts +31 -0
- package/dist/dragonbones/db-pixi/PixiSlot.d.ts.map +1 -0
- package/dist/dragonbones/db-pixi/PixiSlot.js +332 -0
- package/dist/dragonbones/db-pixi/PixiTextureAtlasData.d.ts +38 -0
- package/dist/dragonbones/db-pixi/PixiTextureAtlasData.d.ts.map +1 -0
- package/dist/dragonbones/db-pixi/PixiTextureAtlasData.js +85 -0
- package/dist/dragonbones/db-pixi/index.d.ts +5 -0
- package/dist/dragonbones/db-pixi/index.d.ts.map +1 -0
- package/dist/dragonbones/db-pixi/index.js +4 -0
- package/dist/dragonbones/dragonBones/animation/Animation.d.ts +241 -0
- package/dist/dragonbones/dragonBones/animation/Animation.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/Animation.js +692 -0
- package/dist/dragonbones/dragonBones/animation/AnimationState.d.ts +323 -0
- package/dist/dragonbones/dragonBones/animation/AnimationState.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/AnimationState.js +1161 -0
- package/dist/dragonbones/dragonBones/animation/BaseTimelineState.d.ts +100 -0
- package/dist/dragonbones/dragonBones/animation/BaseTimelineState.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/BaseTimelineState.js +479 -0
- package/dist/dragonbones/dragonBones/animation/IAnimatable.d.ts +38 -0
- package/dist/dragonbones/dragonBones/animation/IAnimatable.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/IAnimatable.js +9 -0
- package/dist/dragonbones/dragonBones/animation/TimelineState.d.ts +159 -0
- package/dist/dragonbones/dragonBones/animation/TimelineState.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/TimelineState.js +998 -0
- package/dist/dragonbones/dragonBones/animation/WorldClock.d.ts +74 -0
- package/dist/dragonbones/dragonBones/animation/WorldClock.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/animation/WorldClock.js +162 -0
- package/dist/dragonbones/dragonBones/armature/Armature.d.ts +314 -0
- package/dist/dragonbones/dragonBones/armature/Armature.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/Armature.js +650 -0
- package/dist/dragonbones/dragonBones/armature/Bone.d.ts +123 -0
- package/dist/dragonbones/dragonBones/armature/Bone.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/Bone.js +438 -0
- package/dist/dragonbones/dragonBones/armature/Constraint.d.ts +99 -0
- package/dist/dragonbones/dragonBones/armature/Constraint.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/Constraint.js +672 -0
- package/dist/dragonbones/dragonBones/armature/IArmatureProxy.d.ts +47 -0
- package/dist/dragonbones/dragonBones/armature/IArmatureProxy.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/IArmatureProxy.js +1 -0
- package/dist/dragonbones/dragonBones/armature/Slot.d.ts +357 -0
- package/dist/dragonbones/dragonBones/armature/Slot.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/Slot.js +1009 -0
- package/dist/dragonbones/dragonBones/armature/Surface.d.ts +41 -0
- package/dist/dragonbones/dragonBones/armature/Surface.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/Surface.js +463 -0
- package/dist/dragonbones/dragonBones/armature/TransformObject.d.ts +80 -0
- package/dist/dragonbones/dragonBones/armature/TransformObject.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/armature/TransformObject.js +77 -0
- package/dist/dragonbones/dragonBones/core/BaseObject.d.ts +53 -0
- package/dist/dragonbones/dragonBones/core/BaseObject.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/core/BaseObject.js +130 -0
- package/dist/dragonbones/dragonBones/core/DragonBones.d.ts +236 -0
- package/dist/dragonbones/dragonBones/core/DragonBones.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/core/DragonBones.js +61 -0
- package/dist/dragonbones/dragonBones/event/EventObject.d.ts +143 -0
- package/dist/dragonbones/dragonBones/event/EventObject.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/event/EventObject.js +99 -0
- package/dist/dragonbones/dragonBones/event/IEventDispatcher.d.ts +48 -0
- package/dist/dragonbones/dragonBones/event/IEventDispatcher.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/event/IEventDispatcher.js +1 -0
- package/dist/dragonbones/dragonBones/factory/BaseFactory.d.ts +292 -0
- package/dist/dragonbones/dragonBones/factory/BaseFactory.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/factory/BaseFactory.js +735 -0
- package/dist/dragonbones/dragonBones/geom/ColorTransform.d.ts +17 -0
- package/dist/dragonbones/dragonBones/geom/ColorTransform.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/ColorTransform.js +33 -0
- package/dist/dragonbones/dragonBones/geom/Curve.d.ts +10 -0
- package/dist/dragonbones/dragonBones/geom/Curve.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/Curve.js +26 -0
- package/dist/dragonbones/dragonBones/geom/Matrix.d.ts +105 -0
- package/dist/dragonbones/dragonBones/geom/Matrix.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/Matrix.js +207 -0
- package/dist/dragonbones/dragonBones/geom/Point.d.ts +38 -0
- package/dist/dragonbones/dragonBones/geom/Point.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/Point.js +31 -0
- package/dist/dragonbones/dragonBones/geom/Rectangle.d.ts +53 -0
- package/dist/dragonbones/dragonBones/geom/Rectangle.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/Rectangle.js +37 -0
- package/dist/dragonbones/dragonBones/geom/Transform.d.ts +102 -0
- package/dist/dragonbones/dragonBones/geom/Transform.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/geom/Transform.js +170 -0
- package/dist/dragonbones/dragonBones/index.d.ts +37 -0
- package/dist/dragonbones/dragonBones/index.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/index.js +36 -0
- package/dist/dragonbones/dragonBones/model/AnimationConfig.d.ts +162 -0
- package/dist/dragonbones/dragonBones/model/AnimationConfig.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/AnimationConfig.js +81 -0
- package/dist/dragonbones/dragonBones/model/AnimationData.d.ts +174 -0
- package/dist/dragonbones/dragonBones/model/AnimationData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/AnimationData.js +256 -0
- package/dist/dragonbones/dragonBones/model/ArmatureData.d.ts +319 -0
- package/dist/dragonbones/dragonBones/model/ArmatureData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/ArmatureData.js +450 -0
- package/dist/dragonbones/dragonBones/model/BoundingBoxData.d.ts +188 -0
- package/dist/dragonbones/dragonBones/model/BoundingBoxData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/BoundingBoxData.js +500 -0
- package/dist/dragonbones/dragonBones/model/CanvasData.d.ts +15 -0
- package/dist/dragonbones/dragonBones/model/CanvasData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/CanvasData.js +17 -0
- package/dist/dragonbones/dragonBones/model/ConstraintData.d.ts +46 -0
- package/dist/dragonbones/dragonBones/model/ConstraintData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/ConstraintData.js +57 -0
- package/dist/dragonbones/dragonBones/model/DisplayData.d.ts +98 -0
- package/dist/dragonbones/dragonBones/model/DisplayData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/DisplayData.js +174 -0
- package/dist/dragonbones/dragonBones/model/DragonBonesData.d.ts +108 -0
- package/dist/dragonbones/dragonBones/model/DragonBonesData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/DragonBonesData.js +86 -0
- package/dist/dragonbones/dragonBones/model/SkinData.d.ts +40 -0
- package/dist/dragonbones/dragonBones/model/SkinData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/SkinData.js +68 -0
- package/dist/dragonbones/dragonBones/model/TextureAtlasData.d.ts +73 -0
- package/dist/dragonbones/dragonBones/model/TextureAtlasData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/TextureAtlasData.js +102 -0
- package/dist/dragonbones/dragonBones/model/UserData.d.ts +73 -0
- package/dist/dragonbones/dragonBones/model/UserData.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/model/UserData.js +101 -0
- package/dist/dragonbones/dragonBones/parser/BinaryDataParser.d.ts +29 -0
- package/dist/dragonbones/dragonBones/parser/BinaryDataParser.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/parser/BinaryDataParser.js +356 -0
- package/dist/dragonbones/dragonBones/parser/DataParser.d.ts +153 -0
- package/dist/dragonbones/dragonBones/parser/DataParser.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/parser/DataParser.js +283 -0
- package/dist/dragonbones/dragonBones/parser/ObjectDataParser.d.ts +130 -0
- package/dist/dragonbones/dragonBones/parser/ObjectDataParser.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones/parser/ObjectDataParser.js +2098 -0
- package/package.json +1 -2
package/dist/app.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare function startGame(defaultFont: any, designedResolution: {
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
}, assetManager: AssetsClass, id?: string): Promise<Application<Renderer>>;
|
|
6
|
+
export declare function loadAll(assets: any, cb?: (progress: number) => void): Promise<void>;
|
|
6
7
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAU,WAAW,EAAE,QAAQ,EAAW,MAAM,SAAS,CAAA;AAM7E,wBAAsB,SAAS,CAC7B,WAAW,KAAA,EACX,kBAAkB;;;CAA+B,EACjD,YAAY,EAAE,WAAW,EACzB,EAAE,SAAe,GAChB,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CA6BhC;AAqBD,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,iBAgBnE"}
|
package/dist/app.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { actionManager } from 'pixi-action-ease';
|
|
11
|
-
import { Application } from 'pixi.js';
|
|
11
|
+
import { Application, Assets } from 'pixi.js';
|
|
12
12
|
import { GameWorld } from './base';
|
|
13
13
|
import { NoRenderSystem } from './norender/NoRenderSystem';
|
|
14
14
|
import { RenderSystem } from './render/RenderSystem';
|
|
@@ -61,3 +61,22 @@ function initWorld(defaultFont) {
|
|
|
61
61
|
}
|
|
62
62
|
world.systems.addThenConfigure(NoRenderSystem);
|
|
63
63
|
}
|
|
64
|
+
export function loadAll(assets, cb) {
|
|
65
|
+
const allAssets = [];
|
|
66
|
+
const fontBundle = {};
|
|
67
|
+
Object.values(assets).forEach((value) => {
|
|
68
|
+
if (value.skeleton) {
|
|
69
|
+
allAssets.push(value.skeleton, value.atlas, value.texture);
|
|
70
|
+
}
|
|
71
|
+
else if (value.endsWith('.ttf')) {
|
|
72
|
+
fontBundle[value] = value;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
allAssets.push(value);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Assets.addBundle('fonts', fontBundle);
|
|
79
|
+
return Promise.all([Assets.loadBundle('fonts')]).then(() => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
yield Assets.load(allAssets, cb);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PixiArmatureDisplay } from 'dragonbones-pixijs';
|
|
2
1
|
import { BaseComponentProps } from '..';
|
|
3
2
|
import { ComponentX } from '../components/BaseComponent';
|
|
3
|
+
import { PixiArmatureDisplay } from './db-pixi';
|
|
4
4
|
interface DragonBonesData {
|
|
5
5
|
atlas: string;
|
|
6
6
|
skeleton: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragonBonesComponent.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesComponent.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DragonBonesComponent.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,kBAAkB,EAAE,MAAM,IAAI,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAU,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAe,MAAM,WAAW,CAAA;AAC5D,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,gBAAiB,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IACpE,IAAI,EAAE,eAAe,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAClD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACxD;AACD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;IACpF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAI;IAOxC,eAAe,CAAC,IAAI,EAAE,eAAe;IAerC,QAAQ,CAAC,OAAO,EAAE,OAAO;IAIzB,YAAY,CAAC,SAAS,EAAE,KAAK;CAG9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PixiFactory } from 'dragonbones-pixijs';
|
|
2
1
|
import { Assets } from '..';
|
|
3
2
|
import { ComponentX, render } from '../components/BaseComponent';
|
|
3
|
+
import { PixiFactory } from './db-pixi';
|
|
4
4
|
export class DragonBonesComp extends ComponentX {
|
|
5
5
|
setAnimation(name, playTimes = 0) {
|
|
6
6
|
const skel = this.node.instance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragonBonesSystem.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesSystem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DragonBonesSystem.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKnC,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,SAAS,CAAC;CA6BjD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PixiFactory } from 'dragonbones-pixijs';
|
|
2
1
|
import { EventTypes } from 'entityx-ts';
|
|
3
2
|
import { Assets } from 'pixi.js';
|
|
4
3
|
import { NodeComp } from '../components/NodeComp';
|
|
5
4
|
import { DragonBonesComp } from './DragonBonesComponent';
|
|
5
|
+
import { PixiFactory } from './db-pixi';
|
|
6
6
|
export class DragonBonesSystem {
|
|
7
7
|
configure(event_manager) {
|
|
8
8
|
event_manager.subscribe(EventTypes.ComponentAdded, DragonBonesComp, ({ entity, component }) => {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Animation, Armature, EventObject, EventStringType, IArmatureProxy } from '../dragonBones';
|
|
3
|
+
/**
|
|
4
|
+
* @inheritDoc
|
|
5
|
+
*/
|
|
6
|
+
export declare class PixiArmatureDisplay extends Container implements IArmatureProxy {
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
debugDraw: boolean;
|
|
11
|
+
private _debugDraw;
|
|
12
|
+
private _armature;
|
|
13
|
+
private _debugDrawer;
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
dbInit(armature: Armature): void;
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
dbClear(): void;
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
dbUpdate(): void;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
dispose(disposeProxy?: boolean): void;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
destroy(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
hasDBEventListener(type: EventStringType): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
addDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* @inheritDoc
|
|
48
|
+
*/
|
|
49
|
+
removeDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
get armature(): Armature;
|
|
54
|
+
/**
|
|
55
|
+
* @inheritDoc
|
|
56
|
+
*/
|
|
57
|
+
get animation(): Animation;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=PixiArmatureDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PixiArmatureDisplay.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/db-pixi/PixiArmatureDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6B,MAAM,SAAS,CAAA;AAC9D,OAAO,EACL,SAAS,EACT,QAAQ,EAGR,WAAW,EACX,eAAe,EACf,cAAc,EAEf,MAAM,gBAAgB,CAAA;AAEvB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAU,YAAW,cAAc;IAC1E;;OAEG;IACI,SAAS,UAAO;IACvB,OAAO,CAAC,UAAU,CAAQ;IAE1B,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,YAAY,CAAsB;IAC1C;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAGvC;;OAEG;IACI,OAAO,IAAI,IAAI;IAatB;;OAEG;IACI,QAAQ,IAAI,IAAI;IAgHvB;;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;IAGzD;;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,180 @@
|
|
|
1
|
+
import { Container, Graphics, Sprite, Texture } from 'pixi.js';
|
|
2
|
+
import { DragonBones, } from '../dragonBones';
|
|
3
|
+
/**
|
|
4
|
+
* @inheritDoc
|
|
5
|
+
*/
|
|
6
|
+
export class PixiArmatureDisplay extends Container {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
this.debugDraw = true;
|
|
13
|
+
this._debugDraw = false;
|
|
14
|
+
// private _disposeProxy: boolean = false;
|
|
15
|
+
this._armature = null;
|
|
16
|
+
this._debugDrawer = null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
dbInit(armature) {
|
|
22
|
+
this._armature = armature;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
dbClear() {
|
|
28
|
+
if (this._debugDrawer !== null) {
|
|
29
|
+
this._debugDrawer.destroy({
|
|
30
|
+
children: true,
|
|
31
|
+
texture: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
this._armature = null;
|
|
35
|
+
this._debugDrawer = null;
|
|
36
|
+
super.destroy();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
dbUpdate() {
|
|
42
|
+
const drawed = DragonBones.debugDraw || this.debugDraw;
|
|
43
|
+
if (drawed || this._debugDraw) {
|
|
44
|
+
this._debugDraw = drawed;
|
|
45
|
+
if (this._debugDraw) {
|
|
46
|
+
if (this._debugDrawer === null) {
|
|
47
|
+
this._debugDrawer = new Sprite(Texture.EMPTY);
|
|
48
|
+
const boneDrawer = new Graphics();
|
|
49
|
+
this._debugDrawer.addChild(boneDrawer);
|
|
50
|
+
}
|
|
51
|
+
this.addChild(this._debugDrawer);
|
|
52
|
+
const boneDrawer = this._debugDrawer.getChildAt(0);
|
|
53
|
+
boneDrawer.clear();
|
|
54
|
+
const bones = this._armature.getBones();
|
|
55
|
+
for (let i = 0, l = bones.length; i < l; ++i) {
|
|
56
|
+
const bone = bones[i];
|
|
57
|
+
const boneLength = bone.boneData.length;
|
|
58
|
+
const startX = bone.globalTransformMatrix.tx;
|
|
59
|
+
const startY = bone.globalTransformMatrix.ty;
|
|
60
|
+
const endX = startX + bone.globalTransformMatrix.a * boneLength;
|
|
61
|
+
const endY = startY + bone.globalTransformMatrix.b * boneLength;
|
|
62
|
+
boneDrawer.lineStyle(2.0, 0x00ffff, 0.7);
|
|
63
|
+
boneDrawer.moveTo(startX, startY);
|
|
64
|
+
boneDrawer.lineTo(endX, endY);
|
|
65
|
+
boneDrawer.lineStyle(0.0, 0, 0.0);
|
|
66
|
+
boneDrawer.beginFill(0x00ffff, 0.7);
|
|
67
|
+
boneDrawer.drawCircle(startX, startY, 3.0);
|
|
68
|
+
boneDrawer.endFill();
|
|
69
|
+
}
|
|
70
|
+
const slots = this._armature.getSlots();
|
|
71
|
+
for (let i = 0, l = slots.length; i < l; ++i) {
|
|
72
|
+
const slot = slots[i];
|
|
73
|
+
const boundingBoxData = slot.boundingBoxData;
|
|
74
|
+
if (boundingBoxData) {
|
|
75
|
+
let child = this._debugDrawer.getChildByName(slot.name);
|
|
76
|
+
if (!child) {
|
|
77
|
+
child = new Graphics();
|
|
78
|
+
child.name = slot.name;
|
|
79
|
+
this._debugDrawer.addChild(child);
|
|
80
|
+
}
|
|
81
|
+
child.clear();
|
|
82
|
+
child.lineStyle(2.0, 0xff00ff, 0.7);
|
|
83
|
+
switch (boundingBoxData.type) {
|
|
84
|
+
case 0 /* BoundingBoxType.Rectangle */:
|
|
85
|
+
child.drawRect(-boundingBoxData.width * 0.5, -boundingBoxData.height * 0.5, boundingBoxData.width, boundingBoxData.height);
|
|
86
|
+
break;
|
|
87
|
+
case 1 /* BoundingBoxType.Ellipse */:
|
|
88
|
+
child.drawEllipse(-boundingBoxData.width * 0.5, -boundingBoxData.height * 0.5, boundingBoxData.width, boundingBoxData.height);
|
|
89
|
+
break;
|
|
90
|
+
case 2 /* BoundingBoxType.Polygon */: {
|
|
91
|
+
const vertices = boundingBoxData.vertices;
|
|
92
|
+
for (let i = 0, l = vertices.length; i < l; i += 2) {
|
|
93
|
+
const x = vertices[i];
|
|
94
|
+
const y = vertices[i + 1];
|
|
95
|
+
if (i === 0) {
|
|
96
|
+
child.moveTo(x, y);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
child.lineTo(x, y);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
child.lineTo(vertices[0], vertices[1]);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
default:
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
child.endFill();
|
|
109
|
+
slot.updateTransformAndMatrix();
|
|
110
|
+
slot.updateGlobalTransform();
|
|
111
|
+
const transform = slot.global;
|
|
112
|
+
child.setTransform(transform.x, transform.y, transform.scaleX, transform.scaleY, transform.rotation, transform.skew);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const child = this._debugDrawer.getChildByName(slot.name);
|
|
116
|
+
if (child) {
|
|
117
|
+
this._debugDrawer.removeChild(child);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (this._debugDrawer !== null && this._debugDrawer.parent === this) {
|
|
123
|
+
this.removeChild(this._debugDrawer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @inheritDoc
|
|
129
|
+
*/
|
|
130
|
+
dispose(disposeProxy = true) {
|
|
131
|
+
// tslint:disable-next-line:no-unused-expression
|
|
132
|
+
// disposeProxy
|
|
133
|
+
if (this._armature !== null) {
|
|
134
|
+
this._armature.dispose();
|
|
135
|
+
this._armature = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @inheritDoc
|
|
140
|
+
*/
|
|
141
|
+
destroy() {
|
|
142
|
+
this.dispose();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
dispatchDBEvent(type, eventObject) {
|
|
148
|
+
this.emit(type, eventObject);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @inheritDoc
|
|
152
|
+
*/
|
|
153
|
+
hasDBEventListener(type) {
|
|
154
|
+
return this.listenerCount(type) > 0;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @inheritDoc
|
|
158
|
+
*/
|
|
159
|
+
addDBEventListener(type, listener, target) {
|
|
160
|
+
this.addListener(type, listener, target);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @inheritDoc
|
|
164
|
+
*/
|
|
165
|
+
removeDBEventListener(type, listener, target) {
|
|
166
|
+
this.removeListener(type, listener, target);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @inheritDoc
|
|
170
|
+
*/
|
|
171
|
+
get armature() {
|
|
172
|
+
return this._armature;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @inheritDoc
|
|
176
|
+
*/
|
|
177
|
+
get animation() {
|
|
178
|
+
return this._armature.animation;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Sprite, Texture } from 'pixi.js';
|
|
2
|
+
import { Armature, BaseFactory, BuildArmaturePackage, DataParser, Slot, SlotData } from '../dragonBones';
|
|
3
|
+
import { PixiArmatureDisplay } from './PixiArmatureDisplay';
|
|
4
|
+
import { PixiTextureAtlasData } from './PixiTextureAtlasData';
|
|
5
|
+
/**
|
|
6
|
+
* - The PixiJS factory.
|
|
7
|
+
* @version DragonBones 3.0
|
|
8
|
+
* @language en_US
|
|
9
|
+
*/
|
|
10
|
+
export declare class PixiFactory extends BaseFactory {
|
|
11
|
+
private static _dragonBonesInstance;
|
|
12
|
+
private static _factory;
|
|
13
|
+
private static _clockHandler;
|
|
14
|
+
static advanceTime(passedTime: number): void;
|
|
15
|
+
static useSharedTicker: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* - A global factory instance that can be used directly.
|
|
18
|
+
* @version DragonBones 4.7
|
|
19
|
+
* @language en_US
|
|
20
|
+
*/
|
|
21
|
+
static get factory(): PixiFactory;
|
|
22
|
+
/**
|
|
23
|
+
* - A method to obtain a global factory instance (single case).
|
|
24
|
+
* Compared with get factory, the advantage is that parameters can be passed.
|
|
25
|
+
* @version DragonBones 4.7
|
|
26
|
+
* @language en_US
|
|
27
|
+
*/
|
|
28
|
+
static newInstance(useSharedTicker?: boolean): PixiFactory;
|
|
29
|
+
/**
|
|
30
|
+
* - Create a new factory instance.
|
|
31
|
+
* @param dataParser - The data parser instance.
|
|
32
|
+
* @param useSharedTicker - Whether to use the shared ticker.
|
|
33
|
+
*
|
|
34
|
+
* What it will do:
|
|
35
|
+
* - Create a new DragonBones instance.
|
|
36
|
+
* - Create new PixiArmatureDisplay instance.
|
|
37
|
+
* - Link Ticker.shared to the _clockHandler.
|
|
38
|
+
* -
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
constructor(dataParser?: DataParser | null, useSharedTicker?: boolean);
|
|
42
|
+
protected _buildTextureAtlasData(textureAtlasData: PixiTextureAtlasData | null, textureAtlas: Texture | null): PixiTextureAtlasData;
|
|
43
|
+
protected _buildArmature(dataPackage: BuildArmaturePackage): Armature;
|
|
44
|
+
/**
|
|
45
|
+
* Build a slot.
|
|
46
|
+
* This method is used to create a slot for the armature.
|
|
47
|
+
* it will used Pixi.Sprite and MeshSimple as the display object.
|
|
48
|
+
* @param _dataPackage
|
|
49
|
+
* @param slotData
|
|
50
|
+
* @param armature
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
protected _buildSlot(_dataPackage: BuildArmaturePackage, slotData: SlotData, armature: Armature): Slot;
|
|
54
|
+
/**
|
|
55
|
+
* - Create a armature from cached DragonBonesData instances and TextureAtlasData instances, then use the {@link #clock} to update it.
|
|
56
|
+
* The difference is that the armature created by {@link #buildArmature} is not WorldClock instance update.
|
|
57
|
+
* @param armatureName - The armature data name.
|
|
58
|
+
* @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)
|
|
59
|
+
* @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)
|
|
60
|
+
* @returns The armature display container.
|
|
61
|
+
* @see dragonBones.IArmatureProxy
|
|
62
|
+
* @see dragonBones.BaseFactory#buildArmature
|
|
63
|
+
* @version DragonBones 4.5
|
|
64
|
+
* @example
|
|
65
|
+
* <pre>
|
|
66
|
+
* let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
|
|
67
|
+
* </pre>
|
|
68
|
+
* @language en_US
|
|
69
|
+
*/
|
|
70
|
+
buildArmatureDisplay(armatureName: string, dragonBonesName?: string, skinName?: string | null, textureAtlasName?: string): PixiArmatureDisplay | null;
|
|
71
|
+
/**
|
|
72
|
+
* - Create the display object with the specified texture.
|
|
73
|
+
* @param textureName - The texture data name.
|
|
74
|
+
* @param textureAtlasName - The texture atlas data name (Of not set, all texture atlas data will be searched)
|
|
75
|
+
* @version DragonBones 3.0
|
|
76
|
+
* @language en_US
|
|
77
|
+
*/
|
|
78
|
+
getTextureDisplay(textureName: string, textureAtlasName?: string | null): Sprite | null;
|
|
79
|
+
/**
|
|
80
|
+
* - A global sound event manager.
|
|
81
|
+
* Sound events can be listened to uniformly from the manager.
|
|
82
|
+
* @version DragonBones 4.5
|
|
83
|
+
* @language en_US
|
|
84
|
+
*/
|
|
85
|
+
get soundEventManager(): PixiArmatureDisplay;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=PixiFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PixiFactory.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/db-pixi/PixiFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,MAAM,EAAE,OAAO,EAAU,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAc,oBAAoB,EAAE,UAAU,EAAe,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACjI,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,oBAAoB,EAAmB,MAAM,wBAAwB,CAAA;AAE9E;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAA2B;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAElD,OAAO,CAAC,MAAM,CAAC,aAAa;WAWd,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAOnD,OAAc,eAAe,UAAO;IAEpC;;;;OAIG;IACH,WAAkB,OAAO,IAAI,WAAW,CAMvC;IAED;;;;;OAKG;WACW,WAAW,CAAC,eAAe,UAAO,GAAG,WAAW;IAQ9D;;;;;;;;;;;OAWG;gBACgB,UAAU,GAAE,UAAU,GAAG,IAAW,EAAE,eAAe,UAAO;IAc/E,SAAS,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,oBAAoB,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI,GAAG,oBAAoB;IAUnI,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,oBAAoB,GAAG,QAAQ;IASrE;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IActG;;;;;;;;;;;;;;;OAeG;IACI,oBAAoB,CACzB,YAAY,EAAE,MAAM,EACpB,eAAe,SAAK,EACpB,QAAQ,GAAE,MAAM,GAAG,IAAS,EAC5B,gBAAgB,SAAK,GACpB,mBAAmB,GAAG,IAAI;IAa7B;;;;;;OAMG;IACI,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,GAAG,IAAI;IASpG;;;;;OAKG;IACH,IAAW,iBAAiB,IAAI,mBAAmB,CAElD;CACF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
import { MeshSimple, Sprite, Texture, Ticker } from 'pixi.js';
|
|
3
|
+
import { Armature, BaseFactory, BaseObject, DragonBones } from '../dragonBones';
|
|
4
|
+
import { PixiArmatureDisplay } from './PixiArmatureDisplay';
|
|
5
|
+
import { PixiSlot } from './PixiSlot';
|
|
6
|
+
import { PixiTextureAtlasData } from './PixiTextureAtlasData';
|
|
7
|
+
/**
|
|
8
|
+
* - The PixiJS factory.
|
|
9
|
+
* @version DragonBones 3.0
|
|
10
|
+
* @language en_US
|
|
11
|
+
*/
|
|
12
|
+
export class PixiFactory extends BaseFactory {
|
|
13
|
+
static _clockHandler(ticker) {
|
|
14
|
+
const passedTimeMs = ticker.elapsedMS;
|
|
15
|
+
//const passedTimeSec = (passedTimeMs / Ticker.targetFPMS) * 0.001;
|
|
16
|
+
const passedTimeSec = passedTimeMs * 0.001;
|
|
17
|
+
// console.log(passedTimeMs, passedTimeSec, ticker.elapsedMS, Ticker.targetFPMS);
|
|
18
|
+
this._dragonBonesInstance.advanceTime(passedTimeSec);
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
* `passedTime` is elapsed time, specified in seconds.
|
|
22
|
+
*/
|
|
23
|
+
static advanceTime(passedTime) {
|
|
24
|
+
this._dragonBonesInstance.advanceTime(passedTime);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* - A global factory instance that can be used directly.
|
|
28
|
+
* @version DragonBones 4.7
|
|
29
|
+
* @language en_US
|
|
30
|
+
*/
|
|
31
|
+
static get factory() {
|
|
32
|
+
if (PixiFactory._factory === null) {
|
|
33
|
+
PixiFactory._factory = new PixiFactory(null, PixiFactory.useSharedTicker);
|
|
34
|
+
}
|
|
35
|
+
return PixiFactory._factory;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* - A method to obtain a global factory instance (single case).
|
|
39
|
+
* Compared with get factory, the advantage is that parameters can be passed.
|
|
40
|
+
* @version DragonBones 4.7
|
|
41
|
+
* @language en_US
|
|
42
|
+
*/
|
|
43
|
+
static newInstance(useSharedTicker = true) {
|
|
44
|
+
if (PixiFactory._factory === null) {
|
|
45
|
+
PixiFactory._factory = new PixiFactory(null, useSharedTicker);
|
|
46
|
+
}
|
|
47
|
+
return PixiFactory._factory;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* - Create a new factory instance.
|
|
51
|
+
* @param dataParser - The data parser instance.
|
|
52
|
+
* @param useSharedTicker - Whether to use the shared ticker.
|
|
53
|
+
*
|
|
54
|
+
* What it will do:
|
|
55
|
+
* - Create a new DragonBones instance.
|
|
56
|
+
* - Create new PixiArmatureDisplay instance.
|
|
57
|
+
* - Link Ticker.shared to the _clockHandler.
|
|
58
|
+
* -
|
|
59
|
+
* @inheritDoc
|
|
60
|
+
*/
|
|
61
|
+
constructor(dataParser = null, useSharedTicker = true) {
|
|
62
|
+
super(dataParser);
|
|
63
|
+
if (PixiFactory._dragonBonesInstance === null) {
|
|
64
|
+
const eventManager = new PixiArmatureDisplay(PIXI.Texture.EMPTY);
|
|
65
|
+
PixiFactory._dragonBonesInstance = new DragonBones(eventManager);
|
|
66
|
+
if (useSharedTicker) {
|
|
67
|
+
Ticker.shared.add(PixiFactory._clockHandler, PixiFactory);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this._dragonBones = PixiFactory._dragonBonesInstance;
|
|
71
|
+
}
|
|
72
|
+
_buildTextureAtlasData(textureAtlasData, textureAtlas) {
|
|
73
|
+
if (textureAtlasData) {
|
|
74
|
+
textureAtlasData.renderTexture = textureAtlas;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
textureAtlasData = BaseObject.borrowObject(PixiTextureAtlasData);
|
|
78
|
+
}
|
|
79
|
+
return textureAtlasData;
|
|
80
|
+
}
|
|
81
|
+
_buildArmature(dataPackage) {
|
|
82
|
+
const armature = BaseObject.borrowObject(Armature);
|
|
83
|
+
const armatureDisplay = new PixiArmatureDisplay(PIXI.Texture.EMPTY);
|
|
84
|
+
armature.init(dataPackage.armature, armatureDisplay, armatureDisplay, this._dragonBones);
|
|
85
|
+
return armature;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Build a slot.
|
|
89
|
+
* This method is used to create a slot for the armature.
|
|
90
|
+
* it will used Pixi.Sprite and MeshSimple as the display object.
|
|
91
|
+
* @param _dataPackage
|
|
92
|
+
* @param slotData
|
|
93
|
+
* @param armature
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
_buildSlot(_dataPackage, slotData, armature) {
|
|
97
|
+
const slot = BaseObject.borrowObject(PixiSlot);
|
|
98
|
+
slot.init(slotData, armature, new PIXI.Sprite(Texture.EMPTY), new MeshSimple({
|
|
99
|
+
texture: Texture.EMPTY,
|
|
100
|
+
}));
|
|
101
|
+
return slot;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* - Create a armature from cached DragonBonesData instances and TextureAtlasData instances, then use the {@link #clock} to update it.
|
|
105
|
+
* The difference is that the armature created by {@link #buildArmature} is not WorldClock instance update.
|
|
106
|
+
* @param armatureName - The armature data name.
|
|
107
|
+
* @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)
|
|
108
|
+
* @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)
|
|
109
|
+
* @returns The armature display container.
|
|
110
|
+
* @see dragonBones.IArmatureProxy
|
|
111
|
+
* @see dragonBones.BaseFactory#buildArmature
|
|
112
|
+
* @version DragonBones 4.5
|
|
113
|
+
* @example
|
|
114
|
+
* <pre>
|
|
115
|
+
* let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
|
|
116
|
+
* </pre>
|
|
117
|
+
* @language en_US
|
|
118
|
+
*/
|
|
119
|
+
buildArmatureDisplay(armatureName, dragonBonesName = '', skinName = '', textureAtlasName = '') {
|
|
120
|
+
const armature = this.buildArmature(armatureName, dragonBonesName || '', skinName || '', textureAtlasName || '');
|
|
121
|
+
if (armature !== null) {
|
|
122
|
+
this._dragonBones.clock.add(armature);
|
|
123
|
+
return armature.display;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.warn('Non-existent armature: ', armatureName, dragonBonesName);
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* - Create the display object with the specified texture.
|
|
132
|
+
* @param textureName - The texture data name.
|
|
133
|
+
* @param textureAtlasName - The texture atlas data name (Of not set, all texture atlas data will be searched)
|
|
134
|
+
* @version DragonBones 3.0
|
|
135
|
+
* @language en_US
|
|
136
|
+
*/
|
|
137
|
+
getTextureDisplay(textureName, textureAtlasName = null) {
|
|
138
|
+
const textureData = this._getTextureData(textureAtlasName !== null ? textureAtlasName : '', textureName);
|
|
139
|
+
if (textureData !== null && textureData.renderTexture !== null) {
|
|
140
|
+
return new Sprite(textureData.renderTexture);
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* - A global sound event manager.
|
|
146
|
+
* Sound events can be listened to uniformly from the manager.
|
|
147
|
+
* @version DragonBones 4.5
|
|
148
|
+
* @language en_US
|
|
149
|
+
*/
|
|
150
|
+
get soundEventManager() {
|
|
151
|
+
return this._dragonBones.eventManager;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
PixiFactory._dragonBonesInstance = null;
|
|
155
|
+
PixiFactory._factory = null;
|
|
156
|
+
/*
|
|
157
|
+
* whether use `Ticker.shared`
|
|
158
|
+
*/
|
|
159
|
+
PixiFactory.useSharedTicker = true;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Slot } from '../dragonBones';
|
|
2
|
+
/**
|
|
3
|
+
* - The PixiJS slot.
|
|
4
|
+
* @version DragonBones 3.0
|
|
5
|
+
* @language en_US
|
|
6
|
+
*/
|
|
7
|
+
export declare class PixiSlot extends Slot {
|
|
8
|
+
static toString(): string;
|
|
9
|
+
private _textureScale;
|
|
10
|
+
private _renderDisplay;
|
|
11
|
+
protected _onClear(): void;
|
|
12
|
+
protected _initDisplay(value: any, isRetain: boolean): void;
|
|
13
|
+
protected _disposeDisplay(value: any, isRelease: boolean): void;
|
|
14
|
+
protected _onUpdateDisplay(): void;
|
|
15
|
+
protected _addDisplay(): void;
|
|
16
|
+
protected _replaceDisplay(value: any): void;
|
|
17
|
+
protected _removeDisplay(): void;
|
|
18
|
+
protected _updateZOrder(): void;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
_updateVisible(): void;
|
|
23
|
+
protected _updateBlendMode(): void;
|
|
24
|
+
protected _updateColor(): void;
|
|
25
|
+
protected _updateFrame(): void;
|
|
26
|
+
protected _updateMesh(): void;
|
|
27
|
+
protected _updateTransform(): void;
|
|
28
|
+
protected _updateTransformV4(): void;
|
|
29
|
+
protected _identityTransform(): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=PixiSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PixiSlot.d.ts","sourceRoot":"","sources":["../../../src/dragonbones/db-pixi/PixiSlot.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6E,IAAI,EAAW,MAAM,gBAAgB,CAAA;AAIzH;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,IAAI;WAClB,QAAQ,IAAI,MAAM;IAIhC,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,cAAc,CAAW;IAEjC,SAAS,CAAC,QAAQ,IAAI,IAAI;IAQ1B,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAO3D,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAQ/D,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAIlC,SAAS,CAAC,WAAW,IAAI,IAAI;IAK7B,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAS3C,SAAS,CAAC,cAAc,IAAI,IAAI;IAIhC,SAAS,CAAC,aAAa,IAAI,IAAI;IAS/B;;OAEG;IACI,cAAc,IAAI,IAAI;IAI7B,SAAS,CAAC,gBAAgB,IAAI,IAAI;IA8ClC,SAAS,CAAC,YAAY,IAAI,IAAI;IAc9B,SAAS,CAAC,YAAY,IAAI,IAAI;IAuG9B,SAAS,CAAC,WAAW,IAAI,IAAI;IAsF7B,SAAS,CAAC,gBAAgB,IAAI,IAAI;IA4BlC,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAgCpC,SAAS,CAAC,kBAAkB,IAAI,IAAI;CAGrC"}
|