@safe-engine/pixi 8.5.1 → 8.5.5
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 +5 -4
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +0 -23
- package/dist/box2d-wasm/PhysicsSystem.d.ts +1 -1
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.js +2 -2
- package/dist/collider/CollideComponent.d.ts +8 -6
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.js +4 -3
- package/dist/collider/index.d.ts +1 -0
- package/dist/collider/index.d.ts.map +1 -1
- package/dist/collider/index.js +1 -0
- package/dist/components/NodeComp.d.ts +62 -36
- package/dist/components/NodeComp.d.ts.map +1 -1
- package/dist/components/NodeComp.js +18 -99
- package/dist/core/Color.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComponent.d.ts +3 -2
- package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComponent.js +1 -1
- package/dist/dragonbones/DragonBonesSystem.js +2 -2
- package/dist/gui/GUISystem.d.ts.map +1 -1
- package/dist/gui/GUISystem.js +5 -6
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5
- package/dist/norender/NoRenderComponent.d.ts +5 -1
- package/dist/norender/NoRenderComponent.d.ts.map +1 -1
- package/dist/norender/NoRenderSystem.d.ts.map +1 -1
- package/dist/norender/NoRenderSystem.js +8 -9
- package/dist/render/RenderComponent.d.ts +6 -17
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +26 -18
- package/dist/spine/lib/require-shim.d.ts.map +1 -1
- package/dist/spine/lib/require-shim.js +1 -1
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -104,18 +104,19 @@ export class ColliderSprite extends ComponentX {
|
|
|
104
104
|
## Physics Events
|
|
105
105
|
|
|
106
106
|
```tsx
|
|
107
|
-
import {
|
|
107
|
+
import { ComponentX, SpriteRender } from '@safe-engine/pixi'
|
|
108
|
+
import { DynamicBody, PhysicsBoxCollider, RigidBody } from '@safe-engine/pixi/dist/box2d-wasm'
|
|
108
109
|
import { sf_crash } from '../assets'
|
|
109
110
|
|
|
110
111
|
export class PhysicsCollider extends ComponentX {
|
|
111
|
-
|
|
112
|
-
console.log('
|
|
112
|
+
onBeginContact(other: RigidBody) {
|
|
113
|
+
console.log('onBeginContact', other)
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
render() {
|
|
116
117
|
return (
|
|
117
118
|
<SpriteRender node={{ xy: [640, 360] }} spriteFrame={sf_crash}>
|
|
118
|
-
<RigidBody type=
|
|
119
|
+
<RigidBody type={DynamicBody} onBeginContact={this.onBeginContact}></RigidBody>
|
|
119
120
|
<PhysicsBoxCollider height={100} width={100}></PhysicsBoxCollider>
|
|
120
121
|
</SpriteRender>
|
|
121
122
|
)
|
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,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAO5D,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"}
|
package/dist/app.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { actionManager } from 'pixi-action-ease';
|
|
11
11
|
import { Application } from 'pixi.js';
|
|
12
12
|
import { GameWorld } from './base';
|
|
13
|
-
import { CollideSystem } from './collider';
|
|
14
13
|
import { GUISystem } from './gui/GUISystem';
|
|
15
14
|
import { NoRenderSystem } from './norender/NoRenderSystem';
|
|
16
15
|
import { RenderSystem } from './render/RenderSystem';
|
|
@@ -30,7 +29,6 @@ export function startGame(defaultFont_1) {
|
|
|
30
29
|
},
|
|
31
30
|
canvas: document.getElementById(id),
|
|
32
31
|
});
|
|
33
|
-
// GameWorld.Instance.setup(NodeComp, app.stage)
|
|
34
32
|
Object.assign(app.canvas.style, {
|
|
35
33
|
width: `${window.innerWidth}px`,
|
|
36
34
|
height: `${window.innerHeight}px`,
|
|
@@ -56,37 +54,16 @@ function startGameLoop(world) {
|
|
|
56
54
|
});
|
|
57
55
|
// app.ticker.speed = 0.5
|
|
58
56
|
}
|
|
59
|
-
// const systemsList = [RenderSystem, GUISystem, SpineSystem, DragonBonesSystem, CollideSystem, NoRenderSystem]
|
|
60
|
-
// export function startGameSystems(list = []) {
|
|
61
|
-
// const world = GameWorld.Instance
|
|
62
|
-
// systemsList.forEach(system => {
|
|
63
|
-
// world.systems.add(system)
|
|
64
|
-
// world.systems.configureOnce(system)
|
|
65
|
-
// })
|
|
66
|
-
// world.listUpdate.push(CollideSystem)
|
|
67
|
-
// // world.listUpdate.push(PhysicsSystem)
|
|
68
|
-
// list.forEach(system => {
|
|
69
|
-
// world.systems.add(system)
|
|
70
|
-
// world.systems.configureOnce(system)
|
|
71
|
-
// world.listUpdate.push(system)
|
|
72
|
-
// })
|
|
73
|
-
// startGameLoop(world)
|
|
74
|
-
// // console.log('startGameLoop', world.listUpdate)
|
|
75
|
-
// }
|
|
76
57
|
function initWorld(defaultFont) {
|
|
77
58
|
const world = GameWorld.Instance;
|
|
78
59
|
world.systems.add(RenderSystem);
|
|
79
|
-
world.systems.add(CollideSystem);
|
|
80
60
|
world.systems.add(GUISystem);
|
|
81
61
|
world.systems.add(NoRenderSystem);
|
|
82
|
-
world.listUpdate.push(CollideSystem);
|
|
83
62
|
world.systems.configureOnce(RenderSystem);
|
|
84
|
-
world.systems.configureOnce(CollideSystem);
|
|
85
63
|
world.systems.configureOnce(GUISystem);
|
|
86
64
|
world.systems.configureOnce(NoRenderSystem);
|
|
87
65
|
if (defaultFont) {
|
|
88
66
|
const guiSystem = world.systems.get(GUISystem);
|
|
89
67
|
guiSystem.defaultFont = defaultFont;
|
|
90
68
|
}
|
|
91
|
-
// startGameLoop(world, app)
|
|
92
69
|
}
|
|
@@ -14,7 +14,7 @@ export declare class PhysicsSystem implements System {
|
|
|
14
14
|
graphics: Graphics;
|
|
15
15
|
addDebug(): void;
|
|
16
16
|
configure(event_manager: EventManager): void;
|
|
17
|
-
update(entities: EntityManager,
|
|
17
|
+
update(entities: EntityManager, _events: EventManager, dt: number): void;
|
|
18
18
|
set gravity(val: Vec2);
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=PhysicsSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsSystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,EAAoC,IAAI,EAAE,MAAM,IAAI,CAAA;AAY3D,eAAO,MAAM,WAAW,IAAI,CAAA;AAC5B,eAAO,MAAM,aAAa,IAAI,CAAA;AAC9B,eAAO,MAAM,UAAU,IAAI,CAAA;AAC3B,eAAO,IAAI,KAAK,EAAE,OAAO,KAAK,CAAA;AAE9B,wBAAsB,SAAS,kBAE9B;AAED,wBAAgB,iBAAiB,CAAC,cAAc,cAAW,QAG1D;AAOD,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAA;IACpB,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,CAAK;IAEnC,cAAc,cAAW;IACzB,QAAQ,EAAE,QAAQ,CAAA;IAElB,QAAQ;IAKR,SAAS,CAAC,aAAa,EAAE,YAAY;IA8JrC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsSystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,EAAoC,IAAI,EAAE,MAAM,IAAI,CAAA;AAY3D,eAAO,MAAM,WAAW,IAAI,CAAA;AAC5B,eAAO,MAAM,aAAa,IAAI,CAAA;AAC9B,eAAO,MAAM,UAAU,IAAI,CAAA;AAC3B,eAAO,IAAI,KAAK,EAAE,OAAO,KAAK,CAAA;AAE9B,wBAAsB,SAAS,kBAE9B;AAED,wBAAgB,iBAAiB,CAAC,cAAc,cAAW,QAG1D;AAOD,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAA;IACpB,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,CAAK;IAEnC,cAAc,cAAW;IACzB,QAAQ,EAAE,QAAQ,CAAA;IAElB,QAAQ;IAKR,SAAS,CAAC,aAAa,EAAE,YAAY;IA8JrC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IA0BjE,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAIpB;CACF"}
|
|
@@ -155,7 +155,7 @@ export class PhysicsSystem {
|
|
|
155
155
|
const [x = 0, y = 0] = offset;
|
|
156
156
|
const zero = new b2Vec2(0, 0);
|
|
157
157
|
const position = new b2Vec2(node.posX, node.posY);
|
|
158
|
-
const { width, height } = node.
|
|
158
|
+
const { width, height } = node.contentSize;
|
|
159
159
|
const { scaleX, scaleY, anchorX, anchorY } = node;
|
|
160
160
|
const bd = new b2BodyDef();
|
|
161
161
|
bd.set_type(type);
|
|
@@ -203,7 +203,7 @@ export class PhysicsSystem {
|
|
|
203
203
|
const listener = makeContactListener(this.world, metadata, box2D);
|
|
204
204
|
this.world.SetContactListener(listener);
|
|
205
205
|
}
|
|
206
|
-
update(entities,
|
|
206
|
+
update(entities, _events, dt) {
|
|
207
207
|
if (this.world) {
|
|
208
208
|
const { getPointer } = box2D;
|
|
209
209
|
for (const entt of entities.entities_with_components(RigidBody)) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Graphics, Rectangle, Size } from 'pixi.js';
|
|
2
|
-
import { Vec2 } from '..';
|
|
2
|
+
import { BaseComponentProps, Vec2 } from '..';
|
|
3
3
|
import { NoRenderComponentX } from '../components/BaseComponent';
|
|
4
|
-
interface ColliderProps {
|
|
5
|
-
offset?: Vec2;
|
|
4
|
+
interface ColliderProps extends BaseComponentProps<Collider> {
|
|
6
5
|
tag?: number;
|
|
7
6
|
onCollisionEnter?: (other: Collider) => void;
|
|
8
7
|
onCollisionExit?: (other: Collider) => void;
|
|
@@ -38,7 +37,8 @@ export declare class Collider<T = ColliderProps> extends NoRenderComponentX<T> {
|
|
|
38
37
|
preAabb: Rectangle;
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
interface BoxColliderProps extends
|
|
40
|
+
interface BoxColliderProps extends BaseComponentProps<BoxCollider> {
|
|
41
|
+
offset?: [number, number];
|
|
42
42
|
width: number;
|
|
43
43
|
height: number;
|
|
44
44
|
}
|
|
@@ -47,13 +47,15 @@ export declare class BoxCollider extends Collider<BoxColliderProps> {
|
|
|
47
47
|
set size(s: Size);
|
|
48
48
|
update(dt: any, draw: Graphics): void;
|
|
49
49
|
}
|
|
50
|
-
interface CircleColliderProps extends
|
|
50
|
+
interface CircleColliderProps extends BaseComponentProps<CircleCollider> {
|
|
51
|
+
offset?: [number, number];
|
|
51
52
|
radius: number;
|
|
52
53
|
}
|
|
53
54
|
export declare class CircleCollider extends Collider<CircleColliderProps> {
|
|
54
55
|
update(dt: any, draw: Graphics): void;
|
|
55
56
|
}
|
|
56
|
-
interface PolygonColliderProps extends
|
|
57
|
+
interface PolygonColliderProps extends BaseComponentProps<PolygonCollider> {
|
|
58
|
+
offset?: [number, number];
|
|
57
59
|
points: Array<Vec2>;
|
|
58
60
|
}
|
|
59
61
|
export declare class PolygonCollider extends Collider<PolygonColliderProps> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EAAa,IAAI,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EAAE,kBAAkB,EAAa,IAAI,EAAE,MAAM,IAAI,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAgBhE,UAAU,aAAc,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC5C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC3C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;CAC5C;AAED,qBAAa,QAAQ,CAAC,CAAC,GAAG,aAAa,CAAE,SAAQ,k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,IAAI,EAAE,QAAQ;CAsB1B;AAED,oBAAY,aAAa;IACvB,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AASD,qBAAa,QAAQ;IACnB,UAAU,EAAE,QAAQ,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,eAAe,EAAE,OAAO,CAAA;IACxB,gBAAgB,EAAE,OAAO,CAAA;gBAEb,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAsBpD,WAAW;IAiBX,IAAI;CAyBL"}
|
|
@@ -43,7 +43,7 @@ export class BoxCollider extends Collider {
|
|
|
43
43
|
if (!this.node) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const [x, y] = this.props.offset || [0, 0];
|
|
47
47
|
// const hw = this.width * 0.5
|
|
48
48
|
// const hh = this.height * 0.5
|
|
49
49
|
const transform = getNodeToWorldTransformAR(this.node);
|
|
@@ -81,8 +81,9 @@ export class CircleCollider extends Collider {
|
|
|
81
81
|
}
|
|
82
82
|
const transform = getNodeToWorldTransformAR(this.node);
|
|
83
83
|
const collider = this.getComponent(Collider);
|
|
84
|
+
const [x, y] = this.props.offset || [0, 0];
|
|
84
85
|
collider._worldRadius = this.props.radius * this.node.scaleX;
|
|
85
|
-
collider._worldPosition = transform.apply(
|
|
86
|
+
collider._worldPosition = transform.apply(Vec2(x, y));
|
|
86
87
|
if (draw) {
|
|
87
88
|
const { x } = collider._worldPosition;
|
|
88
89
|
const y = GameWorld.Instance.app.screen.height - collider._worldPosition.y;
|
|
@@ -101,7 +102,7 @@ export class CircleCollider extends Collider {
|
|
|
101
102
|
}
|
|
102
103
|
export class PolygonCollider extends Collider {
|
|
103
104
|
get points() {
|
|
104
|
-
const
|
|
105
|
+
const [x, y] = this.props.offset || [0, 0];
|
|
105
106
|
const pointsList = this.props.points.map((p) => Vec2(p.x + x, p.y + y));
|
|
106
107
|
return pointsList;
|
|
107
108
|
}
|
package/dist/collider/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collider/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collider/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AAErC,wBAAgB,aAAa,CAAC,cAAc,CAAC,KAAA,EAAE,KAAK,UAAQ,QAS3D"}
|
package/dist/collider/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { GameWorld } from '..';
|
|
|
2
2
|
import { CollideSystem, enabledDebugDraw } from './CollideSystem';
|
|
3
3
|
export * from './CollideComponent';
|
|
4
4
|
export * from './CollideSystem';
|
|
5
|
+
export * from './helper/Intersection';
|
|
5
6
|
export function setupCollider(colliderMatrix, debug = false) {
|
|
6
7
|
GameWorld.Instance.systems.add(CollideSystem);
|
|
7
8
|
GameWorld.Instance.listUpdate.push(CollideSystem);
|
|
@@ -1,37 +1,18 @@
|
|
|
1
|
-
import { Constructor, Entity } from 'entityx-ts';
|
|
1
|
+
import { ComponentType, Constructor, Entity } from 'entityx-ts';
|
|
2
2
|
import { Action, Animation } from 'pixi-action-ease';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ColorSource, Container, Point } from 'pixi.js';
|
|
4
|
+
import { EnhancedComponent } from '..';
|
|
5
5
|
import { Vec2 } from '../core';
|
|
6
6
|
import { Size } from '../core/Size';
|
|
7
|
-
export type EventCallbackType = (...args: any[]) => void;
|
|
8
|
-
export interface EventMap {
|
|
9
|
-
[key: string]: [EventCallbackType];
|
|
10
|
-
}
|
|
11
|
-
type TouchEventCallback = (target: {
|
|
12
|
-
location: Vec2;
|
|
13
|
-
}) => void;
|
|
14
7
|
export declare class NodeComp<C extends Container = Container> {
|
|
15
8
|
entity: Entity;
|
|
16
9
|
instance: C;
|
|
17
|
-
events: EventMap;
|
|
18
|
-
data: {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
};
|
|
21
10
|
parent: NodeComp;
|
|
22
11
|
children: NodeComp[];
|
|
23
12
|
actionsList: Animation[];
|
|
24
13
|
name: string;
|
|
25
14
|
private _group;
|
|
26
15
|
private _active;
|
|
27
|
-
onTouchStart?: TouchEventCallback;
|
|
28
|
-
onTouchMove?: TouchEventCallback;
|
|
29
|
-
onTouchEnd?: TouchEventCallback;
|
|
30
|
-
onTouchCancel?: TouchEventCallback;
|
|
31
|
-
setOnTouchStart(cb: TouchEventCallback): void;
|
|
32
|
-
setOnTouchMove(cb: TouchEventCallback): void;
|
|
33
|
-
setOnTouchEnd(cb: TouchEventCallback): void;
|
|
34
|
-
setOnTouchCancel(cb: TouchEventCallback): void;
|
|
35
16
|
constructor(instance: C, entity: Entity);
|
|
36
17
|
get uuid(): number;
|
|
37
18
|
get position(): Vec2;
|
|
@@ -78,16 +59,65 @@ export declare class NodeComp<C extends Container = Container> {
|
|
|
78
59
|
getComponent<T extends Constructor<ComponentType>>(component: T): InstanceType<T>;
|
|
79
60
|
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
80
61
|
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
81
|
-
convertToNodeSpace(point: Vec2):
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
62
|
+
convertToNodeSpace(point: Vec2): {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
equals(other: /*elided*/ any): boolean;
|
|
66
|
+
add(value: Point | Vec2): /*elided*/ any;
|
|
67
|
+
addSelf(value: Point | Vec2): /*elided*/ any;
|
|
68
|
+
sub(value: Point | Vec2): /*elided*/ any;
|
|
69
|
+
mul(multiply: number): /*elided*/ any;
|
|
70
|
+
mulSelf(multiply: number): /*elided*/ any;
|
|
71
|
+
mag(): number;
|
|
72
|
+
normalizeSelf(): /*elided*/ any;
|
|
73
|
+
normalize(): /*elided*/ any;
|
|
74
|
+
cross(other: Vec2): number;
|
|
75
|
+
signAngle(other: Vec2): number;
|
|
76
|
+
lengthSqr(): number;
|
|
77
|
+
dot(other: Vec2): number;
|
|
78
|
+
angle(other: Vec2): number;
|
|
79
|
+
distance(other: /*elided*/ any): number;
|
|
80
|
+
};
|
|
81
|
+
convertToNodeSpaceAR(point: Vec2): {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
equals(other: /*elided*/ any): boolean;
|
|
85
|
+
add(value: Point | Vec2): /*elided*/ any;
|
|
86
|
+
addSelf(value: Point | Vec2): /*elided*/ any;
|
|
87
|
+
sub(value: Point | Vec2): /*elided*/ any;
|
|
88
|
+
mul(multiply: number): /*elided*/ any;
|
|
89
|
+
mulSelf(multiply: number): /*elided*/ any;
|
|
90
|
+
mag(): number;
|
|
91
|
+
normalizeSelf(): /*elided*/ any;
|
|
92
|
+
normalize(): /*elided*/ any;
|
|
93
|
+
cross(other: Vec2): number;
|
|
94
|
+
signAngle(other: Vec2): number;
|
|
95
|
+
lengthSqr(): number;
|
|
96
|
+
dot(other: Vec2): number;
|
|
97
|
+
angle(other: Vec2): number;
|
|
98
|
+
distance(other: /*elided*/ any): number;
|
|
99
|
+
};
|
|
100
|
+
convertToWorldSpaceAR(point: Vec2): {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
equals(other: /*elided*/ any): boolean;
|
|
104
|
+
add(value: Point | Vec2): /*elided*/ any;
|
|
105
|
+
addSelf(value: Point | Vec2): /*elided*/ any;
|
|
106
|
+
sub(value: Point | Vec2): /*elided*/ any;
|
|
107
|
+
mul(multiply: number): /*elided*/ any;
|
|
108
|
+
mulSelf(multiply: number): /*elided*/ any;
|
|
109
|
+
mag(): number;
|
|
110
|
+
normalizeSelf(): /*elided*/ any;
|
|
111
|
+
normalize(): /*elided*/ any;
|
|
112
|
+
cross(other: Vec2): number;
|
|
113
|
+
signAngle(other: Vec2): number;
|
|
114
|
+
lengthSqr(): number;
|
|
115
|
+
dot(other: Vec2): number;
|
|
116
|
+
angle(other: Vec2): number;
|
|
117
|
+
distance(other: /*elided*/ any): number;
|
|
118
|
+
};
|
|
119
|
+
get contentSize(): Size;
|
|
120
|
+
set contentSize(size: Size);
|
|
91
121
|
runAction(act: Action): void;
|
|
92
122
|
stopAllActions(): void;
|
|
93
123
|
pauseAllActions(): void;
|
|
@@ -97,12 +127,8 @@ export declare class NodeComp<C extends Container = Container> {
|
|
|
97
127
|
addChild(child: NodeComp, zOrder?: number): void;
|
|
98
128
|
destroyAllChildren(): void;
|
|
99
129
|
removeAllChildren(): void;
|
|
100
|
-
on(name: string, callback: EventCallbackType, target?: any): void;
|
|
101
|
-
off(name: string): void;
|
|
102
|
-
emit(name: string, ...params: any): void;
|
|
103
130
|
resolveComponent(component: EnhancedComponent<object, NodeComp>): void;
|
|
104
131
|
getData<T>(key: string): T;
|
|
105
132
|
setData<T>(key: string, value: T): void;
|
|
106
133
|
}
|
|
107
|
-
export {};
|
|
108
134
|
//# sourceMappingURL=NodeComp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAiB,SAA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CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAI7E,kBAAkB,CAAC,KAAK,EAAE,IAAI;;;;;;;;;;;;;;;;;;;IAI9B,oBAAoB,CAAC,KAAK,EAAE,IAAI;;;;;;;;;;;;;;;;;;;IAIhC,qBAAqB,CAAC,KAAK,EAAE,IAAI;;;;;;;;;;;;;;;;;;;IAoBjC,IAAI,WAAW,IAAI,IAAI,CAEtB;IAED,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAEzB;IAED,SAAS,CAAC,GAAG,EAAE,MAAM;IAKrB,cAAc;IAOd,eAAe;IAMf,gBAAgB;IAMhB,OAAO;IAaP,gBAAgB;IAMhB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM;IAQzC,kBAAkB;IAMlB,iBAAiB;IAMjB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAY/D,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAM1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;CASjC"}
|
|
@@ -1,58 +1,28 @@
|
|
|
1
1
|
import { actionManager } from 'pixi-action-ease';
|
|
2
2
|
import { Point, Sprite, Text } from 'pixi.js';
|
|
3
|
-
import { instantiate } from '
|
|
3
|
+
import { instantiate } from '..';
|
|
4
4
|
import { updatePoint, Vec2 } from '../core';
|
|
5
5
|
import { ProgressBarComp } from '../gui/GUIComponent';
|
|
6
6
|
import { ExtraDataComp } from '../norender/NoRenderComponent';
|
|
7
7
|
export class NodeComp {
|
|
8
|
-
setOnTouchStart(cb) {
|
|
9
|
-
this.onTouchStart = cb;
|
|
10
|
-
this.instance.on('touchstart', (event) => {
|
|
11
|
-
const { global } = event;
|
|
12
|
-
this.onTouchStart({ location: updatePoint(global) });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
setOnTouchMove(cb) {
|
|
16
|
-
this.onTouchMove = cb;
|
|
17
|
-
this.instance.on('touchmove', (event) => {
|
|
18
|
-
const { global } = event;
|
|
19
|
-
this.onTouchMove({ location: updatePoint(global) });
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
setOnTouchEnd(cb) {
|
|
23
|
-
this.onTouchEnd = cb;
|
|
24
|
-
this.instance.on('touchend', (event) => {
|
|
25
|
-
const { global } = event;
|
|
26
|
-
this.onTouchEnd({ location: updatePoint(global) });
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
setOnTouchCancel(cb) {
|
|
30
|
-
this.onTouchCancel = cb;
|
|
31
|
-
this.instance.on('touchcancel', (event) => {
|
|
32
|
-
const { global } = event;
|
|
33
|
-
this.onTouchCancel({ location: updatePoint(global) });
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
8
|
constructor(instance, entity) {
|
|
37
|
-
this.events = {};
|
|
38
|
-
this.data = {};
|
|
39
9
|
this.children = [];
|
|
40
10
|
this.actionsList = [];
|
|
41
|
-
// private lastMove: { x: number; y: number }
|
|
42
11
|
this._group = 0;
|
|
43
12
|
this._active = true;
|
|
44
13
|
this.entity = entity;
|
|
45
14
|
this.instance = instance;
|
|
46
|
-
this.
|
|
15
|
+
this.anchorX = 0.5;
|
|
16
|
+
this.anchorY = 0.5;
|
|
47
17
|
}
|
|
48
18
|
get uuid() {
|
|
49
19
|
return this.entity.id;
|
|
50
20
|
}
|
|
51
21
|
get position() {
|
|
52
|
-
return this.
|
|
22
|
+
return updatePoint(this.instance.position);
|
|
53
23
|
}
|
|
54
24
|
set position(val) {
|
|
55
|
-
this.
|
|
25
|
+
this.instance.position = val;
|
|
56
26
|
}
|
|
57
27
|
get posX() {
|
|
58
28
|
return this.instance.x;
|
|
@@ -67,7 +37,7 @@ export class NodeComp {
|
|
|
67
37
|
this.instance.y = val;
|
|
68
38
|
}
|
|
69
39
|
set xy(val) {
|
|
70
|
-
this.
|
|
40
|
+
this.position = Vec2(val[0], val[1]);
|
|
71
41
|
}
|
|
72
42
|
get scale() {
|
|
73
43
|
return this.instance.scale.x;
|
|
@@ -90,7 +60,7 @@ export class NodeComp {
|
|
|
90
60
|
get anchorX() {
|
|
91
61
|
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
92
62
|
return this.instance.anchor.x;
|
|
93
|
-
return 0;
|
|
63
|
+
return 0.5;
|
|
94
64
|
}
|
|
95
65
|
set anchorX(val) {
|
|
96
66
|
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
@@ -99,7 +69,7 @@ export class NodeComp {
|
|
|
99
69
|
get anchorY() {
|
|
100
70
|
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
101
71
|
return this.instance.anchor.y;
|
|
102
|
-
return 0;
|
|
72
|
+
return 0.5;
|
|
103
73
|
}
|
|
104
74
|
set anchorY(val) {
|
|
105
75
|
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
@@ -135,10 +105,10 @@ export class NodeComp {
|
|
|
135
105
|
this.instance.style.fill = val;
|
|
136
106
|
}
|
|
137
107
|
get opacity() {
|
|
138
|
-
return this.instance.alpha;
|
|
108
|
+
return Math.round(this.instance.alpha * 255);
|
|
139
109
|
}
|
|
140
110
|
set opacity(val) {
|
|
141
|
-
this.instance.alpha = val;
|
|
111
|
+
this.instance.alpha = val / 255;
|
|
142
112
|
}
|
|
143
113
|
get active() {
|
|
144
114
|
if (!this._active)
|
|
@@ -171,7 +141,7 @@ export class NodeComp {
|
|
|
171
141
|
return this.instance.height;
|
|
172
142
|
}
|
|
173
143
|
set height(val) {
|
|
174
|
-
this.instance.
|
|
144
|
+
this.instance.setSize(this.width, val);
|
|
175
145
|
}
|
|
176
146
|
get zIndex() {
|
|
177
147
|
return this.instance.zIndex;
|
|
@@ -201,30 +171,13 @@ export class NodeComp {
|
|
|
201
171
|
return this.getComponentsInChildren(component)[0];
|
|
202
172
|
}
|
|
203
173
|
convertToNodeSpace(point) {
|
|
204
|
-
return this.instance.toLocal(point);
|
|
174
|
+
return updatePoint(this.instance.toLocal(point));
|
|
205
175
|
}
|
|
206
176
|
convertToNodeSpaceAR(point) {
|
|
207
|
-
return this.instance.toLocal(point);
|
|
177
|
+
return updatePoint(this.instance.toLocal(point));
|
|
208
178
|
}
|
|
209
179
|
convertToWorldSpaceAR(point) {
|
|
210
|
-
return this.instance.toGlobal(point);
|
|
211
|
-
}
|
|
212
|
-
getPosition() {
|
|
213
|
-
return updatePoint(this.instance.position);
|
|
214
|
-
}
|
|
215
|
-
setPosition(x, y) {
|
|
216
|
-
if (typeof x !== 'number') {
|
|
217
|
-
this.instance.position = Vec2(x.x, x.y);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
this.instance.position = Vec2(x, y);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
setRotation(deg) {
|
|
224
|
-
this.instance.rotation = deg;
|
|
225
|
-
}
|
|
226
|
-
getRotation() {
|
|
227
|
-
return this.instance.rotation;
|
|
180
|
+
return updatePoint(this.instance.toGlobal(point));
|
|
228
181
|
}
|
|
229
182
|
// setAnchorPoint(point: number | cc.Point, y?: number) {
|
|
230
183
|
// this.instance.setAnchorPoint(point, y)
|
|
@@ -239,28 +192,11 @@ export class NodeComp {
|
|
|
239
192
|
// }
|
|
240
193
|
// return box
|
|
241
194
|
// }
|
|
242
|
-
|
|
243
|
-
return this.instance.
|
|
244
|
-
}
|
|
245
|
-
// setContentSize(size: cc.Size | number, height?: number) {
|
|
246
|
-
// this.instance.setContentSize(size, height)
|
|
247
|
-
// if (this.instance instanceof cc.ClippingNode) {
|
|
248
|
-
// const hw = ((size as any).width || size) * 0.5
|
|
249
|
-
// const hh = ((size as any).height || height) * 0.5
|
|
250
|
-
// const stencil = new cc.DrawNode()
|
|
251
|
-
// const rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)]
|
|
252
|
-
// stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE)
|
|
253
|
-
// // stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
|
|
254
|
-
// this.instance.stencil = stencil
|
|
255
|
-
// }
|
|
256
|
-
// }
|
|
257
|
-
setColor(color) {
|
|
258
|
-
if (this.instance instanceof Sprite)
|
|
259
|
-
this.instance.tint = color;
|
|
195
|
+
get contentSize() {
|
|
196
|
+
return this.instance.getSize();
|
|
260
197
|
}
|
|
261
|
-
|
|
262
|
-
this.instance.
|
|
263
|
-
this.instance.scale.y = scaleY || scaleX;
|
|
198
|
+
set contentSize(size) {
|
|
199
|
+
this.instance.setSize(size);
|
|
264
200
|
}
|
|
265
201
|
runAction(act) {
|
|
266
202
|
const animation = actionManager.runAction(this.instance, act);
|
|
@@ -317,23 +253,6 @@ export class NodeComp {
|
|
|
317
253
|
child.removeFromParent();
|
|
318
254
|
});
|
|
319
255
|
}
|
|
320
|
-
on(name, callback, target) {
|
|
321
|
-
const bound = target ? callback.bind(target) : callback;
|
|
322
|
-
if (this.events[name]) {
|
|
323
|
-
this.events[name].push(bound);
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
this.events[name] = [bound];
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
off(name) {
|
|
330
|
-
this.events[name] = undefined;
|
|
331
|
-
}
|
|
332
|
-
emit(name, ...params) {
|
|
333
|
-
if (this.events[name]) {
|
|
334
|
-
this.events[name].forEach((fc) => fc(...params));
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
256
|
resolveComponent(component) {
|
|
338
257
|
// console.log(component.constructor.name, (component.constructor as any).hasRender)
|
|
339
258
|
if (component.constructor.hasRender) {
|
package/dist/core/Color.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../src/core/Color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../src/core/Color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,SAEjE;AAED,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { BaseComponentProps } from "..";
|
|
1
2
|
import { ComponentX } from "../components/BaseComponent";
|
|
2
3
|
interface DragonBonesData {
|
|
3
4
|
atlas: string;
|
|
4
5
|
skeleton: string;
|
|
5
6
|
texture: string;
|
|
6
7
|
}
|
|
7
|
-
interface DragonBonesProps {
|
|
8
|
+
interface DragonBonesProps extends BaseComponentProps<DragonBonesComp> {
|
|
8
9
|
data: DragonBonesData;
|
|
9
10
|
skin?: string;
|
|
10
11
|
animation?: string;
|
|
@@ -20,7 +21,7 @@ interface DragonBonesProps {
|
|
|
20
21
|
name: string;
|
|
21
22
|
}) => void;
|
|
22
23
|
}
|
|
23
|
-
export declare class
|
|
24
|
+
export declare class DragonBonesComp extends ComponentX<DragonBonesProps> {
|
|
24
25
|
setAnimation(name: string, playTimes?: number): void;
|
|
25
26
|
setSkeletonData(data: string): void;
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragonBonesComponent.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,
|
|
1
|
+
{"version":3,"file":"DragonBonesComponent.d.ts","sourceRoot":"","sources":["../../src/dragonbones/DragonBonesComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,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,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,CAAC;IAE/D,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAI;IAOxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAK7B"}
|
|
@@ -2,10 +2,10 @@ import { PixiFactory } from 'dragonbones-pixijs';
|
|
|
2
2
|
import { EventTypes } from 'entityx-ts';
|
|
3
3
|
import { Assets } from 'pixi.js';
|
|
4
4
|
import { NodeComp } from '../components/NodeComp';
|
|
5
|
-
import {
|
|
5
|
+
import { DragonBonesComp } from './DragonBonesComponent';
|
|
6
6
|
export class DragonBonesSystem {
|
|
7
7
|
configure(event_manager) {
|
|
8
|
-
event_manager.subscribe(EventTypes.ComponentAdded,
|
|
8
|
+
event_manager.subscribe(EventTypes.ComponentAdded, DragonBonesComp, ({ entity, component }) => {
|
|
9
9
|
const { data, animation, playTimes = 0 } = component.props;
|
|
10
10
|
const { skeleton, atlas, texture } = data;
|
|
11
11
|
const skeletonAsset = Assets.get(skeleton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAenC,qBAAa,SAAU,YAAW,MAAM;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAenC,qBAAa,SAAU,YAAW,MAAM;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,SAAS,CAAC;CAoGjD"}
|
package/dist/gui/GUISystem.js
CHANGED
|
@@ -9,18 +9,17 @@ export class GUISystem {
|
|
|
9
9
|
configure(event_manager) {
|
|
10
10
|
event_manager.subscribe(EventTypes.ComponentAdded, ButtonComp, ({ entity, component }) => {
|
|
11
11
|
const nodeComp = entity.getComponent(NodeComp);
|
|
12
|
-
|
|
13
|
-
// console.log('onPress.ButtonComp', component)
|
|
12
|
+
const { zoomScale = 1.2 } = component.props;
|
|
14
13
|
const button = new Button(nodeComp.instance);
|
|
15
|
-
// node.setZoomScale(zoomScale - 1)
|
|
16
14
|
component.node = nodeComp;
|
|
17
|
-
|
|
15
|
+
const lastScaleX = nodeComp.scaleX;
|
|
16
|
+
const lastScaleY = nodeComp.scaleY;
|
|
18
17
|
button.onPress.connect(() => {
|
|
19
18
|
if (!component.enabled)
|
|
20
19
|
return;
|
|
21
20
|
// console.log('onPress.connect')
|
|
22
|
-
const scale = scaleTo(0.
|
|
23
|
-
const scaleDown = scaleTo(0.
|
|
21
|
+
const scale = scaleTo(0.3, zoomScale * lastScaleX, lastScaleY * zoomScale);
|
|
22
|
+
const scaleDown = scaleTo(0.3, lastScaleX, lastScaleY);
|
|
24
23
|
const seq = sequence(scale, callFunc(() => {
|
|
25
24
|
if (Object.prototype.hasOwnProperty.call(component.props, 'onPress')) {
|
|
26
25
|
component.props.onPress(component);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,10 @@ export * from 'pixi-action-ease';
|
|
|
2
2
|
export * from 'pixi.js';
|
|
3
3
|
export * from './app';
|
|
4
4
|
export * from './base';
|
|
5
|
-
export * from './collider';
|
|
6
|
-
export * from './collider/helper/Intersection';
|
|
7
5
|
export * from './components/BaseComponent';
|
|
8
6
|
export * from './components/NodeComp';
|
|
9
7
|
export * from './components/Scene';
|
|
10
8
|
export * from './core';
|
|
11
|
-
export * from './dragonbones';
|
|
12
9
|
export * from './gui/GUIComponent';
|
|
13
10
|
export * from './gui/GUISystem';
|
|
14
11
|
export * from './helper/utils';
|
|
@@ -16,6 +13,4 @@ export * from './norender/NoRenderComponent';
|
|
|
16
13
|
export * from './norender/Touch';
|
|
17
14
|
export * from './render/RenderComponent';
|
|
18
15
|
export * from './render/RenderSystem';
|
|
19
|
-
export * from './richtext';
|
|
20
|
-
export * from './spine';
|
|
21
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,10 @@ export * from 'pixi-action-ease';
|
|
|
2
2
|
export * from 'pixi.js';
|
|
3
3
|
export * from './app';
|
|
4
4
|
export * from './base';
|
|
5
|
-
export * from './collider';
|
|
6
|
-
export * from './collider/helper/Intersection';
|
|
7
5
|
export * from './components/BaseComponent';
|
|
8
6
|
export * from './components/NodeComp';
|
|
9
7
|
export * from './components/Scene';
|
|
10
8
|
export * from './core';
|
|
11
|
-
export * from './dragonbones';
|
|
12
9
|
export * from './gui/GUIComponent';
|
|
13
10
|
export * from './gui/GUISystem';
|
|
14
11
|
export * from './helper/utils';
|
|
@@ -16,5 +13,3 @@ export * from './norender/NoRenderComponent';
|
|
|
16
13
|
export * from './norender/Touch';
|
|
17
14
|
export * from './render/RenderComponent';
|
|
18
15
|
export * from './render/RenderSystem';
|
|
19
|
-
export * from './richtext';
|
|
20
|
-
export * from './spine';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NoRenderComponentX } from '../components/BaseComponent';
|
|
2
|
-
import {
|
|
2
|
+
import { NodeComp } from '../components/NodeComp';
|
|
3
3
|
import { Touch } from './Touch';
|
|
4
|
+
export type EventCallbackType = (...args: any[]) => void;
|
|
5
|
+
export interface EventMap {
|
|
6
|
+
[key: string]: [EventCallbackType];
|
|
7
|
+
}
|
|
4
8
|
export type TouchEventCallback = (touch?: Touch, node?: NodeComp) => void;
|
|
5
9
|
export declare class EventRegister extends NoRenderComponentX {
|
|
6
10
|
events: EventMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoRenderComponent.d.ts","sourceRoot":"","sources":["../../src/norender/NoRenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NoRenderComponent.d.ts","sourceRoot":"","sources":["../../src/norender/NoRenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAA;AACjD,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC,CAAA;CACnC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAA;AAEzE,qBAAa,aAAc,SAAQ,kBAAkB;IACnD,MAAM,EAAE,QAAQ,CAAK;IAErB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAS1D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAK5D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;CAKlC;AAED,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,aAAa,CAAC,EAAE,kBAAkB,CAAA;CACnC;AACD,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IACzE,QAAQ,EAAE,aAAa,CAAA;IACvB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,GAAG,CAAA;CACX;AACD,qBAAa,aAAc,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACnE,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAK;IAEjC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAG1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoRenderSystem.d.ts","sourceRoot":"","sources":["../../src/norender/NoRenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"NoRenderSystem.d.ts","sourceRoot":"","sources":["../../src/norender/NoRenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAO7D,qBAAa,cAAe,YAAW,MAAM;IAC3C,SAAS,CAAC,aAAa,EAAE,YAAY;CAwDtC"}
|
|
@@ -14,31 +14,30 @@ export class NoRenderSystem {
|
|
|
14
14
|
const nodeComp = ett.getComponent(NodeComp);
|
|
15
15
|
touchComp.node = nodeComp;
|
|
16
16
|
const container = nodeComp.instance;
|
|
17
|
+
container.eventMode = 'static';
|
|
17
18
|
if (touchComp.props.onTouchStart) {
|
|
18
|
-
container.on('
|
|
19
|
+
container.on('touchstart', (event) => {
|
|
19
20
|
touchComp.props.onTouchStart(new Touch(event), nodeComp);
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
if (touchComp.props.onTouchMove) {
|
|
23
|
-
container.on('
|
|
24
|
+
container.on('touchmove', (event) => {
|
|
24
25
|
touchComp.props.onTouchMove(new Touch(event), nodeComp);
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
if (touchComp.props.onTouchEnd) {
|
|
28
|
-
container.on('
|
|
29
|
+
container.on('touchend', (event) => {
|
|
29
30
|
touchComp.props.onTouchEnd(new Touch(event), nodeComp);
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
if (touchComp.props.
|
|
33
|
-
container.on('
|
|
34
|
-
touchComp.props.
|
|
33
|
+
if (touchComp.props.onTouchCancel) {
|
|
34
|
+
container.on('touchcancel', (event) => {
|
|
35
|
+
touchComp.props.onTouchCancel(new Touch(event), nodeComp);
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
event_manager.subscribe(EventTypes.ComponentRemoved, TouchEventRegister, ({ component }) => {
|
|
39
|
-
console.log('ComponentRemovedEvent TouchEventRegister',
|
|
40
|
-
// const ett = event.entity
|
|
41
|
-
// const nodeComp = ett.getComponent(NodeComp)
|
|
40
|
+
console.log('ComponentRemovedEvent TouchEventRegister', component);
|
|
42
41
|
const touchComp = component;
|
|
43
42
|
const container = touchComp.node.instance;
|
|
44
43
|
if (touchComp.props.onTouchStart) {
|
|
@@ -15,29 +15,18 @@ export declare class SpriteRender extends ComponentX<SpriteRenderProps, Sprite>
|
|
|
15
15
|
get spriteFrame(): string;
|
|
16
16
|
set spriteFrame(frame: string);
|
|
17
17
|
}
|
|
18
|
-
declare enum PointType {
|
|
19
|
-
Circle = 0,
|
|
20
|
-
Rect = 1
|
|
21
|
-
}
|
|
22
18
|
interface GraphicsRenderProps extends BaseComponentProps<GraphicsRender> {
|
|
23
19
|
lineWidth?: number;
|
|
24
20
|
strokeColor?: Color4B;
|
|
25
21
|
fillColor?: Color4B;
|
|
26
22
|
}
|
|
27
23
|
export declare class GraphicsRender extends ComponentX<GraphicsRenderProps, Graphics> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B): void;
|
|
35
|
-
drawCubicBezier(origin: Vec2, destination: Vec2, color: Color4B): void;
|
|
36
|
-
drawCardinalSpline(points: Vec2[], color: Color4B): void;
|
|
37
|
-
drawCatmullRom(points: Vec2[], color: Color4B): void;
|
|
38
|
-
drawPoly(points: Vec2[], color?: Color4B, thickness?: Float): void;
|
|
39
|
-
drawSolidPoly(points: Vec2[], color: Color4B): void;
|
|
40
|
-
drawDot(points: Vec2[], color: Color4B): void;
|
|
24
|
+
drawRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
|
|
25
|
+
drawSolidRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
|
|
26
|
+
drawCircle(center: Vec2, radius: Float, color?: Color4B): void;
|
|
27
|
+
drawSolidCircle(center: Vec2, radius: Float, color?: Color4B): void;
|
|
28
|
+
drawPoly(points: Vec2[], color?: Color4B): void;
|
|
29
|
+
drawSolidPoly(points: Vec2[], color?: Color4B): void;
|
|
41
30
|
drawSegment(from: Vec2, to: Vec2, thickness?: Float, color?: Color4B): void;
|
|
42
31
|
drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B): void;
|
|
43
32
|
clear(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/render/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAW,M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AAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AACD,qBAAa,UAAW,SAAQ,UAAU,CAAC,eAAe,CAAC;CAAG"}
|
|
@@ -38,40 +38,48 @@ export class SpriteRender extends ComponentX {
|
|
|
38
38
|
// }
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
var PointType;
|
|
42
|
-
(function (PointType) {
|
|
43
|
-
PointType[PointType["Circle"] = 0] = "Circle";
|
|
44
|
-
PointType[PointType["Rect"] = 1] = "Rect";
|
|
45
|
-
})(PointType || (PointType = {}));
|
|
46
41
|
export class GraphicsRender extends ComponentX {
|
|
47
|
-
drawPoint(
|
|
42
|
+
// drawPoint(_pointType = PointType.Rect) {}
|
|
48
43
|
// drawPoints(points: Vec2[], color: Color4B) {
|
|
49
44
|
// }
|
|
50
|
-
drawLine(
|
|
45
|
+
// drawLine() {}
|
|
51
46
|
drawRect(origin, destination, color) {
|
|
52
47
|
const { x, y } = origin;
|
|
53
48
|
const width = destination.x - x;
|
|
54
49
|
const height = destination.y - y;
|
|
55
50
|
this.node.instance.rect(x, y, width, height);
|
|
56
|
-
this.node.instance.
|
|
51
|
+
this.node.instance.stroke(color || this.props.strokeColor);
|
|
52
|
+
}
|
|
53
|
+
drawSolidRect(origin, destination, color) {
|
|
54
|
+
const { x, y } = origin;
|
|
55
|
+
const width = destination.x - x;
|
|
56
|
+
const height = destination.y - y;
|
|
57
|
+
this.node.instance.rect(x, y, width, height);
|
|
58
|
+
this.node.instance.fill(color || this.props.fillColor);
|
|
59
|
+
}
|
|
60
|
+
drawCircle(center, radius, color) {
|
|
61
|
+
const { x, y } = center;
|
|
62
|
+
this.node.instance.circle(x, y, radius);
|
|
63
|
+
this.node.instance.stroke(color || this.props.strokeColor);
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
drawCircle(center, radius, angle, segments, drawLineToCenter, scaleX, scaleY, color, thickness) {
|
|
65
|
+
drawSolidCircle(center, radius, color) {
|
|
60
66
|
const { x, y } = center;
|
|
61
67
|
this.node.instance.circle(x, y, radius);
|
|
62
68
|
this.node.instance.fill(color);
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
// drawQuadBezier() {}
|
|
71
|
+
// drawCubicBezier() {}
|
|
72
|
+
// drawCardinalSpline() {}
|
|
73
|
+
// drawCatmullRom() {}
|
|
74
|
+
drawPoly(points, color) {
|
|
75
|
+
this.node.instance.poly(points, true);
|
|
76
|
+
this.node.instance.stroke(color || this.props.strokeColor);
|
|
77
|
+
}
|
|
78
|
+
drawSolidPoly(points, color) {
|
|
70
79
|
this.node.instance.poly(points, true);
|
|
71
80
|
this.node.instance.fill(color || this.props.fillColor);
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
drawDot(points, color) { }
|
|
82
|
+
// drawDot() {}
|
|
75
83
|
drawSegment(from, to, thickness, color) {
|
|
76
84
|
this.node.instance.moveTo(from.x, from.y);
|
|
77
85
|
this.node.instance.lineTo(to.x, to.y);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-shim.d.ts","sourceRoot":"","sources":["../../../src/spine/lib/require-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;+EA2B+E;AAE/E,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,IAAI,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"require-shim.d.ts","sourceRoot":"","sources":["../../../src/spine/lib/require-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;+EA2B+E;AAE/E,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,IAAI,EAAE,GAAG,CAAA;CACd;AAUD,OAAO,EAAG,CAAC"}
|
|
@@ -31,7 +31,7 @@ if (typeof window !== 'undefined' && window.PIXI) {
|
|
|
31
31
|
window.require = (x) => {
|
|
32
32
|
if (prevRequire)
|
|
33
33
|
return prevRequire(x);
|
|
34
|
-
else if (x.startsWith(
|
|
34
|
+
else if (x.startsWith('@pixi/') || x.startsWith('pixi.js'))
|
|
35
35
|
return window.PIXI;
|
|
36
36
|
};
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-engine/pixi",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.5",
|
|
4
4
|
"description": "safex pixi plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
"@types"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"export": "safex build -p ios",
|
|
14
|
-
"start": "parcel src/index.html -p 8080",
|
|
15
|
-
"dev": "parcel src/index.html -p 8080 --no-cache",
|
|
16
13
|
"build": "tsc",
|
|
17
14
|
"fix": "eslint ./src --ext .ts --fix"
|
|
18
15
|
},
|
|
@@ -22,9 +19,7 @@
|
|
|
22
19
|
"dependencies": {
|
|
23
20
|
"@esotericsoftware/spine-core": "^4.2.87",
|
|
24
21
|
"@pixi/ui": "^2.2.4",
|
|
25
|
-
"@types/node": "^24.0.15",
|
|
26
22
|
"box2d-wasm": "^7.0.0",
|
|
27
|
-
"copyfiles": "^2.4.1",
|
|
28
23
|
"dragonbones-pixijs": "^1.0.5",
|
|
29
24
|
"entityx-ts": "^2.2.1",
|
|
30
25
|
"pixi-action-ease": "^3.2.3",
|