@safe-engine/cocos 1.8.1 → 1.8.2

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 (94) hide show
  1. package/dist/animation/AnimationSystem.js +1 -1
  2. package/dist/collider/CollideComponent.d.ts +1 -1
  3. package/dist/collider/CollideComponent.d.ts.map +1 -1
  4. package/dist/collider/CollideComponent.js +1 -1
  5. package/dist/collider/CollideSystem.js +1 -1
  6. package/dist/{gworld/components → core}/EnhancedComponent.d.ts +1 -1
  7. package/dist/core/EnhancedComponent.d.ts.map +1 -0
  8. package/dist/{gworld/components → core}/NodeComp.d.ts +1 -1
  9. package/dist/core/NodeComp.d.ts.map +1 -0
  10. package/dist/{gworld/components → core}/NodeComp.js +3 -3
  11. package/dist/{gworld/core → core}/NodePool.d.ts +1 -1
  12. package/dist/core/NodePool.d.ts.map +1 -0
  13. package/dist/core/Scene.d.ts +5 -0
  14. package/dist/core/Scene.d.ts.map +1 -0
  15. package/dist/{gworld/core → core}/Scene.js +3 -3
  16. package/dist/{gworld/core → core}/decorator.d.ts +2 -2
  17. package/dist/core/decorator.d.ts.map +1 -0
  18. package/dist/{gworld/core → core}/decorator.js +2 -2
  19. package/dist/core/index.d.ts +6 -0
  20. package/dist/core/index.d.ts.map +1 -0
  21. package/dist/core/index.js +5 -0
  22. package/dist/dragonbones/index.d.ts +1 -1
  23. package/dist/dragonbones/index.d.ts.map +1 -1
  24. package/dist/dragonbones/index.js +2 -2
  25. package/dist/gui/GUIComponent.d.ts +1 -1
  26. package/dist/gui/GUIComponent.d.ts.map +1 -1
  27. package/dist/gui/GUIComponent.js +1 -1
  28. package/dist/gui/GUISystem.d.ts.map +1 -1
  29. package/dist/gui/GUISystem.js +2 -2
  30. package/dist/gworld/decorator.d.ts +1 -2
  31. package/dist/gworld/decorator.d.ts.map +1 -1
  32. package/dist/gworld/decorator.js +1 -2
  33. package/dist/gworld/index.d.ts +0 -5
  34. package/dist/gworld/index.d.ts.map +1 -1
  35. package/dist/gworld/index.js +0 -5
  36. package/dist/helper/index.d.ts +5 -0
  37. package/dist/helper/index.d.ts.map +1 -0
  38. package/dist/helper/index.js +4 -0
  39. package/dist/index.d.ts +2 -4
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +2 -4
  42. package/dist/norender/NoRenderComponent.d.ts +3 -2
  43. package/dist/norender/NoRenderComponent.d.ts.map +1 -1
  44. package/dist/norender/NoRenderComponent.js +1 -1
  45. package/dist/norender/NoRenderSystem.js +1 -1
  46. package/dist/render/RenderComponent.d.ts +2 -2
  47. package/dist/render/RenderComponent.d.ts.map +1 -1
  48. package/dist/render/RenderComponent.js +1 -1
  49. package/dist/render/RenderSystem.js +1 -1
  50. package/dist/richtext/RichTextComp.d.ts +1 -1
  51. package/dist/richtext/RichTextComp.d.ts.map +1 -1
  52. package/dist/richtext/RichTextComp.js +1 -1
  53. package/package.json +1 -1
  54. package/dist/gworld/components/AnimationComponent.d.ts +0 -65
  55. package/dist/gworld/components/AnimationComponent.d.ts.map +0 -1
  56. package/dist/gworld/components/AnimationComponent.js +0 -141
  57. package/dist/gworld/components/CollideComponent.d.ts +0 -64
  58. package/dist/gworld/components/CollideComponent.d.ts.map +0 -1
  59. package/dist/gworld/components/CollideComponent.js +0 -265
  60. package/dist/gworld/components/EnhancedComponent.d.ts.map +0 -1
  61. package/dist/gworld/components/GUIComponent.d.ts +0 -93
  62. package/dist/gworld/components/GUIComponent.d.ts.map +0 -1
  63. package/dist/gworld/components/GUIComponent.js +0 -77
  64. package/dist/gworld/components/NoRenderComponent.d.ts +0 -38
  65. package/dist/gworld/components/NoRenderComponent.d.ts.map +0 -1
  66. package/dist/gworld/components/NoRenderComponent.js +0 -41
  67. package/dist/gworld/components/NodeComp.d.ts.map +0 -1
  68. package/dist/gworld/components/RenderComponent.d.ts +0 -52
  69. package/dist/gworld/components/RenderComponent.d.ts.map +0 -1
  70. package/dist/gworld/components/RenderComponent.js +0 -84
  71. package/dist/gworld/core/NodePool.d.ts.map +0 -1
  72. package/dist/gworld/core/Scene.d.ts +0 -5
  73. package/dist/gworld/core/Scene.d.ts.map +0 -1
  74. package/dist/gworld/core/decorator.d.ts.map +0 -1
  75. package/dist/gworld/systems/AnimationSystem.d.ts +0 -6
  76. package/dist/gworld/systems/AnimationSystem.d.ts.map +0 -1
  77. package/dist/gworld/systems/AnimationSystem.js +0 -30
  78. package/dist/gworld/systems/CollideSystem.d.ts +0 -20
  79. package/dist/gworld/systems/CollideSystem.d.ts.map +0 -1
  80. package/dist/gworld/systems/CollideSystem.js +0 -171
  81. package/dist/gworld/systems/GUISystem.d.ts +0 -15
  82. package/dist/gworld/systems/GUISystem.d.ts.map +0 -1
  83. package/dist/gworld/systems/GUISystem.js +0 -112
  84. package/dist/gworld/systems/NoRenderSystem.d.ts +0 -16
  85. package/dist/gworld/systems/NoRenderSystem.d.ts.map +0 -1
  86. package/dist/gworld/systems/NoRenderSystem.js +0 -75
  87. package/dist/gworld/systems/RenderSystem.d.ts +0 -21
  88. package/dist/gworld/systems/RenderSystem.d.ts.map +0 -1
  89. package/dist/gworld/systems/RenderSystem.js +0 -74
  90. package/dist/helper/html-text-parser.d.ts +0 -30
  91. package/dist/helper/html-text-parser.d.ts.map +0 -1
  92. package/dist/helper/html-text-parser.js +0 -354
  93. /package/dist/{gworld/components → core}/EnhancedComponent.js +0 -0
  94. /package/dist/{gworld/core → core}/NodePool.js +0 -0
@@ -1,38 +0,0 @@
1
- import { Touch } from '../../polyfills';
2
- import { NoRenderComponentX } from '../decorator';
3
- import { EventCallbackType, NodeComp } from '../NodeComp';
4
- type TouchEVentCallback = (touch?: Touch, node?: NodeComp) => void;
5
- export interface EventMap {
6
- [key: string]: [EventCallbackType];
7
- }
8
- export declare class EventRegister extends NoRenderComponentX {
9
- events: EventMap;
10
- on(name: string, callback: EventCallbackType, target?: any): void;
11
- off(name: string, callback?: EventCallbackType, target?: any): any;
12
- emit(name: string, ...params: any): void;
13
- }
14
- interface TouchEventProps {
15
- onTouchStart?: TouchEVentCallback;
16
- onTouchMove?: TouchEVentCallback;
17
- onTouchEnd?: TouchEVentCallback;
18
- onTouchCancel?: TouchEVentCallback;
19
- }
20
- export declare class TouchEventRegister extends NoRenderComponentX<TouchEventProps> {
21
- listener: cc.EventListener;
22
- touch: cc.Touch;
23
- setEnabled(enabled: boolean): void;
24
- }
25
- interface ExtraDataProps {
26
- key: string;
27
- value: Integer | Float | string;
28
- }
29
- export declare class ExtraDataComp extends NoRenderComponentX<ExtraDataProps> {
30
- data: {
31
- [key: string]: any;
32
- };
33
- getData<T>(key: string): T;
34
- setData<T>(key: string, val: T): void;
35
- removeData(key: string): void;
36
- }
37
- export { };
38
- //# sourceMappingURL=NoRenderComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoRenderComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/NoRenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAExD,KAAK,kBAAkB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAA;AAElE,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC,CAAA;CACnC;AAED,qBAAa,aAAc,SAAQ,kBAAkB;IACnD,MAAM,EAAE,QAAQ,CAAK;IAErB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAS1D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAK5D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;CAMlC;AAED,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,aAAa,CAAC,EAAE,kBAAkB,CAAA;CACnC;AACD,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IACzE,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAA;IAC1B,KAAK,EAAE,EAAE,CAAC,KAAK,CAAA;IACf,UAAU,CAAC,OAAO,EAAE,OAAO;CAG5B;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;CAChC;AACD,qBAAa,aAAc,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACnE,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAK;IACjC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAG1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAG9B,UAAU,CAAC,GAAG,EAAE,MAAM;CAGvB"}
@@ -1,41 +0,0 @@
1
- import { NoRenderComponentX } from '../core/decorator';
2
- export class EventRegister extends NoRenderComponentX {
3
- events = {};
4
- on(name, callback, target) {
5
- const bound = target ? callback.bind(target) : callback;
6
- if (this.events[name]) {
7
- this.events[name].push(bound);
8
- }
9
- else {
10
- this.events[name] = [bound];
11
- }
12
- }
13
- off(name) {
14
- this.events[name] = undefined;
15
- }
16
- emit(name, ...params) {
17
- // if (!this.node || !this.node.active || !this.enabled) return
18
- if (this.events[name]) {
19
- this.events[name].forEach((fc) => fc(...params));
20
- }
21
- }
22
- }
23
- export class TouchEventRegister extends NoRenderComponentX {
24
- listener;
25
- touch;
26
- setEnabled(enabled) {
27
- this.listener.setEnabled(enabled);
28
- }
29
- }
30
- export class ExtraDataComp extends NoRenderComponentX {
31
- data = {};
32
- getData(key) {
33
- return this.data[key];
34
- }
35
- setData(key, val) {
36
- this.data[key] = val;
37
- }
38
- removeData(key) {
39
- delete this.data[key];
40
- }
41
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAA;AACjD,qBAAa,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,CAAA;IACX,MAAM,EAAE,QAAQ,CAAA;IAChB,QAAQ,EAAE,QAAQ,EAAE,CAAK;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,MAAM,CAAA;IACd,OAAO,CAAC,OAAO,CAAO;gBAEV,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IAKvC,IAAI,IAAI,WAEP;IAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAE7B;IAED,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,EAErB;IAED,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAE3B;IAED,IAAI,IAAI,IAIM,MAAM,CAFnB;IAED,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,EAEnB;IAED,IAAI,IAAI,IAIM,MAAM,CAFnB;IAED,IAAI,IAAI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,MAAM,CAAC,EAAE,MAAM;IAIxC,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc;IAIhC,cAAc;IAId,0BAA0B;IAK1B,2BAA2B;IAK3B,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO;IAkBlC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAQvD,iBAAiB,CAAC,OAAO,CAAC,KAAA;IAM1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAM1B,OAAO,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAQjE,UAAU,CAAC,GAAG,EAAE,MAAM;IAOtB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC;CAOhE"}
@@ -1,52 +0,0 @@
1
- import { Color4B, Vec2 } from '../../polyfills';
2
- import { BaseComponentProps, ColorSource } from '../../safex';
3
- import { ComponentX } from '../decorator';
4
- export declare class NodeRender extends ComponentX {
5
- nodeName: string;
6
- }
7
- interface SpriteRenderProps {
8
- spriteFrame: string;
9
- texType?: number;
10
- type?: number;
11
- }
12
- export declare class SpriteRender extends ComponentX<SpriteRenderProps & BaseComponentProps<SpriteRender>, cc.Sprite> {
13
- get spriteFrame(): string;
14
- set spriteFrame(frame: string);
15
- }
16
- interface MaskRenderProps {
17
- type?: number;
18
- segments?: number;
19
- inverted?: boolean;
20
- }
21
- export declare class MaskRender extends ComponentX<MaskRenderProps, cc.ClippingNode> {
22
- }
23
- interface ParticleCompProps {
24
- plistFile: string;
25
- }
26
- export declare class ParticleComp extends ComponentX<ParticleCompProps, cc.ParticleSystem> {
27
- }
28
- interface GraphicsRenderProps {
29
- lineWidth?: number;
30
- strokeColor?: ColorSource;
31
- fillColor?: ColorSource;
32
- }
33
- export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & BaseComponentProps<GraphicsRender>, cc.DrawNode> {
34
- lineWidth: number;
35
- strokeColor: cc.Color;
36
- fillColor: cc.Color;
37
- drawDot(x: any, y: any, r: any): void;
38
- drawLine(origin: Vec2, destination: Vec2, thickness: Float, color: Color4B): void;
39
- drawRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
40
- drawCircle(center: Vec2, radius: Float, angle?: Float, segments?: Integer, drawLineToCenter?: boolean, lineWidth?: Float, color?: Color4B): void;
41
- drawPoly(points: Vec2[], color?: Color4B, thickness?: Float): void;
42
- clear(): void;
43
- }
44
- interface TiledMapProps {
45
- mapFile: string;
46
- }
47
- export declare class TiledMap extends ComponentX<TiledMapProps & {
48
- $ref?: TiledMap;
49
- }, cc.TMXTiledMap> {
50
- }
51
- export { };
52
- //# sourceMappingURL=RenderComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAO,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,qBAAa,UAAW,SAAQ,UAAU;IACxC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,qBAAa,YAAa,SAAQ,UAAU,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;IAC3G,IAAI,WAAW,WAEd;IAED,IAAI,WAAW,CAAC,KAAK,QAAA,EAepB;CACF;AACD,UAAU,eAAe;IACvB,IAAI,CAA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B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,QAAS,SAAQ,UAAU,CAAC,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAE,EAAE,EAAE,CAAC,WAAW,CAAC;CAAG"}
@@ -1,84 +0,0 @@
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;
9
- }
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)
25
- }
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) {
36
- this.node.instance.drawDot(cc.p(x, y), r, this.fillColor);
37
- }
38
- // drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
39
- // }
40
- // // drawPoints(points: Vec2[], color: Color4B) {
41
- // // }
42
- drawLine(origin, destination, thickness, color) {
43
- this.node.instance.drawSegment(origin, destination, thickness, color);
44
- }
45
- drawRect(origin, destination, color) {
46
- this.node.instance.drawRect(origin, destination, color);
47
- }
48
- // drawSolidRect(origin: Vec2, destination: Vec2, color: Color4B) {
49
- // }
50
- drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color) {
51
- this.node.instance.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color);
52
- }
53
- // drawSolidCircle(origin: Vec2, destination: Vec2, color: Color4B) {
54
- // }
55
- // drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B) {
56
- // }
57
- // drawCubicBezier(origin: Vec2, destination: Vec2, color: Color4B) {
58
- // }
59
- // drawCardinalSpline(points: Vec2[], color: Color4B) {
60
- // }
61
- // drawCatmullRom(points: Vec2[], color: Color4B) {
62
- // }
63
- drawPoly(points, color, thickness) {
64
- this.node.instance.drawPoly(points, color, thickness);
65
- }
66
- // drawSolidPoly(points: Vec2[], color: Color4B) {
67
- // this.node.instance.drawPoly(points, color)
68
- // }
69
- // drawDot(points: Vec2[], color: Color4B) {
70
- // }
71
- // drawSegment(from: Vec2, to: Vec2, color: Color4B) {
72
- // }
73
- // drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B) {
74
- // this.node.instance.poly([p1, p2, p3], true)
75
- // this.node.instance.fill(color)
76
- // }
77
- clear() {
78
- if (this.node.instance instanceof cc.DrawNode) {
79
- this.node.instance.clear();
80
- }
81
- }
82
- }
83
- export class TiledMap extends ComponentX {
84
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodePool.d.ts","sourceRoot":"","sources":["../../../src/gworld/core/NodePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,qBAAa,QAAQ;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAK;IAEtB,GAAG,CAAC,IAAI,EAAE,QAAQ;IAQlB,GAAG,IAAI,QAAQ;IAOf,IAAI;IAIJ,KAAK;CAIN"}
@@ -1,5 +0,0 @@
1
- import { EnhancedComponent } from '../EnhancedComponent';
2
- export declare class SceneComponent extends EnhancedComponent {
3
- render(): this;
4
- }
5
- //# sourceMappingURL=Scene.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../src/gworld/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAGnE,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CASP"}
@@ -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,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;AAK5E,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 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 onAddScrollViewComp;
11
- private onAddBlockInputEventsComp;
12
- private onAddInputComp;
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,CAc7B;IAED,OAAO,CAAC,cAAc,CAMrB;IAED,OAAO,CAAC,qBAAqB,CAM5B;IAED,OAAO,CAAC,oBAAoB,CAM3B;IAED,OAAO,CAAC,mBAAmB,CAU1B;IAED,OAAO,CAAC,yBAAyB,CAOhC;IAED,OAAO,CAAC,cAAc,CAWrB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
@@ -1,112 +0,0 @@
1
- import { EventTypes } from 'entityx-ts';
2
- import { TouchEventRegister } from '../..';
3
- import { Vec2 } from '../../polyfills';
4
- import { BlockInputEventsComp, ButtonComp, FillType, InputComp, LabelComp, LabelOutlineComp, LabelShadowComp, ProgressTimerComp, ScrollViewComp, } from '../components/GUIComponent';
5
- import { NodeComp } from '../components/NodeComp';
6
- export class GUISystem {
7
- defaultFont;
8
- configure(event_manager) {
9
- event_manager.subscribe(EventTypes.ComponentAdded, ButtonComp, this.onAddButtonComp);
10
- event_manager.subscribe(EventTypes.ComponentAdded, ProgressTimerComp, this.onAddProgressTimerComp);
11
- event_manager.subscribe(EventTypes.ComponentAdded, LabelComp, this.onAddLabelComp);
12
- event_manager.subscribe(EventTypes.ComponentAdded, LabelOutlineComp, this.onAddLabelOutlineComp);
13
- event_manager.subscribe(EventTypes.ComponentAdded, LabelShadowComp, this.onAddLabelShadowComp);
14
- event_manager.subscribe(EventTypes.ComponentAdded, ScrollViewComp, this.onAddScrollViewComp);
15
- event_manager.subscribe(EventTypes.ComponentAdded, InputComp, this.onAddInputComp);
16
- event_manager.subscribe(EventTypes.ComponentAdded, BlockInputEventsComp, this.onAddBlockInputEventsComp);
17
- }
18
- onAddButtonComp = ({ entity, component: button }) => {
19
- const nodeComp = entity.getComponent(NodeComp);
20
- const { zoomScale = 1.2 } = button.props;
21
- button.node = nodeComp;
22
- const lastScaleX = nodeComp.scaleX;
23
- const lastScaleY = nodeComp.scaleY;
24
- const touchComp = entity.assign(new TouchEventRegister());
25
- touchComp.props.onTouchStart = function (touch) {
26
- const p = touch.getLocation();
27
- // console.log('onTouchBegan', p, lastScaleX, lastScaleY)
28
- const rect = nodeComp.getBoundingBox();
29
- const nodeSpaceLocation = nodeComp.parent.convertToNodeSpace(p);
30
- if (rect.contains(nodeSpaceLocation) && button.enabled && nodeComp.active) {
31
- const scale = cc.scaleTo(0.3, zoomScale * lastScaleX, lastScaleY * zoomScale);
32
- nodeComp.runAction(scale);
33
- button.props.onPress(button);
34
- }
35
- };
36
- touchComp.props.onTouchEnd = function () {
37
- const scale = cc.scaleTo(0.3, lastScaleX, lastScaleY);
38
- nodeComp.runAction(scale);
39
- };
40
- touchComp.props.onTouchCancel = touchComp.props.onTouchEnd;
41
- };
42
- onAddProgressTimerComp = ({ entity, component: bar }) => {
43
- const { spriteFrame, fillType = FillType.HORIZONTAL, fillRange = 1, fillCenter = Vec2(0, 0) } = bar.props;
44
- const frame = cc.spriteFrameCache.getSpriteFrame(spriteFrame);
45
- const sprite = new cc.Sprite(frame || spriteFrame);
46
- const pTimer = new cc.ProgressTimer(sprite);
47
- const ptt = fillType === FillType.RADIAL ? cc.ProgressTimer.TYPE_RADIAL : cc.ProgressTimer.TYPE_BAR;
48
- pTimer.setType(ptt);
49
- if (fillType !== FillType.RADIAL) {
50
- const rate = fillType === FillType.HORIZONTAL ? cc.p(1, 0) : cc.p(0, 1);
51
- pTimer.setBarChangeRate(rate);
52
- }
53
- pTimer.setPercentage(fillRange * 100);
54
- pTimer.setMidpoint(fillCenter);
55
- bar.node = entity.assign(new NodeComp(pTimer, entity));
56
- };
57
- onAddLabelComp = ({ entity, component: label }) => {
58
- const { string = '', font = this.defaultFont, size = 64 } = label.props;
59
- const fontName = cc.path.basename(font, '.ttf');
60
- const node = new ccui.Text(string, fontName, size);
61
- node.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM);
62
- label.node = entity.assign(new NodeComp(node, entity));
63
- };
64
- onAddLabelOutlineComp = ({ entity, component: outline }) => {
65
- const { color, width } = outline.props;
66
- const node = entity.getComponent(NodeComp);
67
- if (node.instance instanceof ccui.Text) {
68
- node.instance.enableOutline(color, width);
69
- }
70
- };
71
- onAddLabelShadowComp = ({ entity, component: shadow }) => {
72
- const { color, blur, offset } = shadow.props;
73
- const node = entity.getComponent(NodeComp);
74
- if (node.instance instanceof ccui.Text) {
75
- node.instance.enableShadow(color, offset, blur);
76
- }
77
- };
78
- onAddScrollViewComp = ({ entity, component: scrollView }) => {
79
- const { viewSize, contentSize, direction = cc.SCROLLVIEW_DIRECTION_VERTICAL } = scrollView.props;
80
- const node = new cc.ScrollView(viewSize);
81
- node.setContentSize(contentSize);
82
- node.setViewSize(viewSize);
83
- node.setDirection(direction);
84
- // node.setContentOffset(cc.p(0, viewSize.height - contentSize.height))
85
- // node.setTouchEnabled(false)
86
- node.setBounceable(false);
87
- scrollView.node = entity.assign(new NodeComp(node, entity));
88
- };
89
- onAddBlockInputEventsComp = ({ entity, component: blockInput }) => {
90
- const node = entity.getComponent(NodeComp);
91
- if (node.instance instanceof ccui.ImageView) {
92
- node.instance.setTouchEnabled(true);
93
- node.instance.setScale9Enabled(true);
94
- }
95
- blockInput.node = node;
96
- };
97
- onAddInputComp = ({ entity, component: textInput }) => {
98
- const { placeHolder = '', font = this.defaultFont, size = 64, maxLength = 20, isPassword = false } = textInput.props;
99
- const textField = new ccui.TextField();
100
- textField.setPlaceHolder(placeHolder);
101
- textField.setFontName(font);
102
- textField.setFontSize(size);
103
- textField.setTextColor(cc.color(255, 255, 255));
104
- textField.setMaxLengthEnabled(true);
105
- textField.setMaxLength(maxLength);
106
- textField.setPasswordEnabled(isPassword);
107
- textInput.node = entity.assign(new NodeComp(textField, entity));
108
- };
109
- update() {
110
- // throw new Error('Method not implemented.');
111
- }
112
- }
@@ -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,GAAI;;;KAAqB,UAiD/C;IAED,kBAAkB,GAAI;;KAAa,UAIlC;IAED,2BAA2B,GAAI;;KAAa,UAM3C;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}