@safe-engine/pixi 8.3.1 → 8.3.4
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/README.md +72 -3
- package/dist/@types/safex.d.ts +2 -155
- package/dist/app.d.ts +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +13 -4
- package/dist/base/EnhancedComponent.d.ts +5 -15
- package/dist/base/EnhancedComponent.d.ts.map +1 -1
- package/dist/base/EnhancedComponent.js +4 -2
- package/dist/collider/CollideComponent.d.ts +20 -18
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.js +12 -35
- package/dist/collider/CollideSystem.js +12 -12
- package/dist/components/BaseComponent.d.ts +2 -2
- package/dist/components/BaseComponent.d.ts.map +1 -1
- package/dist/components/NodeComp.d.ts +2 -2
- package/dist/components/NodeComp.d.ts.map +1 -1
- package/dist/components/NodeComp.js +1 -1
- package/dist/dragonbones/DragonBonesComponent.d.ts +22 -6
- package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComponent.js +0 -4
- package/dist/dragonbones/DragonBonesSystem.js +1 -1
- package/dist/gui/GUIComponent.d.ts +29 -22
- package/dist/gui/GUIComponent.d.ts.map +1 -1
- package/dist/gui/GUIComponent.js +12 -16
- package/dist/gui/GUISystem.js +24 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/norender/NoRenderComponent.d.ts +7 -7
- package/dist/norender/NoRenderComponent.d.ts.map +1 -1
- package/dist/norender/NoRenderComponent.js +0 -12
- package/dist/norender/NoRenderSystem.js +13 -13
- package/dist/planck/PhysicsComponent.d.ts +30 -17
- package/dist/planck/PhysicsComponent.d.ts.map +1 -1
- package/dist/planck/PhysicsComponent.js +0 -35
- package/dist/planck/PhysicsSystem.d.ts.map +1 -1
- package/dist/planck/PhysicsSystem.js +16 -18
- package/dist/render/RenderComponent.d.ts +22 -17
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +10 -19
- package/dist/render/RenderSystem.d.ts.map +1 -1
- package/dist/render/RenderSystem.js +9 -12
- package/dist/spine/SpineComponent.d.ts +13 -6
- package/dist/spine/SpineComponent.d.ts.map +1 -1
- package/dist/spine/SpineSystem.js +1 -1
- package/dist/spine/lib/Spine.d.ts +1 -1
- package/dist/spine/lib/Spine.d.ts.map +1 -1
- package/dist/spine/lib/Spine.js +2 -2
- package/package.json +7 -7
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
import { Vec2 } from 'planck';
|
|
2
1
|
import { NoRenderComponentX } from '../components/BaseComponent';
|
|
3
2
|
export class RigidBody extends NoRenderComponentX {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.type = 'dynamic';
|
|
7
|
-
this.density = 1;
|
|
8
|
-
this.restitution = 0.5;
|
|
9
|
-
this.friction = 0.3;
|
|
10
|
-
this.gravityScale = 1;
|
|
11
|
-
// set linearVelocity(vel: Vec2) {
|
|
12
|
-
// if (!this.node) {
|
|
13
|
-
// return
|
|
14
|
-
// }
|
|
15
|
-
// const physics = this.node.instance
|
|
16
|
-
// if (physics instanceof Sprite) {
|
|
17
|
-
// physics.getBody().setVel(vel)
|
|
18
|
-
// }
|
|
19
|
-
// }
|
|
20
|
-
// get linearVelocity() {
|
|
21
|
-
// if (!this.node) {
|
|
22
|
-
// return Vec2.ZERO
|
|
23
|
-
// }
|
|
24
|
-
// const physics = this.node.instance
|
|
25
|
-
// const vel = (physics as Sprite).getBody().getVel()
|
|
26
|
-
// return v2(vel)
|
|
27
|
-
// }
|
|
28
|
-
}
|
|
29
3
|
}
|
|
30
4
|
export class PhysicsMaterial extends NoRenderComponentX {
|
|
31
|
-
constructor() {
|
|
32
|
-
super(...arguments);
|
|
33
|
-
this.density = 1;
|
|
34
|
-
this.restitution = 0;
|
|
35
|
-
this.friction = 0;
|
|
36
|
-
}
|
|
37
5
|
}
|
|
38
6
|
export class ColliderPhysics extends NoRenderComponentX {
|
|
39
7
|
constructor() {
|
|
40
8
|
super(...arguments);
|
|
41
|
-
this.tag = 0;
|
|
42
|
-
this.group = 0;
|
|
43
|
-
this.offset = Vec2.zero();
|
|
44
9
|
this.enabled = true;
|
|
45
10
|
}
|
|
46
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/planck/PhysicsSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAO,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAQ,KAAK,EAAE,MAAM,QAAQ,CAAA;AAqBlF,wBAAgB,iBAAiB,CAAC,cAAc,cAAW,QAG1D;AAED,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAA;IACZ,cAAc,EAAE,IAAI,EAAE,CAAK;IAC3B,eAAe,EAAE,KAAK,EAAE,CAAK;IAC7B,cAAc,cAAW;IAEzB,SAAS,CAAC,aAAa,EAAE,YAAY;IAgErC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IAoBhE,UAAU,CAAC,IAAI,EAAE,IAAI;IAWrB,aAAa,CAAC,OAAO,EAAE,OAAO;IAM9B,WAAW,CAAC,KAAK,KAAA;IAIjB,YAAY,CAAC,OAAO,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/planck/PhysicsSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAO,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAQ,KAAK,EAAE,MAAM,QAAQ,CAAA;AAqBlF,wBAAgB,iBAAiB,CAAC,cAAc,cAAW,QAG1D;AAED,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAA;IACZ,cAAc,EAAE,IAAI,EAAE,CAAK;IAC3B,eAAe,EAAE,KAAK,EAAE,CAAK;IAC7B,cAAc,cAAW;IAEzB,SAAS,CAAC,aAAa,EAAE,YAAY;IAgErC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IAoBhE,UAAU,CAAC,IAAI,EAAE,IAAI;IAWrB,aAAa,CAAC,OAAO,EAAE,OAAO;IAM9B,WAAW,CAAC,KAAK,KAAA;IAIjB,YAAY,CAAC,OAAO,EAAE,OAAO;IAuB7B,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ;IAIhD,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,KAAA;IAI1C,UAAU,CAAC,OAAO,EAAE,OAAO;IAkB3B,IAAI,OAAO,CAAC,GAAG,KAAA,EAMd;CACF"}
|
|
@@ -33,9 +33,8 @@ export class PhysicsSystem {
|
|
|
33
33
|
this.colliderMatrix = [[true]];
|
|
34
34
|
}
|
|
35
35
|
configure(event_manager) {
|
|
36
|
-
// Settings.lengthUnitsPerMeter = 100
|
|
37
36
|
this.world = new World({
|
|
38
|
-
gravity: Vec2(0,
|
|
37
|
+
gravity: Vec2(0, 98.0),
|
|
39
38
|
});
|
|
40
39
|
// event_manager.world.physicsManager = this
|
|
41
40
|
// event_manager.subscribe(ComponentAddedEvent(RigidBody), this);
|
|
@@ -46,21 +45,20 @@ export class PhysicsSystem {
|
|
|
46
45
|
rigidBody = instantiate(RigidBody);
|
|
47
46
|
entity.assign(rigidBody);
|
|
48
47
|
}
|
|
48
|
+
const { type = 'dynamic', gravityScale = 1 } = rigidBody.props;
|
|
49
49
|
// const physicsMaterial = entity.getComponent(PhysicsMaterial)
|
|
50
50
|
const box = component;
|
|
51
51
|
const node = entity.getComponent(NodeComp);
|
|
52
|
-
const { width, height } =
|
|
53
|
-
// ett.assign(instantiate(ColliderPhysics, { tag, offset }))
|
|
54
|
-
// const { density, restitution, friction } = physicsMaterial
|
|
55
|
-
, ["width", "height"]);
|
|
52
|
+
const _a = box.props, { width, height } = _a, colliderProps = __rest(_a, ["width", "height"]);
|
|
56
53
|
// ett.assign(instantiate(ColliderPhysics, { tag, offset }))
|
|
57
54
|
// const { density, restitution, friction } = physicsMaterial
|
|
55
|
+
const { x = 0, y = 0 } = colliderProps.offset || {};
|
|
58
56
|
const body = this.world.createBody({
|
|
59
|
-
position: node.position, // the body's origin position.
|
|
57
|
+
position: { x: node.position.x + x, y: node.position.y + y }, // the body's origin position.
|
|
60
58
|
angle: 0.25 * Math.PI, // the body's angle in radians.
|
|
61
59
|
userData: node,
|
|
62
|
-
type
|
|
63
|
-
gravityScale
|
|
60
|
+
type,
|
|
61
|
+
gravityScale,
|
|
64
62
|
});
|
|
65
63
|
rigidBody.body = body;
|
|
66
64
|
// console.log('body', body);
|
|
@@ -73,7 +71,6 @@ export class PhysicsSystem {
|
|
|
73
71
|
isSensor: true,
|
|
74
72
|
});
|
|
75
73
|
const debugBox = new Graphics();
|
|
76
|
-
const { x, y } = colliderProps.offset;
|
|
77
74
|
debugBox.rect(x, y, width, height);
|
|
78
75
|
debugBox.fill({ color: 0xff0000, alpha: 0.3 });
|
|
79
76
|
node.instance.addChild(debugBox);
|
|
@@ -134,6 +131,7 @@ export class PhysicsSystem {
|
|
|
134
131
|
// Render or update joint rendering
|
|
135
132
|
}
|
|
136
133
|
contactBegin(contact) {
|
|
134
|
+
console.log('contactBegin');
|
|
137
135
|
const ett1 = contact.getFixtureA().getBody().getUserData();
|
|
138
136
|
const ett2 = contact.getFixtureB().getBody().getUserData();
|
|
139
137
|
// this.world.addPostStepCallback(() => {
|
|
@@ -147,21 +145,21 @@ export class PhysicsSystem {
|
|
|
147
145
|
const phys2 = ett2.getComponent(ColliderPhysics);
|
|
148
146
|
if (phys1 && phys2) {
|
|
149
147
|
if (Object.prototype.hasOwnProperty.call(phys1, 'onCollisionEnter')) {
|
|
150
|
-
phys1.onCollisionEnter(phys2);
|
|
148
|
+
phys1.props.onCollisionEnter(phys2);
|
|
151
149
|
}
|
|
152
150
|
if (Object.prototype.hasOwnProperty.call(phys2, 'onCollisionEnter')) {
|
|
153
|
-
phys2.onCollisionEnter(phys1);
|
|
151
|
+
phys2.props.onCollisionEnter(phys1);
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
preSolve(contact, oldManifold) {
|
|
158
|
-
|
|
156
|
+
console.log('preSolve');
|
|
159
157
|
}
|
|
160
158
|
postSolve(contact, contactImpulse) {
|
|
161
|
-
|
|
159
|
+
console.log('collisionPost');
|
|
162
160
|
}
|
|
163
161
|
contactEnd(contact) {
|
|
164
|
-
|
|
162
|
+
console.log('collisionSeparate');
|
|
165
163
|
const ett1 = contact.getFixtureA().getBody().getUserData();
|
|
166
164
|
const ett2 = contact.getFixtureB().getBody().getUserData();
|
|
167
165
|
// const event1 = ett1.getComponent(NodeComp)
|
|
@@ -170,16 +168,16 @@ export class PhysicsSystem {
|
|
|
170
168
|
// const event2 = ett2.getComponent(NodeComp)
|
|
171
169
|
if (phys1 && phys2) {
|
|
172
170
|
if (Object.prototype.hasOwnProperty.call(phys1, 'onCollisionExit')) {
|
|
173
|
-
phys1.onCollisionExit(phys2);
|
|
171
|
+
phys1.props.onCollisionExit(phys2);
|
|
174
172
|
}
|
|
175
173
|
if (Object.prototype.hasOwnProperty.call(phys2, 'onCollisionExit')) {
|
|
176
|
-
phys2.onCollisionExit(phys1);
|
|
174
|
+
phys2.props.onCollisionExit(phys1);
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
set enabled(val) {
|
|
181
179
|
if (val) {
|
|
182
|
-
this.world.setGravity(Vec2(0,
|
|
180
|
+
this.world.setGravity(Vec2(0, 98));
|
|
183
181
|
// this.world.iterations = 60
|
|
184
182
|
// this.world.collisionSlop = 0.5
|
|
185
183
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { Graphics, Point, Sprite } from 'pixi.js';
|
|
2
2
|
import { Color4B, Vec2 } from '..';
|
|
3
|
-
import { GraphicsRenderProps, MaskRenderProps, SpriteRenderProps } from '../@types/safex';
|
|
4
3
|
import { ComponentX } from '../components/BaseComponent';
|
|
5
|
-
import {
|
|
4
|
+
import { LoadingBarMode } from '../core/LoadingBar';
|
|
6
5
|
import { SpriteTypes } from './RenderSystem';
|
|
7
6
|
export declare class NodeRender extends ComponentX {
|
|
8
7
|
nodeName?: string;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
fillType
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
interface SpriteRenderProps {
|
|
10
|
+
spriteFrame: string;
|
|
11
|
+
type?: SpriteTypes;
|
|
12
|
+
fillType?: LoadingBarMode;
|
|
13
|
+
}
|
|
14
|
+
export declare class SpriteRender extends ComponentX<SpriteRenderProps & {
|
|
15
|
+
$ref?: SpriteRender;
|
|
16
|
+
}, Sprite> {
|
|
18
17
|
get spriteFrame(): string;
|
|
19
18
|
set spriteFrame(frame: string);
|
|
20
19
|
}
|
|
@@ -22,10 +21,14 @@ declare enum PointType {
|
|
|
22
21
|
Circle = 0,
|
|
23
22
|
Rect = 1
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
lineWidth
|
|
27
|
-
strokeColor
|
|
28
|
-
fillColor
|
|
24
|
+
interface GraphicsRenderProps {
|
|
25
|
+
lineWidth?: number;
|
|
26
|
+
strokeColor?: Color4B;
|
|
27
|
+
fillColor?: Color4B;
|
|
28
|
+
}
|
|
29
|
+
export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & {
|
|
30
|
+
$ref?: GraphicsRender;
|
|
31
|
+
}, Graphics> {
|
|
29
32
|
drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType?: PointType): void;
|
|
30
33
|
drawLine(origin: Vec2, destination: Vec2, color: Color4B, thickness: Float): void;
|
|
31
34
|
drawRect(origin: Vec2, destination: Vec2, color: Color4B): void;
|
|
@@ -43,10 +46,12 @@ export declare class GraphicsRender extends ComponentX<GraphicsRenderProps, Grap
|
|
|
43
46
|
drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B): void;
|
|
44
47
|
clear(): void;
|
|
45
48
|
}
|
|
49
|
+
interface MaskRenderProps {
|
|
50
|
+
type?: number;
|
|
51
|
+
segments?: number;
|
|
52
|
+
inverted?: boolean;
|
|
53
|
+
}
|
|
46
54
|
export declare class MaskRender extends ComponentX<MaskRenderProps> {
|
|
47
|
-
type: number;
|
|
48
|
-
segments: number;
|
|
49
|
-
inverted: boolean;
|
|
50
55
|
}
|
|
51
56
|
export {};
|
|
52
57
|
//# sourceMappingURL=RenderComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/render/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAE1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/render/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAE1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OA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|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import { Texture } from 'pixi.js';
|
|
2
2
|
import { ComponentX } from '../components/BaseComponent';
|
|
3
|
-
import { LoadingBarMode } from '../core/LoadingBar';
|
|
4
3
|
export class NodeRender extends ComponentX {
|
|
5
4
|
}
|
|
6
5
|
export class SpriteRender extends ComponentX {
|
|
7
|
-
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.fillType = LoadingBarMode.BAR;
|
|
10
|
-
this.fillRange = 1;
|
|
11
|
-
}
|
|
6
|
+
// protected _spriteFrame: string
|
|
12
7
|
// set fillStart(val: number) {
|
|
13
8
|
// if (this.node.instance instanceof cc.ProgressTimer) {
|
|
14
9
|
// this.node.instance.setMidpoint(cc.v2(val, val));
|
|
15
10
|
// }
|
|
16
11
|
// }
|
|
17
|
-
setFillRange(val) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
12
|
+
// setFillRange(val: number) {
|
|
13
|
+
// if (this.loadingBar) {
|
|
14
|
+
// this.loadingBar.progress = val
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
22
17
|
get spriteFrame() {
|
|
23
|
-
return this.
|
|
18
|
+
return this.props.spriteFrame;
|
|
24
19
|
}
|
|
25
20
|
set spriteFrame(frame) {
|
|
26
|
-
this.
|
|
21
|
+
this.props.spriteFrame = frame;
|
|
27
22
|
if (!this.node)
|
|
28
23
|
return;
|
|
29
24
|
const sprite = this.node.instance;
|
|
@@ -50,10 +45,6 @@ var PointType;
|
|
|
50
45
|
})(PointType || (PointType = {}));
|
|
51
46
|
;
|
|
52
47
|
export class GraphicsRender extends ComponentX {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...arguments);
|
|
55
|
-
this.lineWidth = 2;
|
|
56
|
-
}
|
|
57
48
|
drawPoint(position, pointSize, color, pointType = PointType.Rect) {
|
|
58
49
|
}
|
|
59
50
|
// drawPoints(points: Vec2[], color: Color4B) {
|
|
@@ -97,8 +88,8 @@ export class GraphicsRender extends ComponentX {
|
|
|
97
88
|
this.node.instance.lineTo(to.x, to.y);
|
|
98
89
|
this.node.instance.strokeStyle = {
|
|
99
90
|
cap: 'round', join: 'round',
|
|
100
|
-
width: this.lineWidth || 36,
|
|
101
|
-
color: color || this.strokeColor,
|
|
91
|
+
width: this.props.lineWidth || 36,
|
|
92
|
+
color: color || this.props.strokeColor,
|
|
102
93
|
};
|
|
103
94
|
this.node.instance.stroke();
|
|
104
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;AAMnB,oBAAY,WAAW;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,qBAAa,YAAa,YAAW,MAAM;IACzC,SAAS,CAAC,aAAa,EAAE,YAAY;CA8CtC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EventTypes } from 'entityx-ts';
|
|
2
2
|
import { Container, Graphics, Sprite } from 'pixi.js';
|
|
3
3
|
import { NodeComp } from '..';
|
|
4
|
-
import { LoadingBar } from '../core/LoadingBar';
|
|
5
4
|
import { GraphicsRender, MaskRender, NodeRender, SpriteRender } from './RenderComponent';
|
|
6
5
|
export var SpriteTypes;
|
|
7
6
|
(function (SpriteTypes) {
|
|
@@ -20,19 +19,17 @@ export class RenderSystem {
|
|
|
20
19
|
nodeRenderComp.node = entity.assign(new NodeComp(node, entity));
|
|
21
20
|
});
|
|
22
21
|
event_manager.subscribe(EventTypes.ComponentAdded, SpriteRender, ({ entity, component }) => {
|
|
23
|
-
const { spriteFrame
|
|
22
|
+
const { spriteFrame } = component.props;
|
|
24
23
|
// console.log('SpriteRender ComponentAdded', component)
|
|
25
24
|
const node = Sprite.from(spriteFrame);
|
|
26
|
-
if (type === SpriteTypes.FILLED) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// node.setMidpoint(fillCenter)
|
|
35
|
-
}
|
|
25
|
+
// if (type === SpriteTypes.FILLED) {
|
|
26
|
+
// // console.log('fillType', fillType)
|
|
27
|
+
// const loadingBar = new LoadingBar(fillType, node)
|
|
28
|
+
// if (fillRange) loadingBar.progress = fillRange
|
|
29
|
+
// if (fillCenter) loadingBar.fillCenter = fillCenter
|
|
30
|
+
// component.loadingBar = loadingBar
|
|
31
|
+
// // node.setMidpoint(fillCenter)
|
|
32
|
+
// }
|
|
36
33
|
// node.texture.rotate = 8
|
|
37
34
|
component.node = entity.assign(new NodeComp(node, entity));
|
|
38
35
|
// component.node.anchorX = 0.5
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { SpineData, SpineSkeletonProps } from "../@types/safex";
|
|
2
1
|
import { ComponentX } from "../components/BaseComponent";
|
|
3
|
-
|
|
2
|
+
interface SpineData {
|
|
3
|
+
atlas: string;
|
|
4
|
+
skeleton: string;
|
|
5
|
+
texture?: string;
|
|
6
|
+
}
|
|
7
|
+
interface SpineSkeletonProps {
|
|
4
8
|
data: SpineData;
|
|
5
|
-
skin
|
|
6
|
-
animation
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
skin?: string;
|
|
10
|
+
animation?: string;
|
|
11
|
+
timeScale?: number;
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class SpineSkeleton extends ComponentX<SpineSkeletonProps> {
|
|
9
15
|
}
|
|
16
|
+
export {};
|
|
10
17
|
//# sourceMappingURL=SpineComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpineComponent.d.ts","sourceRoot":"","sources":["../../src/spine/SpineComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SpineComponent.d.ts","sourceRoot":"","sources":["../../src/spine/SpineComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AACD,qBAAa,aAAc,SAAQ,UAAU,CAAC,kBAAkB,CAAC;CAEhE"}
|
|
@@ -7,7 +7,7 @@ export class SpineSystem {
|
|
|
7
7
|
event_manager.subscribe(EventTypes.ComponentAdded, SpineSkeleton, ({ entity, component }) => {
|
|
8
8
|
// console.log('SpineSkeleton', component)
|
|
9
9
|
// const spine = entity.getComponent(SpineSkeleton)
|
|
10
|
-
const { data, skin, animation, loop, timeScale } = component;
|
|
10
|
+
const { data, skin, animation, loop, timeScale } = component.props;
|
|
11
11
|
const node = Spine.from(data);
|
|
12
12
|
// node.skeleton.scaleY = -1
|
|
13
13
|
if (skin) {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
|
|
27
27
|
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
*****************************************************************************/
|
|
29
|
+
import { AnimationState, Bone, Color, MeshAttachment, RegionAttachment, Skeleton, SkeletonBounds, SkeletonData, Slot, TrackEntry } from '@esotericsoftware/spine-core';
|
|
29
30
|
import { Bounds, Container, ContainerOptions, DestroyOptions, PointData, Texture, ViewContainer } from 'pixi.js';
|
|
30
31
|
import { ISpineDebugRenderer } from './SpineDebugRenderer.js';
|
|
31
|
-
import { AnimationState, Bone, Color, MeshAttachment, RegionAttachment, Skeleton, SkeletonBounds, SkeletonData, Slot, TrackEntry } from '@esotericsoftware/spine-core';
|
|
32
32
|
/**
|
|
33
33
|
* Options to create a {@link Spine} using {@link Spine.from}.
|
|
34
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spine.d.ts","sourceRoot":"","sources":["../../../src/spine/lib/Spine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;+EA2B+E;AAE/E,OAAO,
|
|
1
|
+
{"version":3,"file":"Spine.d.ts","sourceRoot":"","sources":["../../../src/spine/lib/Spine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;+EA2B+E;AAE/E,OAAO,EACL,cAAc,EAId,IAAI,EAEJ,KAAK,EACL,cAAc,EAGd,gBAAgB,EAChB,QAAQ,EAER,cAAc,EAEd,YAAY,EAEZ,IAAI,EAEJ,UAAU,EAEX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,MAAM,EAEN,SAAS,EACT,gBAAgB,EAEhB,cAAc,EAGd,SAAS,EACT,OAAO,EAEP,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gGAAgG;IAChG,QAAQ,EAAE,MAAM,CAAC;IAEjB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IAEd,uHAAuH;IACvH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gFAAgF;IAChF,UAAU,CAAC,EAAE,OA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gGAAgG;IACzF,8BAA8B,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAIrE,oGAAoG;IAC7F,0BAA0B,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,IAAI;IAU7E;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAS,EAAE,QAAQ,EAAE,UAAiB,EAAE,EAAE,gBAAgB;CA0B1F"}
|
package/dist/spine/lib/Spine.js
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
|
|
27
27
|
* SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
*****************************************************************************/
|
|
29
|
-
import { Assets, Cache, Container, DEG_TO_RAD, fastCopy, Graphics, Texture, Ticker, ViewContainer, } from 'pixi.js';
|
|
30
29
|
import { AnimationState, AnimationStateData, AtlasAttachmentLoader, ClippingAttachment, Color, MeshAttachment, Physics, Pool, RegionAttachment, Skeleton, SkeletonBinary, SkeletonBounds, SkeletonClipping, SkeletonData, SkeletonJson, Vector2, } from '@esotericsoftware/spine-core';
|
|
30
|
+
import { Assets, Cache, Container, DEG_TO_RAD, fastCopy, Graphics, Texture, Ticker, ViewContainer, } from 'pixi.js';
|
|
31
31
|
;
|
|
32
32
|
const vectorAux = new Vector2();
|
|
33
33
|
Skeleton.yDown = true;
|
|
@@ -86,7 +86,7 @@ export class Spine extends ViewContainer {
|
|
|
86
86
|
skeletonData: options,
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
super();
|
|
89
|
+
super(options);
|
|
90
90
|
// Pixi properties
|
|
91
91
|
this.batched = true;
|
|
92
92
|
this.buildId = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-engine/pixi",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"description": "safex pixi plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
"author": "",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@esotericsoftware/spine-core": "^4.2.
|
|
20
|
-
"@pixi/ui": "^2.2.
|
|
21
|
-
"@types/node": "^22.
|
|
19
|
+
"@esotericsoftware/spine-core": "^4.2.74",
|
|
20
|
+
"@pixi/ui": "^2.2.2",
|
|
21
|
+
"@types/node": "^22.13.5",
|
|
22
22
|
"copyfiles": "^2.4.1",
|
|
23
23
|
"dragonbones-pixijs": "^1.0.3",
|
|
24
|
-
"entityx-ts": "^2.1.
|
|
24
|
+
"entityx-ts": "^2.1.3",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"pixi-action-ease": "^3.0.6",
|
|
27
27
|
"pixi-tagged-text-plus": "0.0.1-next.2",
|
|
28
|
-
"pixi.js": "8.
|
|
28
|
+
"pixi.js": "8.8.0",
|
|
29
29
|
"planck": "^1.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/lodash": "^4.17.
|
|
32
|
+
"@types/lodash": "^4.17.15",
|
|
33
33
|
"typescript": "^5.7.3"
|
|
34
34
|
}
|
|
35
35
|
}
|