@safe-engine/cocos 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/@types/index.d.ts +61 -0
  2. package/@types/safex.d.ts +103 -0
  3. package/README.md +10 -0
  4. package/dist/app.d.ts +2 -0
  5. package/dist/app.d.ts.map +1 -0
  6. package/dist/app.js +24 -0
  7. package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +77 -0
  8. package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +1 -0
  9. package/dist/dragonbones/cocos/CocosArmatureDisplay.js +227 -0
  10. package/dist/dragonbones/cocos/CocosFactory.d.ts +128 -0
  11. package/dist/dragonbones/cocos/CocosFactory.d.ts.map +1 -0
  12. package/dist/dragonbones/cocos/CocosFactory.js +231 -0
  13. package/dist/dragonbones/cocos/CocosSlot.d.ts +49 -0
  14. package/dist/dragonbones/cocos/CocosSlot.d.ts.map +1 -0
  15. package/dist/dragonbones/cocos/CocosSlot.js +385 -0
  16. package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +53 -0
  17. package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +1 -0
  18. package/dist/dragonbones/cocos/CocosTextureAtlasData.js +158 -0
  19. package/dist/dragonbones/dragonBones.d.ts +3 -0
  20. package/dist/dragonbones/dragonBones.d.ts.map +1 -0
  21. package/dist/dragonbones/dragonBones.js +4788 -0
  22. package/dist/dragonbones/index.d.ts +20 -0
  23. package/dist/dragonbones/index.d.ts.map +1 -0
  24. package/dist/dragonbones/index.js +112 -0
  25. package/dist/gworld/components/AnimationComponent.d.ts +65 -0
  26. package/dist/gworld/components/AnimationComponent.d.ts.map +1 -0
  27. package/dist/gworld/components/AnimationComponent.js +141 -0
  28. package/dist/gworld/components/CollideComponent.d.ts +64 -0
  29. package/dist/gworld/components/CollideComponent.d.ts.map +1 -0
  30. package/dist/gworld/components/CollideComponent.js +266 -0
  31. package/dist/gworld/components/EnhancedComponent.d.ts +21 -0
  32. package/dist/gworld/components/EnhancedComponent.d.ts.map +1 -0
  33. package/dist/gworld/components/EnhancedComponent.js +50 -0
  34. package/dist/gworld/components/GUIComponent.d.ts +62 -0
  35. package/dist/gworld/components/GUIComponent.d.ts.map +1 -0
  36. package/dist/gworld/components/GUIComponent.js +158 -0
  37. package/dist/gworld/components/NoRenderComponent.d.ts +36 -0
  38. package/dist/gworld/components/NoRenderComponent.d.ts.map +1 -0
  39. package/dist/gworld/components/NoRenderComponent.js +74 -0
  40. package/dist/gworld/components/NodeComp.d.ts +184 -0
  41. package/dist/gworld/components/NodeComp.d.ts.map +1 -0
  42. package/dist/gworld/components/NodeComp.js +425 -0
  43. package/dist/gworld/components/RenderComponent.d.ts +53 -0
  44. package/dist/gworld/components/RenderComponent.d.ts.map +1 -0
  45. package/dist/gworld/components/RenderComponent.js +158 -0
  46. package/dist/gworld/core/Scene.d.ts +5 -0
  47. package/dist/gworld/core/Scene.d.ts.map +1 -0
  48. package/dist/gworld/core/Scene.js +38 -0
  49. package/dist/gworld/core/decorator.d.ts +9 -0
  50. package/dist/gworld/core/decorator.d.ts.map +1 -0
  51. package/dist/gworld/core/decorator.js +43 -0
  52. package/dist/gworld/index.d.ts +8 -0
  53. package/dist/gworld/index.d.ts.map +1 -0
  54. package/dist/gworld/index.js +43 -0
  55. package/dist/gworld/systems/AnimationSystem.d.ts +7 -0
  56. package/dist/gworld/systems/AnimationSystem.d.ts.map +1 -0
  57. package/dist/gworld/systems/AnimationSystem.js +38 -0
  58. package/dist/gworld/systems/CollideSystem.d.ts +19 -0
  59. package/dist/gworld/systems/CollideSystem.d.ts.map +1 -0
  60. package/dist/gworld/systems/CollideSystem.js +183 -0
  61. package/dist/gworld/systems/GUISystem.d.ts +7 -0
  62. package/dist/gworld/systems/GUISystem.d.ts.map +1 -0
  63. package/dist/gworld/systems/GUISystem.js +147 -0
  64. package/dist/gworld/systems/NoRenderSystem.d.ts +7 -0
  65. package/dist/gworld/systems/NoRenderSystem.d.ts.map +1 -0
  66. package/dist/gworld/systems/NoRenderSystem.js +93 -0
  67. package/dist/gworld/systems/RenderSystem.d.ts +15 -0
  68. package/dist/gworld/systems/RenderSystem.d.ts.map +1 -0
  69. package/dist/gworld/systems/RenderSystem.js +115 -0
  70. package/dist/helper/Intersection.d.ts +6 -0
  71. package/dist/helper/Intersection.d.ts.map +1 -0
  72. package/dist/helper/Intersection.js +117 -0
  73. package/dist/helper/NodePool.d.ts +9 -0
  74. package/dist/helper/NodePool.d.ts.map +1 -0
  75. package/dist/helper/NodePool.js +29 -0
  76. package/dist/helper/action.d.ts +9 -0
  77. package/dist/helper/action.d.ts.map +1 -0
  78. package/dist/helper/action.js +34 -0
  79. package/dist/helper/director.d.ts +3 -0
  80. package/dist/helper/director.d.ts.map +1 -0
  81. package/dist/helper/director.js +10 -0
  82. package/dist/helper/html-text-parser.d.ts +30 -0
  83. package/dist/helper/html-text-parser.d.ts.map +1 -0
  84. package/dist/helper/html-text-parser.js +354 -0
  85. package/dist/helper/math.d.ts +4 -0
  86. package/dist/helper/math.d.ts.map +1 -0
  87. package/dist/helper/math.js +9 -0
  88. package/dist/helper/utils.d.ts +14 -0
  89. package/dist/helper/utils.d.ts.map +1 -0
  90. package/dist/helper/utils.js +81 -0
  91. package/dist/index.d.ts +19 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +33 -0
  94. package/dist/polyfills.d.ts +54 -0
  95. package/dist/polyfills.d.ts.map +1 -0
  96. package/dist/polyfills.js +168 -0
  97. package/dist/spine/CCSkeleton.d.ts +2 -0
  98. package/dist/spine/CCSkeleton.d.ts.map +1 -0
  99. package/dist/spine/CCSkeleton.js +380 -0
  100. package/dist/spine/CCSkeletonAnimation.d.ts +16 -0
  101. package/dist/spine/CCSkeletonAnimation.d.ts.map +1 -0
  102. package/dist/spine/CCSkeletonAnimation.js +353 -0
  103. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +2 -0
  104. package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -0
  105. package/dist/spine/CCSkeletonCanvasRenderCmd.js +229 -0
  106. package/dist/spine/CCSkeletonTexture.d.ts +2 -0
  107. package/dist/spine/CCSkeletonTexture.d.ts.map +1 -0
  108. package/dist/spine/CCSkeletonTexture.js +98 -0
  109. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +2 -0
  110. package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +1 -0
  111. package/dist/spine/CCSkeletonWebGLRenderCmd.js +317 -0
  112. package/package.json +32 -0
@@ -0,0 +1,425 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NodeComp = void 0;
7
+ var remove_1 = __importDefault(require("lodash/remove"));
8
+ var utils_1 = require("../../helper/utils");
9
+ var polyfills_1 = require("../../polyfills");
10
+ var NoRenderComponent_1 = require("./NoRenderComponent");
11
+ var NodeComp = /** @class */ (function () {
12
+ function NodeComp(instance, entity) {
13
+ this.children = [];
14
+ this.entity = entity;
15
+ this.instance = instance;
16
+ }
17
+ Object.defineProperty(NodeComp.prototype, "uuid", {
18
+ get: function () {
19
+ return this.entity.id;
20
+ },
21
+ enumerable: false,
22
+ configurable: true
23
+ });
24
+ Object.defineProperty(NodeComp.prototype, "position", {
25
+ get: function () {
26
+ return this.getPosition();
27
+ },
28
+ set: function (val) {
29
+ this.setPosition(val.x, val.y);
30
+ },
31
+ enumerable: false,
32
+ configurable: true
33
+ });
34
+ Object.defineProperty(NodeComp.prototype, "x", {
35
+ get: function () {
36
+ return this.instance.getPositionX();
37
+ },
38
+ set: function (val) {
39
+ this.instance.setPositionX(val);
40
+ },
41
+ enumerable: false,
42
+ configurable: true
43
+ });
44
+ Object.defineProperty(NodeComp.prototype, "y", {
45
+ get: function () {
46
+ return this.instance.getPositionY();
47
+ },
48
+ set: function (val) {
49
+ this.instance.setPositionY(val);
50
+ },
51
+ enumerable: false,
52
+ configurable: true
53
+ });
54
+ Object.defineProperty(NodeComp.prototype, "scale", {
55
+ get: function () {
56
+ return this.instance.getScale();
57
+ },
58
+ set: function (val) {
59
+ this.instance.setScale(val, val);
60
+ },
61
+ enumerable: false,
62
+ configurable: true
63
+ });
64
+ Object.defineProperty(NodeComp.prototype, "scaleX", {
65
+ get: function () {
66
+ return this.instance.getScaleX();
67
+ },
68
+ set: function (val) {
69
+ this.instance.setScaleX(val);
70
+ },
71
+ enumerable: false,
72
+ configurable: true
73
+ });
74
+ Object.defineProperty(NodeComp.prototype, "scaleY", {
75
+ get: function () {
76
+ return this.instance.getScaleY();
77
+ },
78
+ set: function (val) {
79
+ this.instance.setScaleY(val);
80
+ },
81
+ enumerable: false,
82
+ configurable: true
83
+ });
84
+ Object.defineProperty(NodeComp.prototype, "anchorX", {
85
+ get: function () {
86
+ return this.instance.anchorX;
87
+ },
88
+ set: function (val) {
89
+ this.instance.anchorX = val;
90
+ },
91
+ enumerable: false,
92
+ configurable: true
93
+ });
94
+ Object.defineProperty(NodeComp.prototype, "anchorY", {
95
+ get: function () {
96
+ return this.instance.anchorY;
97
+ },
98
+ set: function (val) {
99
+ this.instance.anchorY = val;
100
+ },
101
+ enumerable: false,
102
+ configurable: true
103
+ });
104
+ Object.defineProperty(NodeComp.prototype, "rotation", {
105
+ /**
106
+ * Returns the rotation of the node in radians. 0 is the default rotation angle. Positive values rotate node clockwise.
107
+ * @function
108
+ * @return {Number} The rotation of the node in radians.
109
+ */
110
+ get: function () {
111
+ return cc.degreesToRadians(this.instance.getRotation());
112
+ },
113
+ /**
114
+ *
115
+ * Sets the X rotation of the node in radians which performs a horizontal rotational skew.
116
+ * (support only in WebGL rendering mode)
117
+ * 0 is the default rotation angle.
118
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
119
+ *
120
+ * @param {Number} radians The X rotation in radians which performs a horizontal rotational skew.
121
+ */
122
+ set: function (val) {
123
+ this.instance.setRotation(cc.radiansToDegrees(val));
124
+ },
125
+ enumerable: false,
126
+ configurable: true
127
+ });
128
+ Object.defineProperty(NodeComp.prototype, "angle", {
129
+ /**
130
+ * Returns the angle of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
131
+ * @function
132
+ * @return {Number} The rotation of the node in degrees.
133
+ */
134
+ get: function () {
135
+ return this.instance.getRotation();
136
+ },
137
+ /**
138
+ *
139
+ * Sets the X angle of the node in degrees which performs a horizontal rotational skew.
140
+ * (support only in WebGL rendering mode)
141
+ * 0 is the default rotation angle.
142
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
143
+ *
144
+ * @param {Number} degrees The X rotation in degrees which performs a horizontal rotational skew.
145
+ */
146
+ set: function (val) {
147
+ this.instance.setRotation(val);
148
+ },
149
+ enumerable: false,
150
+ configurable: true
151
+ });
152
+ Object.defineProperty(NodeComp.prototype, "color", {
153
+ get: function () {
154
+ return this.instance.getColor();
155
+ },
156
+ set: function (val) {
157
+ this.instance.setColor(val);
158
+ },
159
+ enumerable: false,
160
+ configurable: true
161
+ });
162
+ Object.defineProperty(NodeComp.prototype, "opacity", {
163
+ get: function () {
164
+ return this.instance.getOpacity();
165
+ },
166
+ set: function (val) {
167
+ this.instance.setOpacity(val);
168
+ },
169
+ enumerable: false,
170
+ configurable: true
171
+ });
172
+ Object.defineProperty(NodeComp.prototype, "active", {
173
+ get: function () {
174
+ return cc.sys.isObjectValid(this.instance) && this.instance.visible;
175
+ },
176
+ set: function (val) {
177
+ if (!cc.sys.isObjectValid(this.instance)) {
178
+ return;
179
+ }
180
+ if (this.instance instanceof ccui.Widget) {
181
+ this.instance.setEnabled(val);
182
+ }
183
+ this.instance.setVisible(val);
184
+ },
185
+ enumerable: false,
186
+ configurable: true
187
+ });
188
+ Object.defineProperty(NodeComp.prototype, "group", {
189
+ get: function () {
190
+ return this._group;
191
+ },
192
+ set: function (val) {
193
+ this._group = val;
194
+ },
195
+ enumerable: false,
196
+ configurable: true
197
+ });
198
+ Object.defineProperty(NodeComp.prototype, "width", {
199
+ get: function () {
200
+ return this.instance.width;
201
+ },
202
+ set: function (val) {
203
+ this.instance.setContentSize(val, this.height);
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ Object.defineProperty(NodeComp.prototype, "height", {
209
+ get: function () {
210
+ return this.instance.height;
211
+ },
212
+ set: function (val) {
213
+ this.instance.setContentSize(val, this.width);
214
+ },
215
+ enumerable: false,
216
+ configurable: true
217
+ });
218
+ Object.defineProperty(NodeComp.prototype, "zIndex", {
219
+ get: function () {
220
+ return this.instance.zIndex;
221
+ },
222
+ set: function (val) {
223
+ this.instance.zIndex = val;
224
+ },
225
+ enumerable: false,
226
+ configurable: true
227
+ });
228
+ Object.defineProperty(NodeComp.prototype, "childrenCount", {
229
+ get: function () {
230
+ return this.children.length;
231
+ },
232
+ enumerable: false,
233
+ configurable: true
234
+ });
235
+ NodeComp.prototype.destroy = function () {
236
+ this.removeFromParent(true);
237
+ };
238
+ NodeComp.prototype.addComponent = function (instance) {
239
+ return this.entity.assign(instance);
240
+ };
241
+ NodeComp.prototype.getComponent = function (component) {
242
+ return this.entity.getComponent(component);
243
+ };
244
+ NodeComp.prototype.getComponentsInChildren = function (component) {
245
+ if (!this.children.length) {
246
+ return [];
247
+ }
248
+ var listHave = this.children.filter(function (child) {
249
+ return child.getComponent(component);
250
+ });
251
+ return listHave.map(function (node) { return node.getComponent(component); });
252
+ };
253
+ NodeComp.prototype.getComponentInChildren = function (component) {
254
+ return this.getComponentsInChildren(component)[0];
255
+ };
256
+ NodeComp.prototype.hasComponentInChildren = function (component) {
257
+ if (!this.children.length) {
258
+ return false;
259
+ }
260
+ return this.children.some(function (child) {
261
+ return child.getComponent(component);
262
+ });
263
+ };
264
+ NodeComp.prototype.getPercent = function () {
265
+ if (this.instance instanceof ccui.LoadingBar) {
266
+ return this.instance.getPercent();
267
+ }
268
+ return 0;
269
+ };
270
+ NodeComp.prototype.setPercent = function (val) {
271
+ if (this.instance instanceof ccui.LoadingBar) {
272
+ return this.instance.setPercent(val);
273
+ }
274
+ };
275
+ NodeComp.prototype.setTouchEnabled = function (enabled) {
276
+ if (!cc.sys.isObjectValid(this.instance)) {
277
+ return;
278
+ }
279
+ if (this.instance instanceof ccui.Widget) {
280
+ this.instance.setTouchEnabled(enabled);
281
+ }
282
+ };
283
+ NodeComp.prototype.addTouchEventListener = function (cb) {
284
+ if (!cc.sys.isObjectValid(this.instance)) {
285
+ return;
286
+ }
287
+ if (this.instance instanceof ccui.Widget) {
288
+ this.instance.addTouchEventListener(cb);
289
+ }
290
+ };
291
+ NodeComp.prototype.convertToNodeSpace = function (point) {
292
+ var _a = this.instance.convertToNodeSpace(point), x = _a.x, y = _a.y;
293
+ return (0, polyfills_1.Vec2)(x, y);
294
+ };
295
+ NodeComp.prototype.convertToNodeSpaceAR = function (point) {
296
+ var _a = this.instance.convertToNodeSpaceAR(point), x = _a.x, y = _a.y;
297
+ return (0, polyfills_1.Vec2)(x, y);
298
+ };
299
+ NodeComp.prototype.convertToWorldSpaceAR = function (point) {
300
+ var _a = this.instance.convertToWorldSpaceAR(point), x = _a.x, y = _a.y;
301
+ return (0, polyfills_1.Vec2)(x, y);
302
+ };
303
+ NodeComp.prototype.getPosition = function () {
304
+ return (0, polyfills_1.Vec2)(this.x, this.y);
305
+ };
306
+ NodeComp.prototype.setPosition = function (x, y) {
307
+ if (typeof x !== 'number') {
308
+ this.x = x.x;
309
+ this.y = x.y;
310
+ }
311
+ else {
312
+ this.x = x;
313
+ this.y = y;
314
+ }
315
+ };
316
+ NodeComp.prototype.setRotation = function (deg) {
317
+ this.instance.setRotation(deg);
318
+ };
319
+ NodeComp.prototype.getRotation = function () {
320
+ return this.instance.getRotation();
321
+ };
322
+ NodeComp.prototype.setAnchorPoint = function (point, y) {
323
+ this.instance.setAnchorPoint(point, y);
324
+ };
325
+ NodeComp.prototype.getAnchorPoint = function () {
326
+ return this.instance.getAnchorPoint();
327
+ };
328
+ NodeComp.prototype.getBoundingBox = function () {
329
+ var box = this.instance.getBoundingBox();
330
+ box.contains = function (point) {
331
+ return this.x <= point.x && this.x + this.width >= point.x && this.y <= point.y && this.y + this.height >= point.y;
332
+ };
333
+ return box;
334
+ };
335
+ NodeComp.prototype.getContentSize = function () {
336
+ return this.instance.getContentSize();
337
+ };
338
+ NodeComp.prototype.setContentSize = function (size, height) {
339
+ this.instance.setContentSize(size, height);
340
+ if (this.instance instanceof cc.ClippingNode) {
341
+ var hw = (size.width || size) * 0.5;
342
+ var hh = (size.height || height) * 0.5;
343
+ var stencil = new cc.DrawNode();
344
+ var rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)];
345
+ stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE);
346
+ // stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
347
+ this.instance.stencil = stencil;
348
+ }
349
+ };
350
+ NodeComp.prototype.setColor = function (color) {
351
+ this.instance.setColor(color);
352
+ };
353
+ NodeComp.prototype.setScale = function (scaleX, scaleY) {
354
+ this.instance.setScale(scaleX, scaleY || scaleX);
355
+ };
356
+ NodeComp.prototype.runAction = function (atc) {
357
+ this.instance.runAction(atc);
358
+ };
359
+ NodeComp.prototype.stopAllActions = function () {
360
+ this.instance.stopAllActions();
361
+ };
362
+ NodeComp.prototype.pauseAllActionsAndSchedule = function () {
363
+ this.instance.pause();
364
+ this.instance.unscheduleUpdate();
365
+ };
366
+ NodeComp.prototype.resumeAllActionsAndSchedule = function () {
367
+ this.instance.resume();
368
+ this.instance.scheduleUpdate();
369
+ };
370
+ NodeComp.prototype.removeFromParent = function (cleanup) {
371
+ var _this = this;
372
+ if (this.parent) {
373
+ (0, remove_1.default)(this.parent.children, function (_a) {
374
+ var entity = _a.entity;
375
+ return entity.id === _this.entity.id;
376
+ });
377
+ }
378
+ if (cleanup) {
379
+ this.children.forEach(function (child) {
380
+ child.entity.destroy();
381
+ });
382
+ this.parent = null;
383
+ this.entity.destroy();
384
+ this.instance.removeFromParent(cleanup);
385
+ }
386
+ else {
387
+ this.active = false;
388
+ this.stopAllActions();
389
+ this.instance.removeFromParent();
390
+ }
391
+ };
392
+ NodeComp.prototype.addChild = function (child) {
393
+ child.parent = this;
394
+ this.children.push(child);
395
+ this.instance.addChild(child.instance);
396
+ };
397
+ NodeComp.prototype.removeAllChildren = function (cleanup) {
398
+ this.instance.removeAllChildren(cleanup);
399
+ };
400
+ NodeComp.prototype.getData = function (key) {
401
+ var data = this.getComponent(NoRenderComponent_1.ExtraDataComp);
402
+ if (!data)
403
+ throw Error('need add ExtraDataComp to Node');
404
+ return data.getData(key);
405
+ };
406
+ NodeComp.prototype.setData = function (key, value) {
407
+ var data = this.getComponent(NoRenderComponent_1.ExtraDataComp);
408
+ if (!data) {
409
+ this.addComponent((0, utils_1.instantiate)(NoRenderComponent_1.ExtraDataComp, { key: key, value: value }));
410
+ }
411
+ else {
412
+ data.setData(key, value);
413
+ }
414
+ };
415
+ NodeComp.prototype.resolveComponent = function (component) {
416
+ if (component.constructor.hasRender) {
417
+ this.addChild(component.node);
418
+ }
419
+ else {
420
+ this.addComponent(component);
421
+ }
422
+ };
423
+ return NodeComp;
424
+ }());
425
+ exports.NodeComp = NodeComp;
@@ -0,0 +1,53 @@
1
+ import { GraphicsRenderProps, SpineData } from '../../../@types/safex';
2
+ import { ComponentX } from '../core/decorator';
3
+ export declare class NodeRender extends ComponentX {
4
+ nodeName: string;
5
+ }
6
+ interface SpriteRenderProps {
7
+ spriteFrame: string;
8
+ texType?: number;
9
+ type?: number;
10
+ }
11
+ export declare class SpriteRender extends ComponentX<SpriteRenderProps & {
12
+ $ref?: SpriteRender;
13
+ }, cc.Sprite> {
14
+ get spriteFrame(): string;
15
+ set spriteFrame(frame: string);
16
+ }
17
+ interface MaskRenderProps {
18
+ type?: number;
19
+ segments?: number;
20
+ inverted?: boolean;
21
+ }
22
+ export declare class MaskRender extends ComponentX<MaskRenderProps, cc.ClippingNode> {
23
+ }
24
+ export declare class ParticleComp extends ComponentX<cc.ParticleSystem> {
25
+ plistFile: string;
26
+ }
27
+ interface SpineSkeletonProps {
28
+ data: SpineData;
29
+ skin?: string;
30
+ animation?: string;
31
+ timeScale?: number;
32
+ loop?: boolean;
33
+ }
34
+ export declare class SpineSkeleton extends ComponentX<SpineSkeletonProps & {
35
+ $ref: SpineSkeleton;
36
+ }> {
37
+ data: SpineData;
38
+ skin: string;
39
+ animation: string;
40
+ loop: boolean;
41
+ timeScale: number;
42
+ setAnimation(name: string, loop?: boolean): void;
43
+ setSkeletonData(data: string): void;
44
+ }
45
+ export declare class GraphicsRender extends ComponentX<GraphicsRenderProps, cc.DrawNode> {
46
+ lineWidth: number;
47
+ strokeColor: cc.Color;
48
+ fillColor: cc.Color;
49
+ circle(x: any, y: any, r: any): void;
50
+ clear(): void;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=RenderComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtE,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;IAAE,IAAI,CAAC,EAAE,YAAY,CAAA;CAAE,EAAE,EAAE,CAAC,MAAM,CAAC;IAClG,IAAI,WAAW,WAEd;IAED,IAAI,WAAW,CAAC,KAAK,QAAA,EAepB;CACF;AACD,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AACD,qBAAa,UAAW,SAAQ,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC,YAAY,CAAC;CAAG;AAE/E,qBAAa,YAAa,SAAQ,UAAU,CAAC,EAAE,CAAC,cAAc,CAAC;IAC7D,SAAS,EAAE,MAAM,CAAA;CAClB;AACD,UAAU,kBAAkB;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AACD,qBAAa,aAAc,SAAQ,UAAU,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;IACzF,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IAEjB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,UAAQ;IAOvC,eAAe,CAAC,IAAI,EAAE,MAAM;CAK7B;AAED,qBAAa,cAAe,SAAQ,UAAU,CAAC,mBAAmB,EAAE,EAAE,CAAC,QAAQ,CAAC;IAC9E,SAAS,SAAI;IACb,WAAW,WAAM;IACjB,SAAS,WAAO;IAEhB,MAAM,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,EAAE,CAAC,KAAA;IAwDd,KAAK;CAKN"}
@@ -0,0 +1,158 @@
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.GraphicsRender = exports.SpineSkeleton = exports.ParticleComp = exports.MaskRender = exports.SpriteRender = exports.NodeRender = void 0;
19
+ var polyfills_1 = require("../../polyfills");
20
+ var decorator_1 = require("../core/decorator");
21
+ var NodeRender = /** @class */ (function (_super) {
22
+ __extends(NodeRender, _super);
23
+ function NodeRender() {
24
+ return _super !== null && _super.apply(this, arguments) || this;
25
+ }
26
+ return NodeRender;
27
+ }(decorator_1.ComponentX));
28
+ exports.NodeRender = NodeRender;
29
+ var SpriteRender = /** @class */ (function (_super) {
30
+ __extends(SpriteRender, _super);
31
+ function SpriteRender() {
32
+ return _super !== null && _super.apply(this, arguments) || this;
33
+ }
34
+ Object.defineProperty(SpriteRender.prototype, "spriteFrame", {
35
+ get: function () {
36
+ return this.props.spriteFrame;
37
+ },
38
+ set: function (frame) {
39
+ this.props.spriteFrame = frame;
40
+ if (this.node && this.node.instance instanceof cc.Sprite) {
41
+ this.node.instance.setTexture(frame);
42
+ }
43
+ // } else if (this.node.instance instanceof ccui.ImageView) {
44
+ // if (this.texType) {
45
+ // this.node.instance.loadTexture(frame, this.texType)
46
+ // } else {
47
+ // this.node.instance.loadTexture(frame)
48
+ // }
49
+ // const sprite = new cc.Sprite(frame)
50
+ // this.node.setContentSize(sprite.getContentSize())
51
+ // } else if (this.node.instance instanceof ccui.Button) {
52
+ // this.node.instance.loadTextureNormal(frame)
53
+ },
54
+ enumerable: false,
55
+ configurable: true
56
+ });
57
+ return SpriteRender;
58
+ }(decorator_1.ComponentX));
59
+ exports.SpriteRender = SpriteRender;
60
+ var MaskRender = /** @class */ (function (_super) {
61
+ __extends(MaskRender, _super);
62
+ function MaskRender() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ return MaskRender;
66
+ }(decorator_1.ComponentX));
67
+ exports.MaskRender = MaskRender;
68
+ var ParticleComp = /** @class */ (function (_super) {
69
+ __extends(ParticleComp, _super);
70
+ function ParticleComp() {
71
+ return _super !== null && _super.apply(this, arguments) || this;
72
+ }
73
+ return ParticleComp;
74
+ }(decorator_1.ComponentX));
75
+ exports.ParticleComp = ParticleComp;
76
+ var SpineSkeleton = /** @class */ (function (_super) {
77
+ __extends(SpineSkeleton, _super);
78
+ function SpineSkeleton() {
79
+ return _super !== null && _super.apply(this, arguments) || this;
80
+ }
81
+ SpineSkeleton.prototype.setAnimation = function (name, loop) {
82
+ if (loop === void 0) { loop = false; }
83
+ var skel = this.node.instance;
84
+ if (skel.setAnimation) {
85
+ skel.setAnimation(0, name, loop);
86
+ }
87
+ };
88
+ SpineSkeleton.prototype.setSkeletonData = function (data) {
89
+ var skel = this.node.instance;
90
+ var atlas = data.replace('.json', '.atlas');
91
+ skel.initWithArgs(data, atlas, this.node.scale);
92
+ };
93
+ return SpineSkeleton;
94
+ }(decorator_1.ComponentX));
95
+ exports.SpineSkeleton = SpineSkeleton;
96
+ var GraphicsRender = /** @class */ (function (_super) {
97
+ __extends(GraphicsRender, _super);
98
+ function GraphicsRender() {
99
+ var _this = _super !== null && _super.apply(this, arguments) || this;
100
+ _this.lineWidth = 5;
101
+ _this.strokeColor = polyfills_1.RED;
102
+ _this.fillColor = polyfills_1.BLUE;
103
+ return _this;
104
+ }
105
+ GraphicsRender.prototype.circle = function (x, y, r) {
106
+ if (this.node.instance instanceof cc.DrawNode) {
107
+ this.node.instance.drawDot(cc.p(x, y), r, this.fillColor);
108
+ }
109
+ };
110
+ // fill() { }
111
+ // stroke() { }
112
+ // drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
113
+ // }
114
+ // // drawPoints(points: Vec2[], color: Color4B) {
115
+ // // }
116
+ // drawLine(origin: Vec2, destination: Vec2, color: Color4B, thickness: Float) {
117
+ // }
118
+ // drawRect(origin: Vec2, destination: Vec2, color: Color4B) {
119
+ // this.node.instance.drawRect(origin, destination, color)
120
+ // }
121
+ // drawSolidRect(origin: Vec2, destination: Vec2, color: Color4B) {
122
+ // }
123
+ // drawCircle(center: Vec2, radius: Float, angle?: Float, segments?: Integer, drawLineToCenter?: boolean, scaleX?: Float, scaleY?: Float, color?: Color4B, thickness?: Float) {
124
+ // this.node.instance.drawCircle(x, y, radius)
125
+ // }
126
+ // drawSolidCircle(origin: Vec2, destination: Vec2, color: Color4B) {
127
+ // }
128
+ // drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B) {
129
+ // }
130
+ // drawCubicBezier(origin: Vec2, destination: Vec2, color: Color4B) {
131
+ // }
132
+ // drawCardinalSpline(points: Vec2[], color: Color4B) {
133
+ // }
134
+ // drawCatmullRom(points: Vec2[], color: Color4B) {
135
+ // }
136
+ // drawPoly(points: Vec2[], closedPolygon: boolean, color: Color4B, thickness?: Float) {
137
+ // this.node.instance.poly(points, closedPolygon)
138
+ // this.node.instance.fill(color)
139
+ // }
140
+ // drawSolidPoly(points: Vec2[], color: Color4B) {
141
+ // this.node.instance.drawPoly(points, color)
142
+ // }
143
+ // drawDot(points: Vec2[], color: Color4B) {
144
+ // }
145
+ // drawSegment(from: Vec2, to: Vec2, color: Color4B) {
146
+ // }
147
+ // drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B) {
148
+ // this.node.instance.poly([p1, p2, p3], true)
149
+ // this.node.instance.fill(color)
150
+ // }
151
+ GraphicsRender.prototype.clear = function () {
152
+ if (this.node.instance instanceof cc.DrawNode) {
153
+ this.node.instance.clear();
154
+ }
155
+ };
156
+ return GraphicsRender;
157
+ }(decorator_1.ComponentX));
158
+ exports.GraphicsRender = GraphicsRender;
@@ -0,0 +1,5 @@
1
+ import { EnhancedComponent } from '../components/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/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAGnE,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CASP"}
@@ -0,0 +1,38 @@
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;