@safe-engine/cocos 1.0.1
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/@types/index.d.ts +61 -0
- package/@types/safex.d.ts +103 -0
- package/README.md +10 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +24 -0
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +77 -0
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +1 -0
- package/dist/dragonbones/cocos/CocosArmatureDisplay.js +227 -0
- package/dist/dragonbones/cocos/CocosFactory.d.ts +128 -0
- package/dist/dragonbones/cocos/CocosFactory.d.ts.map +1 -0
- package/dist/dragonbones/cocos/CocosFactory.js +231 -0
- package/dist/dragonbones/cocos/CocosSlot.d.ts +49 -0
- package/dist/dragonbones/cocos/CocosSlot.d.ts.map +1 -0
- package/dist/dragonbones/cocos/CocosSlot.js +385 -0
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +53 -0
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +1 -0
- package/dist/dragonbones/cocos/CocosTextureAtlasData.js +158 -0
- package/dist/dragonbones/dragonBones.d.ts +3 -0
- package/dist/dragonbones/dragonBones.d.ts.map +1 -0
- package/dist/dragonbones/dragonBones.js +4788 -0
- package/dist/dragonbones/index.d.ts +20 -0
- package/dist/dragonbones/index.d.ts.map +1 -0
- package/dist/dragonbones/index.js +112 -0
- package/dist/gworld/components/AnimationComponent.d.ts +65 -0
- package/dist/gworld/components/AnimationComponent.d.ts.map +1 -0
- package/dist/gworld/components/AnimationComponent.js +141 -0
- package/dist/gworld/components/CollideComponent.d.ts +64 -0
- package/dist/gworld/components/CollideComponent.d.ts.map +1 -0
- package/dist/gworld/components/CollideComponent.js +266 -0
- package/dist/gworld/components/EnhancedComponent.d.ts +21 -0
- package/dist/gworld/components/EnhancedComponent.d.ts.map +1 -0
- package/dist/gworld/components/EnhancedComponent.js +50 -0
- package/dist/gworld/components/GUIComponent.d.ts +62 -0
- package/dist/gworld/components/GUIComponent.d.ts.map +1 -0
- package/dist/gworld/components/GUIComponent.js +158 -0
- package/dist/gworld/components/NoRenderComponent.d.ts +36 -0
- package/dist/gworld/components/NoRenderComponent.d.ts.map +1 -0
- package/dist/gworld/components/NoRenderComponent.js +74 -0
- package/dist/gworld/components/NodeComp.d.ts +184 -0
- package/dist/gworld/components/NodeComp.d.ts.map +1 -0
- package/dist/gworld/components/NodeComp.js +425 -0
- package/dist/gworld/components/RenderComponent.d.ts +53 -0
- package/dist/gworld/components/RenderComponent.d.ts.map +1 -0
- package/dist/gworld/components/RenderComponent.js +158 -0
- package/dist/gworld/core/Scene.d.ts +5 -0
- package/dist/gworld/core/Scene.d.ts.map +1 -0
- package/dist/gworld/core/Scene.js +38 -0
- package/dist/gworld/core/decorator.d.ts +9 -0
- package/dist/gworld/core/decorator.d.ts.map +1 -0
- package/dist/gworld/core/decorator.js +43 -0
- package/dist/gworld/index.d.ts +8 -0
- package/dist/gworld/index.d.ts.map +1 -0
- package/dist/gworld/index.js +43 -0
- package/dist/gworld/systems/AnimationSystem.d.ts +7 -0
- package/dist/gworld/systems/AnimationSystem.d.ts.map +1 -0
- package/dist/gworld/systems/AnimationSystem.js +38 -0
- package/dist/gworld/systems/CollideSystem.d.ts +19 -0
- package/dist/gworld/systems/CollideSystem.d.ts.map +1 -0
- package/dist/gworld/systems/CollideSystem.js +183 -0
- package/dist/gworld/systems/GUISystem.d.ts +7 -0
- package/dist/gworld/systems/GUISystem.d.ts.map +1 -0
- package/dist/gworld/systems/GUISystem.js +147 -0
- package/dist/gworld/systems/NoRenderSystem.d.ts +7 -0
- package/dist/gworld/systems/NoRenderSystem.d.ts.map +1 -0
- package/dist/gworld/systems/NoRenderSystem.js +93 -0
- package/dist/gworld/systems/RenderSystem.d.ts +15 -0
- package/dist/gworld/systems/RenderSystem.d.ts.map +1 -0
- package/dist/gworld/systems/RenderSystem.js +115 -0
- package/dist/helper/Intersection.d.ts +6 -0
- package/dist/helper/Intersection.d.ts.map +1 -0
- package/dist/helper/Intersection.js +117 -0
- package/dist/helper/NodePool.d.ts +9 -0
- package/dist/helper/NodePool.d.ts.map +1 -0
- package/dist/helper/NodePool.js +29 -0
- package/dist/helper/action.d.ts +9 -0
- package/dist/helper/action.d.ts.map +1 -0
- package/dist/helper/action.js +34 -0
- package/dist/helper/director.d.ts +3 -0
- package/dist/helper/director.d.ts.map +1 -0
- package/dist/helper/director.js +10 -0
- package/dist/helper/html-text-parser.d.ts +30 -0
- package/dist/helper/html-text-parser.d.ts.map +1 -0
- package/dist/helper/html-text-parser.js +354 -0
- package/dist/helper/math.d.ts +4 -0
- package/dist/helper/math.d.ts.map +1 -0
- package/dist/helper/math.js +9 -0
- package/dist/helper/utils.d.ts +14 -0
- package/dist/helper/utils.d.ts.map +1 -0
- package/dist/helper/utils.js +81 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/polyfills.d.ts +54 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +168 -0
- package/dist/spine/CCSkeleton.d.ts +2 -0
- package/dist/spine/CCSkeleton.d.ts.map +1 -0
- package/dist/spine/CCSkeleton.js +380 -0
- package/dist/spine/CCSkeletonAnimation.d.ts +16 -0
- package/dist/spine/CCSkeletonAnimation.d.ts.map +1 -0
- package/dist/spine/CCSkeletonAnimation.js +353 -0
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +2 -0
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -0
- package/dist/spine/CCSkeletonCanvasRenderCmd.js +229 -0
- package/dist/spine/CCSkeletonTexture.d.ts +2 -0
- package/dist/spine/CCSkeletonTexture.d.ts.map +1 -0
- package/dist/spine/CCSkeletonTexture.js +98 -0
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +2 -0
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +1 -0
- package/dist/spine/CCSkeletonWebGLRenderCmd.js +317 -0
- package/package.json +32 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EnhancedComponent } from '../components/EnhancedComponent';
|
|
2
|
+
import { NodeComp } from '../components/NodeComp';
|
|
3
|
+
export declare class NoRenderComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
4
|
+
static hasRender: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class ComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
7
|
+
render?(): this;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/gworld/core/decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,qBAAa,kBAAkB,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxH,MAAM,CAAC,SAAS,UAAQ;CACzB;AAED,qBAAa,UAAU,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChH,MAAM,CAAC;CAMR"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.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);
|
|
39
|
+
return comp;
|
|
40
|
+
};
|
|
41
|
+
return ComponentX;
|
|
42
|
+
}(EnhancedComponent_1.EnhancedComponent));
|
|
43
|
+
exports.ComponentX = ComponentX;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Constructor, System, World } from 'entityx-ts';
|
|
2
|
+
export declare class GameWorld extends World {
|
|
3
|
+
listUpdate: (System | Constructor<System>)[];
|
|
4
|
+
update(dt: number): void;
|
|
5
|
+
private static _instance;
|
|
6
|
+
static get Instance(): GameWorld;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gworld/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvD,qBAAa,SAAU,SAAQ,KAAK;IAClC,UAAU,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAK;IACjD,MAAM,CAAC,EAAE,EAAE,MAAM;IAMjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAEnC,WAAkB,QAAQ,cAGzB;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.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);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(GameWorld, "Instance", {
|
|
34
|
+
get: function () {
|
|
35
|
+
// Do you need arguments? Make it a regular static method instead.
|
|
36
|
+
return this._instance || (this._instance = new this());
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
return GameWorld;
|
|
42
|
+
}(entityx_ts_1.World));
|
|
43
|
+
exports.GameWorld = GameWorld;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EntityManager, EventManager, EventReceive, System } from 'entityx-ts';
|
|
2
|
+
export declare class AnimationSystem implements System {
|
|
3
|
+
configure(event_manager: EventManager): void;
|
|
4
|
+
receive(type: string, event: EventReceive): void;
|
|
5
|
+
update(entities: EntityManager, events: EventManager, dt: Float): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=AnimationSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/AnimationSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAInG,qBAAa,eAAgB,YAAW,MAAM;IAC5C,SAAS,CAAC,aAAa,EAAE,YAAY;IAGrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAczC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK;CAUhE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnimationSystem = void 0;
|
|
4
|
+
var entityx_ts_1 = require("entityx-ts");
|
|
5
|
+
var AnimationComponent_1 = require("../components/AnimationComponent");
|
|
6
|
+
var NodeComp_1 = require("../components/NodeComp");
|
|
7
|
+
var AnimationSystem = /** @class */ (function () {
|
|
8
|
+
function AnimationSystem() {
|
|
9
|
+
}
|
|
10
|
+
AnimationSystem.prototype.configure = function (event_manager) {
|
|
11
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(AnimationComponent_1.AnimationComp), this);
|
|
12
|
+
};
|
|
13
|
+
AnimationSystem.prototype.receive = function (type, event) {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(AnimationComponent_1.AnimationComp): {
|
|
16
|
+
// cc.log('AnimationComp', event);
|
|
17
|
+
var animation = event.entity.getComponent(AnimationComponent_1.AnimationComp);
|
|
18
|
+
animation.node = event.entity.getComponent(NodeComp_1.NodeComp);
|
|
19
|
+
setTimeout(animation.start.bind(animation), 0);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
default:
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
AnimationSystem.prototype.update = function (entities, events, dt) {
|
|
27
|
+
var animations = entities.entities_with_components(AnimationComponent_1.AnimationComp);
|
|
28
|
+
// cc.log(animations);
|
|
29
|
+
animations.forEach(function (ett) {
|
|
30
|
+
var animation = ett.getComponent(AnimationComponent_1.AnimationComp);
|
|
31
|
+
if (animation.node && animation.node.active) {
|
|
32
|
+
animation.update(dt);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return AnimationSystem;
|
|
37
|
+
}());
|
|
38
|
+
exports.AnimationSystem = AnimationSystem;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EntityManager, EventManager, EventReceive, System } from 'entityx-ts';
|
|
2
|
+
import { Collider, Contract } from '../components/CollideComponent';
|
|
3
|
+
export declare class CollideSystem implements System {
|
|
4
|
+
listColliders: Collider[];
|
|
5
|
+
_contracts: Contract[];
|
|
6
|
+
removeColliders: any[];
|
|
7
|
+
debugGraphics: cc.DrawNode;
|
|
8
|
+
enabledDebugDraw: boolean;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
colliderMatrix: boolean[][];
|
|
11
|
+
configure(event_manager: EventManager): void;
|
|
12
|
+
receive(type: string, event: EventReceive): void;
|
|
13
|
+
update(entities: EntityManager, events: EventManager, dt: number): void;
|
|
14
|
+
addCollider(collider: Collider): void;
|
|
15
|
+
removeCollider(collider: Collider): void;
|
|
16
|
+
addDebugNode(root: cc.Scene): void;
|
|
17
|
+
toggleDebugDraw(enable?: boolean): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=CollideSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollideSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/CollideSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAG1H,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,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IA4BzC,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"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollideSystem = void 0;
|
|
4
|
+
var entityx_ts_1 = require("entityx-ts");
|
|
5
|
+
var utils_1 = require("../../helper/utils");
|
|
6
|
+
var CollideComponent_1 = require("../components/CollideComponent");
|
|
7
|
+
var NodeComp_1 = require("../components/NodeComp");
|
|
8
|
+
var CollideSystem = /** @class */ (function () {
|
|
9
|
+
function CollideSystem() {
|
|
10
|
+
this.listColliders = [];
|
|
11
|
+
this._contracts = [];
|
|
12
|
+
this.removeColliders = [];
|
|
13
|
+
this.enabledDebugDraw = false;
|
|
14
|
+
this.enabled = true;
|
|
15
|
+
this.colliderMatrix = [[true]];
|
|
16
|
+
}
|
|
17
|
+
CollideSystem.prototype.configure = function (event_manager) {
|
|
18
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.BoxCollider), this);
|
|
19
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.CircleCollider), this);
|
|
20
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.PolygonCollider), this);
|
|
21
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.BoxCollider), this);
|
|
22
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.CircleCollider), this);
|
|
23
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.PolygonCollider), this);
|
|
24
|
+
};
|
|
25
|
+
CollideSystem.prototype.receive = function (type, event) {
|
|
26
|
+
var ett = event.entity;
|
|
27
|
+
var comp = event.component;
|
|
28
|
+
switch (type) {
|
|
29
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.BoxCollider):
|
|
30
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.CircleCollider):
|
|
31
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(CollideComponent_1.PolygonCollider): {
|
|
32
|
+
// cc.log(type, event)
|
|
33
|
+
var collider = ett.assign(new CollideComponent_1.Collider(comp));
|
|
34
|
+
collider.node = ett.getComponent(NodeComp_1.NodeComp);
|
|
35
|
+
collider.props = comp.props;
|
|
36
|
+
// collider.props.enable = true
|
|
37
|
+
comp.node = ett.getComponent(NodeComp_1.NodeComp);
|
|
38
|
+
this.addCollider(collider);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case (0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.BoxCollider):
|
|
42
|
+
case (0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.CircleCollider):
|
|
43
|
+
case (0, entityx_ts_1.ComponentRemovedEvent)(CollideComponent_1.PolygonCollider): {
|
|
44
|
+
this.removeColliders.push(comp.getComponent(CollideComponent_1.Collider));
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
CollideSystem.prototype.update = function (entities, events, dt) {
|
|
52
|
+
var _this = this;
|
|
53
|
+
if (!this.enabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.listColliders.forEach(function (collider) {
|
|
57
|
+
if (!cc.sys.isObjectValid(collider.node.instance)) {
|
|
58
|
+
_this.removeColliders.push(collider);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// this.removeColliders.forEach(comp => {
|
|
62
|
+
// this.listColliders = this.listColliders.filter(col => !col.isEqual(comp)
|
|
63
|
+
// && cc.sys.isObjectValid(col.node.instance));
|
|
64
|
+
// this._contracts = this._contracts.filter(contract => {
|
|
65
|
+
// const col1 = contract._collider1;
|
|
66
|
+
// const col2 = contract._collider2;
|
|
67
|
+
// if (col1.isEqual(comp) || !cc.sys.isObjectValid(col1.node.instance)) {
|
|
68
|
+
// if (contract._touching) {
|
|
69
|
+
// col2.node.emit('onCollisionExit', col1, col2);
|
|
70
|
+
// }
|
|
71
|
+
// return false;
|
|
72
|
+
// }
|
|
73
|
+
// if (col2.isEqual(comp) || !cc.sys.isObjectValid(col2.node.instance)) {
|
|
74
|
+
// if (contract._touching) {
|
|
75
|
+
// col1.node.emit('onCollisionExit', col2, col1);
|
|
76
|
+
// }
|
|
77
|
+
// return false;
|
|
78
|
+
// }
|
|
79
|
+
// return true;
|
|
80
|
+
// }
|
|
81
|
+
// );
|
|
82
|
+
// });
|
|
83
|
+
this.removeColliders = [];
|
|
84
|
+
var draw;
|
|
85
|
+
var _a = this, enabledDebugDraw = _a.enabledDebugDraw, debugGraphics = _a.debugGraphics;
|
|
86
|
+
if (enabledDebugDraw) {
|
|
87
|
+
draw = debugGraphics;
|
|
88
|
+
draw.clear();
|
|
89
|
+
// this.listColliders.forEach(collider => {
|
|
90
|
+
// if (collider.node && collider.node.active) {
|
|
91
|
+
// collider.update(dt, draw);
|
|
92
|
+
// }
|
|
93
|
+
// });
|
|
94
|
+
// } else {
|
|
95
|
+
// this.listColliders.forEach(collider => {
|
|
96
|
+
// if (collider.node && collider.node.active) {
|
|
97
|
+
// collider.update(dt);
|
|
98
|
+
// }
|
|
99
|
+
// });
|
|
100
|
+
}
|
|
101
|
+
for (var _i = 0, _b = entities.entities_with_components(CollideComponent_1.BoxCollider); _i < _b.length; _i++) {
|
|
102
|
+
var entt = _b[_i];
|
|
103
|
+
var comp = entt.getComponent(CollideComponent_1.BoxCollider);
|
|
104
|
+
comp.update(dt, draw);
|
|
105
|
+
}
|
|
106
|
+
for (var _c = 0, _d = entities.entities_with_components(CollideComponent_1.CircleCollider); _c < _d.length; _c++) {
|
|
107
|
+
var entt = _d[_c];
|
|
108
|
+
var comp = entt.getComponent(CollideComponent_1.CircleCollider);
|
|
109
|
+
comp.update(dt, draw);
|
|
110
|
+
}
|
|
111
|
+
for (var _e = 0, _f = entities.entities_with_components(CollideComponent_1.PolygonCollider); _e < _f.length; _e++) {
|
|
112
|
+
var entt = _f[_e];
|
|
113
|
+
var comp = entt.getComponent(CollideComponent_1.PolygonCollider);
|
|
114
|
+
comp.update(dt, draw);
|
|
115
|
+
}
|
|
116
|
+
this._contracts.forEach(function (contract) {
|
|
117
|
+
var col1 = contract._collider1;
|
|
118
|
+
var col2 = contract._collider2;
|
|
119
|
+
if (!cc.sys.isObjectValid(col1.node.instance) ||
|
|
120
|
+
!cc.sys.isObjectValid(col2.node.instance) ||
|
|
121
|
+
!col1.node ||
|
|
122
|
+
!col2.node ||
|
|
123
|
+
!col1.node.active ||
|
|
124
|
+
!col2.node.active) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
var type = contract.updateState();
|
|
128
|
+
switch (type) {
|
|
129
|
+
case CollideComponent_1.CollisionType.ENTER: {
|
|
130
|
+
if (col1.props.onCollisionEnter) {
|
|
131
|
+
col1.props.onCollisionEnter(col2);
|
|
132
|
+
}
|
|
133
|
+
if (col2.props.onCollisionEnter) {
|
|
134
|
+
col2.props.onCollisionEnter(col1);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case CollideComponent_1.CollisionType.STAY:
|
|
139
|
+
if (col1.props.onCollisionStay) {
|
|
140
|
+
col1.props.onCollisionStay(col2);
|
|
141
|
+
}
|
|
142
|
+
if (col2.props.onCollisionStay) {
|
|
143
|
+
col2.props.onCollisionStay(col1);
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case CollideComponent_1.CollisionType.EXIT:
|
|
147
|
+
if (col1.props.onCollisionExit) {
|
|
148
|
+
col1.props.onCollisionExit(col2);
|
|
149
|
+
}
|
|
150
|
+
if (col2.props.onCollisionExit) {
|
|
151
|
+
col2.props.onCollisionExit(col1);
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
CollideSystem.prototype.addCollider = function (collider) {
|
|
160
|
+
var _this = this;
|
|
161
|
+
this.listColliders.forEach(function (col) {
|
|
162
|
+
if ((0, utils_1.shouldCollider)(col, collider)) {
|
|
163
|
+
_this._contracts.push(new CollideComponent_1.Contract(col, collider));
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
this.listColliders.push(collider);
|
|
167
|
+
};
|
|
168
|
+
CollideSystem.prototype.removeCollider = function (collider) {
|
|
169
|
+
this.removeColliders.push(collider);
|
|
170
|
+
};
|
|
171
|
+
CollideSystem.prototype.addDebugNode = function (root) {
|
|
172
|
+
this.debugGraphics = new cc.DrawNode();
|
|
173
|
+
this.debugGraphics.zIndex = 1000;
|
|
174
|
+
root.addChild(this.debugGraphics);
|
|
175
|
+
};
|
|
176
|
+
CollideSystem.prototype.toggleDebugDraw = function (enable) {
|
|
177
|
+
if (enable === void 0) { enable = true; }
|
|
178
|
+
this.enabledDebugDraw = enable;
|
|
179
|
+
this.addDebugNode(cc.director.getRunningScene());
|
|
180
|
+
};
|
|
181
|
+
return CollideSystem;
|
|
182
|
+
}());
|
|
183
|
+
exports.CollideSystem = CollideSystem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EntityManager, EventManager, EventReceive, System } from 'entityx-ts';
|
|
2
|
+
export declare class GUISystem implements System {
|
|
3
|
+
configure(event_manager: EventManager): void;
|
|
4
|
+
receive(type: string, event: EventReceive): void;
|
|
5
|
+
update(entities: EntityManager, events: EventManager, dt: number): any;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=GUISystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/GUISystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAiBnG,qBAAa,SAAU,YAAW,MAAM;IACtC,SAAS,CAAC,aAAa,EAAE,YAAY;IAUrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAyHzC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUISystem = void 0;
|
|
4
|
+
var entityx_ts_1 = require("entityx-ts");
|
|
5
|
+
var __1 = require("../..");
|
|
6
|
+
var polyfills_1 = require("../../polyfills");
|
|
7
|
+
var GUIComponent_1 = require("../components/GUIComponent");
|
|
8
|
+
var NodeComp_1 = require("../components/NodeComp");
|
|
9
|
+
var GUISystem = /** @class */ (function () {
|
|
10
|
+
function GUISystem() {
|
|
11
|
+
}
|
|
12
|
+
GUISystem.prototype.configure = function (event_manager) {
|
|
13
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ButtonComp), this);
|
|
14
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ProgressTimerComp), this);
|
|
15
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelComp), this);
|
|
16
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelOutlineComp), this);
|
|
17
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelShadowComp), this);
|
|
18
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.RichTextComp), this);
|
|
19
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ScrollViewComp), this);
|
|
20
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.BlockInputEventsComp), this);
|
|
21
|
+
};
|
|
22
|
+
GUISystem.prototype.receive = function (type, event) {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ButtonComp): {
|
|
25
|
+
console.log(event.component);
|
|
26
|
+
var ett = event.entity;
|
|
27
|
+
var button_1 = ett.getComponent(GUIComponent_1.ButtonComp);
|
|
28
|
+
var nodeComp_1 = ett.getComponent(NodeComp_1.NodeComp);
|
|
29
|
+
// const { normalImage, selectedImage, disableImage, texType, zoomScale } = button
|
|
30
|
+
button_1.node = nodeComp_1;
|
|
31
|
+
var touchComp = ett.assign(new __1.TouchEventRegister());
|
|
32
|
+
touchComp.props.onTouchStart = function (touch) {
|
|
33
|
+
var p = touch.getLocation();
|
|
34
|
+
// console.log('onTouchBegan', p, nodeComp)
|
|
35
|
+
var rect = nodeComp_1.getBoundingBox();
|
|
36
|
+
var nodeSpaceLocation = nodeComp_1.parent.convertToNodeSpace(p);
|
|
37
|
+
if (rect.contains(nodeSpaceLocation)) {
|
|
38
|
+
var scale = cc.scaleTo(0.3, 1.2);
|
|
39
|
+
nodeComp_1.runAction(scale);
|
|
40
|
+
button_1.props.onPress(button_1);
|
|
41
|
+
// return true
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
touchComp.props.onTouchEnd = function () {
|
|
45
|
+
var scale = cc.scaleTo(0.3, 1);
|
|
46
|
+
nodeComp_1.runAction(scale);
|
|
47
|
+
// return true
|
|
48
|
+
};
|
|
49
|
+
touchComp.props.onTouchCancel = touchComp.props.onTouchEnd;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ProgressTimerComp): {
|
|
53
|
+
console.log(event.component);
|
|
54
|
+
var ett = event.entity;
|
|
55
|
+
var bar = ett.getComponent(GUIComponent_1.ProgressTimerComp);
|
|
56
|
+
var _a = bar.props, spriteFrame = _a.spriteFrame, _b = _a.fillType, fillType = _b === void 0 ? GUIComponent_1.FillType.HORIZONTAL : _b, _c = _a.fillRange, fillRange = _c === void 0 ? 1 : _c, _d = _a.fillCenter, fillCenter = _d === void 0 ? (0, polyfills_1.Vec2)(0, 0) : _d;
|
|
57
|
+
var sprite = new cc.Sprite(spriteFrame);
|
|
58
|
+
var pTimer = new cc.ProgressTimer(sprite);
|
|
59
|
+
var ptt = fillType === GUIComponent_1.FillType.RADIAL ? cc.ProgressTimer.TYPE_RADIAL : cc.ProgressTimer.TYPE_BAR;
|
|
60
|
+
pTimer.setType(ptt);
|
|
61
|
+
if (fillType !== GUIComponent_1.FillType.RADIAL) {
|
|
62
|
+
var rate = fillType === GUIComponent_1.FillType.HORIZONTAL ? cc.p(1, 0) : cc.p(0, 1);
|
|
63
|
+
pTimer.setBarChangeRate(rate);
|
|
64
|
+
}
|
|
65
|
+
pTimer.setPercentage(fillRange * 100);
|
|
66
|
+
pTimer.setMidpoint(fillCenter);
|
|
67
|
+
bar.node = ett.assign(new NodeComp_1.NodeComp(pTimer, ett));
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.BlockInputEventsComp): {
|
|
71
|
+
// console.log('BlockInputEventsComp', event);
|
|
72
|
+
var node = event.entity.getComponent(NodeComp_1.NodeComp);
|
|
73
|
+
if (node.instance instanceof ccui.ImageView) {
|
|
74
|
+
node.instance.setTouchEnabled(true);
|
|
75
|
+
node.instance.setScale9Enabled(true);
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelComp): {
|
|
80
|
+
console.log(event.component);
|
|
81
|
+
var ett = event.entity;
|
|
82
|
+
var label = ett.getComponent(GUIComponent_1.LabelComp);
|
|
83
|
+
var _e = label.props, _f = _e.string, string = _f === void 0 ? '' : _f, _g = _e.font, font = _g === void 0 ? '' : _g, _h = _e.size, size = _h === void 0 ? 64 : _h;
|
|
84
|
+
var fontName = cc.path.basename(font, '.ttf');
|
|
85
|
+
var node = new ccui.Text(string, fontName, size);
|
|
86
|
+
node.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM);
|
|
87
|
+
label.node = ett.assign(new NodeComp_1.NodeComp(node, ett));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelOutlineComp): {
|
|
91
|
+
console.log(event.component);
|
|
92
|
+
var ett = event.entity;
|
|
93
|
+
var outline = ett.getComponent(GUIComponent_1.LabelOutlineComp);
|
|
94
|
+
var _j = outline.props, color = _j.color, width = _j.width;
|
|
95
|
+
var node = event.entity.getComponent(NodeComp_1.NodeComp);
|
|
96
|
+
if (node.instance instanceof ccui.Text) {
|
|
97
|
+
node.instance.enableOutline(color, width);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.LabelShadowComp): {
|
|
102
|
+
console.log(event.component);
|
|
103
|
+
var ett = event.entity;
|
|
104
|
+
var outline = ett.getComponent(GUIComponent_1.LabelShadowComp);
|
|
105
|
+
var _k = outline.props, color = _k.color, blur_1 = _k.blur, offset = _k.offset;
|
|
106
|
+
var node = event.entity.getComponent(NodeComp_1.NodeComp);
|
|
107
|
+
if (node.instance instanceof ccui.Text) {
|
|
108
|
+
node.instance.enableShadow(color, offset, blur_1);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.ScrollViewComp): {
|
|
113
|
+
console.log(event.component);
|
|
114
|
+
var ett = event.entity;
|
|
115
|
+
var scrollView = ett.getComponent(GUIComponent_1.ScrollViewComp);
|
|
116
|
+
var _l = scrollView, viewSize = _l.viewSize, contentSize = _l.contentSize;
|
|
117
|
+
var node = new cc.ScrollView(viewSize);
|
|
118
|
+
node.setContentSize(contentSize);
|
|
119
|
+
node.setViewSize(viewSize);
|
|
120
|
+
node.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
|
|
121
|
+
node.setContentOffset(cc.p(0, viewSize.height - contentSize.height));
|
|
122
|
+
scrollView.node = ett.assign(new NodeComp_1.NodeComp(node, ett));
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(GUIComponent_1.RichTextComp): {
|
|
126
|
+
console.log(event.component);
|
|
127
|
+
var ett = event.entity;
|
|
128
|
+
var rich = ett.getComponent(GUIComponent_1.RichTextComp);
|
|
129
|
+
var _m = rich.props.string, string = _m === void 0 ? '' : _m;
|
|
130
|
+
var node = new ccui.RichText();
|
|
131
|
+
node.width = 500;
|
|
132
|
+
node.height = 300;
|
|
133
|
+
node.ignoreContentAdaptWithSize(false);
|
|
134
|
+
rich.node = ett.assign(new NodeComp_1.NodeComp(node, ett));
|
|
135
|
+
rich.string = string;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
default:
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
GUISystem.prototype.update = function () {
|
|
143
|
+
// throw new Error('Method not implemented.');
|
|
144
|
+
};
|
|
145
|
+
return GUISystem;
|
|
146
|
+
}());
|
|
147
|
+
exports.GUISystem = GUISystem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EntityManager, EventManager, EventReceive, System } from 'entityx-ts';
|
|
2
|
+
export declare class NoRenderSystem implements System {
|
|
3
|
+
configure(event_manager: EventManager): void;
|
|
4
|
+
receive(type: string, event: EventReceive): void;
|
|
5
|
+
update(entities: EntityManager, events: EventManager, dt: number): any;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=NoRenderSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoRenderSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/NoRenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAM1H,qBAAa,cAAe,YAAW,MAAM;IAC3C,SAAS,CAAC,aAAa,EAAE,YAAY;IAMrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IA0EzC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoRenderSystem = void 0;
|
|
4
|
+
var entityx_ts_1 = require("entityx-ts");
|
|
5
|
+
var NodeComp_1 = require("../components/NodeComp");
|
|
6
|
+
var NoRenderComponent_1 = require("../components/NoRenderComponent");
|
|
7
|
+
var NoRenderSystem = /** @class */ (function () {
|
|
8
|
+
function NoRenderSystem() {
|
|
9
|
+
}
|
|
10
|
+
NoRenderSystem.prototype.configure = function (event_manager) {
|
|
11
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(NoRenderComponent_1.ExtraDataComp), this);
|
|
12
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentAddedEvent)(NoRenderComponent_1.TouchEventRegister), this);
|
|
13
|
+
event_manager.subscribe((0, entityx_ts_1.ComponentRemovedEvent)(NoRenderComponent_1.TouchEventRegister), this);
|
|
14
|
+
};
|
|
15
|
+
NoRenderSystem.prototype.receive = function (type, event) {
|
|
16
|
+
switch (type) {
|
|
17
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(NoRenderComponent_1.TouchEventRegister): {
|
|
18
|
+
// console.log('TouchEventRegister', event)
|
|
19
|
+
var ett = event.entity;
|
|
20
|
+
var touchComp_1 = event.component;
|
|
21
|
+
var nodeComp_1 = ett.getComponent(NodeComp_1.NodeComp);
|
|
22
|
+
touchComp_1.node = nodeComp_1;
|
|
23
|
+
touchComp_1.listener = cc.eventManager.addListener({
|
|
24
|
+
event: cc.EventListener.TOUCH_ONE_BY_ONE,
|
|
25
|
+
swallowTouches: true,
|
|
26
|
+
onTouchBegan: function (touch) {
|
|
27
|
+
var onTouchStart = touchComp_1.props.onTouchStart;
|
|
28
|
+
// console.log('onTouchBegan', onTouchStart)
|
|
29
|
+
if (!nodeComp_1.parent) {
|
|
30
|
+
if (onTouchStart) {
|
|
31
|
+
onTouchStart(touch, nodeComp_1);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
var p = touch.getLocation();
|
|
36
|
+
var rect = nodeComp_1.getBoundingBox();
|
|
37
|
+
var nodeSpaceLocation = nodeComp_1.parent.convertToNodeSpace(p);
|
|
38
|
+
if (rect.contains(nodeSpaceLocation)) {
|
|
39
|
+
if (onTouchStart) {
|
|
40
|
+
onTouchStart(touch, nodeComp_1);
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
onTouchMoved: function (touch) {
|
|
46
|
+
var onTouchMove = touchComp_1.props.onTouchMove;
|
|
47
|
+
if (!onTouchMove)
|
|
48
|
+
return false;
|
|
49
|
+
onTouchMove(touch, nodeComp_1);
|
|
50
|
+
return true;
|
|
51
|
+
},
|
|
52
|
+
onTouchEnded: function (touch) {
|
|
53
|
+
var onTouchEnd = touchComp_1.props.onTouchEnd;
|
|
54
|
+
if (!onTouchEnd)
|
|
55
|
+
return false;
|
|
56
|
+
onTouchEnd(touch, nodeComp_1);
|
|
57
|
+
return true;
|
|
58
|
+
},
|
|
59
|
+
onTouchCancelled: function (touch) {
|
|
60
|
+
var onTouchCancel = touchComp_1.props.onTouchCancel;
|
|
61
|
+
if (!onTouchCancel)
|
|
62
|
+
return false;
|
|
63
|
+
onTouchCancel(touch, nodeComp_1);
|
|
64
|
+
return true;
|
|
65
|
+
},
|
|
66
|
+
}, nodeComp_1.instance);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case (0, entityx_ts_1.ComponentRemovedEvent)(NoRenderComponent_1.TouchEventRegister): {
|
|
70
|
+
console.log('ComponentRemovedEvent TouchEventRegister', event);
|
|
71
|
+
// const ett = event.entity
|
|
72
|
+
// const nodeComp = ett.getComponent(NodeComp)
|
|
73
|
+
var touchComp = event.component;
|
|
74
|
+
delete touchComp.touch;
|
|
75
|
+
cc.eventManager.removeListener(touchComp.listener);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case (0, entityx_ts_1.ComponentAddedEvent)(NoRenderComponent_1.ExtraDataComp): {
|
|
79
|
+
var extra = event.component;
|
|
80
|
+
var _a = extra.props, key = _a.key, value = _a.value;
|
|
81
|
+
extra.data[key] = value;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
NoRenderSystem.prototype.update = function () {
|
|
89
|
+
// throw new Error('Method not implemented.');
|
|
90
|
+
};
|
|
91
|
+
return NoRenderSystem;
|
|
92
|
+
}());
|
|
93
|
+
exports.NoRenderSystem = NoRenderSystem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntityManager, EventManager, EventReceive, System } from 'entityx-ts';
|
|
2
|
+
export declare enum SpriteTypes {
|
|
3
|
+
SIMPLE = 0,
|
|
4
|
+
SLICED = 1,
|
|
5
|
+
TILED = 2,
|
|
6
|
+
FILLED = 3,
|
|
7
|
+
MESH = 4,
|
|
8
|
+
ANIMATION = 5
|
|
9
|
+
}
|
|
10
|
+
export declare class RenderSystem implements System {
|
|
11
|
+
configure(event_manager: EventManager): void;
|
|
12
|
+
receive(type: string, event: EventReceive): void;
|
|
13
|
+
update(entities: EntityManager, events: EventManager, dt: number): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=RenderSystem.d.ts.map
|