@safe-engine/cocos 2.6.5 → 2.6.7

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.
Files changed (97) hide show
  1. package/README.md +124 -2
  2. package/dist/core/NodeComp.d.ts +4 -1
  3. package/dist/core/NodeComp.d.ts.map +1 -1
  4. package/dist/core/NodeComp.js +12 -1
  5. package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts +1 -1
  6. package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts.map +1 -1
  7. package/dist/gui/GUIComponent.d.ts +1 -0
  8. package/dist/gui/GUIComponent.d.ts.map +1 -1
  9. package/dist/gui/GUISystem.js +2 -2
  10. package/dist/gui/SliderComp.d.ts +16 -0
  11. package/dist/gui/SliderComp.d.ts.map +1 -0
  12. package/dist/gui/SliderComp.js +32 -0
  13. package/dist/render/RenderTextureComp.d.ts +10 -0
  14. package/dist/render/RenderTextureComp.d.ts.map +1 -0
  15. package/dist/render/RenderTextureComp.js +13 -0
  16. package/dist/richtext/RichTextComp.d.ts +1 -0
  17. package/dist/richtext/RichTextComp.d.ts.map +1 -1
  18. package/dist/richtext/RichTextSystem.js +4 -4
  19. package/package.json +3 -3
  20. package/dist/dragonbones/PixiDragonBonesSprite.d.ts +0 -19
  21. package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +0 -1
  22. package/dist/dragonbones/PixiDragonBonesSprite.js +0 -75
  23. package/dist/gworld/components/AnimationComponent.d.ts +0 -65
  24. package/dist/gworld/components/AnimationComponent.d.ts.map +0 -1
  25. package/dist/gworld/components/AnimationComponent.js +0 -141
  26. package/dist/gworld/components/CollideComponent.d.ts +0 -64
  27. package/dist/gworld/components/CollideComponent.d.ts.map +0 -1
  28. package/dist/gworld/components/CollideComponent.js +0 -269
  29. package/dist/gworld/components/EnhancedComponent.d.ts +0 -22
  30. package/dist/gworld/components/EnhancedComponent.d.ts.map +0 -1
  31. package/dist/gworld/components/EnhancedComponent.js +0 -51
  32. package/dist/gworld/components/GUIComponent.d.ts +0 -67
  33. package/dist/gworld/components/GUIComponent.d.ts.map +0 -1
  34. package/dist/gworld/components/GUIComponent.js +0 -166
  35. package/dist/gworld/components/NoRenderComponent.d.ts +0 -38
  36. package/dist/gworld/components/NoRenderComponent.d.ts.map +0 -1
  37. package/dist/gworld/components/NoRenderComponent.js +0 -81
  38. package/dist/gworld/components/NodeComp.d.ts +0 -152
  39. package/dist/gworld/components/NodeComp.d.ts.map +0 -1
  40. package/dist/gworld/components/NodeComp.js +0 -405
  41. package/dist/gworld/components/RenderComponent.d.ts +0 -58
  42. package/dist/gworld/components/RenderComponent.d.ts.map +0 -1
  43. package/dist/gworld/components/RenderComponent.js +0 -166
  44. package/dist/gworld/core/NodePool.d.ts +0 -9
  45. package/dist/gworld/core/NodePool.d.ts.map +0 -1
  46. package/dist/gworld/core/NodePool.js +0 -30
  47. package/dist/gworld/core/Scene.d.ts +0 -5
  48. package/dist/gworld/core/Scene.d.ts.map +0 -1
  49. package/dist/gworld/core/Scene.js +0 -38
  50. package/dist/gworld/core/decorator.d.ts +0 -9
  51. package/dist/gworld/core/decorator.d.ts.map +0 -1
  52. package/dist/gworld/core/decorator.js +0 -43
  53. package/dist/gworld/index.d.ts +0 -8
  54. package/dist/gworld/index.d.ts.map +0 -1
  55. package/dist/gworld/index.js +0 -43
  56. package/dist/gworld/systems/AnimationSystem.d.ts +0 -6
  57. package/dist/gworld/systems/AnimationSystem.d.ts.map +0 -1
  58. package/dist/gworld/systems/AnimationSystem.js +0 -30
  59. package/dist/gworld/systems/CollideSystem.d.ts +0 -20
  60. package/dist/gworld/systems/CollideSystem.d.ts.map +0 -1
  61. package/dist/gworld/systems/CollideSystem.js +0 -171
  62. package/dist/gworld/systems/GUISystem.d.ts +0 -15
  63. package/dist/gworld/systems/GUISystem.d.ts.map +0 -1
  64. package/dist/gworld/systems/GUISystem.js +0 -123
  65. package/dist/gworld/systems/NoRenderSystem.d.ts +0 -16
  66. package/dist/gworld/systems/NoRenderSystem.d.ts.map +0 -1
  67. package/dist/gworld/systems/NoRenderSystem.js +0 -85
  68. package/dist/gworld/systems/RenderSystem.d.ts +0 -22
  69. package/dist/gworld/systems/RenderSystem.d.ts.map +0 -1
  70. package/dist/gworld/systems/RenderSystem.js +0 -104
  71. package/dist/helper/NodePool.d.ts +0 -9
  72. package/dist/helper/NodePool.d.ts.map +0 -1
  73. package/dist/helper/NodePool.js +0 -29
  74. package/dist/helper/html-text-parser.d.ts +0 -30
  75. package/dist/helper/html-text-parser.d.ts.map +0 -1
  76. package/dist/helper/html-text-parser.js +0 -354
  77. package/dist/safex.d.ts +0 -10
  78. package/dist/safex.d.ts.map +0 -1
  79. package/dist/safex.js +0 -25
  80. package/dist/spine/CCSkeleton.d.ts +0 -2
  81. package/dist/spine/CCSkeleton.d.ts.map +0 -1
  82. package/dist/spine/CCSkeleton.js +0 -344
  83. package/dist/spine/CCSkeletonAnimation.d.ts +0 -16
  84. package/dist/spine/CCSkeletonAnimation.d.ts.map +0 -1
  85. package/dist/spine/CCSkeletonAnimation.js +0 -317
  86. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +0 -2
  87. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +0 -1
  88. package/dist/spine/CCSkeletonCanvasRenderCmd.js +0 -225
  89. package/dist/spine/CCSkeletonTexture.d.ts +0 -2
  90. package/dist/spine/CCSkeletonTexture.d.ts.map +0 -1
  91. package/dist/spine/CCSkeletonTexture.js +0 -62
  92. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +0 -2
  93. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +0 -1
  94. package/dist/spine/CCSkeletonWebGLRenderCmd.js +0 -281
  95. package/dist/spine/PixiSpineSprite.d.ts +0 -19
  96. package/dist/spine/PixiSpineSprite.d.ts.map +0 -1
  97. package/dist/spine/PixiSpineSprite.js +0 -72
@@ -1,38 +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.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;
29
- world.entities.reset();
30
- var root = world.entities.create();
31
- var node = root.assign(new NodeComp_1.NodeComp(cc.director.getRunningScene(), root));
32
- var sceneComponent = root.assign(this);
33
- sceneComponent.node = node;
34
- return sceneComponent;
35
- };
36
- return SceneComponent;
37
- }(EnhancedComponent_1.EnhancedComponent));
38
- exports.SceneComponent = SceneComponent;
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,43 +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.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;
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,43 +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.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;
@@ -1,6 +0,0 @@
1
- import { EntityManager, EventManager, System } from 'entityx-ts';
2
- export declare class AnimationSystem implements System {
3
- configure(event_manager: EventManager): void;
4
- update(entities: EntityManager, events: EventManager, dt: Float): void;
5
- }
6
- //# sourceMappingURL=AnimationSystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimationSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/AnimationSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAI5E,qBAAa,eAAgB,YAAW,MAAM;IAC5C,SAAS,CAAC,aAAa,EAAE,YAAY;IAQrC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK;CAUhE"}
@@ -1,30 +0,0 @@
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(entityx_ts_1.EventTypes.ComponentAdded, AnimationComponent_1.AnimationComp, function (_a) {
12
- var entity = _a.entity;
13
- var animation = entity.getComponent(AnimationComponent_1.AnimationComp);
14
- animation.node = entity.getComponent(NodeComp_1.NodeComp);
15
- setTimeout(animation.start.bind(animation), 0);
16
- });
17
- };
18
- AnimationSystem.prototype.update = function (entities, events, dt) {
19
- var animations = entities.entities_with_components(AnimationComponent_1.AnimationComp);
20
- // cc.log(animations);
21
- animations.forEach(function (ett) {
22
- var animation = ett.getComponent(AnimationComponent_1.AnimationComp);
23
- if (animation.node && animation.node.active) {
24
- animation.update(dt);
25
- }
26
- });
27
- };
28
- return AnimationSystem;
29
- }());
30
- exports.AnimationSystem = AnimationSystem;
@@ -1,20 +0,0 @@
1
- import { EntityManager, EventManager, 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
- private onAddCollider;
13
- private onRemoveCollider;
14
- update(entities: EntityManager, events: EventManager, dt: number): void;
15
- addCollider(collider: Collider): void;
16
- removeCollider(collider: Collider): void;
17
- addDebugNode(root: cc.Scene): void;
18
- toggleDebugDraw(enable?: boolean): void;
19
- }
20
- //# sourceMappingURL=CollideSystem.d.ts.map
@@ -1 +0,0 @@
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,171 +0,0 @@
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
- var _this = this;
11
- this.listColliders = [];
12
- this._contracts = [];
13
- this.removeColliders = [];
14
- this.enabledDebugDraw = false;
15
- this.enabled = true;
16
- this.colliderMatrix = [[true]];
17
- this.onAddCollider = function (_a) {
18
- var entity = _a.entity, component = _a.component;
19
- var collider = entity.assign(new CollideComponent_1.Collider(component));
20
- collider.node = entity.getComponent(NodeComp_1.NodeComp);
21
- collider.props = component.props;
22
- // collider.props.enable = true
23
- component.node = entity.getComponent(NodeComp_1.NodeComp);
24
- _this.addCollider(collider);
25
- };
26
- this.onRemoveCollider = function (_a) {
27
- var entity = _a.entity, component = _a.component;
28
- _this.removeColliders.push(component.getComponent(CollideComponent_1.Collider));
29
- };
30
- }
31
- CollideSystem.prototype.configure = function (event_manager) {
32
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, CollideComponent_1.BoxCollider, this.onAddCollider.bind(this));
33
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, CollideComponent_1.CircleCollider, this.onAddCollider.bind(this));
34
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, CollideComponent_1.PolygonCollider, this.onAddCollider.bind(this));
35
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentRemoved, CollideComponent_1.BoxCollider, this.onRemoveCollider.bind(this));
36
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentRemoved, CollideComponent_1.CircleCollider, this.onRemoveCollider.bind(this));
37
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentRemoved, CollideComponent_1.PolygonCollider, this.onRemoveCollider.bind(this));
38
- };
39
- CollideSystem.prototype.update = function (entities, events, dt) {
40
- var _this = this;
41
- if (!this.enabled) {
42
- return;
43
- }
44
- this.listColliders.forEach(function (collider) {
45
- if (!cc.sys.isObjectValid(collider.node.instance)) {
46
- _this.removeColliders.push(collider);
47
- }
48
- });
49
- // this.removeColliders.forEach(comp => {
50
- // this.listColliders = this.listColliders.filter(col => !col.isEqual(comp)
51
- // && cc.sys.isObjectValid(col.node.instance));
52
- // this._contracts = this._contracts.filter(contract => {
53
- // const col1 = contract._collider1;
54
- // const col2 = contract._collider2;
55
- // if (col1.isEqual(comp) || !cc.sys.isObjectValid(col1.node.instance)) {
56
- // if (contract._touching) {
57
- // col2.node.emit('onCollisionExit', col1, col2);
58
- // }
59
- // return false;
60
- // }
61
- // if (col2.isEqual(comp) || !cc.sys.isObjectValid(col2.node.instance)) {
62
- // if (contract._touching) {
63
- // col1.node.emit('onCollisionExit', col2, col1);
64
- // }
65
- // return false;
66
- // }
67
- // return true;
68
- // }
69
- // );
70
- // });
71
- this.removeColliders = [];
72
- var draw;
73
- var _a = this, enabledDebugDraw = _a.enabledDebugDraw, debugGraphics = _a.debugGraphics;
74
- if (enabledDebugDraw) {
75
- draw = debugGraphics;
76
- draw.clear();
77
- // this.listColliders.forEach(collider => {
78
- // if (collider.node && collider.node.active) {
79
- // collider.update(dt, draw);
80
- // }
81
- // });
82
- // } else {
83
- // this.listColliders.forEach(collider => {
84
- // if (collider.node && collider.node.active) {
85
- // collider.update(dt);
86
- // }
87
- // });
88
- }
89
- for (var _i = 0, _b = entities.entities_with_components(CollideComponent_1.BoxCollider); _i < _b.length; _i++) {
90
- var entt = _b[_i];
91
- var comp = entt.getComponent(CollideComponent_1.BoxCollider);
92
- comp.update(dt, draw);
93
- }
94
- for (var _c = 0, _d = entities.entities_with_components(CollideComponent_1.CircleCollider); _c < _d.length; _c++) {
95
- var entt = _d[_c];
96
- var comp = entt.getComponent(CollideComponent_1.CircleCollider);
97
- comp.update(dt, draw);
98
- }
99
- for (var _e = 0, _f = entities.entities_with_components(CollideComponent_1.PolygonCollider); _e < _f.length; _e++) {
100
- var entt = _f[_e];
101
- var comp = entt.getComponent(CollideComponent_1.PolygonCollider);
102
- comp.update(dt, draw);
103
- }
104
- this._contracts.forEach(function (contract) {
105
- var col1 = contract._collider1;
106
- var col2 = contract._collider2;
107
- if (!cc.sys.isObjectValid(col1.node.instance) ||
108
- !cc.sys.isObjectValid(col2.node.instance) ||
109
- !col1.node ||
110
- !col2.node ||
111
- !col1.node.active ||
112
- !col2.node.active) {
113
- return;
114
- }
115
- var type = contract.updateState();
116
- switch (type) {
117
- case CollideComponent_1.CollisionType.ENTER: {
118
- if (col1.props.onCollisionEnter) {
119
- col1.props.onCollisionEnter(col2);
120
- }
121
- if (col2.props.onCollisionEnter) {
122
- col2.props.onCollisionEnter(col1);
123
- }
124
- break;
125
- }
126
- case CollideComponent_1.CollisionType.STAY:
127
- if (col1.props.onCollisionStay) {
128
- col1.props.onCollisionStay(col2);
129
- }
130
- if (col2.props.onCollisionStay) {
131
- col2.props.onCollisionStay(col1);
132
- }
133
- break;
134
- case CollideComponent_1.CollisionType.EXIT:
135
- if (col1.props.onCollisionExit) {
136
- col1.props.onCollisionExit(col2);
137
- }
138
- if (col2.props.onCollisionExit) {
139
- col2.props.onCollisionExit(col1);
140
- }
141
- break;
142
- default:
143
- break;
144
- }
145
- });
146
- };
147
- CollideSystem.prototype.addCollider = function (collider) {
148
- var _this = this;
149
- this.listColliders.forEach(function (col) {
150
- if ((0, utils_1.shouldCollider)(col, collider)) {
151
- _this._contracts.push(new CollideComponent_1.Contract(col, collider));
152
- }
153
- });
154
- this.listColliders.push(collider);
155
- };
156
- CollideSystem.prototype.removeCollider = function (collider) {
157
- this.removeColliders.push(collider);
158
- };
159
- CollideSystem.prototype.addDebugNode = function (root) {
160
- this.debugGraphics = new cc.DrawNode();
161
- this.debugGraphics.zIndex = 1000;
162
- root.addChild(this.debugGraphics);
163
- };
164
- CollideSystem.prototype.toggleDebugDraw = function (enable) {
165
- if (enable === void 0) { enable = true; }
166
- this.enabledDebugDraw = enable;
167
- this.addDebugNode(cc.director.getRunningScene());
168
- };
169
- return CollideSystem;
170
- }());
171
- exports.CollideSystem = CollideSystem;
@@ -1,15 +0,0 @@
1
- import { EntityManager, EventManager, System } from 'entityx-ts';
2
- export declare class GUISystem implements System {
3
- defaultFont: string;
4
- configure(event_manager: EventManager): void;
5
- private onAddButtonComp;
6
- private onAddProgressTimerComp;
7
- private onAddLabelComp;
8
- private onAddLabelOutlineComp;
9
- private onAddLabelShadowComp;
10
- private onAddRichTextComp;
11
- private onAddScrollViewComp;
12
- private onAddBlockInputEventsComp;
13
- update(entities: EntityManager, events: EventManager, dt: number): any;
14
- }
15
- //# sourceMappingURL=GUISystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/GUISystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAiBlG,qBAAa,SAAU,YAAW,MAAM;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,aAAa,EAAE,YAAY;IAWrC,OAAO,CAAC,eAAe,CAuBtB;IAED,OAAO,CAAC,sBAAsB,CAa7B;IAED,OAAO,CAAC,cAAc,CAMrB;IAED,OAAO,CAAC,qBAAqB,CAM5B;IAED,OAAO,CAAC,oBAAoB,CAM3B;IAED,OAAO,CAAC,iBAAiB,CAQxB;IAED,OAAO,CAAC,mBAAmB,CAU1B;IAED,OAAO,CAAC,yBAAyB,CAOhC;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
@@ -1,123 +0,0 @@
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
- var _this = this;
12
- this.onAddButtonComp = function (_a) {
13
- var entity = _a.entity, button = _a.component;
14
- var nodeComp = entity.getComponent(NodeComp_1.NodeComp);
15
- // const { normalImage, selectedImage, disableImage, texType, zoomScale } = button
16
- button.node = nodeComp;
17
- var touchComp = entity.assign(new __1.TouchEventRegister());
18
- touchComp.props.onTouchStart = function (touch) {
19
- var p = touch.getLocation();
20
- // console.log('onTouchBegan', p, nodeComp)
21
- var rect = nodeComp.getBoundingBox();
22
- var nodeSpaceLocation = nodeComp.parent.convertToNodeSpace(p);
23
- if (rect.contains(nodeSpaceLocation) && button.enabled && nodeComp.active) {
24
- var scale = cc.scaleTo(0.3, 1.2);
25
- nodeComp.runAction(scale);
26
- button.props.onPress(button);
27
- // return true
28
- }
29
- };
30
- touchComp.props.onTouchEnd = function () {
31
- var scale = cc.scaleTo(0.3, 1);
32
- nodeComp.runAction(scale);
33
- // return true
34
- };
35
- touchComp.props.onTouchCancel = touchComp.props.onTouchEnd;
36
- };
37
- this.onAddProgressTimerComp = function (_a) {
38
- var entity = _a.entity, bar = _a.component;
39
- var _b = bar.props, spriteFrame = _b.spriteFrame, _c = _b.fillType, fillType = _c === void 0 ? GUIComponent_1.FillType.HORIZONTAL : _c, _d = _b.fillRange, fillRange = _d === void 0 ? 1 : _d, _e = _b.fillCenter, fillCenter = _e === void 0 ? (0, polyfills_1.Vec2)(1, 0) : _e;
40
- var sprite = new cc.Sprite(spriteFrame);
41
- var pTimer = new cc.ProgressTimer(sprite);
42
- var ptt = fillType === GUIComponent_1.FillType.RADIAL ? cc.ProgressTimer.TYPE_RADIAL : cc.ProgressTimer.TYPE_BAR;
43
- pTimer.setType(ptt);
44
- if (fillType !== GUIComponent_1.FillType.RADIAL) {
45
- var rate = fillType === GUIComponent_1.FillType.HORIZONTAL ? cc.p(1, 0) : cc.p(0, 1);
46
- pTimer.setBarChangeRate(rate);
47
- }
48
- pTimer.setPercentage(fillRange * 100);
49
- pTimer.setMidpoint(fillCenter);
50
- bar.node = entity.assign(new NodeComp_1.NodeComp(pTimer, entity));
51
- };
52
- this.onAddLabelComp = function (_a) {
53
- var entity = _a.entity, label = _a.component;
54
- var _b = label.props, _c = _b.string, string = _c === void 0 ? '' : _c, _d = _b.font, font = _d === void 0 ? _this.defaultFont : _d, _e = _b.size, size = _e === void 0 ? 64 : _e;
55
- var fontName = cc.path.basename(font, '.ttf');
56
- var node = new ccui.Text(string, fontName, size);
57
- node.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM);
58
- label.node = entity.assign(new NodeComp_1.NodeComp(node, entity));
59
- };
60
- this.onAddLabelOutlineComp = function (_a) {
61
- var entity = _a.entity, outline = _a.component;
62
- var _b = outline.props, color = _b.color, width = _b.width;
63
- var node = entity.getComponent(NodeComp_1.NodeComp);
64
- if (node.instance instanceof ccui.Text) {
65
- node.instance.enableOutline(color, width);
66
- }
67
- };
68
- this.onAddLabelShadowComp = function (_a) {
69
- var entity = _a.entity, shadow = _a.component;
70
- var _b = shadow.props, color = _b.color, blur = _b.blur, offset = _b.offset;
71
- var node = entity.getComponent(NodeComp_1.NodeComp);
72
- if (node.instance instanceof ccui.Text) {
73
- node.instance.enableShadow(color, offset, blur);
74
- }
75
- };
76
- this.onAddRichTextComp = function (_a) {
77
- var entity = _a.entity, rich = _a.component;
78
- var _b = rich.props.string, string = _b === void 0 ? '' : _b;
79
- var node = new ccui.RichText();
80
- node.width = 500;
81
- node.height = 300;
82
- node.ignoreContentAdaptWithSize(false);
83
- rich.node = entity.assign(new NodeComp_1.NodeComp(node, entity));
84
- rich.string = string;
85
- };
86
- this.onAddScrollViewComp = function (_a) {
87
- var entity = _a.entity, scrollView = _a.component;
88
- var _b = scrollView.props, viewSize = _b.viewSize, contentSize = _b.contentSize, _c = _b.direction, direction = _c === void 0 ? cc.SCROLLVIEW_DIRECTION_VERTICAL : _c;
89
- var node = new cc.ScrollView(viewSize);
90
- node.setContentSize(contentSize);
91
- node.setViewSize(viewSize);
92
- node.setDirection(direction);
93
- // node.setContentOffset(cc.p(0, viewSize.height - contentSize.height))
94
- // node.setTouchEnabled(false)
95
- node.setBounceable(false);
96
- scrollView.node = entity.assign(new NodeComp_1.NodeComp(node, entity));
97
- };
98
- this.onAddBlockInputEventsComp = function (_a) {
99
- var entity = _a.entity, blockInput = _a.component;
100
- var node = entity.getComponent(NodeComp_1.NodeComp);
101
- if (node.instance instanceof ccui.ImageView) {
102
- node.instance.setTouchEnabled(true);
103
- node.instance.setScale9Enabled(true);
104
- }
105
- blockInput.node = node;
106
- };
107
- }
108
- GUISystem.prototype.configure = function (event_manager) {
109
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.ButtonComp, this.onAddButtonComp);
110
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.ProgressTimerComp, this.onAddProgressTimerComp);
111
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.LabelComp, this.onAddLabelComp);
112
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.LabelOutlineComp, this.onAddLabelOutlineComp);
113
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.LabelShadowComp, this.onAddLabelShadowComp);
114
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.RichTextComp, this.onAddRichTextComp);
115
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.ScrollViewComp, this.onAddScrollViewComp);
116
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, GUIComponent_1.BlockInputEventsComp, this.onAddBlockInputEventsComp);
117
- };
118
- GUISystem.prototype.update = function () {
119
- // throw new Error('Method not implemented.');
120
- };
121
- return GUISystem;
122
- }());
123
- exports.GUISystem = GUISystem;
@@ -1,16 +0,0 @@
1
- import { EntityManager, EventManager, System } from 'entityx-ts';
2
- export declare class NoRenderSystem implements System {
3
- configure(event_manager: EventManager): void;
4
- onAddTouchEventRegister: ({ entity, component }: {
5
- entity: any;
6
- component: any;
7
- }) => void;
8
- onAddExtraDataComp: ({ component }: {
9
- component: any;
10
- }) => void;
11
- onRemovedTouchEventRegister: ({ component }: {
12
- component: any;
13
- }) => void;
14
- update(entities: EntityManager, events: EventManager, dt: number): any;
15
- }
16
- //# sourceMappingURL=NoRenderSystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoRenderSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/NoRenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAM5E,qBAAa,cAAe,YAAW,MAAM;IAC3C,SAAS,CAAC,aAAa,EAAE,YAAY;IAMrC,uBAAuB;;;eAiDtB;IAED,kBAAkB;;eAIjB;IAED,2BAA2B;;eAM1B;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
@@ -1,85 +0,0 @@
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
- this.onAddTouchEventRegister = function (_a) {
10
- var entity = _a.entity, component = _a.component;
11
- var ett = entity;
12
- var touchComp = component;
13
- var nodeComp = ett.getComponent(NodeComp_1.NodeComp);
14
- touchComp.node = nodeComp;
15
- touchComp.listener = cc.eventManager.addListener({
16
- event: cc.EventListener.TOUCH_ONE_BY_ONE,
17
- swallowTouches: true,
18
- onTouchBegan: function (touch) {
19
- var onTouchStart = touchComp.props.onTouchStart;
20
- // console.log('onTouchBegan', onTouchStart)
21
- if (!nodeComp.parent) {
22
- if (onTouchStart) {
23
- onTouchStart(touch, nodeComp);
24
- }
25
- return true;
26
- }
27
- var p = touch.getLocation();
28
- var rect = nodeComp.getBoundingBox();
29
- var nodeSpaceLocation = nodeComp.parent.convertToNodeSpace(p);
30
- if (rect.contains(nodeSpaceLocation)) {
31
- if (onTouchStart) {
32
- onTouchStart(touch, nodeComp);
33
- }
34
- return true;
35
- }
36
- },
37
- onTouchMoved: function (touch) {
38
- var onTouchMove = touchComp.props.onTouchMove;
39
- if (!onTouchMove)
40
- return false;
41
- onTouchMove(touch, nodeComp);
42
- return true;
43
- },
44
- onTouchEnded: function (touch) {
45
- var onTouchEnd = touchComp.props.onTouchEnd;
46
- if (!onTouchEnd)
47
- return false;
48
- onTouchEnd(touch, nodeComp);
49
- return true;
50
- },
51
- onTouchCancelled: function (touch) {
52
- var onTouchCancel = touchComp.props.onTouchCancel;
53
- if (!onTouchCancel)
54
- return false;
55
- onTouchCancel(touch, nodeComp);
56
- return true;
57
- },
58
- }, nodeComp.instance);
59
- };
60
- this.onAddExtraDataComp = function (_a) {
61
- var component = _a.component;
62
- var extra = component;
63
- var _b = extra.props, key = _b.key, value = _b.value;
64
- extra.data[key] = value;
65
- };
66
- this.onRemovedTouchEventRegister = function (_a) {
67
- var component = _a.component;
68
- var touchComp = component;
69
- if (touchComp.listener) {
70
- cc.eventManager.removeListener(touchComp.listener);
71
- touchComp.listener = null;
72
- }
73
- };
74
- }
75
- NoRenderSystem.prototype.configure = function (event_manager) {
76
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, NoRenderComponent_1.ExtraDataComp, this.onAddExtraDataComp);
77
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, NoRenderComponent_1.TouchEventRegister, this.onAddTouchEventRegister);
78
- event_manager.subscribe(entityx_ts_1.EventTypes.ComponentRemoved, NoRenderComponent_1.TouchEventRegister, this.onRemovedTouchEventRegister);
79
- };
80
- NoRenderSystem.prototype.update = function () {
81
- // throw new Error('Method not implemented.');
82
- };
83
- return NoRenderSystem;
84
- }());
85
- exports.NoRenderSystem = NoRenderSystem;