@safe-engine/cocos 1.5.2 → 1.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/dist/animation/AnimationComponent.d.ts +63 -0
- package/dist/animation/AnimationComponent.d.ts.map +1 -0
- package/dist/animation/AnimationComponent.js +119 -0
- package/dist/animation/AnimationSystem.d.ts +6 -0
- package/dist/animation/AnimationSystem.d.ts.map +1 -0
- package/dist/animation/AnimationSystem.js +22 -0
- package/dist/animation/index.d.ts +2 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/index.js +7 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +40 -65
- package/dist/box2d-wasm/ContactListener.d.ts +12 -0
- package/dist/box2d-wasm/ContactListener.d.ts.map +1 -0
- package/dist/box2d-wasm/ContactListener.js +64 -0
- package/dist/box2d-wasm/PhysicsComponent.d.ts +50 -0
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -0
- package/dist/box2d-wasm/PhysicsComponent.js +16 -0
- package/dist/box2d-wasm/PhysicsSprite.d.ts +12 -0
- package/dist/box2d-wasm/PhysicsSprite.d.ts.map +1 -0
- package/dist/box2d-wasm/PhysicsSprite.js +51 -0
- package/dist/box2d-wasm/PhysicsSystem.d.ts +15 -0
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -0
- package/dist/box2d-wasm/PhysicsSystem.js +139 -0
- package/dist/box2d-wasm/debugDraw.d.ts +66 -0
- package/dist/box2d-wasm/debugDraw.d.ts.map +1 -0
- package/dist/box2d-wasm/debugDraw.js +210 -0
- package/dist/box2d-wasm/index.d.ts +6 -0
- package/dist/box2d-wasm/index.d.ts.map +1 -0
- package/dist/box2d-wasm/index.js +10 -0
- package/dist/collider/CollideComponent.js +98 -159
- package/dist/collider/CollideSystem.js +63 -79
- package/dist/collider/index.d.ts +1 -1
- package/dist/collider/index.d.ts.map +1 -1
- package/dist/collider/index.js +11 -9
- package/dist/dragonbones/PixiDragonBonesSprite.js +15 -19
- package/dist/dragonbones/index.js +38 -68
- package/dist/gworld/components/AnimationComponent.d.ts +2 -2
- package/dist/gworld/components/CollideComponent.d.ts +3 -3
- package/dist/gworld/components/EnhancedComponent.js +29 -36
- package/dist/gworld/components/GUIComponent.js +50 -118
- package/dist/gworld/components/NoRenderComponent.js +25 -65
- package/dist/gworld/components/NodeComp.d.ts.map +1 -1
- package/dist/gworld/components/NodeComp.js +237 -317
- package/dist/gworld/components/RenderComponent.js +46 -104
- package/dist/gworld/core/NodePool.js +13 -20
- package/dist/gworld/core/Scene.js +11 -35
- package/dist/gworld/core/decorator.js +12 -42
- package/dist/gworld/index.js +13 -42
- package/dist/gworld/systems/CollideSystem.d.ts +1 -2
- package/dist/gworld/systems/CollideSystem.d.ts.map +1 -1
- package/dist/gworld/systems/CollideSystem.js +2 -12
- package/dist/gworld/systems/GUISystem.js +105 -120
- package/dist/gworld/systems/NoRenderSystem.d.ts.map +1 -1
- package/dist/gworld/systems/NoRenderSystem.js +70 -80
- package/dist/gworld/systems/RenderSystem.js +64 -78
- package/dist/helper/Intersection.js +33 -40
- package/dist/helper/action.js +8 -21
- package/dist/helper/director.js +2 -6
- package/dist/helper/math.js +9 -15
- package/dist/helper/utils.js +28 -37
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -31
- package/dist/polyfills.js +69 -97
- package/dist/richtext/RichTextComp.js +27 -55
- package/dist/richtext/RichTextSystem.js +17 -25
- package/dist/richtext/html-text-parser.js +36 -40
- package/dist/richtext/index.js +5 -8
- package/dist/safex.js +1 -2
- package/dist/spine/CCSkeleton.d.ts.map +1 -1
- package/dist/spine/CCSkeleton.js +25 -61
- package/dist/spine/CCSkeletonAnimation.js +18 -54
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +1 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.js +39 -43
- package/dist/spine/CCSkeletonTexture.js +4 -40
- package/dist/spine/CCSkeletonWebGLRenderCmd.js +56 -92
- package/dist/spine/index.js +37 -63
- package/package.json +4 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +0 -77
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.js +0 -227
- package/dist/dragonbones/cocos/CocosFactory.d.ts +0 -128
- package/dist/dragonbones/cocos/CocosFactory.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosFactory.js +0 -231
- package/dist/dragonbones/cocos/CocosSlot.d.ts +0 -49
- package/dist/dragonbones/cocos/CocosSlot.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosSlot.js +0 -385
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +0 -53
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosTextureAtlasData.js +0 -158
- package/dist/dragonbones/dragonBones.d.ts +0 -3
- package/dist/dragonbones/dragonBones.d.ts.map +0 -1
- package/dist/dragonbones/dragonBones.js +0 -4788
- package/dist/helper/NodePool.d.ts +0 -9
- package/dist/helper/NodePool.d.ts.map +0 -1
- package/dist/helper/NodePool.js +0 -29
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.polygonPolygon = polygonPolygon;
|
|
6
|
-
exports.circleCircle = circleCircle;
|
|
7
|
-
exports.polygonCircle = polygonCircle;
|
|
8
|
-
function pointInPolygon(pos, polygon) {
|
|
9
|
-
var inside = false;
|
|
10
|
-
var x = pos.x;
|
|
11
|
-
var y = pos.y;
|
|
1
|
+
export function pointInPolygon(pos, polygon) {
|
|
2
|
+
let inside = false;
|
|
3
|
+
const x = pos.x;
|
|
4
|
+
const y = pos.y;
|
|
12
5
|
// use some raycasting to test hits
|
|
13
6
|
// https://github.com/substack/point-in-polygon/blob/master/index.js
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
for (
|
|
17
|
-
|
|
7
|
+
const length = polygon.length;
|
|
8
|
+
let intersect = false;
|
|
9
|
+
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
10
|
+
const xi = polygon[i].x, yi = polygon[i].y, xj = polygon[j].x, yj = polygon[j].y;
|
|
18
11
|
intersect = yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi;
|
|
19
12
|
if (intersect) {
|
|
20
13
|
inside = !inside;
|
|
@@ -24,12 +17,12 @@ function pointInPolygon(pos, polygon) {
|
|
|
24
17
|
}
|
|
25
18
|
function lineLine(a1, a2, b1, b2) {
|
|
26
19
|
// jshint camel case:false
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const ua_t = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
|
|
21
|
+
const ub_t = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
|
|
22
|
+
const u_b = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
|
|
30
23
|
if (u_b !== 0) {
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const ua = ua_t / u_b;
|
|
25
|
+
const ub = ub_t / u_b;
|
|
33
26
|
if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
|
|
34
27
|
return true;
|
|
35
28
|
}
|
|
@@ -37,22 +30,22 @@ function lineLine(a1, a2, b1, b2) {
|
|
|
37
30
|
return false;
|
|
38
31
|
}
|
|
39
32
|
function linePolygon(A, B, polygon) {
|
|
40
|
-
|
|
41
|
-
for (
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
const length = polygon.length;
|
|
34
|
+
for (let i = 0; i < length; ++i) {
|
|
35
|
+
const C = polygon[i];
|
|
36
|
+
const D = polygon[(i + 1) % length];
|
|
44
37
|
if (lineLine(A, B, C, D)) {
|
|
45
38
|
return true;
|
|
46
39
|
}
|
|
47
40
|
}
|
|
48
41
|
return false;
|
|
49
42
|
}
|
|
50
|
-
function pointLineDistance(point, start, end, isSegment) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
export function pointLineDistance(point, start, end, isSegment) {
|
|
44
|
+
let dx = end.x - start.x;
|
|
45
|
+
let dy = end.y - start.y;
|
|
46
|
+
const d = dx * dx + dy * dy;
|
|
47
|
+
const t = ((point.x - start.x) * dx + (point.y - start.y) * dy) / d;
|
|
48
|
+
let p;
|
|
56
49
|
if (!isSegment) {
|
|
57
50
|
p = cc.p(start.x + t * dx, start.y + t * dy);
|
|
58
51
|
}
|
|
@@ -74,12 +67,12 @@ function pointLineDistance(point, start, end, isSegment) {
|
|
|
74
67
|
dy = point.y - p.y;
|
|
75
68
|
return Math.sqrt(dx * dx + dy * dy);
|
|
76
69
|
}
|
|
77
|
-
function polygonPolygon(pts1, pts2) {
|
|
78
|
-
|
|
70
|
+
export function polygonPolygon(pts1, pts2) {
|
|
71
|
+
let i = 0, l = 0;
|
|
79
72
|
// check if p1 pts1 intersects pts2
|
|
80
73
|
for (l = pts1.length; i < l; ++i) {
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
const a1 = pts1[i];
|
|
75
|
+
const a2 = pts1[(i + 1) % l];
|
|
83
76
|
if (linePolygon(a1, a2, pts2)) {
|
|
84
77
|
return true;
|
|
85
78
|
}
|
|
@@ -98,17 +91,17 @@ function polygonPolygon(pts1, pts2) {
|
|
|
98
91
|
}
|
|
99
92
|
return false;
|
|
100
93
|
}
|
|
101
|
-
function circleCircle(p1, r1, p2, r2) {
|
|
102
|
-
|
|
94
|
+
export function circleCircle(p1, r1, p2, r2) {
|
|
95
|
+
const distance = cc.pDistance(p1, p2);
|
|
103
96
|
return distance < r1 + r2;
|
|
104
97
|
}
|
|
105
|
-
function polygonCircle(pts1, p2, r2) {
|
|
98
|
+
export function polygonCircle(pts1, p2, r2) {
|
|
106
99
|
if (pointInPolygon(p2, pts1)) {
|
|
107
100
|
return true;
|
|
108
101
|
}
|
|
109
|
-
for (
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
for (let i = 0, l = pts1.length; i < l; i++) {
|
|
103
|
+
const start = i === 0 ? pts1[l - 1] : pts1[i - 1];
|
|
104
|
+
const end = pts1[i];
|
|
112
105
|
if (pointLineDistance(p2, start, end, true) < r2) {
|
|
113
106
|
return true;
|
|
114
107
|
}
|
package/dist/helper/action.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveTo = moveTo;
|
|
4
|
-
exports.moveBy = moveBy;
|
|
5
|
-
exports.scaleTo = scaleTo;
|
|
6
|
-
exports.callFunc = callFunc;
|
|
7
|
-
exports.sequence = sequence;
|
|
8
|
-
exports.repeatForever = repeatForever;
|
|
9
|
-
exports.easeBackOut = easeBackOut;
|
|
10
|
-
function moveTo(t, to) {
|
|
1
|
+
export function moveTo(t, to) {
|
|
11
2
|
return cc.moveTo(t, to);
|
|
12
3
|
}
|
|
13
|
-
function moveBy(t, to) {
|
|
4
|
+
export function moveBy(t, to) {
|
|
14
5
|
return cc.moveBy(t, to);
|
|
15
6
|
}
|
|
16
|
-
function scaleTo(t, x, y) {
|
|
7
|
+
export function scaleTo(t, x, y) {
|
|
17
8
|
return cc.scaleTo(t, x, y);
|
|
18
9
|
}
|
|
19
|
-
function callFunc(cb, target, data) {
|
|
10
|
+
export function callFunc(cb, target, data) {
|
|
20
11
|
return cc.callFunc(cb, target, data);
|
|
21
12
|
}
|
|
22
|
-
function sequence() {
|
|
23
|
-
|
|
24
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
25
|
-
actions[_i] = arguments[_i];
|
|
26
|
-
}
|
|
27
|
-
return cc.sequence.apply(cc, actions);
|
|
13
|
+
export function sequence(...actions) {
|
|
14
|
+
return cc.sequence(...actions);
|
|
28
15
|
}
|
|
29
|
-
function repeatForever(action) {
|
|
16
|
+
export function repeatForever(action) {
|
|
30
17
|
return cc.repeatForever(action);
|
|
31
18
|
}
|
|
32
|
-
function easeBackOut(action) {
|
|
19
|
+
export function easeBackOut(action) {
|
|
33
20
|
return action.easing(cc.easeBackOut());
|
|
34
21
|
}
|
package/dist/helper/director.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pauseAll = pauseAll;
|
|
4
|
-
exports.resumeAll = resumeAll;
|
|
5
|
-
function pauseAll() {
|
|
1
|
+
export function pauseAll() {
|
|
6
2
|
cc.director.pause();
|
|
7
3
|
}
|
|
8
|
-
function resumeAll() {
|
|
4
|
+
export function resumeAll() {
|
|
9
5
|
cc.director.resume();
|
|
10
6
|
}
|
package/dist/helper/math.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.radiansToDegrees = exports.degreesToRadians = void 0;
|
|
4
|
-
exports.randomRangeInt = randomRangeInt;
|
|
5
|
-
exports.getMin = getMin;
|
|
6
|
-
exports.getMax = getMax;
|
|
7
|
-
function randomRangeInt(minInclude, maxExclude) {
|
|
1
|
+
export function randomRangeInt(minInclude, maxExclude) {
|
|
8
2
|
return Math.round(Math.random() * (maxExclude - minInclude - 1)) + minInclude;
|
|
9
3
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function getMin(arr) {
|
|
4
|
+
export const degreesToRadians = cc.degreesToRadians;
|
|
5
|
+
export const radiansToDegrees = cc.radiansToDegrees;
|
|
6
|
+
export function getMin(arr) {
|
|
13
7
|
if (arr.length === 0)
|
|
14
8
|
return null;
|
|
15
|
-
|
|
16
|
-
for (
|
|
9
|
+
let min = arr[0];
|
|
10
|
+
for (let i = 1; i < arr.length; i++) {
|
|
17
11
|
if (arr[i] < min) {
|
|
18
12
|
min = arr[i];
|
|
19
13
|
}
|
|
20
14
|
}
|
|
21
15
|
return min;
|
|
22
16
|
}
|
|
23
|
-
function getMax(arr) {
|
|
17
|
+
export function getMax(arr) {
|
|
24
18
|
if (arr.length === 0)
|
|
25
19
|
return null;
|
|
26
|
-
|
|
27
|
-
for (
|
|
20
|
+
let max = arr[0];
|
|
21
|
+
for (let i = 1; i < arr.length; i++) {
|
|
28
22
|
if (arr[i] > max) {
|
|
29
23
|
max = arr[i];
|
|
30
24
|
}
|
package/dist/helper/utils.js
CHANGED
|
@@ -1,61 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var entityx_ts_1 = require("entityx-ts");
|
|
7
|
-
var __1 = require("..");
|
|
8
|
-
var gworld_1 = require("../gworld");
|
|
9
|
-
function registerSystem(component) {
|
|
10
|
-
if (gworld_1.GameWorld.Instance.systems.isRegistered("".concat(component.name, "System"))) {
|
|
1
|
+
import { EventTypes } from 'entityx-ts';
|
|
2
|
+
import { NodeComp } from '..';
|
|
3
|
+
import { GameWorld } from '../gworld';
|
|
4
|
+
export function registerSystem(component) {
|
|
5
|
+
if (GameWorld.Instance.systems.isRegistered(`${component.name}System`)) {
|
|
11
6
|
return;
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
NewSystem.prototype.configure = function (event_manager) {
|
|
8
|
+
class NewSystem {
|
|
9
|
+
configure(event_manager) {
|
|
17
10
|
console.log('configure registerSystem', component.name);
|
|
18
|
-
event_manager.subscribe(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
newComp.node = ett.getComponent(
|
|
11
|
+
event_manager.subscribe(EventTypes.ComponentAdded, component, (event) => {
|
|
12
|
+
const ett = event.entity;
|
|
13
|
+
const newComp = event.component;
|
|
14
|
+
newComp.node = ett.getComponent(NodeComp);
|
|
22
15
|
});
|
|
23
|
-
event_manager.subscribe(
|
|
24
|
-
|
|
16
|
+
event_manager.subscribe(EventTypes.ComponentRemoved, component, (event) => {
|
|
17
|
+
const newComp = event.component;
|
|
25
18
|
if (newComp.destroy) {
|
|
26
19
|
newComp.destroy();
|
|
27
20
|
}
|
|
28
21
|
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
for (
|
|
32
|
-
|
|
33
|
-
var comp = entt.getComponent(component);
|
|
22
|
+
}
|
|
23
|
+
update(entities, events, dt) {
|
|
24
|
+
for (const entt of entities.entities_with_components(component)) {
|
|
25
|
+
const comp = entt.getComponent(component);
|
|
34
26
|
// console.log('comp', comp.constructor.name, typeof comp['update'] === 'function')
|
|
35
27
|
if (comp.node.active && comp.enabled && typeof comp['update'] === 'function') {
|
|
36
28
|
comp['update'](dt);
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
gworld_1.GameWorld.Instance.listUpdate.push(NewSystem);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(NewSystem, 'name', { value: `${component.name}System` });
|
|
34
|
+
GameWorld.Instance.systems.add(NewSystem);
|
|
35
|
+
GameWorld.Instance.systems.configureOnce(NewSystem);
|
|
36
|
+
GameWorld.Instance.listUpdate.push(NewSystem);
|
|
46
37
|
return NewSystem;
|
|
47
38
|
}
|
|
48
|
-
function instantiate(ComponentType, data) {
|
|
49
|
-
|
|
39
|
+
export function instantiate(ComponentType, data) {
|
|
40
|
+
const instance = new ComponentType(data);
|
|
50
41
|
instance.init(data);
|
|
51
42
|
if (!instance.render) {
|
|
52
43
|
return instance;
|
|
53
44
|
}
|
|
54
45
|
return instance.render();
|
|
55
46
|
}
|
|
56
|
-
function loadScene(ComponentType) {
|
|
57
|
-
|
|
47
|
+
export function loadScene(ComponentType) {
|
|
48
|
+
const world = GameWorld.Instance;
|
|
58
49
|
world.entities.reset();
|
|
59
|
-
|
|
50
|
+
const instance = new ComponentType();
|
|
60
51
|
instance.render();
|
|
61
52
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './app';
|
|
2
|
+
export * from './box2d-wasm';
|
|
3
|
+
export * from './collider';
|
|
4
|
+
export * from './dragonbones';
|
|
2
5
|
export * from './gworld';
|
|
3
6
|
export * from './gworld/components/GUIComponent';
|
|
4
7
|
export * from './gworld/components/NodeComp';
|
|
@@ -13,5 +16,7 @@ export * from './helper/math';
|
|
|
13
16
|
export * from './helper/utils';
|
|
14
17
|
export * from './polyfills';
|
|
15
18
|
export { type Touch } from './polyfills';
|
|
19
|
+
export * from './richtext';
|
|
16
20
|
export * from './safex';
|
|
21
|
+
export * from './spine';
|
|
17
22
|
//# 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,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uCAAuC,CAAA;AACrD,cAAc,qCAAqC,CAAA;AACnD,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uCAAuC,CAAA;AACrD,cAAc,qCAAqC,CAAA;AACnD,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__exportStar(require("./gworld/components/NoRenderComponent"), exports);
|
|
22
|
-
__exportStar(require("./gworld/components/RenderComponent"), exports);
|
|
23
|
-
__exportStar(require("./gworld/core/decorator"), exports);
|
|
24
|
-
__exportStar(require("./gworld/core/Scene"), exports);
|
|
25
|
-
__exportStar(require("./gworld/systems/GUISystem"), exports);
|
|
26
|
-
__exportStar(require("./helper/action"), exports);
|
|
27
|
-
__exportStar(require("./helper/director"), exports);
|
|
28
|
-
__exportStar(require("./helper/math"), exports);
|
|
29
|
-
__exportStar(require("./helper/utils"), exports);
|
|
30
|
-
__exportStar(require("./polyfills"), exports);
|
|
31
|
-
__exportStar(require("./safex"), exports);
|
|
1
|
+
export * from './app';
|
|
2
|
+
export * from './box2d-wasm';
|
|
3
|
+
export * from './collider';
|
|
4
|
+
export * from './dragonbones';
|
|
5
|
+
export * from './gworld';
|
|
6
|
+
export * from './gworld/components/GUIComponent';
|
|
7
|
+
export * from './gworld/components/NodeComp';
|
|
8
|
+
export * from './gworld/components/NoRenderComponent';
|
|
9
|
+
export * from './gworld/components/RenderComponent';
|
|
10
|
+
export * from './gworld/core/decorator';
|
|
11
|
+
export * from './gworld/core/Scene';
|
|
12
|
+
export * from './gworld/systems/GUISystem';
|
|
13
|
+
export * from './helper/action';
|
|
14
|
+
export * from './helper/director';
|
|
15
|
+
export * from './helper/math';
|
|
16
|
+
export * from './helper/utils';
|
|
17
|
+
export * from './polyfills';
|
|
18
|
+
export * from './richtext';
|
|
19
|
+
export * from './safex';
|
|
20
|
+
export * from './spine';
|
package/dist/polyfills.js
CHANGED
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
|
|
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.Touch = exports.BLUE = exports.GREEN = exports.WHITE = exports.BLACK = exports.RED = exports.SpriteType = void 0;
|
|
19
|
-
exports.Vec2 = Vec2;
|
|
20
|
-
exports.Color4B = Color4B;
|
|
21
|
-
exports.Size = Size;
|
|
22
|
-
exports.getWinSize = getWinSize;
|
|
23
|
-
var Intersection_1 = require("./helper/Intersection");
|
|
1
|
+
import { circleCircle, pointInPolygon, polygonCircle, polygonPolygon } from './helper/Intersection';
|
|
24
2
|
function updatePoint(p) {
|
|
25
|
-
|
|
3
|
+
const { x, y } = p;
|
|
26
4
|
return Vec2(x, y);
|
|
27
5
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
class _Vec2 {
|
|
7
|
+
x;
|
|
8
|
+
y;
|
|
9
|
+
static ZERO;
|
|
10
|
+
constructor(x = 0, y = 0) {
|
|
32
11
|
if (!(this instanceof _Vec2)) {
|
|
33
12
|
return new _Vec2(x, y);
|
|
34
13
|
}
|
|
@@ -40,106 +19,106 @@ var _Vec2 = /** @class */ (function () {
|
|
|
40
19
|
this.x = x;
|
|
41
20
|
this.y = y;
|
|
42
21
|
}
|
|
43
|
-
|
|
22
|
+
equals(other) {
|
|
44
23
|
return this.x === other.x && this.y === other.y;
|
|
45
|
-
}
|
|
46
|
-
|
|
24
|
+
}
|
|
25
|
+
add(value) {
|
|
47
26
|
return updatePoint(cc.pAdd(cc.p(this.x, this.y), value));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
}
|
|
28
|
+
addSelf(value) {
|
|
29
|
+
const nor = updatePoint(cc.pAdd(cc.p(this.x, this.y), value));
|
|
51
30
|
this.x = nor.x;
|
|
52
31
|
this.y = nor.y;
|
|
53
32
|
return nor;
|
|
54
|
-
}
|
|
55
|
-
|
|
33
|
+
}
|
|
34
|
+
sub(value) {
|
|
56
35
|
return updatePoint(cc.pSub(cc.p(this.x, this.y), value));
|
|
57
|
-
}
|
|
58
|
-
|
|
36
|
+
}
|
|
37
|
+
mul(multiply) {
|
|
59
38
|
return updatePoint(cc.pMult(cc.p(this.x, this.y), multiply));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
39
|
+
}
|
|
40
|
+
mulSelf(multiply) {
|
|
41
|
+
const nor = updatePoint(cc.pMult(cc.p(this.x, this.y), multiply));
|
|
63
42
|
this.x = nor.x;
|
|
64
43
|
this.y = nor.y;
|
|
65
44
|
return nor;
|
|
66
|
-
}
|
|
67
|
-
|
|
45
|
+
}
|
|
46
|
+
mag() {
|
|
68
47
|
return cc.pLength(cc.p(this.x, this.y));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
}
|
|
49
|
+
normalizeSelf() {
|
|
50
|
+
const nor = updatePoint(cc.pNormalize(cc.p(this.x, this.y)));
|
|
72
51
|
this.x = nor.x;
|
|
73
52
|
this.y = nor.y;
|
|
74
53
|
return nor;
|
|
75
|
-
}
|
|
76
|
-
|
|
54
|
+
}
|
|
55
|
+
normalize() {
|
|
77
56
|
return updatePoint(cc.pNormalize(cc.p(this.x, this.y)));
|
|
78
|
-
}
|
|
79
|
-
|
|
57
|
+
}
|
|
58
|
+
cross(other) {
|
|
80
59
|
return this.x * other.y - this.y * other.x;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
}
|
|
61
|
+
signAngle(other) {
|
|
62
|
+
const angle = this.angle(other);
|
|
84
63
|
return this.cross(other) < 0 ? -angle : angle;
|
|
85
|
-
}
|
|
86
|
-
|
|
64
|
+
}
|
|
65
|
+
lengthSqr() {
|
|
87
66
|
return this.x * this.x + this.y * this.y;
|
|
88
|
-
}
|
|
89
|
-
|
|
67
|
+
}
|
|
68
|
+
dot(other) {
|
|
90
69
|
return this.x * other.x + this.y * other.y;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
}
|
|
71
|
+
angle(other) {
|
|
72
|
+
const magSqr1 = this.lengthSqr();
|
|
73
|
+
const magSqr2 = other.lengthSqr();
|
|
95
74
|
if (magSqr1 === 0 || magSqr2 === 0) {
|
|
96
75
|
console.warn('Cant get angle between zero vector');
|
|
97
76
|
return 0.0;
|
|
98
77
|
}
|
|
99
|
-
|
|
100
|
-
|
|
78
|
+
const dot = this.dot(other);
|
|
79
|
+
let theta = dot / Math.sqrt(magSqr1 * magSqr2);
|
|
101
80
|
theta = cc.clampf(theta, -1.0, 1.0);
|
|
102
81
|
return Math.acos(theta);
|
|
103
|
-
}
|
|
104
|
-
|
|
82
|
+
}
|
|
83
|
+
distance(other) {
|
|
105
84
|
return cc.pDistance(this, other);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
function Vec2(x, y) {
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export function Vec2(x, y) {
|
|
110
88
|
return new _Vec2(x, y);
|
|
111
89
|
}
|
|
112
90
|
cc.Vec2 = _Vec2;
|
|
113
91
|
Vec2.ZERO = cc.Vec2.ZERO = Object.freeze(Vec2(0, 0));
|
|
114
|
-
var SpriteType;
|
|
92
|
+
export var SpriteType;
|
|
115
93
|
(function (SpriteType) {
|
|
116
94
|
SpriteType[SpriteType["SIMPLE"] = 0] = "SIMPLE";
|
|
117
95
|
SpriteType[SpriteType["SLICED"] = 1] = "SLICED";
|
|
118
96
|
SpriteType[SpriteType["TILED"] = 2] = "TILED";
|
|
119
97
|
SpriteType[SpriteType["FILLED"] = 3] = "FILLED";
|
|
120
98
|
SpriteType[SpriteType["MESH"] = 4] = "MESH";
|
|
121
|
-
})(SpriteType || (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
})(SpriteType || (SpriteType = {}));
|
|
100
|
+
export const RED = Color4B(255, 0, 0, 255);
|
|
101
|
+
export const BLACK = Color4B(0, 0, 0, 255);
|
|
102
|
+
export const WHITE = Color4B(255, 255, 255, 255);
|
|
103
|
+
export const GREEN = Color4B(0, 255, 0, 255);
|
|
104
|
+
export const BLUE = Color4B(0, 0, 255, 255);
|
|
127
105
|
cc.Color.DEBUG_FILL_COLOR = cc.color(255, 255, 0, 150);
|
|
128
106
|
cc.Color.DEBUG_BORDER_COLOR = cc.color(255, 0, 0, 255);
|
|
129
107
|
cc.Color.prototype.fromHEX = cc.hexToColor;
|
|
130
108
|
cc.Intersection = {
|
|
131
|
-
polygonPolygon
|
|
132
|
-
circleCircle
|
|
133
|
-
polygonCircle
|
|
134
|
-
pointInPolygon
|
|
109
|
+
polygonPolygon,
|
|
110
|
+
circleCircle,
|
|
111
|
+
polygonCircle,
|
|
112
|
+
pointInPolygon,
|
|
135
113
|
};
|
|
136
|
-
function Color4B(r, g, b, a) {
|
|
114
|
+
export function Color4B(r, g, b, a) {
|
|
137
115
|
return cc.color(r, g, b, a);
|
|
138
116
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
117
|
+
class _Size {
|
|
118
|
+
width;
|
|
119
|
+
height;
|
|
120
|
+
static ZERO;
|
|
121
|
+
constructor(width = 0, height = 0) {
|
|
143
122
|
if (!(this instanceof _Size)) {
|
|
144
123
|
return new _Size(width, height);
|
|
145
124
|
}
|
|
@@ -150,19 +129,12 @@ var _Size = /** @class */ (function () {
|
|
|
150
129
|
this.width = width;
|
|
151
130
|
this.height = height;
|
|
152
131
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
function Size(x, y) {
|
|
132
|
+
}
|
|
133
|
+
export function Size(x, y) {
|
|
156
134
|
return new _Size(x, y);
|
|
157
135
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
162
|
-
}
|
|
163
|
-
return Touch;
|
|
164
|
-
}(cc.Touch));
|
|
165
|
-
exports.Touch = Touch;
|
|
166
|
-
function getWinSize() {
|
|
136
|
+
export class Touch extends cc.Touch {
|
|
137
|
+
}
|
|
138
|
+
export function getWinSize() {
|
|
167
139
|
return cc.director.getWinSize();
|
|
168
140
|
}
|