@safe-engine/pixi 8.2.9 → 8.3.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.
Files changed (59) hide show
  1. package/README.md +72 -3
  2. package/dist/@types/safex.d.ts +1 -155
  3. package/dist/app.d.ts +1 -1
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/app.js +13 -4
  6. package/dist/base/EnhancedComponent.d.ts +6 -15
  7. package/dist/base/EnhancedComponent.d.ts.map +1 -1
  8. package/dist/base/EnhancedComponent.js +6 -2
  9. package/dist/base/utils.d.ts +4 -4
  10. package/dist/base/utils.d.ts.map +1 -1
  11. package/dist/base/utils.js +15 -2
  12. package/dist/collider/CollideComponent.d.ts +20 -18
  13. package/dist/collider/CollideComponent.d.ts.map +1 -1
  14. package/dist/collider/CollideComponent.js +12 -35
  15. package/dist/collider/CollideSystem.js +12 -12
  16. package/dist/components/BaseComponent.d.ts +3 -5
  17. package/dist/components/BaseComponent.d.ts.map +1 -1
  18. package/dist/components/BaseComponent.js +2 -10
  19. package/dist/components/NodeComp.d.ts +2 -2
  20. package/dist/components/NodeComp.d.ts.map +1 -1
  21. package/dist/components/NodeComp.js +3 -2
  22. package/dist/components/Scene.d.ts +1 -1
  23. package/dist/components/Scene.d.ts.map +1 -1
  24. package/dist/components/Scene.js +4 -2
  25. package/dist/dragonbones/DragonBonesComponent.d.ts +22 -6
  26. package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
  27. package/dist/dragonbones/DragonBonesComponent.js +0 -4
  28. package/dist/dragonbones/DragonBonesSystem.js +1 -1
  29. package/dist/gui/GUIComponent.d.ts +29 -22
  30. package/dist/gui/GUIComponent.d.ts.map +1 -1
  31. package/dist/gui/GUIComponent.js +12 -16
  32. package/dist/gui/GUISystem.js +24 -24
  33. package/dist/helper/utils.d.ts +4 -1
  34. package/dist/helper/utils.d.ts.map +1 -1
  35. package/dist/helper/utils.js +3 -0
  36. package/dist/index.d.ts +0 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +0 -1
  39. package/dist/norender/NoRenderComponent.d.ts +7 -7
  40. package/dist/norender/NoRenderComponent.d.ts.map +1 -1
  41. package/dist/norender/NoRenderComponent.js +0 -12
  42. package/dist/norender/NoRenderSystem.js +17 -17
  43. package/dist/planck/PhysicsComponent.d.ts +30 -17
  44. package/dist/planck/PhysicsComponent.d.ts.map +1 -1
  45. package/dist/planck/PhysicsComponent.js +0 -35
  46. package/dist/planck/PhysicsSystem.d.ts.map +1 -1
  47. package/dist/planck/PhysicsSystem.js +16 -18
  48. package/dist/render/RenderComponent.d.ts +23 -18
  49. package/dist/render/RenderComponent.d.ts.map +1 -1
  50. package/dist/render/RenderComponent.js +16 -17
  51. package/dist/render/RenderSystem.d.ts.map +1 -1
  52. package/dist/render/RenderSystem.js +10 -18
  53. package/dist/spine/SpineComponent.d.ts +13 -6
  54. package/dist/spine/SpineComponent.d.ts.map +1 -1
  55. package/dist/spine/SpineSystem.js +1 -1
  56. package/dist/spine/lib/Spine.d.ts +1 -1
  57. package/dist/spine/lib/Spine.d.ts.map +1 -1
  58. package/dist/spine/lib/Spine.js +2 -2
  59. package/package.json +7 -7
@@ -4,7 +4,7 @@ import { ExtraDataComp, TouchEventRegister } from './NoRenderComponent';
4
4
  export class NoRenderSystem {
5
5
  configure(event_manager) {
6
6
  event_manager.subscribe(EventTypes.ComponentAdded, ExtraDataComp, ({ entity, component }) => {
7
- const { key, value } = component;
7
+ const { key, value } = component.props;
8
8
  component.data[key] = value;
9
9
  });
10
10
  event_manager.subscribe(EventTypes.ComponentAdded, TouchEventRegister, ({ entity, component }) => {
@@ -13,24 +13,24 @@ export class NoRenderSystem {
13
13
  const nodeComp = ett.getComponent(NodeComp);
14
14
  touchComp.node = nodeComp;
15
15
  const container = nodeComp.instance;
16
- if (touchComp.onTouchStart) {
17
- container.on('touchstart', (event) => {
18
- touchComp.onTouchStart(event, nodeComp);
16
+ if (touchComp.props.onTouchStart) {
17
+ container.on('pointerdown', (event) => {
18
+ touchComp.props.onTouchStart(event, nodeComp);
19
19
  });
20
20
  }
21
- if (touchComp.onTouchMove) {
22
- container.on('touchmove', (event) => {
23
- touchComp.onTouchMove(event, nodeComp);
21
+ if (touchComp.props.onTouchMove) {
22
+ container.on('pointermove', (event) => {
23
+ touchComp.props.onTouchMove(event, nodeComp);
24
24
  });
25
25
  }
26
- if (touchComp.onTouchEnd) {
27
- container.on('touchend', (event) => {
28
- touchComp.onTouchEnd(event, nodeComp);
26
+ if (touchComp.props.onTouchEnd) {
27
+ container.on('pointerup', (event) => {
28
+ touchComp.props.onTouchEnd(event, nodeComp);
29
29
  });
30
30
  }
31
- if (touchComp.onTouchEnd) {
32
- container.on('touchcancel', (event) => {
33
- touchComp.onTouchEnd(event, nodeComp);
31
+ if (touchComp.props.onTouchEnd) {
32
+ container.on('pointercancel', (event) => {
33
+ touchComp.props.onTouchEnd(event, nodeComp);
34
34
  });
35
35
  }
36
36
  });
@@ -40,16 +40,16 @@ export class NoRenderSystem {
40
40
  // const nodeComp = ett.getComponent(NodeComp)
41
41
  const touchComp = component;
42
42
  const container = touchComp.node.instance;
43
- if (touchComp.onTouchStart) {
43
+ if (touchComp.props.onTouchStart) {
44
44
  container.removeListener('touchstart');
45
45
  }
46
- if (touchComp.onTouchMove) {
46
+ if (touchComp.props.onTouchMove) {
47
47
  container.removeListener('touchmove');
48
48
  }
49
- if (touchComp.onTouchEnd) {
49
+ if (touchComp.props.onTouchEnd) {
50
50
  container.removeListener('touchend');
51
51
  }
52
- if (touchComp.onTouchEnd) {
52
+ if (touchComp.props.onTouchEnd) {
53
53
  container.removeListener('touchcancel');
54
54
  }
55
55
  });
@@ -1,37 +1,50 @@
1
1
  import { Body, BodyType, Vec2 } from 'planck';
2
- import { BoxColliderPhysicsProps, CircleColliderPhysicsProps, ColliderPhysicsProps, PhysicsMaterialProps, PolygonColliderPhysicsProps, RigidBodyProps } from '../@types/safex';
3
2
  import { NoRenderComponentX } from '../components/BaseComponent';
4
3
  import { PhysicsSprite } from './PhysicsSprite';
4
+ interface RigidBodyProps {
5
+ type?: BodyType;
6
+ density?: Float;
7
+ restitution?: Float;
8
+ friction?: Float;
9
+ gravityScale?: Float;
10
+ }
5
11
  export declare class RigidBody extends NoRenderComponentX<RigidBodyProps> {
6
- type: BodyType;
7
- density: number;
8
- restitution: number;
9
- friction: number;
10
12
  body: Body;
11
- gravityScale: number;
13
+ }
14
+ interface PhysicsMaterialProps {
15
+ friction?: number;
16
+ restitution?: number;
17
+ density?: number;
12
18
  }
13
19
  export declare class PhysicsMaterial extends NoRenderComponentX<PhysicsMaterialProps> {
14
- density: number;
15
- restitution: number;
16
- friction: number;
20
+ }
21
+ interface ColliderPhysicsProps {
22
+ tag?: number;
23
+ group?: number;
24
+ offset?: Vec2;
25
+ onCollisionEnter?: (other: ColliderPhysics) => void;
26
+ onCollisionExit?: (other: ColliderPhysics) => void;
27
+ onCollisionStay?: (other: ColliderPhysics) => void;
17
28
  }
18
29
  export declare class ColliderPhysics<T extends ColliderPhysicsProps = ColliderPhysicsProps> extends NoRenderComponentX<T, PhysicsSprite['node']> {
19
- tag: number;
20
- group: number;
21
- offset: Vec2;
22
- onCollisionEnter: (other: ColliderPhysics) => void;
23
- onCollisionExit: (other: ColliderPhysics) => void;
24
30
  enabled: boolean;
25
31
  instance: PhysicsSprite;
26
32
  }
27
- export declare class BoxColliderPhysics extends ColliderPhysics<BoxColliderPhysicsProps> {
33
+ interface BoxColliderPhysicsProps extends ColliderPhysicsProps {
28
34
  width: number;
29
35
  height: number;
30
36
  }
31
- export declare class CircleColliderPhysics extends ColliderPhysics<CircleColliderPhysicsProps> {
37
+ export declare class BoxColliderPhysics extends ColliderPhysics<BoxColliderPhysicsProps> {
38
+ }
39
+ interface CircleColliderPhysicsProps extends ColliderPhysicsProps {
32
40
  radius: number;
33
41
  }
42
+ export declare class CircleColliderPhysics extends ColliderPhysics<CircleColliderPhysicsProps> {
43
+ }
44
+ interface PolygonColliderPhysicsProps extends ColliderPhysicsProps {
45
+ points: Array<Vec2>;
46
+ }
34
47
  export declare class PolygonColliderPhysics extends ColliderPhysics<PolygonColliderPhysicsProps> {
35
- points: number[];
36
48
  }
49
+ export {};
37
50
  //# sourceMappingURL=PhysicsComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhysicsComponent.d.ts","sourceRoot":"","sources":["../../src/planck/PhysicsComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC9K,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,qBAAa,SAAU,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IAC/D,IAAI,EAAE,QAAQ,CAAY;IAC1B,OAAO,SAAI;IACX,WAAW,SAAM;IACjB,QAAQ,SAAM;IACd,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,SAAI;CAmBjB;AAED,qBAAa,eAAgB,SAAQ,kBAAkB,CAAC,oBAAoB,CAAC;IAC3E,OAAO,SAAI;IACX,WAAW,SAAI;IACf,QAAQ,SAAI;CACb;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,kBAAkB,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtI,GAAG,SAAI;IACP,KAAK,SAAI;IACT,MAAM,EAAE,IAAI,CAAc;IAC1B,gBAAgB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAClD,eAAe,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IACjD,OAAO,UAAO;IACd,QAA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AgB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IACnD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAClD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;CACnD;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,kBAAkB,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtI,OAAO,UAAO;IACd,QAAQ,EAAE,aAAa,CAAA;CACxB;AAED,UAAU,uBAAwB,SAAQ,oBAAoB;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AACD,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,uBAAuB,CAAC;CAW/E;AACD,UAAU,0BAA2B,SAAQ,oBAAoB;IAC/D,MAAM,EAAE,MAAM,CAAA;CACf;AACD,qBAAa,qBAAsB,SAAQ,eAAe,CAAC,0BAA0B,CAAC;CACrF;AACD,UAAU,2BAA4B,SAAQ,oBAAoB;IAChE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;CACpB;AACD,qBAAa,sBAAuB,SAAQ,eAAe,CAAC,2BAA2B,CAAC;CACvF"}
@@ -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;IAsB7B,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"}
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, -10.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 } = box, colliderProps = __rest(box
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: rigidBody.type,
63
- gravityScale: rigidBody.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
- // log('preSolve');
156
+ console.log('preSolve');
159
157
  }
160
158
  postSolve(contact, contactImpulse) {
161
- // log('collisionPost');
159
+ console.log('collisionPost');
162
160
  }
163
161
  contactEnd(contact) {
164
- // log('collisionSeparate');
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, -1));
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 { LoadingBar, LoadingBarMode } from '../core/LoadingBar';
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
- export declare class SpriteRender extends ComponentX<SpriteRenderProps, Sprite> {
11
- protected _spriteFrame: string;
12
- type: SpriteTypes;
13
- fillType: LoadingBarMode;
14
- fillRange: number;
15
- fillCenter: Point;
16
- loadingBar: LoadingBar;
17
- setFillRange(val: number): void;
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
- export declare class GraphicsRender extends ComponentX<GraphicsRenderProps, Graphics> {
26
- lineWidth: number;
27
- strokeColor: Color4B;
28
- fillColor: Color4B;
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;
@@ -39,14 +42,16 @@ export declare class GraphicsRender extends ComponentX<GraphicsRenderProps, Grap
39
42
  drawPoly(points: Vec2[], closedPolygon: boolean, color: Color4B, thickness?: Float): void;
40
43
  drawSolidPoly(points: Vec2[], color: Color4B): void;
41
44
  drawDot(points: Vec2[], color: Color4B): void;
42
- drawSegment(from: Vec2, to: Vec2, color: Color4B): void;
45
+ drawSegment(from: Point, to: Point, color?: Color4B): void;
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,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,qBAAa,UAAW,SAAQ,UAAU;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,YAAa,SAAQ,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACrE,SAAS,CAAC,YAAY,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,EAAE,cAAc,CAAqB;IAC7C,SAAS,SAAI;IACb,UAAU,EAAE,KAAK,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IAQtB,YAAY,CAAC,GAAG,EAAE,MAAM;IAMxB,IAAI,WAAW,WAEd;IAED,IAAI,WAAW,CAAC,KAAK,QAAA,EA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OAAO;IAG/D,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO;IAG9D,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO;IAG/D,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IAEjD,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IAE7C,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,KAAK;IAIlF,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IAE5C,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IAEtC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO;IAUnD,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO;IAIzD,KAAK;CAGN;AAED,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AACD,qBAAa,UAAW,SAAQ,UAAU,CAAC,eAAe,CAAC;CAAI"}
@@ -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
- constructor() {
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
- if (this.loadingBar) {
19
- this.loadingBar.progress = val;
20
- }
21
- }
12
+ // setFillRange(val: number) {
13
+ // if (this.loadingBar) {
14
+ // this.loadingBar.progress = val
15
+ // }
16
+ // }
22
17
  get spriteFrame() {
23
- return this._spriteFrame;
18
+ return this.props.spriteFrame;
24
19
  }
25
20
  set spriteFrame(frame) {
26
- this._spriteFrame = frame;
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) {
@@ -93,6 +84,14 @@ export class GraphicsRender extends ComponentX {
93
84
  drawDot(points, color) {
94
85
  }
95
86
  drawSegment(from, to, color) {
87
+ this.node.instance.moveTo(from.x, from.y);
88
+ this.node.instance.lineTo(to.x, to.y);
89
+ this.node.instance.strokeStyle = {
90
+ cap: 'round', join: 'round',
91
+ width: this.props.lineWidth || 36,
92
+ color: color || this.props.strokeColor,
93
+ };
94
+ this.node.instance.stroke();
96
95
  }
97
96
  drawTriangle(p1, p2, p3, color) {
98
97
  this.node.instance.poly([p1, p2, p3], true);
@@ -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;AAOnB,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;CAmDtC"}
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, type, fillType, fillRange, fillCenter } = component;
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
- // console.log('fillType', fillType)
28
- const loadingBar = new LoadingBar(fillType, node);
29
- if (fillRange)
30
- loadingBar.progress = fillRange;
31
- if (fillCenter)
32
- loadingBar.fillCenter = fillCenter;
33
- component.loadingBar = loadingBar;
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
@@ -46,15 +43,10 @@ export class RenderSystem {
46
43
  // maskComp.node = ett.assign(new NodeComp(node, ett))
47
44
  });
48
45
  event_manager.subscribe(EventTypes.ComponentAdded, GraphicsRender, ({ entity, component }) => {
49
- const { lineWidth, strokeColor, fillColor } = component;
46
+ // const { lineWidth, strokeColor, fillColor } = component
50
47
  // console.log('GraphicsRender', component);
51
48
  const node = new Graphics();
52
- node.fill(fillColor);
53
- // node.fillStyle = fillColor
54
- node.stroke(strokeColor);
55
- node.width = lineWidth;
56
49
  component.node = entity.assign(new NodeComp(node, entity));
57
- // node.drawCircle(0, 0, 100)
58
50
  });
59
51
  event_manager.subscribe(EventTypes.ComponentRemoved, NodeComp, ({ component }) => {
60
52
  if (component) {
@@ -1,10 +1,17 @@
1
- import { SpineData, SpineSkeletonProps } from "../@types/safex";
2
1
  import { ComponentX } from "../components/BaseComponent";
3
- export declare class SpineSkeleton extends ComponentX<SpineSkeletonProps> {
2
+ interface SpineData {
3
+ atlas: string;
4
+ skeleton: string;
5
+ texture?: string;
6
+ }
7
+ interface SpineSkeletonProps {
4
8
  data: SpineData;
5
- skin: string;
6
- animation: string;
7
- loop: boolean;
8
- timeScale: number;
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,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,qBAAa,aAAc,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IAC/D,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB"}
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,EAEN,MAAM,EAEN,SAAS,EACT,gBAAgB,EAEhB,cAAc,EAGd,SAAS,EACT,OAAO,EAEP,aAAa,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACN,cAAc,EAId,IAAI,EAEJ,KAAK,EACL,cAAc,EAGd,gBAAgB,EAChB,QAAQ,EAER,cAAc,EAEd,YAAY,EAEZ,IAAI,EAEJ,UAAU,EAEV,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,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,OAAO,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAQD,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACrD,g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;;;;;OAaG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAS,EAAE,QAAQ,EAAE,UAAiB,EAAE,EAAE,gBAAgB;CA0B1F"}
@@ -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;