@safe-engine/cocos 1.7.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 (115) hide show
  1. package/dist/animation/AnimationComponent.d.ts +1 -1
  2. package/dist/animation/AnimationComponent.d.ts.map +1 -1
  3. package/dist/animation/AnimationComponent.js +2 -2
  4. package/dist/animation/AnimationSystem.js +1 -1
  5. package/dist/app.js +3 -3
  6. package/dist/box2d-wasm/PhysicsComponent.d.ts +1 -1
  7. package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
  8. package/dist/box2d-wasm/PhysicsComponent.js +1 -1
  9. package/dist/collider/CollideComponent.d.ts +1 -1
  10. package/dist/collider/CollideComponent.d.ts.map +1 -1
  11. package/dist/collider/CollideComponent.js +1 -1
  12. package/dist/collider/CollideSystem.js +1 -1
  13. package/dist/collider/index.d.ts +1 -0
  14. package/dist/collider/index.d.ts.map +1 -1
  15. package/dist/collider/index.js +1 -0
  16. package/dist/{gworld/components → core}/EnhancedComponent.d.ts +1 -1
  17. package/dist/core/EnhancedComponent.d.ts.map +1 -0
  18. package/dist/{gworld/components → core}/NodeComp.d.ts +1 -1
  19. package/dist/core/NodeComp.d.ts.map +1 -0
  20. package/dist/{gworld/components → core}/NodeComp.js +3 -3
  21. package/dist/{gworld/core → core}/NodePool.d.ts +1 -1
  22. package/dist/core/NodePool.d.ts.map +1 -0
  23. package/dist/core/Scene.d.ts +5 -0
  24. package/dist/core/Scene.d.ts.map +1 -0
  25. package/dist/{gworld/core → core}/Scene.js +3 -3
  26. package/dist/{gworld/core → core}/decorator.d.ts +2 -2
  27. package/dist/core/decorator.d.ts.map +1 -0
  28. package/dist/{gworld/core → core}/decorator.js +2 -2
  29. package/dist/core/index.d.ts +6 -0
  30. package/dist/core/index.d.ts.map +1 -0
  31. package/dist/core/index.js +5 -0
  32. package/dist/dragonbones/index.d.ts +1 -1
  33. package/dist/dragonbones/index.d.ts.map +1 -1
  34. package/dist/dragonbones/index.js +2 -2
  35. package/dist/{gworld/components → gui}/GUIComponent.d.ts +2 -2
  36. package/dist/gui/GUIComponent.d.ts.map +1 -0
  37. package/dist/{gworld/components → gui}/GUIComponent.js +1 -1
  38. package/dist/gui/GUISystem.d.ts.map +1 -0
  39. package/dist/{gworld/systems → gui}/GUISystem.js +4 -4
  40. package/dist/gui/index.d.ts +3 -0
  41. package/dist/gui/index.d.ts.map +1 -0
  42. package/dist/gui/index.js +2 -0
  43. package/dist/gworld/EnhancedComponent.d.ts +22 -0
  44. package/dist/gworld/EnhancedComponent.d.ts.map +1 -0
  45. package/dist/gworld/EnhancedComponent.js +44 -0
  46. package/dist/gworld/NodeComp.d.ts +153 -0
  47. package/dist/gworld/NodeComp.d.ts.map +1 -0
  48. package/dist/gworld/NodeComp.js +337 -0
  49. package/dist/gworld/NodePool.d.ts +9 -0
  50. package/dist/gworld/NodePool.d.ts.map +1 -0
  51. package/dist/gworld/NodePool.js +23 -0
  52. package/dist/gworld/Scene.d.ts +5 -0
  53. package/dist/gworld/Scene.d.ts.map +1 -0
  54. package/dist/gworld/Scene.js +14 -0
  55. package/dist/gworld/decorator.d.ts +8 -0
  56. package/dist/gworld/decorator.d.ts.map +1 -0
  57. package/dist/gworld/decorator.js +12 -0
  58. package/dist/helper/index.d.ts +5 -0
  59. package/dist/helper/index.d.ts.map +1 -0
  60. package/dist/helper/index.js +4 -0
  61. package/dist/index.d.ts +5 -11
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +5 -11
  64. package/dist/{gworld/components → norender}/NoRenderComponent.d.ts +2 -2
  65. package/dist/norender/NoRenderComponent.d.ts.map +1 -0
  66. package/dist/norender/NoRenderSystem.d.ts.map +1 -0
  67. package/dist/{gworld/systems → norender}/NoRenderSystem.js +2 -2
  68. package/dist/norender/index.d.ts +3 -0
  69. package/dist/norender/index.d.ts.map +1 -0
  70. package/dist/norender/index.js +2 -0
  71. package/dist/{gworld/components → render}/RenderComponent.d.ts +6 -10
  72. package/dist/render/RenderComponent.d.ts.map +1 -0
  73. package/dist/{gworld/components → render}/RenderComponent.js +7 -11
  74. package/dist/render/RenderSystem.d.ts.map +1 -0
  75. package/dist/{gworld/systems → render}/RenderSystem.js +3 -3
  76. package/dist/render/index.d.ts +3 -0
  77. package/dist/render/index.d.ts.map +1 -0
  78. package/dist/render/index.js +2 -0
  79. package/dist/richtext/RichTextComp.d.ts +1 -1
  80. package/dist/richtext/RichTextComp.d.ts.map +1 -1
  81. package/dist/richtext/RichTextComp.js +1 -1
  82. package/package.json +1 -1
  83. package/dist/gworld/components/AnimationComponent.d.ts +0 -65
  84. package/dist/gworld/components/AnimationComponent.d.ts.map +0 -1
  85. package/dist/gworld/components/AnimationComponent.js +0 -141
  86. package/dist/gworld/components/CollideComponent.d.ts +0 -64
  87. package/dist/gworld/components/CollideComponent.d.ts.map +0 -1
  88. package/dist/gworld/components/CollideComponent.js +0 -265
  89. package/dist/gworld/components/EnhancedComponent.d.ts.map +0 -1
  90. package/dist/gworld/components/GUIComponent.d.ts.map +0 -1
  91. package/dist/gworld/components/NoRenderComponent.d.ts.map +0 -1
  92. package/dist/gworld/components/NodeComp.d.ts.map +0 -1
  93. package/dist/gworld/components/RenderComponent.d.ts.map +0 -1
  94. package/dist/gworld/core/NodePool.d.ts.map +0 -1
  95. package/dist/gworld/core/Scene.d.ts +0 -5
  96. package/dist/gworld/core/Scene.d.ts.map +0 -1
  97. package/dist/gworld/core/decorator.d.ts.map +0 -1
  98. package/dist/gworld/systems/AnimationSystem.d.ts +0 -6
  99. package/dist/gworld/systems/AnimationSystem.d.ts.map +0 -1
  100. package/dist/gworld/systems/AnimationSystem.js +0 -30
  101. package/dist/gworld/systems/CollideSystem.d.ts +0 -20
  102. package/dist/gworld/systems/CollideSystem.d.ts.map +0 -1
  103. package/dist/gworld/systems/CollideSystem.js +0 -171
  104. package/dist/gworld/systems/GUISystem.d.ts.map +0 -1
  105. package/dist/gworld/systems/NoRenderSystem.d.ts.map +0 -1
  106. package/dist/gworld/systems/RenderSystem.d.ts.map +0 -1
  107. package/dist/helper/html-text-parser.d.ts +0 -30
  108. package/dist/helper/html-text-parser.d.ts.map +0 -1
  109. package/dist/helper/html-text-parser.js +0 -354
  110. /package/dist/{gworld/components → core}/EnhancedComponent.js +0 -0
  111. /package/dist/{gworld/core → core}/NodePool.js +0 -0
  112. /package/dist/{gworld/systems → gui}/GUISystem.d.ts +0 -0
  113. /package/dist/{gworld/components → norender}/NoRenderComponent.js +0 -0
  114. /package/dist/{gworld/systems → norender}/NoRenderSystem.d.ts +0 -0
  115. /package/dist/{gworld/systems → render}/RenderSystem.d.ts +0 -0
@@ -0,0 +1,337 @@
1
+ import { instantiate } from '../helper/utils';
2
+ import { ExtraDataComp } from '../norender';
3
+ import { Vec2 } from '../polyfills';
4
+ export class NodeComp {
5
+ entity;
6
+ instance;
7
+ parent;
8
+ children = [];
9
+ name;
10
+ _group;
11
+ _active = true;
12
+ constructor(instance, entity) {
13
+ this.entity = entity;
14
+ this.instance = instance;
15
+ }
16
+ get uuid() {
17
+ return this.entity.id;
18
+ }
19
+ get position() {
20
+ return Vec2(this.instance.getPosition());
21
+ }
22
+ set position(val) {
23
+ this.instance.setPosition(val.x, val.y);
24
+ }
25
+ set xy(val) {
26
+ this.instance.setPosition(val[0], val[1]);
27
+ }
28
+ get posX() {
29
+ return this.instance.getPositionX();
30
+ }
31
+ set posX(val) {
32
+ this.instance.setPositionX(val);
33
+ }
34
+ get posY() {
35
+ return this.instance.getPositionY();
36
+ }
37
+ set posY(val) {
38
+ this.instance.setPositionY(val);
39
+ }
40
+ get scale() {
41
+ return this.instance.getScale();
42
+ }
43
+ set scale(val) {
44
+ this.instance.setScale(val, val);
45
+ }
46
+ get scaleX() {
47
+ return this.instance.getScaleX();
48
+ }
49
+ set scaleX(val) {
50
+ this.instance.setScaleX(val);
51
+ }
52
+ get scaleY() {
53
+ return this.instance.getScaleY();
54
+ }
55
+ set scaleY(val) {
56
+ this.instance.setScaleY(val);
57
+ }
58
+ get anchorX() {
59
+ return this.instance.anchorX;
60
+ }
61
+ set anchorX(val) {
62
+ this.instance.anchorX = val;
63
+ }
64
+ get anchorY() {
65
+ return this.instance.anchorY;
66
+ }
67
+ set anchorY(val) {
68
+ this.instance.anchorY = val;
69
+ }
70
+ /**
71
+ * Returns the angle of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
72
+ * @function
73
+ * @return {Number} The rotation of the node in degrees.
74
+ */
75
+ get rotation() {
76
+ return this.instance.getRotation();
77
+ }
78
+ /**
79
+ *
80
+ * Sets the X angle of the node in degrees which performs a horizontal rotational skew.
81
+ * (support only in WebGL rendering mode)
82
+ * 0 is the default rotation angle.
83
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
84
+ *
85
+ * @param {Number} degrees The X rotation in degrees which performs a horizontal rotational skew.
86
+ */
87
+ set rotation(val) {
88
+ this.instance.setRotation(val);
89
+ }
90
+ get color() {
91
+ return this.instance.getColor();
92
+ }
93
+ set color(val) {
94
+ this.instance.setColor(val);
95
+ }
96
+ get opacity() {
97
+ return this.instance.getOpacity();
98
+ }
99
+ set opacity(val) {
100
+ this.instance.setOpacity(val);
101
+ }
102
+ get active() {
103
+ if (!cc.sys.isObjectValid(this.instance) || !this._active)
104
+ return false;
105
+ let p = this.parent;
106
+ while (p) {
107
+ if (!p.active)
108
+ return false;
109
+ p = p.parent;
110
+ }
111
+ return true;
112
+ }
113
+ set active(val) {
114
+ if (!cc.sys.isObjectValid(this.instance)) {
115
+ return;
116
+ }
117
+ this._active = val;
118
+ if (this.instance instanceof ccui.Widget) {
119
+ this.instance.setEnabled(val);
120
+ }
121
+ this.instance.setVisible(val);
122
+ }
123
+ get group() {
124
+ return this._group;
125
+ }
126
+ set group(val) {
127
+ this._group = val;
128
+ }
129
+ get width() {
130
+ return this.instance.width;
131
+ }
132
+ set width(val) {
133
+ this.instance.setContentSize(val, this.height);
134
+ }
135
+ get height() {
136
+ return this.instance.height;
137
+ }
138
+ set height(val) {
139
+ this.instance.setContentSize(val, this.width);
140
+ }
141
+ get zIndex() {
142
+ return this.instance.zIndex;
143
+ }
144
+ set zIndex(val) {
145
+ this.instance.zIndex = val;
146
+ }
147
+ get childrenCount() {
148
+ return this.children.length;
149
+ }
150
+ destroy() {
151
+ this.removeFromParent(true);
152
+ }
153
+ addComponent(instance) {
154
+ return this.entity.assign(instance);
155
+ }
156
+ getComponent(component) {
157
+ return this.entity.getComponent(component);
158
+ }
159
+ getComponentsInChildren(component) {
160
+ if (!this.children.length) {
161
+ return [];
162
+ }
163
+ const listHave = this.children.filter((child) => {
164
+ return child.getComponent(component);
165
+ });
166
+ return listHave.map((node) => node.getComponent(component));
167
+ }
168
+ getComponentInChildren(component) {
169
+ return this.getComponentsInChildren(component)[0];
170
+ }
171
+ hasComponentInChildren(component) {
172
+ if (!this.children.length) {
173
+ return false;
174
+ }
175
+ return this.children.some((child) => {
176
+ return child.getComponent(component);
177
+ });
178
+ }
179
+ getPercent() {
180
+ if (this.instance instanceof ccui.LoadingBar) {
181
+ return this.instance.getPercent();
182
+ }
183
+ return 0;
184
+ }
185
+ setPercent(val) {
186
+ if (this.instance instanceof ccui.LoadingBar) {
187
+ return this.instance.setPercent(val);
188
+ }
189
+ }
190
+ setTouchEnabled(enabled) {
191
+ if (!cc.sys.isObjectValid(this.instance)) {
192
+ return;
193
+ }
194
+ if (this.instance instanceof ccui.Widget) {
195
+ this.instance.setTouchEnabled(enabled);
196
+ }
197
+ }
198
+ addTouchEventListener(cb) {
199
+ if (!cc.sys.isObjectValid(this.instance)) {
200
+ return;
201
+ }
202
+ if (this.instance instanceof ccui.Widget) {
203
+ this.instance.addTouchEventListener(cb);
204
+ }
205
+ }
206
+ convertToNodeSpace(point) {
207
+ const { x, y } = this.instance.convertToNodeSpace(point);
208
+ return Vec2(x, y);
209
+ }
210
+ convertToNodeSpaceAR(point) {
211
+ const { x, y } = this.instance.convertToNodeSpaceAR(point);
212
+ return Vec2(x, y);
213
+ }
214
+ convertToWorldSpaceAR(point) {
215
+ const { x, y } = this.instance.convertToWorldSpaceAR(point);
216
+ return Vec2(x, y);
217
+ }
218
+ getPosition() {
219
+ return this.instance.getPosition();
220
+ }
221
+ setPosition(x, y) {
222
+ this.instance.setPosition(x, y);
223
+ }
224
+ setRotation(deg) {
225
+ this.instance.setRotation(deg);
226
+ }
227
+ getRotation() {
228
+ return this.instance.getRotation();
229
+ }
230
+ setAnchorPoint(point, y) {
231
+ this.instance.setAnchorPoint(point, y);
232
+ }
233
+ getAnchorPoint() {
234
+ return this.instance.getAnchorPoint();
235
+ }
236
+ getBoundingBox() {
237
+ const box = this.instance.getBoundingBox();
238
+ box.contains = function (point) {
239
+ return this.x <= point.x && this.x + this.width >= point.x && this.y <= point.y && this.y + this.height >= point.y;
240
+ };
241
+ return box;
242
+ }
243
+ getContentSize() {
244
+ return this.instance.getContentSize();
245
+ }
246
+ setContentSize(size, height) {
247
+ this.instance.setContentSize(size, height);
248
+ if (this.instance instanceof cc.ClippingNode) {
249
+ const hw = (size.width || size) * 0.5;
250
+ const hh = (size.height || height) * 0.5;
251
+ const stencil = new cc.DrawNode();
252
+ const rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)];
253
+ stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE);
254
+ // stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
255
+ this.instance.stencil = stencil;
256
+ }
257
+ }
258
+ setColor(color) {
259
+ this.instance.setColor(color);
260
+ }
261
+ setScale(scaleX, scaleY) {
262
+ this.instance.setScale(scaleX, scaleY || scaleX);
263
+ }
264
+ runAction(atc) {
265
+ this.instance.runAction(atc);
266
+ }
267
+ stopAllActions() {
268
+ this.instance.stopAllActions();
269
+ }
270
+ pauseAllActionsAndSchedule() {
271
+ this.instance.pause();
272
+ this.instance.unscheduleUpdate();
273
+ }
274
+ resumeAllActionsAndSchedule() {
275
+ this.instance.resume();
276
+ this.instance.scheduleUpdate();
277
+ }
278
+ removeFromParent(cleanup) {
279
+ this.active = false;
280
+ if (this.parent) {
281
+ this.parent.children = this.parent.children.filter(({ entity }) => entity.id !== this.entity.id);
282
+ }
283
+ if (cleanup) {
284
+ this.children.forEach((child) => {
285
+ child.destroy();
286
+ });
287
+ this.parent = null;
288
+ this.entity.destroy();
289
+ this.stopAllActions();
290
+ this.instance.removeFromParent(cleanup);
291
+ }
292
+ else {
293
+ this.stopAllActions();
294
+ this.instance.removeFromParent();
295
+ }
296
+ }
297
+ addChild(child) {
298
+ child._active = true;
299
+ child.parent = this;
300
+ this.children.push(child);
301
+ this.instance.addChild(child.instance);
302
+ }
303
+ removeAllChildren(cleanup) {
304
+ this.children.forEach((child) => {
305
+ child.removeFromParent(cleanup);
306
+ });
307
+ }
308
+ getData(key) {
309
+ const data = this.getComponent(ExtraDataComp);
310
+ if (!data)
311
+ throw Error('need add ExtraDataComp to Node');
312
+ return data.getData(key);
313
+ }
314
+ setData(key, value) {
315
+ const data = this.getComponent(ExtraDataComp);
316
+ if (!data) {
317
+ this.addComponent(instantiate(ExtraDataComp, { key, value }));
318
+ }
319
+ else {
320
+ data.setData(key, value);
321
+ }
322
+ }
323
+ removeData(key) {
324
+ const data = this.getComponent(ExtraDataComp);
325
+ if (data) {
326
+ data.removeData(key);
327
+ }
328
+ }
329
+ resolveComponent(component) {
330
+ if (component.constructor.hasRender) {
331
+ this.addChild(component.node);
332
+ }
333
+ else {
334
+ this.addComponent(component);
335
+ }
336
+ }
337
+ }
@@ -0,0 +1,9 @@
1
+ import { NodeComp } from "./NodeComp";
2
+ export declare class NodePool {
3
+ items: NodeComp[];
4
+ put(node: NodeComp): void;
5
+ get(): NodeComp;
6
+ size(): number;
7
+ clear(): void;
8
+ }
9
+ //# sourceMappingURL=NodePool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodePool.d.ts","sourceRoot":"","sources":["../../src/gworld/NodePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,QAAQ;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAK;IAEtB,GAAG,CAAC,IAAI,EAAE,QAAQ;IAQlB,GAAG,IAAI,QAAQ;IAOf,IAAI;IAIJ,KAAK;CAIN"}
@@ -0,0 +1,23 @@
1
+ export class NodePool {
2
+ items = [];
3
+ put(node) {
4
+ if (node) {
5
+ node.removeFromParent();
6
+ node.entity.immortal = true;
7
+ this.items.push(node);
8
+ }
9
+ }
10
+ get() {
11
+ const node = this.items.pop();
12
+ node.entity.immortal = false;
13
+ node.active = true;
14
+ return node;
15
+ }
16
+ size() {
17
+ return this.items.length;
18
+ }
19
+ clear() {
20
+ this.items.forEach((node) => node.destroy());
21
+ this.items.length = 0;
22
+ }
23
+ }
@@ -0,0 +1,5 @@
1
+ import { EnhancedComponent } from './EnhancedComponent';
2
+ export declare class SceneComponent extends EnhancedComponent {
3
+ render(): this;
4
+ }
5
+ //# sourceMappingURL=Scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/gworld/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CASP"}
@@ -0,0 +1,14 @@
1
+ import { GameWorld } from '.';
2
+ import { EnhancedComponent } from './EnhancedComponent';
3
+ import { NodeComp } from './NodeComp';
4
+ export class SceneComponent extends EnhancedComponent {
5
+ render() {
6
+ const world = GameWorld.Instance;
7
+ world.entities.reset();
8
+ const root = world.entities.create();
9
+ const node = root.assign(new NodeComp(cc.director.getRunningScene(), root));
10
+ const sceneComponent = root.assign(this);
11
+ sceneComponent.node = node;
12
+ return sceneComponent;
13
+ }
14
+ }
@@ -0,0 +1,8 @@
1
+ import { EnhancedComponent, NodeComp } from '.';
2
+ export declare class NoRenderComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
3
+ static hasRender: boolean;
4
+ }
5
+ export declare class ComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
6
+ render?(): this;
7
+ }
8
+ //# sourceMappingURL=decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/gworld/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAa,QAAQ,EAAE,MAAM,GAAG,CAAA;AAE1D,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,12 @@
1
+ import { EnhancedComponent, GameWorld } from '.';
2
+ export class NoRenderComponentX extends EnhancedComponent {
3
+ static hasRender = false;
4
+ }
5
+ export class ComponentX extends EnhancedComponent {
6
+ render() {
7
+ const world = GameWorld.Instance;
8
+ const root = world.entities.create();
9
+ const comp = root.assign(this);
10
+ return comp;
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ export * from './action';
2
+ export * from './director';
3
+ export * from './math';
4
+ export * from './utils';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './action';
2
+ export * from './director';
3
+ export * from './math';
4
+ export * from './utils';
package/dist/index.d.ts CHANGED
@@ -1,20 +1,14 @@
1
1
  export * from './app';
2
2
  export * from './collider';
3
+ export * from './core';
3
4
  export * from './dragonbones';
5
+ export * from './gui';
4
6
  export * from './gworld';
5
- export * from './gworld/components/GUIComponent';
6
- export * from './gworld/components/NodeComp';
7
- export * from './gworld/components/NoRenderComponent';
8
- export * from './gworld/components/RenderComponent';
9
- export * from './gworld/core/decorator';
10
- export * from './gworld/core/Scene';
11
- export * from './gworld/systems/GUISystem';
12
- export * from './helper/action';
13
- export * from './helper/director';
14
- export * from './helper/math';
15
- export * from './helper/utils';
7
+ export * from './helper';
8
+ export * from './norender';
16
9
  export * from './polyfills';
17
10
  export { type Touch } from './polyfills';
11
+ export * from './render';
18
12
  export * from './richtext';
19
13
  export * from './safex';
20
14
  export * from './spine';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uCAAuC,CAAA;AACrD,cAAc,qCAAqC,CAAA;AACnD,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,19 +1,13 @@
1
1
  export * from './app';
2
2
  export * from './collider';
3
+ export * from './core';
3
4
  export * from './dragonbones';
5
+ export * from './gui';
4
6
  export * from './gworld';
5
- export * from './gworld/components/GUIComponent';
6
- export * from './gworld/components/NodeComp';
7
- export * from './gworld/components/NoRenderComponent';
8
- export * from './gworld/components/RenderComponent';
9
- export * from './gworld/core/decorator';
10
- export * from './gworld/core/Scene';
11
- export * from './gworld/systems/GUISystem';
12
- export * from './helper/action';
13
- export * from './helper/director';
14
- export * from './helper/math';
15
- export * from './helper/utils';
7
+ export * from './helper';
8
+ export * from './norender';
16
9
  export * from './polyfills';
10
+ export * from './render';
17
11
  export * from './richtext';
18
12
  export * from './safex';
19
13
  export * from './spine';
@@ -1,6 +1,6 @@
1
- import { Touch } from '../../polyfills';
1
+ import { EventCallbackType, NodeComp } from '../core';
2
2
  import { NoRenderComponentX } from '../core/decorator';
3
- import { EventCallbackType, NodeComp } from './NodeComp';
3
+ import { Touch } from '../polyfills';
4
4
  type TouchEVentCallback = (touch?: Touch, node?: NodeComp) => void;
5
5
  export interface EventMap {
6
6
  [key: string]: [EventCallbackType];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoRenderComponent.d.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a,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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoRenderSystem.d.ts","sourceRoot":"","sources":["../../src/norender/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"}
@@ -1,6 +1,6 @@
1
1
  import { EventTypes } from 'entityx-ts';
2
- import { NodeComp } from '../components/NodeComp';
3
- import { ExtraDataComp, TouchEventRegister } from '../components/NoRenderComponent';
2
+ import { NodeComp } from '../core';
3
+ import { ExtraDataComp, TouchEventRegister } from './NoRenderComponent';
4
4
  export class NoRenderSystem {
5
5
  configure(event_manager) {
6
6
  event_manager.subscribe(EventTypes.ComponentAdded, ExtraDataComp, this.onAddExtraDataComp);
@@ -0,0 +1,3 @@
1
+ export * from './NoRenderComponent';
2
+ export * from './NoRenderSystem';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/norender/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './NoRenderComponent';
2
+ export * from './NoRenderSystem';
@@ -1,6 +1,5 @@
1
- import { Color4B, Vec2 } from '../../polyfills';
2
- import { BaseComponentProps, ColorSource } from '../../safex';
3
- import { ComponentX } from '../core/decorator';
1
+ import { BaseComponentProps, ColorSource, ComponentX } from '..';
2
+ import { Color4B, Vec2 } from '../polyfills';
4
3
  export declare class NodeRender extends ComponentX {
5
4
  nodeName: string;
6
5
  }
@@ -31,14 +30,11 @@ interface GraphicsRenderProps {
31
30
  fillColor?: ColorSource;
32
31
  }
33
32
  export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & BaseComponentProps<GraphicsRender>, cc.DrawNode> {
34
- lineWidth: number;
35
- strokeColor: cc.Color;
36
- fillColor: cc.Color;
37
33
  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;
34
+ drawLine(origin: Vec2, destination: Vec2, thickness?: Float, color?: Color4B): void;
35
+ drawRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
36
+ drawCircle(center: Vec2, radius: Float, angle?: number, segments?: number, drawLineToCenter?: boolean, lineWidth?: Float, color?: Color4B): void;
37
+ drawPoly(points: Vec2[], color?: Color4B, thickness?: Float): void;
42
38
  clear(): void;
43
39
  }
44
40
  interface TiledMapProps {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/render/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAChE,OAAO,EAAE,O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,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO;IAMzD,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,SAAI,EAAE,QAAQ,SAAK,EAAE,gBAAgB,UAAO,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO;IAyB7H,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,KAAK;IAe3D,KAAK;CAKN;AAED,UAAU,aAAa;IACrB,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,5 +1,4 @@
1
- import { BLUE, RED } from '../../polyfills';
2
- import { ComponentX } from '../core/decorator';
1
+ import { ComponentX } from '..';
3
2
  export class NodeRender extends ComponentX {
4
3
  nodeName;
5
4
  }
@@ -29,26 +28,23 @@ export class MaskRender extends ComponentX {
29
28
  export class ParticleComp extends ComponentX {
30
29
  }
31
30
  export class GraphicsRender extends ComponentX {
32
- lineWidth = 5;
33
- strokeColor = RED;
34
- fillColor = BLUE;
35
31
  drawDot(x, y, r) {
36
- this.node.instance.drawDot(cc.p(x, y), r, this.fillColor);
32
+ this.node.instance.drawDot(cc.p(x, y), r, this.props.fillColor);
37
33
  }
38
34
  // drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
39
35
  // }
40
36
  // // drawPoints(points: Vec2[], color: Color4B) {
41
37
  // // }
42
38
  drawLine(origin, destination, thickness, color) {
43
- this.node.instance.drawSegment(origin, destination, thickness, color);
39
+ this.node.instance.drawSegment(origin, destination, thickness || this.props.lineWidth, color || this.props.strokeColor);
44
40
  }
45
41
  drawRect(origin, destination, color) {
46
- this.node.instance.drawRect(origin, destination, color);
42
+ this.node.instance.drawRect(origin, destination, color || this.props.fillColor);
47
43
  }
48
44
  // drawSolidRect(origin: Vec2, destination: Vec2, color: Color4B) {
49
45
  // }
50
- drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color) {
51
- this.node.instance.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color);
46
+ drawCircle(center, radius, angle = 0, segments = 64, drawLineToCenter = true, lineWidth, color) {
47
+ this.node.instance.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth || this.props.lineWidth, color || this.props.fillColor);
52
48
  }
53
49
  // drawSolidCircle(origin: Vec2, destination: Vec2, color: Color4B) {
54
50
  // }
@@ -61,7 +57,7 @@ export class GraphicsRender extends ComponentX {
61
57
  // drawCatmullRom(points: Vec2[], color: Color4B) {
62
58
  // }
63
59
  drawPoly(points, color, thickness) {
64
- this.node.instance.drawPoly(points, color, thickness);
60
+ this.node.instance.drawPoly(points, color || this.props.fillColor, thickness || this.props.lineWidth);
65
61
  }
66
62
  // drawSolidPoly(points: Vec2[], color: Color4B) {
67
63
  // this.node.instance.drawPoly(points, color)
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAMlG,oBAAY,WAAW;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,qBAAa,YAAa,YAAW,MAAM;IACzC,SAAS,CAAC,aAAa,EAAE,YAAY;IAUrC,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,iBAAiB,CAOxB;IAED,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,mBAAmB,CAQ1B;IAED,OAAO,CAAC,iBAAiB,CAKxB;IAED,OAAO,CAAC,aAAa,CAKpB;IAED,OAAO,CAAC,iBAAiB,CAKxB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
@@ -1,7 +1,7 @@
1
1
  import { EventTypes } from 'entityx-ts';
2
- import { BLUE, RED } from '../../polyfills';
3
- import { NodeComp } from '../components/NodeComp';
4
- import { GraphicsRender, MaskRender, NodeRender, ParticleComp, SpriteRender, TiledMap } from '../components/RenderComponent';
2
+ import { NodeComp } from '../core';
3
+ import { BLUE, RED } from '../polyfills';
4
+ import { GraphicsRender, MaskRender, NodeRender, ParticleComp, SpriteRender, TiledMap } from './RenderComponent';
5
5
  export var SpriteTypes;
6
6
  (function (SpriteTypes) {
7
7
  SpriteTypes[SpriteTypes["SIMPLE"] = 0] = "SIMPLE";
@@ -0,0 +1,3 @@
1
+ export * from './RenderComponent';
2
+ export * from './RenderSystem';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './RenderComponent';
2
+ export * from './RenderSystem';