@safe-engine/cocos 1.5.3 → 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.js +53 -75
- package/dist/animation/AnimationSystem.js +15 -23
- package/dist/animation/index.js +6 -9
- package/dist/app.js +37 -64
- 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.js +7 -11
- 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,105 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.TiledMap = exports.GraphicsRender = exports.ParticleComp = exports.MaskRender = exports.SpriteRender = exports.NodeRender = void 0;
|
|
19
|
-
var polyfills_1 = require("../../polyfills");
|
|
20
|
-
var decorator_1 = require("../core/decorator");
|
|
21
|
-
var NodeRender = /** @class */ (function (_super) {
|
|
22
|
-
__extends(NodeRender, _super);
|
|
23
|
-
function NodeRender() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1
|
+
import { BLUE, RED } from '../../polyfills';
|
|
2
|
+
import { ComponentX } from '../core/decorator';
|
|
3
|
+
export class NodeRender extends ComponentX {
|
|
4
|
+
nodeName;
|
|
5
|
+
}
|
|
6
|
+
export class SpriteRender extends ComponentX {
|
|
7
|
+
get spriteFrame() {
|
|
8
|
+
return this.props.spriteFrame;
|
|
25
9
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.node.instance.setTexture(frame);
|
|
42
|
-
}
|
|
43
|
-
// } else if (this.node.instance instanceof ccui.ImageView) {
|
|
44
|
-
// if (this.texType) {
|
|
45
|
-
// this.node.instance.loadTexture(frame, this.texType)
|
|
46
|
-
// } else {
|
|
47
|
-
// this.node.instance.loadTexture(frame)
|
|
48
|
-
// }
|
|
49
|
-
// const sprite = new cc.Sprite(frame)
|
|
50
|
-
// this.node.setContentSize(sprite.getContentSize())
|
|
51
|
-
// } else if (this.node.instance instanceof ccui.Button) {
|
|
52
|
-
// this.node.instance.loadTextureNormal(frame)
|
|
53
|
-
},
|
|
54
|
-
enumerable: false,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
|
-
return SpriteRender;
|
|
58
|
-
}(decorator_1.ComponentX));
|
|
59
|
-
exports.SpriteRender = SpriteRender;
|
|
60
|
-
var MaskRender = /** @class */ (function (_super) {
|
|
61
|
-
__extends(MaskRender, _super);
|
|
62
|
-
function MaskRender() {
|
|
63
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
-
}
|
|
65
|
-
return MaskRender;
|
|
66
|
-
}(decorator_1.ComponentX));
|
|
67
|
-
exports.MaskRender = MaskRender;
|
|
68
|
-
var ParticleComp = /** @class */ (function (_super) {
|
|
69
|
-
__extends(ParticleComp, _super);
|
|
70
|
-
function ParticleComp() {
|
|
71
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
72
|
-
}
|
|
73
|
-
return ParticleComp;
|
|
74
|
-
}(decorator_1.ComponentX));
|
|
75
|
-
exports.ParticleComp = ParticleComp;
|
|
76
|
-
var GraphicsRender = /** @class */ (function (_super) {
|
|
77
|
-
__extends(GraphicsRender, _super);
|
|
78
|
-
function GraphicsRender() {
|
|
79
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
80
|
-
_this.lineWidth = 5;
|
|
81
|
-
_this.strokeColor = polyfills_1.RED;
|
|
82
|
-
_this.fillColor = polyfills_1.BLUE;
|
|
83
|
-
return _this;
|
|
10
|
+
set spriteFrame(frame) {
|
|
11
|
+
this.props.spriteFrame = frame;
|
|
12
|
+
if (this.node && this.node.instance instanceof cc.Sprite) {
|
|
13
|
+
this.node.instance.setTexture(frame);
|
|
14
|
+
}
|
|
15
|
+
// } else if (this.node.instance instanceof ccui.ImageView) {
|
|
16
|
+
// if (this.texType) {
|
|
17
|
+
// this.node.instance.loadTexture(frame, this.texType)
|
|
18
|
+
// } else {
|
|
19
|
+
// this.node.instance.loadTexture(frame)
|
|
20
|
+
// }
|
|
21
|
+
// const sprite = new cc.Sprite(frame)
|
|
22
|
+
// this.node.setContentSize(sprite.getContentSize())
|
|
23
|
+
// } else if (this.node.instance instanceof ccui.Button) {
|
|
24
|
+
// this.node.instance.loadTextureNormal(frame)
|
|
84
25
|
}
|
|
85
|
-
|
|
26
|
+
}
|
|
27
|
+
export class MaskRender extends ComponentX {
|
|
28
|
+
}
|
|
29
|
+
export class ParticleComp extends ComponentX {
|
|
30
|
+
}
|
|
31
|
+
export class GraphicsRender extends ComponentX {
|
|
32
|
+
lineWidth = 5;
|
|
33
|
+
strokeColor = RED;
|
|
34
|
+
fillColor = BLUE;
|
|
35
|
+
drawDot(x, y, r) {
|
|
86
36
|
this.node.instance.drawDot(cc.p(x, y), r, this.fillColor);
|
|
87
|
-
}
|
|
37
|
+
}
|
|
88
38
|
// drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
|
|
89
39
|
// }
|
|
90
40
|
// // drawPoints(points: Vec2[], color: Color4B) {
|
|
91
41
|
// // }
|
|
92
|
-
|
|
42
|
+
drawLine(origin, destination, thickness, color) {
|
|
93
43
|
this.node.instance.drawSegment(origin, destination, thickness, color);
|
|
94
|
-
}
|
|
95
|
-
|
|
44
|
+
}
|
|
45
|
+
drawRect(origin, destination, color) {
|
|
96
46
|
this.node.instance.drawRect(origin, destination, color);
|
|
97
|
-
}
|
|
47
|
+
}
|
|
98
48
|
// drawSolidRect(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
99
49
|
// }
|
|
100
|
-
|
|
50
|
+
drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color) {
|
|
101
51
|
this.node.instance.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color);
|
|
102
|
-
}
|
|
52
|
+
}
|
|
103
53
|
// drawSolidCircle(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
104
54
|
// }
|
|
105
55
|
// drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
@@ -110,9 +60,9 @@ var GraphicsRender = /** @class */ (function (_super) {
|
|
|
110
60
|
// }
|
|
111
61
|
// drawCatmullRom(points: Vec2[], color: Color4B) {
|
|
112
62
|
// }
|
|
113
|
-
|
|
63
|
+
drawPoly(points, color, thickness) {
|
|
114
64
|
this.node.instance.drawPoly(points, color, thickness);
|
|
115
|
-
}
|
|
65
|
+
}
|
|
116
66
|
// drawSolidPoly(points: Vec2[], color: Color4B) {
|
|
117
67
|
// this.node.instance.drawPoly(points, color)
|
|
118
68
|
// }
|
|
@@ -124,19 +74,11 @@ var GraphicsRender = /** @class */ (function (_super) {
|
|
|
124
74
|
// this.node.instance.poly([p1, p2, p3], true)
|
|
125
75
|
// this.node.instance.fill(color)
|
|
126
76
|
// }
|
|
127
|
-
|
|
77
|
+
clear() {
|
|
128
78
|
if (this.node.instance instanceof cc.DrawNode) {
|
|
129
79
|
this.node.instance.clear();
|
|
130
80
|
}
|
|
131
|
-
};
|
|
132
|
-
return GraphicsRender;
|
|
133
|
-
}(decorator_1.ComponentX));
|
|
134
|
-
exports.GraphicsRender = GraphicsRender;
|
|
135
|
-
var TiledMap = /** @class */ (function (_super) {
|
|
136
|
-
__extends(TiledMap, _super);
|
|
137
|
-
function TiledMap() {
|
|
138
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
139
81
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
82
|
+
}
|
|
83
|
+
export class TiledMap extends ComponentX {
|
|
84
|
+
}
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var NodePool = /** @class */ (function () {
|
|
5
|
-
function NodePool() {
|
|
6
|
-
this.items = [];
|
|
7
|
-
}
|
|
8
|
-
NodePool.prototype.put = function (node) {
|
|
1
|
+
export class NodePool {
|
|
2
|
+
items = [];
|
|
3
|
+
put(node) {
|
|
9
4
|
if (node) {
|
|
10
5
|
node.removeFromParent();
|
|
11
6
|
node.entity.immortal = true;
|
|
12
7
|
this.items.push(node);
|
|
13
8
|
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
}
|
|
10
|
+
get() {
|
|
11
|
+
const node = this.items.pop();
|
|
17
12
|
node.entity.immortal = false;
|
|
18
13
|
node.active = true;
|
|
19
14
|
return node;
|
|
20
|
-
}
|
|
21
|
-
|
|
15
|
+
}
|
|
16
|
+
size() {
|
|
22
17
|
return this.items.length;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
this.items.forEach(
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.items.forEach((node) => node.destroy());
|
|
26
21
|
this.items.length = 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}());
|
|
30
|
-
exports.NodePool = NodePool;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.SceneComponent = void 0;
|
|
19
|
-
var __1 = require("..");
|
|
20
|
-
var EnhancedComponent_1 = require("../components/EnhancedComponent");
|
|
21
|
-
var NodeComp_1 = require("../components/NodeComp");
|
|
22
|
-
var SceneComponent = /** @class */ (function (_super) {
|
|
23
|
-
__extends(SceneComponent, _super);
|
|
24
|
-
function SceneComponent() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
SceneComponent.prototype.render = function () {
|
|
28
|
-
var world = __1.GameWorld.Instance;
|
|
1
|
+
import { GameWorld } from '..';
|
|
2
|
+
import { EnhancedComponent } from '../components/EnhancedComponent';
|
|
3
|
+
import { NodeComp } from '../components/NodeComp';
|
|
4
|
+
export class SceneComponent extends EnhancedComponent {
|
|
5
|
+
render() {
|
|
6
|
+
const world = GameWorld.Instance;
|
|
29
7
|
world.entities.reset();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
const root = world.entities.create();
|
|
9
|
+
const node = root.assign(new NodeComp(cc.director.getRunningScene(), root));
|
|
10
|
+
const sceneComponent = root.assign(this);
|
|
33
11
|
sceneComponent.node = node;
|
|
34
12
|
return sceneComponent;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}(EnhancedComponent_1.EnhancedComponent));
|
|
38
|
-
exports.SceneComponent = SceneComponent;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,43 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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.ComponentX = exports.NoRenderComponentX = void 0;
|
|
19
|
-
var __1 = require("..");
|
|
20
|
-
var EnhancedComponent_1 = require("../components/EnhancedComponent");
|
|
21
|
-
var NoRenderComponentX = /** @class */ (function (_super) {
|
|
22
|
-
__extends(NoRenderComponentX, _super);
|
|
23
|
-
function NoRenderComponentX() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
NoRenderComponentX.hasRender = false;
|
|
27
|
-
return NoRenderComponentX;
|
|
28
|
-
}(EnhancedComponent_1.EnhancedComponent));
|
|
29
|
-
exports.NoRenderComponentX = NoRenderComponentX;
|
|
30
|
-
var ComponentX = /** @class */ (function (_super) {
|
|
31
|
-
__extends(ComponentX, _super);
|
|
32
|
-
function ComponentX() {
|
|
33
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
-
}
|
|
35
|
-
ComponentX.prototype.render = function () {
|
|
36
|
-
var world = __1.GameWorld.Instance;
|
|
37
|
-
var root = world.entities.create();
|
|
38
|
-
var comp = root.assign(this);
|
|
1
|
+
import { GameWorld } from '..';
|
|
2
|
+
import { EnhancedComponent } from '../components/EnhancedComponent';
|
|
3
|
+
export class NoRenderComponentX extends EnhancedComponent {
|
|
4
|
+
static hasRender = false;
|
|
5
|
+
}
|
|
6
|
+
export class ComponentX extends EnhancedComponent {
|
|
7
|
+
render() {
|
|
8
|
+
const world = GameWorld.Instance;
|
|
9
|
+
const root = world.entities.create();
|
|
10
|
+
const comp = root.assign(this);
|
|
39
11
|
return comp;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}(EnhancedComponent_1.EnhancedComponent));
|
|
43
|
-
exports.ComponentX = ComponentX;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/gworld/index.js
CHANGED
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.GameWorld = void 0;
|
|
19
|
-
var entityx_ts_1 = require("entityx-ts");
|
|
20
|
-
var GameWorld = /** @class */ (function (_super) {
|
|
21
|
-
__extends(GameWorld, _super);
|
|
22
|
-
function GameWorld() {
|
|
23
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
_this.listUpdate = [];
|
|
25
|
-
return _this;
|
|
26
|
-
}
|
|
27
|
-
GameWorld.prototype.update = function (dt) {
|
|
28
|
-
var _this = this;
|
|
29
|
-
this.listUpdate.forEach(function (system) {
|
|
30
|
-
_this.systems.update(system, dt);
|
|
1
|
+
import { World } from 'entityx-ts';
|
|
2
|
+
export class GameWorld extends World {
|
|
3
|
+
listUpdate = [];
|
|
4
|
+
update(dt) {
|
|
5
|
+
this.listUpdate.forEach((system) => {
|
|
6
|
+
this.systems.update(system, dt);
|
|
31
7
|
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
configurable: true
|
|
40
|
-
});
|
|
41
|
-
return GameWorld;
|
|
42
|
-
}(entityx_ts_1.World));
|
|
43
|
-
exports.GameWorld = GameWorld;
|
|
8
|
+
}
|
|
9
|
+
static _instance;
|
|
10
|
+
static get Instance() {
|
|
11
|
+
// Do you need arguments? Make it a regular static method instead.
|
|
12
|
+
return this._instance || (this._instance = new this());
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
|
-
import { Collider, Contract } from '
|
|
3
|
-
export declare function shouldCollider(colA: Collider, colB: Collider): any;
|
|
2
|
+
import { Collider, Contract } from '../components/CollideComponent';
|
|
4
3
|
export declare class CollideSystem implements System {
|
|
5
4
|
listColliders: Collider[];
|
|
6
5
|
_contracts: Contract[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollideSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/CollideSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAA+B,QAAQ,EAAiB,QAAQ,EAAmB,MAAM,gCAAgC,CAAA;AAGhI,
|
|
1
|
+
{"version":3,"file":"CollideSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/CollideSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAA+B,QAAQ,EAAiB,QAAQ,EAAmB,MAAM,gCAAgC,CAAA;AAGhI,qBAAa,aAAc,YAAW,MAAM;IAC1C,aAAa,EAAE,QAAQ,EAAE,CAAK;IAC9B,UAAU,EAAE,QAAQ,EAAE,CAAK;IAC3B,eAAe,QAAK;IACpB,aAAa,EAAE,EAAE,CAAC,QAAQ,CAAA;IAC1B,gBAAgB,UAAQ;IACxB,OAAO,UAAO;IACd,cAAc,cAAW;IAEzB,SAAS,CAAC,aAAa,EAAE,YAAY;IASrC,OAAO,CAAC,aAAa,CAOpB;IAED,OAAO,CAAC,gBAAgB,CAEvB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IA2GhE,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAS9B,cAAc,CAAC,QAAQ,EAAE,QAAQ;IAIjC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK;IAK3B,eAAe,CAAC,MAAM,UAAO;CAI9B"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollideSystem = void 0;
|
|
4
|
-
exports.shouldCollider = shouldCollider;
|
|
5
4
|
var entityx_ts_1 = require("entityx-ts");
|
|
6
|
-
var
|
|
5
|
+
var utils_1 = require("../../helper/utils");
|
|
7
6
|
var CollideComponent_1 = require("../components/CollideComponent");
|
|
8
7
|
var NodeComp_1 = require("../components/NodeComp");
|
|
9
|
-
function shouldCollider(colA, colB) {
|
|
10
|
-
var groupA = colA.node.group;
|
|
11
|
-
var groupB = colB.node.group;
|
|
12
|
-
if (groupA === undefined || groupB === undefined) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
var colliderMatrix = __1.GameWorld.Instance.systems.get(CollideSystem).colliderMatrix;
|
|
16
|
-
return colliderMatrix[groupA][groupB];
|
|
17
|
-
}
|
|
18
8
|
var CollideSystem = /** @class */ (function () {
|
|
19
9
|
function CollideSystem() {
|
|
20
10
|
var _this = this;
|
|
@@ -157,7 +147,7 @@ var CollideSystem = /** @class */ (function () {
|
|
|
157
147
|
CollideSystem.prototype.addCollider = function (collider) {
|
|
158
148
|
var _this = this;
|
|
159
149
|
this.listColliders.forEach(function (col) {
|
|
160
|
-
if (shouldCollider(col, collider)) {
|
|
150
|
+
if ((0, utils_1.shouldCollider)(col, collider)) {
|
|
161
151
|
_this._contracts.push(new CollideComponent_1.Contract(col, collider));
|
|
162
152
|
}
|
|
163
153
|
});
|