@safe-engine/cocos 1.6.1 → 1.6.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/dist/box2d-wasm/PhysicsComponent.d.ts +7 -3
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsComponent.js +28 -0
- package/dist/box2d-wasm/PhysicsSystem.d.ts +2 -1
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.js +17 -18
- package/dist/box2d-wasm/index.d.ts +2 -2
- package/dist/box2d-wasm/index.d.ts.map +1 -1
- package/dist/box2d-wasm/index.js +4 -1
- package/dist/gworld/components/NodeComp.d.ts +1 -1
- package/dist/gworld/components/NodeComp.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/gworld/components/AnimationComponent.d.ts +0 -65
- package/dist/gworld/components/AnimationComponent.d.ts.map +0 -1
- package/dist/gworld/components/AnimationComponent.js +0 -141
- package/dist/gworld/components/CollideComponent.d.ts +0 -64
- package/dist/gworld/components/CollideComponent.d.ts.map +0 -1
- package/dist/gworld/components/CollideComponent.js +0 -265
- package/dist/gworld/systems/AnimationSystem.d.ts +0 -6
- package/dist/gworld/systems/AnimationSystem.d.ts.map +0 -1
- package/dist/gworld/systems/AnimationSystem.js +0 -30
- package/dist/gworld/systems/CollideSystem.d.ts +0 -20
- package/dist/gworld/systems/CollideSystem.d.ts.map +0 -1
- package/dist/gworld/systems/CollideSystem.js +0 -171
- package/dist/helper/html-text-parser.d.ts +0 -30
- package/dist/helper/html-text-parser.d.ts.map +0 -1
- package/dist/helper/html-text-parser.js +0 -354
|
@@ -18,23 +18,27 @@ interface RigidBodyProps {
|
|
|
18
18
|
export declare class RigidBody extends NoRenderComponentX<RigidBodyProps> {
|
|
19
19
|
body: Box2D.b2Body;
|
|
20
20
|
physicSprite: PhysicsSprite;
|
|
21
|
+
set linearVelocity(vel: Vec2);
|
|
22
|
+
get linearVelocity(): Vec2;
|
|
23
|
+
set position(pos: Vec2);
|
|
24
|
+
get position(): Vec2;
|
|
21
25
|
}
|
|
22
26
|
interface BoxColliderPhysicsProps {
|
|
23
27
|
width: number;
|
|
24
28
|
height: number;
|
|
25
|
-
offset?:
|
|
29
|
+
offset?: [number, number];
|
|
26
30
|
}
|
|
27
31
|
export declare class PhysicsBoxCollider extends NoRenderComponentX<BoxColliderPhysicsProps & BaseComponentProps<PhysicsBoxCollider>> {
|
|
28
32
|
}
|
|
29
33
|
interface CircleColliderPhysicsProps {
|
|
30
34
|
radius: number;
|
|
31
|
-
offset?:
|
|
35
|
+
offset?: [number, number];
|
|
32
36
|
}
|
|
33
37
|
export declare class PhysicsCircleCollider extends NoRenderComponentX<CircleColliderPhysicsProps & BaseComponentProps<PhysicsCircleCollider>> {
|
|
34
38
|
}
|
|
35
39
|
interface PolygonColliderPhysicsProps {
|
|
36
40
|
points: Array<Vec2> | [number, number][];
|
|
37
|
-
offset?:
|
|
41
|
+
offset?: [number, number];
|
|
38
42
|
}
|
|
39
43
|
export declare class PhysicsPolygonCollider extends NoRenderComponentX<PolygonColliderPhysicsProps & BaseComponentProps<PhysicsPolygonCollider>> {
|
|
40
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsComponent.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"PhysicsComponent.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0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,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,uBAAuB,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CAS3H;AACD,UAAU,0BAA0B;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B;AACD,qBAAa,qBAAsB,SAAQ,kBAAkB,CAAC,0BAA0B,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CAAG;AACxI,UAAU,2BAA2B;IACnC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IACxC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B;AACD,qBAAa,sBAAuB,SAAQ,kBAAkB,CAAC,2BAA2B,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CAAG"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import { NoRenderComponentX } from '../gworld/core/decorator';
|
|
2
|
+
import { Vec2 } from '../polyfills';
|
|
3
|
+
import { box2D } from './PhysicsSystem';
|
|
2
4
|
export class RigidBody extends NoRenderComponentX {
|
|
3
5
|
body;
|
|
4
6
|
physicSprite;
|
|
7
|
+
set linearVelocity(vel) {
|
|
8
|
+
if (!this.node) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
this.physicSprite.getBody().SetLinearVelocity(new box2D.b2Vec2(vel.x, vel.y));
|
|
12
|
+
}
|
|
13
|
+
get linearVelocity() {
|
|
14
|
+
if (!this.node) {
|
|
15
|
+
return Vec2.ZERO;
|
|
16
|
+
}
|
|
17
|
+
const vel = this.physicSprite.getBody().GetLinearVelocity();
|
|
18
|
+
return Vec2(vel);
|
|
19
|
+
}
|
|
20
|
+
set position(pos) {
|
|
21
|
+
this.physicSprite.node.setPosition(pos.x, pos.y);
|
|
22
|
+
const physicsPos = new box2D.b2Vec2(pos.x, pos.y);
|
|
23
|
+
// console.log('SetTransform', pos, physicsPos)
|
|
24
|
+
const body = this.physicSprite.getBody();
|
|
25
|
+
body.SetLinearVelocity(new box2D.b2Vec2(0, 0));
|
|
26
|
+
body.SetAngularVelocity(0);
|
|
27
|
+
body.SetAwake(true);
|
|
28
|
+
body.SetTransform(physicsPos, this.node.rotation);
|
|
29
|
+
}
|
|
30
|
+
get position() {
|
|
31
|
+
return Vec2(this.physicSprite.getBody().GetPosition());
|
|
32
|
+
}
|
|
5
33
|
}
|
|
6
34
|
export class PhysicsBoxCollider extends NoRenderComponentX {
|
|
7
35
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
|
+
import { Vec2 } from '..';
|
|
2
3
|
export declare const DynamicBody = 2;
|
|
3
4
|
export declare const KinematicBody = 1;
|
|
4
5
|
export declare const StaticBody = 0;
|
|
@@ -14,6 +15,6 @@ export declare class PhysicsSystem implements System {
|
|
|
14
15
|
addDebug(): void;
|
|
15
16
|
configure(event_manager: EventManager): void;
|
|
16
17
|
update(entities: EntityManager, events: EventManager, dt: number): void;
|
|
17
|
-
set
|
|
18
|
+
set gravity(val: Vec2);
|
|
18
19
|
}
|
|
19
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;
|
|
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;AAE5E,OAAO,EAAoC,IAAI,EAAE,MAAM,IAAI,CAAA;AAM3D,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,wBAAgB,SAAS,CAAC,EAAE,KAAA,QAK3B;AASD,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;IACnC,eAAe,EAAE,KAAK,CAAC,OAAO,EAAE,CAAK;IACrC,cAAc,cAAW;IACzB,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAA;IAErB,QAAQ;IAKR,SAAS,CAAC,aAAa,EAAE,YAAY;IA4JrC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IAwBhE,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAIpB;CACF"}
|
|
@@ -60,9 +60,9 @@ export class PhysicsSystem {
|
|
|
60
60
|
const { type = StaticBody, gravityScale = 1, density = 1, friction = 0.5, restitution = 0.3 } = rigidBody.props;
|
|
61
61
|
const box = component;
|
|
62
62
|
const node = entity.getComponent(NodeComp);
|
|
63
|
-
const { width, height, offset } = box.props;
|
|
64
|
-
const
|
|
65
|
-
const zero = new b2Vec2(
|
|
63
|
+
const { width, height, offset = [] } = box.props;
|
|
64
|
+
const [x = 0, y = 0] = offset;
|
|
65
|
+
const zero = new b2Vec2(0, 0);
|
|
66
66
|
const position = new b2Vec2(node.posX, node.posY);
|
|
67
67
|
const bd = new b2BodyDef();
|
|
68
68
|
bd.set_type(type);
|
|
@@ -74,7 +74,7 @@ export class PhysicsSystem {
|
|
|
74
74
|
// body.setMassData({ mass: 1 } as any)
|
|
75
75
|
const physicsNode = new PhysicsSprite(node.instance, body);
|
|
76
76
|
const square = new b2PolygonShape();
|
|
77
|
-
square.SetAsBox(width / 2, height / 2);
|
|
77
|
+
square.SetAsBox(width / 2, height / 2, new b2Vec2(x, y), 0);
|
|
78
78
|
const fixtureDef = new b2FixtureDef();
|
|
79
79
|
fixtureDef.set_shape(square);
|
|
80
80
|
fixtureDef.set_density(density);
|
|
@@ -99,9 +99,9 @@ export class PhysicsSystem {
|
|
|
99
99
|
}
|
|
100
100
|
const { type = StaticBody, gravityScale = 1, density = 1, friction = 0.5, restitution = 0.3 } = rigidBody.props;
|
|
101
101
|
const node = entity.getComponent(NodeComp);
|
|
102
|
-
const { radius, offset } = component.props;
|
|
103
|
-
const
|
|
104
|
-
const zero = new b2Vec2(
|
|
102
|
+
const { radius, offset = [] } = component.props;
|
|
103
|
+
const [x = 0, y = 0] = offset;
|
|
104
|
+
const zero = new b2Vec2(0, 0);
|
|
105
105
|
const position = new b2Vec2(node.posX, node.posY);
|
|
106
106
|
const bd = new b2BodyDef();
|
|
107
107
|
bd.set_type(type);
|
|
@@ -114,6 +114,7 @@ export class PhysicsSystem {
|
|
|
114
114
|
const physicsNode = new PhysicsSprite(node.instance, body);
|
|
115
115
|
const circleShape = new b2CircleShape();
|
|
116
116
|
circleShape.set_m_radius(radius);
|
|
117
|
+
circleShape.set_m_p(new b2Vec2(x, y));
|
|
117
118
|
const fixtureDef = new b2FixtureDef();
|
|
118
119
|
fixtureDef.set_shape(circleShape);
|
|
119
120
|
fixtureDef.set_density(density);
|
|
@@ -138,9 +139,8 @@ export class PhysicsSystem {
|
|
|
138
139
|
}
|
|
139
140
|
const { type = StaticBody, gravityScale = 1, density = 1, friction = 0.5, restitution = 0.3 } = rigidBody.props;
|
|
140
141
|
const node = entity.getComponent(NodeComp);
|
|
141
|
-
const { points, offset } = component.props;
|
|
142
|
-
|
|
143
|
-
const { x = 0, y = 0 } = offset || {};
|
|
142
|
+
const { points, offset = [] } = component.props;
|
|
143
|
+
const [x = 0, y = 0] = offset;
|
|
144
144
|
const zero = new b2Vec2(0, 0);
|
|
145
145
|
const position = new b2Vec2(node.posX, node.posY);
|
|
146
146
|
const { width, height } = node.getContentSize();
|
|
@@ -157,10 +157,11 @@ export class PhysicsSystem {
|
|
|
157
157
|
const polygonShape = new b2PolygonShape();
|
|
158
158
|
const fixedPoints = points.map((p) => {
|
|
159
159
|
if (p.x)
|
|
160
|
-
return Vec2(p.x + x - width * anchorX * scaleX, p.y + y
|
|
161
|
-
return Vec2(p[0] + x - width * anchorX * scaleX, p[1] + y
|
|
160
|
+
return Vec2(p.x + x - width * anchorX * scaleX, -p.y + y + height * scaleY * anchorY);
|
|
161
|
+
return Vec2(p[0] + x - width * anchorX * scaleX, -p[1] + y + height * scaleY * anchorY);
|
|
162
162
|
});
|
|
163
163
|
const [vecArr, destroyVecArr] = pointsToVec2Array(fixedPoints);
|
|
164
|
+
// console.log('vecArr', vecArr, vecArr.Length())
|
|
164
165
|
polygonShape.Set(vecArr, points.length);
|
|
165
166
|
destroyVecArr();
|
|
166
167
|
const fixtureDef = new b2FixtureDef();
|
|
@@ -212,11 +213,9 @@ export class PhysicsSystem {
|
|
|
212
213
|
// console.log('GetBodyCount', this.world.GetBodyCount())
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
|
-
set
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// this.world.collisionSlop = 0.5
|
|
220
|
-
}
|
|
216
|
+
set gravity(val) {
|
|
217
|
+
this.world.SetGravity(new box2D.b2Vec2(val.x, val.y));
|
|
218
|
+
// this.world.iterations = 60
|
|
219
|
+
// this.world.collisionSlop = 0.5
|
|
221
220
|
}
|
|
222
221
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GameWorld } from '..';
|
|
1
|
+
import { GameWorld, Vec2 } from '..';
|
|
2
2
|
export * from './PhysicsComponent';
|
|
3
3
|
export * from './PhysicsSprite';
|
|
4
4
|
export * from './PhysicsSystem';
|
|
5
|
-
export declare function setupPhysics(world?: GameWorld, isDebugDraw?:
|
|
5
|
+
export declare function setupPhysics(world?: GameWorld, isDebugDraw?: boolean, gravity?: Vec2): void;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAGpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAE/B,wBAAgB,YAAY,CAAC,KAAK,YAAqB,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,QAU7F"}
|
package/dist/box2d-wasm/index.js
CHANGED
|
@@ -3,11 +3,14 @@ import { PhysicsSystem } from './PhysicsSystem';
|
|
|
3
3
|
export * from './PhysicsComponent';
|
|
4
4
|
export * from './PhysicsSprite';
|
|
5
5
|
export * from './PhysicsSystem';
|
|
6
|
-
export function setupPhysics(world = GameWorld.Instance, isDebugDraw) {
|
|
6
|
+
export function setupPhysics(world = GameWorld.Instance, isDebugDraw, gravity) {
|
|
7
7
|
world.systems.add(PhysicsSystem);
|
|
8
8
|
world.systems.configureOnce(PhysicsSystem);
|
|
9
9
|
world.listUpdate.push(PhysicsSystem);
|
|
10
10
|
if (isDebugDraw) {
|
|
11
11
|
world.systems.get(PhysicsSystem).addDebug();
|
|
12
12
|
}
|
|
13
|
+
if (gravity) {
|
|
14
|
+
world.systems.get(PhysicsSystem).gravity = gravity;
|
|
15
|
+
}
|
|
13
16
|
}
|
|
@@ -14,7 +14,7 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
14
14
|
get uuid(): number;
|
|
15
15
|
get position(): Readonly<Vec2>;
|
|
16
16
|
set position(val: Vec2);
|
|
17
|
-
set xy(val:
|
|
17
|
+
set xy(val: [number, number]);
|
|
18
18
|
get posX(): number;
|
|
19
19
|
set posX(val: number);
|
|
20
20
|
get posY(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAA;AACjD,qBAAa,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,CAAA;IACX,MAAM,EAAE,QAAQ,CAAA;IAChB,QAAQ,EAAE,QAAQ,EAAE,CAAK;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,MAAM,CAAA;IACd,OAAO,CAAC,OAAO,CAAO;gBAEV,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IAKvC,IAAI,IAAI,WAEP;IAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAE7B;IAED,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,EAErB;IAED,IAAI,EAAE,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE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B,OAAO,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAQjE,UAAU,CAAC,GAAG,EAAE,MAAM;IAOtB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC;CAOhE"}
|
package/package.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { EnhancedComponent } from '../gworld/components/EnhancedComponent';
|
|
2
|
-
export declare namespace AnimationClip {
|
|
3
|
-
interface IEvent {
|
|
4
|
-
frame: number;
|
|
5
|
-
func: string;
|
|
6
|
-
params: string[];
|
|
7
|
-
isCalled: boolean;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export declare enum WrapMode {
|
|
11
|
-
Default = 0,
|
|
12
|
-
Normal = 1,
|
|
13
|
-
Loop = 2,
|
|
14
|
-
PingPong = 22,
|
|
15
|
-
Reverse = 36,
|
|
16
|
-
LoopReverse = 38,
|
|
17
|
-
PingPongReverse = 54
|
|
18
|
-
}
|
|
19
|
-
interface AnimProp {
|
|
20
|
-
frame: number;
|
|
21
|
-
value: number;
|
|
22
|
-
}
|
|
23
|
-
interface SpriteFrameProp {
|
|
24
|
-
frame: number;
|
|
25
|
-
value: string;
|
|
26
|
-
}
|
|
27
|
-
interface CurveData {
|
|
28
|
-
comps: {
|
|
29
|
-
spriteFrame: SpriteFrameProp[];
|
|
30
|
-
nextFrame: number;
|
|
31
|
-
};
|
|
32
|
-
props: {
|
|
33
|
-
[key: string]: AnimProp[];
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export declare class AnimationClip {
|
|
37
|
-
static WrapMode: typeof WrapMode;
|
|
38
|
-
sample: number;
|
|
39
|
-
speed: number;
|
|
40
|
-
wrapMode: WrapMode;
|
|
41
|
-
events: AnimationClip.IEvent[];
|
|
42
|
-
duration: number;
|
|
43
|
-
name: string;
|
|
44
|
-
curveData: CurveData;
|
|
45
|
-
}
|
|
46
|
-
export declare class AnimationComp extends EnhancedComponent {
|
|
47
|
-
defaultClip: AnimationClip;
|
|
48
|
-
clips: AnimationClip[];
|
|
49
|
-
playOnLoad: boolean;
|
|
50
|
-
private isPaused;
|
|
51
|
-
private elapsed;
|
|
52
|
-
private currentClip;
|
|
53
|
-
constructor(defaultClip: AnimationClip, clips: AnimationClip[], playOnLoad: boolean);
|
|
54
|
-
start(): void;
|
|
55
|
-
update(dt: Float): void;
|
|
56
|
-
getAnimationState(name: string): {
|
|
57
|
-
isPlaying: boolean;
|
|
58
|
-
};
|
|
59
|
-
play(name?: string): void;
|
|
60
|
-
pause(): void;
|
|
61
|
-
resume(): void;
|
|
62
|
-
stop(name?: string): void;
|
|
63
|
-
}
|
|
64
|
-
export { };
|
|
65
|
-
//# sourceMappingURL=AnimationComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/AnimationComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,UAAiB,MAAM;QACrB,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,EAAE,CAAA;QAChB,QAAQ,EAAE,OAAO,CAAA;KAClB;CACF;AAED,oBAAY,QAAQ;IAClB,OAAO,IAAI;IACX,MAAM,IAAI;IACV,IAAI,IAAI;IACR,QAAQ,KAAK;IACb,OAAO,KAAK;IACZ,WAAW,KAAK;IAChB,eAAe,KAAK;CACrB;AAED,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,SAAS;IACjB,KAAK,EAAE;QAAE,WAAW,EAAE,eAAe,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5D,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;KAAE,CAAA;CACrC;AAED,qBAAa,aAAa;IACxB,OAAc,QAAQ,kBAAW;IAC1B,MAAM,SAAK;IACX,KAAK,SAAI;IACT,QAAQ,WAAkB;IAC1B,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,CAAK;IACnC,QAAQ,SAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAID,qBAAa,aAAc,SAAQ,iBAAiB;IAClD,WAAW,EAAE,aAAa,CAAA;IAC1B,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,OAAO,CAAI;IACnB,OAAO,CAAC,WAAW,CAAe;gBAEtB,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO;IAOnF,KAAK;IASL,MAAM,CAAC,EAAE,EAAE,KAAK;IAqChB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;IAMvB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM;IAoBlB,KAAK;IAKL,MAAM;IAKN,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM;CAI1B"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.AnimationComp = exports.AnimationClip = exports.WrapMode = void 0;
|
|
19
|
-
var EnhancedComponent_1 = require("./EnhancedComponent");
|
|
20
|
-
var RenderComponent_1 = require("./RenderComponent");
|
|
21
|
-
var WrapMode;
|
|
22
|
-
(function (WrapMode) {
|
|
23
|
-
WrapMode[WrapMode["Default"] = 0] = "Default";
|
|
24
|
-
WrapMode[WrapMode["Normal"] = 1] = "Normal";
|
|
25
|
-
WrapMode[WrapMode["Loop"] = 2] = "Loop";
|
|
26
|
-
WrapMode[WrapMode["PingPong"] = 22] = "PingPong";
|
|
27
|
-
WrapMode[WrapMode["Reverse"] = 36] = "Reverse";
|
|
28
|
-
WrapMode[WrapMode["LoopReverse"] = 38] = "LoopReverse";
|
|
29
|
-
WrapMode[WrapMode["PingPongReverse"] = 54] = "PingPongReverse";
|
|
30
|
-
})(WrapMode || (exports.WrapMode = WrapMode = {}));
|
|
31
|
-
var AnimationClip = /** @class */ (function () {
|
|
32
|
-
function AnimationClip() {
|
|
33
|
-
this.sample = 60;
|
|
34
|
-
this.speed = 1;
|
|
35
|
-
this.wrapMode = WrapMode.Normal;
|
|
36
|
-
this.events = [];
|
|
37
|
-
this.duration = 0;
|
|
38
|
-
}
|
|
39
|
-
AnimationClip.WrapMode = WrapMode;
|
|
40
|
-
return AnimationClip;
|
|
41
|
-
}());
|
|
42
|
-
exports.AnimationClip = AnimationClip;
|
|
43
|
-
// cc.AnimationClip = AnimationClip;
|
|
44
|
-
var AnimationComp = /** @class */ (function (_super) {
|
|
45
|
-
__extends(AnimationComp, _super);
|
|
46
|
-
function AnimationComp(defaultClip, clips, playOnLoad) {
|
|
47
|
-
var _this = _super.call(this) || this;
|
|
48
|
-
_this.isPaused = true;
|
|
49
|
-
_this.elapsed = 0;
|
|
50
|
-
_this.defaultClip = defaultClip;
|
|
51
|
-
_this.clips = clips;
|
|
52
|
-
_this.playOnLoad = playOnLoad;
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
AnimationComp.prototype.start = function () {
|
|
56
|
-
var _this = this;
|
|
57
|
-
if (this.playOnLoad) {
|
|
58
|
-
setTimeout(function () {
|
|
59
|
-
_this.play();
|
|
60
|
-
}, 0);
|
|
61
|
-
}
|
|
62
|
-
// cc.log(this.clips);
|
|
63
|
-
};
|
|
64
|
-
AnimationComp.prototype.update = function (dt) {
|
|
65
|
-
var _this = this;
|
|
66
|
-
if (this.isPaused || !this.node.active) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
var _a = this.currentClip, curveData = _a.curveData, wrapMode = _a.wrapMode, events = _a.events, duration = _a.duration, speed = _a.speed;
|
|
70
|
-
this.elapsed += dt * speed;
|
|
71
|
-
var _b = curveData.comps, spriteFrame = _b.spriteFrame, nextFrame = _b.nextFrame;
|
|
72
|
-
var nextFrameTime = spriteFrame[nextFrame].frame;
|
|
73
|
-
events.forEach(function (evt) {
|
|
74
|
-
var func = evt.func, frame = evt.frame, params = evt.params, isCalled = evt.isCalled;
|
|
75
|
-
if (!isCalled && _this.elapsed >= frame) {
|
|
76
|
-
evt.isCalled = true;
|
|
77
|
-
// this.node.emit(func, ...params)
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
if (this.elapsed >= nextFrameTime) {
|
|
81
|
-
var imageComp = this.node.getComponent(RenderComponent_1.SpriteRender);
|
|
82
|
-
if (imageComp) {
|
|
83
|
-
imageComp.spriteFrame = spriteFrame[nextFrame].value;
|
|
84
|
-
}
|
|
85
|
-
// cc.log(spriteFrame[nextFrame].value, nextFrameTime);
|
|
86
|
-
curveData.comps.nextFrame += 1;
|
|
87
|
-
curveData.comps.nextFrame = cc.clampf(curveData.comps.nextFrame, 0, spriteFrame.length - 1);
|
|
88
|
-
if (this.elapsed >= duration) {
|
|
89
|
-
if (wrapMode === WrapMode.Loop) {
|
|
90
|
-
curveData.comps.nextFrame = 0;
|
|
91
|
-
this.elapsed = 0;
|
|
92
|
-
events.forEach(function (evt) {
|
|
93
|
-
evt.isCalled = false;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.isPaused = true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
AnimationComp.prototype.getAnimationState = function (name) {
|
|
103
|
-
return {
|
|
104
|
-
isPlaying: !this.isPaused,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
AnimationComp.prototype.play = function (name) {
|
|
108
|
-
this.elapsed = 0;
|
|
109
|
-
// cc.log('play', name, this.defaultClip.name);
|
|
110
|
-
if (!name) {
|
|
111
|
-
if (!this.defaultClip) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
name = this.defaultClip.name;
|
|
115
|
-
}
|
|
116
|
-
else if (this.currentClip && name === this.currentClip.name) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this.currentClip = this.clips.find(function (clip) { return clip.name === name; });
|
|
120
|
-
this.currentClip.curveData.comps.nextFrame = 0;
|
|
121
|
-
// cc.log('name', name, this.currentClip);
|
|
122
|
-
this.currentClip.events.forEach(function (evt) {
|
|
123
|
-
evt.isCalled = false;
|
|
124
|
-
});
|
|
125
|
-
this.isPaused = false;
|
|
126
|
-
};
|
|
127
|
-
AnimationComp.prototype.pause = function () {
|
|
128
|
-
this.node.instance.pause();
|
|
129
|
-
this.isPaused = true;
|
|
130
|
-
};
|
|
131
|
-
AnimationComp.prototype.resume = function () {
|
|
132
|
-
this.node.instance.resume();
|
|
133
|
-
this.isPaused = false;
|
|
134
|
-
};
|
|
135
|
-
AnimationComp.prototype.stop = function (name) {
|
|
136
|
-
this.node.instance.unscheduleAllCallbacks();
|
|
137
|
-
this.isPaused = true;
|
|
138
|
-
};
|
|
139
|
-
return AnimationComp;
|
|
140
|
-
}(EnhancedComponent_1.EnhancedComponent));
|
|
141
|
-
exports.AnimationComp = AnimationComp;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from '../../polyfills';
|
|
2
|
-
import { NoRenderComponentX } from '../core/decorator';
|
|
3
|
-
interface ColliderProps {
|
|
4
|
-
offset?: Vec2;
|
|
5
|
-
tag?: number;
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
onCollisionEnter?: (other: Collider) => void;
|
|
8
|
-
onCollisionExit?: (other: Collider) => void;
|
|
9
|
-
onCollisionStay?: (other: Collider) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare class Collider<T = ColliderProps> extends NoRenderComponentX<T> {
|
|
12
|
-
_worldPoints: cc.Vec2[] | cc.Point[];
|
|
13
|
-
_worldPosition: cc.Vec2 | cc.Point;
|
|
14
|
-
_worldRadius: any;
|
|
15
|
-
_AABB: cc.Rect;
|
|
16
|
-
_preAabb: cc.Rect;
|
|
17
|
-
getAABB(): cc.Rect;
|
|
18
|
-
get world(): {
|
|
19
|
-
points: cc.Point[] | cc.Vec2[];
|
|
20
|
-
preAabb: cc.Rect;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
interface BoxColliderProps extends ColliderProps {
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
}
|
|
27
|
-
export declare class BoxCollider extends Collider<BoxColliderProps> {
|
|
28
|
-
get size(): cc.Size;
|
|
29
|
-
set size(s: cc.Size);
|
|
30
|
-
update(dt: any, draw: cc.DrawNode): void;
|
|
31
|
-
}
|
|
32
|
-
interface CircleColliderProps extends ColliderProps {
|
|
33
|
-
radius: number;
|
|
34
|
-
}
|
|
35
|
-
export declare class CircleCollider extends Collider<CircleColliderProps> {
|
|
36
|
-
update(dt: any, draw: cc.DrawNode): void;
|
|
37
|
-
}
|
|
38
|
-
interface PolygonColliderProps extends ColliderProps {
|
|
39
|
-
points: Array<Vec2>;
|
|
40
|
-
}
|
|
41
|
-
export declare class PolygonCollider extends Collider<PolygonColliderProps> {
|
|
42
|
-
get points(): Vec2[];
|
|
43
|
-
set points(points: Vec2[]);
|
|
44
|
-
update(dt: any, draw: cc.DrawNode): void;
|
|
45
|
-
}
|
|
46
|
-
export declare enum CollisionType {
|
|
47
|
-
NONE = 0,
|
|
48
|
-
ENTER = 1,
|
|
49
|
-
STAY = 2,
|
|
50
|
-
EXIT = 3
|
|
51
|
-
}
|
|
52
|
-
export declare class Contract {
|
|
53
|
-
_collider1: Collider;
|
|
54
|
-
_collider2: Collider;
|
|
55
|
-
_touching: boolean;
|
|
56
|
-
_isPolygonPolygon: boolean;
|
|
57
|
-
_isCircleCircle: boolean;
|
|
58
|
-
_isPolygonCircle: boolean;
|
|
59
|
-
constructor(collider1: Collider, collider2: Collider);
|
|
60
|
-
updateState(): CollisionType;
|
|
61
|
-
test(): any;
|
|
62
|
-
}
|
|
63
|
-
export {};
|
|
64
|
-
//# sourceMappingURL=CollideComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/CollideComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAYtD,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC5C,eAAe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