@safe-engine/pixi 1.0.0

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 (72) hide show
  1. package/.github/workflows/npm-publish.yml +35 -0
  2. package/README.md +4 -0
  3. package/dist/app.d.ts +9 -0
  4. package/dist/app.d.ts.map +1 -0
  5. package/dist/app.js +102 -0
  6. package/dist/components/EnhancedComponent.d.ts +22 -0
  7. package/dist/components/EnhancedComponent.d.ts.map +1 -0
  8. package/dist/components/EnhancedComponent.js +62 -0
  9. package/dist/components/GUIComponent.d.ts +72 -0
  10. package/dist/components/GUIComponent.d.ts.map +1 -0
  11. package/dist/components/GUIComponent.js +178 -0
  12. package/dist/components/NodeComp.d.ts +104 -0
  13. package/dist/components/NodeComp.d.ts.map +1 -0
  14. package/dist/components/NodeComp.js +420 -0
  15. package/dist/components/RenderComponent.d.ts +29 -0
  16. package/dist/components/RenderComponent.d.ts.map +1 -0
  17. package/dist/components/RenderComponent.js +89 -0
  18. package/dist/core/Color.d.ts +7 -0
  19. package/dist/core/Color.d.ts.map +1 -0
  20. package/dist/core/Color.js +6 -0
  21. package/dist/core/LoadingBar.d.ts +13 -0
  22. package/dist/core/LoadingBar.d.ts.map +1 -0
  23. package/dist/core/LoadingBar.js +55 -0
  24. package/dist/core/Scene.d.ts +6 -0
  25. package/dist/core/Scene.d.ts.map +1 -0
  26. package/dist/core/Scene.js +39 -0
  27. package/dist/core/Size.d.ts +10 -0
  28. package/dist/core/Size.d.ts.map +1 -0
  29. package/dist/core/Size.js +22 -0
  30. package/dist/core/Vec2.d.ts +20 -0
  31. package/dist/core/Vec2.d.ts.map +1 -0
  32. package/dist/core/Vec2.js +70 -0
  33. package/dist/core/decorator.d.ts +9 -0
  34. package/dist/core/decorator.d.ts.map +1 -0
  35. package/dist/core/decorator.js +46 -0
  36. package/dist/gworld.d.ts +8 -0
  37. package/dist/gworld.d.ts.map +1 -0
  38. package/dist/gworld.js +43 -0
  39. package/dist/helper/html-text-parser.d.ts +30 -0
  40. package/dist/helper/html-text-parser.d.ts.map +1 -0
  41. package/dist/helper/html-text-parser.js +353 -0
  42. package/dist/helper/utils.d.ts +17 -0
  43. package/dist/helper/utils.d.ts.map +1 -0
  44. package/dist/helper/utils.js +64 -0
  45. package/dist/index.d.ts +11 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +39 -0
  48. package/dist/systems/GUISystem.d.ts +7 -0
  49. package/dist/systems/GUISystem.d.ts.map +1 -0
  50. package/dist/systems/GUISystem.js +94 -0
  51. package/dist/systems/RenderSystem.d.ts +15 -0
  52. package/dist/systems/RenderSystem.d.ts.map +1 -0
  53. package/dist/systems/RenderSystem.js +100 -0
  54. package/package.json +30 -0
  55. package/src/app.ts +51 -0
  56. package/src/components/EnhancedComponent.ts +57 -0
  57. package/src/components/GUIComponent.ts +147 -0
  58. package/src/components/NodeComp.ts +409 -0
  59. package/src/components/RenderComponent.ts +65 -0
  60. package/src/core/Color.ts +3 -0
  61. package/src/core/LoadingBar.ts +33 -0
  62. package/src/core/Scene.ts +17 -0
  63. package/src/core/Size.ts +21 -0
  64. package/src/core/Vec2.ts +52 -0
  65. package/src/core/decorator.ts +18 -0
  66. package/src/gworld.ts +17 -0
  67. package/src/helper/html-text-parser.ts +364 -0
  68. package/src/helper/utils.ts +64 -0
  69. package/src/index.ts +10 -0
  70. package/src/systems/GUISystem.ts +95 -0
  71. package/src/systems/RenderSystem.ts +100 -0
  72. package/tsconfig.json +24 -0
@@ -0,0 +1,420 @@
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 pixi_js_1 = require("pixi.js");
9
+ var pixi_action_ease_1 = require("pixi-action-ease");
10
+ var GUIComponent_1 = require("./GUIComponent");
11
+ var NodeComp = /** @class */ (function () {
12
+ function NodeComp(instance, entity) {
13
+ this.events = {};
14
+ this.data = {};
15
+ this.children = [];
16
+ this.actionsList = [];
17
+ this._group = 0;
18
+ this.entity = entity;
19
+ this.instance = instance;
20
+ this.instance.eventMode = 'static';
21
+ }
22
+ NodeComp.prototype.setOnTouchStart = function (cb) {
23
+ var _this = this;
24
+ this.onTouchStart = cb;
25
+ this.instance.on('touchstart', function (event) {
26
+ var global = event.global;
27
+ _this.onTouchStart({ location: global });
28
+ });
29
+ };
30
+ NodeComp.prototype.setOnTouchMove = function (cb) {
31
+ var _this = this;
32
+ this.onTouchMove = cb;
33
+ this.instance.on('touchmove', function (event) {
34
+ var global = event.global;
35
+ _this.onTouchMove({ location: global });
36
+ });
37
+ };
38
+ NodeComp.prototype.setOnTouchEnd = function (cb) {
39
+ var _this = this;
40
+ this.onTouchEnd = cb;
41
+ this.instance.on('touchend', function (event) {
42
+ var global = event.global;
43
+ _this.onTouchEnd({ location: global });
44
+ });
45
+ };
46
+ NodeComp.prototype.setOnTouchCancel = function (cb) {
47
+ var _this = this;
48
+ this.onTouchCancel = cb;
49
+ this.instance.on('touchcancel', function (event) {
50
+ var global = event.global;
51
+ _this.onTouchCancel({ location: global });
52
+ });
53
+ };
54
+ Object.defineProperty(NodeComp.prototype, "uuid", {
55
+ get: function () {
56
+ return this.entity.id;
57
+ },
58
+ enumerable: false,
59
+ configurable: true
60
+ });
61
+ Object.defineProperty(NodeComp.prototype, "position", {
62
+ get: function () {
63
+ return this.getPosition();
64
+ },
65
+ set: function (val) {
66
+ this.setPosition(val.x, val.y);
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ Object.defineProperty(NodeComp.prototype, "x", {
72
+ get: function () {
73
+ return this.instance.x;
74
+ },
75
+ set: function (val) {
76
+ this.instance.x = val;
77
+ },
78
+ enumerable: false,
79
+ configurable: true
80
+ });
81
+ Object.defineProperty(NodeComp.prototype, "y", {
82
+ get: function () {
83
+ return this.instance.y;
84
+ },
85
+ set: function (val) {
86
+ this.instance.y = val;
87
+ },
88
+ enumerable: false,
89
+ configurable: true
90
+ });
91
+ Object.defineProperty(NodeComp.prototype, "scale", {
92
+ // get scale() {
93
+ // return this.instance.scale
94
+ // }
95
+ set: function (val) {
96
+ this.instance.scale = new pixi_js_1.Point(val, val);
97
+ },
98
+ enumerable: false,
99
+ configurable: true
100
+ });
101
+ Object.defineProperty(NodeComp.prototype, "scaleX", {
102
+ get: function () {
103
+ return this.instance.scale.x;
104
+ },
105
+ set: function (val) {
106
+ this.instance.scale.x = val;
107
+ },
108
+ enumerable: false,
109
+ configurable: true
110
+ });
111
+ Object.defineProperty(NodeComp.prototype, "scaleY", {
112
+ get: function () {
113
+ return this.instance.y;
114
+ },
115
+ set: function (val) {
116
+ this.instance.y = val;
117
+ },
118
+ enumerable: false,
119
+ configurable: true
120
+ });
121
+ Object.defineProperty(NodeComp.prototype, "anchorX", {
122
+ get: function () {
123
+ return this.instance.anchor.x;
124
+ },
125
+ set: function (val) {
126
+ if (this.instance instanceof pixi_js_1.Sprite)
127
+ this.instance.anchor.x = val;
128
+ },
129
+ enumerable: false,
130
+ configurable: true
131
+ });
132
+ Object.defineProperty(NodeComp.prototype, "anchorY", {
133
+ get: function () {
134
+ return this.instance.anchor.y;
135
+ },
136
+ set: function (val) {
137
+ if (this.instance instanceof pixi_js_1.Sprite)
138
+ this.instance.anchor.y = val;
139
+ },
140
+ enumerable: false,
141
+ configurable: true
142
+ });
143
+ Object.defineProperty(NodeComp.prototype, "rotation", {
144
+ /** rotation is in radians */
145
+ get: function () {
146
+ return this.instance.rotation;
147
+ },
148
+ /** rotation is in radians */
149
+ set: function (val) {
150
+ this.instance.rotation = val;
151
+ },
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ Object.defineProperty(NodeComp.prototype, "angle", {
156
+ /** angle is in degrees. */
157
+ get: function () {
158
+ return this.instance.angle;
159
+ },
160
+ /** angle is in degrees. */
161
+ set: function (val) {
162
+ this.instance.angle = val;
163
+ },
164
+ enumerable: false,
165
+ configurable: true
166
+ });
167
+ Object.defineProperty(NodeComp.prototype, "color", {
168
+ get: function () {
169
+ return this.instance.tint;
170
+ },
171
+ set: function (val) {
172
+ if (this.instance instanceof pixi_js_1.Sprite)
173
+ this.instance.tint = val;
174
+ },
175
+ enumerable: false,
176
+ configurable: true
177
+ });
178
+ Object.defineProperty(NodeComp.prototype, "opacity", {
179
+ get: function () {
180
+ return this.instance.alpha;
181
+ },
182
+ set: function (val) {
183
+ this.instance.alpha = val;
184
+ },
185
+ enumerable: false,
186
+ configurable: true
187
+ });
188
+ Object.defineProperty(NodeComp.prototype, "active", {
189
+ get: function () {
190
+ return this.instance.visible && !this.instance.destroyed;
191
+ },
192
+ set: function (val) {
193
+ this.instance.visible = val;
194
+ },
195
+ enumerable: false,
196
+ configurable: true
197
+ });
198
+ Object.defineProperty(NodeComp.prototype, "group", {
199
+ get: function () {
200
+ return this._group;
201
+ },
202
+ set: function (val) {
203
+ this._group = val;
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ Object.defineProperty(NodeComp.prototype, "width", {
209
+ get: function () {
210
+ return this.instance.width;
211
+ },
212
+ set: function (val) {
213
+ this.instance.width = val;
214
+ },
215
+ enumerable: false,
216
+ configurable: true
217
+ });
218
+ Object.defineProperty(NodeComp.prototype, "height", {
219
+ get: function () {
220
+ return this.instance.height;
221
+ },
222
+ set: function (val) {
223
+ this.instance.height = val;
224
+ },
225
+ enumerable: false,
226
+ configurable: true
227
+ });
228
+ Object.defineProperty(NodeComp.prototype, "zIndex", {
229
+ get: function () {
230
+ return this.instance.zIndex;
231
+ },
232
+ set: function (val) {
233
+ this.instance.zIndex = val;
234
+ },
235
+ enumerable: false,
236
+ configurable: true
237
+ });
238
+ Object.defineProperty(NodeComp.prototype, "childrenCount", {
239
+ get: function () {
240
+ return this.children.length;
241
+ },
242
+ enumerable: false,
243
+ configurable: true
244
+ });
245
+ NodeComp.prototype.addComponent = function (instance) {
246
+ return this.entity.assign(instance);
247
+ };
248
+ NodeComp.prototype.getComponent = function (component) {
249
+ return this.entity.getComponent(component);
250
+ };
251
+ NodeComp.prototype.getComponentsInChildren = function (component) {
252
+ if (!this.children.length) {
253
+ return [];
254
+ }
255
+ var listHave = this.children.filter(function (child) {
256
+ return child.getComponent(component);
257
+ });
258
+ return listHave.map(function (node) { return node.getComponent(component); });
259
+ };
260
+ NodeComp.prototype.getComponentInChildren = function (component) {
261
+ return this.getComponentsInChildren(component)[0];
262
+ };
263
+ NodeComp.prototype.convertToNodeSpace = function (point) {
264
+ return this.instance.toLocal(point);
265
+ };
266
+ NodeComp.prototype.convertToNodeSpaceAR = function (point) {
267
+ return this.instance.toLocal(point);
268
+ };
269
+ NodeComp.prototype.convertToWorldSpaceAR = function (point) {
270
+ return this.instance.toGlobal(point);
271
+ };
272
+ NodeComp.prototype.getPosition = function () {
273
+ return this.instance.position;
274
+ };
275
+ NodeComp.prototype.setPosition = function (x, y) {
276
+ if (typeof x !== 'number') {
277
+ this.x = x.x;
278
+ this.y = x.y;
279
+ }
280
+ else {
281
+ this.x = x;
282
+ this.y = y;
283
+ }
284
+ };
285
+ NodeComp.prototype.setRotation = function (deg) {
286
+ this.instance.rotation = deg;
287
+ };
288
+ NodeComp.prototype.getRotation = function () {
289
+ return this.instance.rotation;
290
+ };
291
+ // setAnchorPoint(point: number | cc.Point, y?: number) {
292
+ // this.instance.setAnchorPoint(point, y)
293
+ // }
294
+ // getAnchorPoint() {
295
+ // return this.instance.getAnchorPoint()
296
+ // }
297
+ // getBoundingBox() {
298
+ // const box = this.instance.getBoundingBox()
299
+ // box.contains = function (point) {
300
+ // return this.x <= point.x && this.x + this.width >= point.x && this.y <= point.y && this.y + this.height >= point.y
301
+ // }
302
+ // return box
303
+ // }
304
+ NodeComp.prototype.getContentSize = function () {
305
+ return this.instance;
306
+ };
307
+ // setContentSize(size: cc.Size | number, height?: number) {
308
+ // this.instance.setContentSize(size, height)
309
+ // if (this.instance instanceof cc.ClippingNode) {
310
+ // const hw = ((size as any).width || size) * 0.5
311
+ // const hh = ((size as any).height || height) * 0.5
312
+ // const stencil = new cc.DrawNode()
313
+ // const rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)]
314
+ // stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE)
315
+ // // stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
316
+ // this.instance.stencil = stencil
317
+ // }
318
+ // }
319
+ NodeComp.prototype.setColor = function (color) {
320
+ this.instance.tint = color;
321
+ };
322
+ NodeComp.prototype.setScale = function (scaleX, scaleY) {
323
+ this.instance.scale.x = scaleX;
324
+ this.instance.scale.x = scaleY || scaleX;
325
+ };
326
+ NodeComp.prototype.runAction = function (act) {
327
+ var animation = pixi_action_ease_1.actionManager.runAction(this.instance, act);
328
+ this.actionsList.push(animation);
329
+ };
330
+ NodeComp.prototype.stopAllActions = function () {
331
+ this.actionsList.forEach(function (act) {
332
+ pixi_action_ease_1.actionManager.cancelAction(act);
333
+ });
334
+ this.actionsList = [];
335
+ };
336
+ NodeComp.prototype.pauseAllActions = function () {
337
+ this.actionsList.forEach(function (anim) {
338
+ anim.isPause = true;
339
+ });
340
+ };
341
+ NodeComp.prototype.resumeAllActions = function () {
342
+ this.actionsList.forEach(function (anim) {
343
+ anim.isPause = false;
344
+ });
345
+ };
346
+ NodeComp.prototype.destroy = function () {
347
+ var _this = this;
348
+ if (this.parent) {
349
+ (0, remove_1.default)(this.parent.children, function (_a) {
350
+ var entity = _a.entity;
351
+ return entity.id === _this.entity.id;
352
+ });
353
+ }
354
+ this.children.forEach(function (child) {
355
+ child.destroy();
356
+ });
357
+ this.parent = null;
358
+ this.entity.destroy();
359
+ this.stopAllActions();
360
+ this.instance.destroy();
361
+ };
362
+ NodeComp.prototype.removeFromParent = function () {
363
+ this.active = false;
364
+ this.stopAllActions();
365
+ this.instance.removeFromParent();
366
+ };
367
+ NodeComp.prototype.addChild = function (child, zOrder) {
368
+ child.parent = this;
369
+ child.active = true;
370
+ this.children.push(child);
371
+ this.instance.addChild(child.instance);
372
+ if (zOrder)
373
+ child.zIndex = zOrder;
374
+ };
375
+ NodeComp.prototype.destroyAllChildren = function () {
376
+ this.children.forEach(function (child) {
377
+ child.destroy();
378
+ });
379
+ };
380
+ NodeComp.prototype.on = function (name, callback, target) {
381
+ var bound = target ? callback.bind(target) : callback;
382
+ if (this.events[name]) {
383
+ this.events[name].push(bound);
384
+ }
385
+ else {
386
+ this.events[name] = [bound];
387
+ }
388
+ };
389
+ NodeComp.prototype.off = function (name) {
390
+ this.events[name] = undefined;
391
+ };
392
+ NodeComp.prototype.emit = function (name) {
393
+ var params = [];
394
+ for (var _i = 1; _i < arguments.length; _i++) {
395
+ params[_i - 1] = arguments[_i];
396
+ }
397
+ if (this.events[name]) {
398
+ this.events[name].forEach(function (fc) { return fc.apply(void 0, params); });
399
+ }
400
+ };
401
+ NodeComp.prototype.resolveComponent = function (component) {
402
+ if (component.constructor.hasRender) {
403
+ this.addChild(component.node);
404
+ }
405
+ else {
406
+ this.addComponent(component);
407
+ if (component instanceof GUIComponent_1.ProgressBarComp) {
408
+ this.addChild(component.node);
409
+ }
410
+ }
411
+ };
412
+ NodeComp.prototype.getData = function (key) {
413
+ return this.data[key];
414
+ };
415
+ NodeComp.prototype.setData = function (key, val) {
416
+ this.data[key] = val;
417
+ };
418
+ return NodeComp;
419
+ }());
420
+ exports.NodeComp = NodeComp;
@@ -0,0 +1,29 @@
1
+ import { ColorSource, Point, TextureSource } from 'pixi.js';
2
+ import { ComponentX } from '../core/decorator';
3
+ import { LoadingBar, LoadingBarMode } from '../core/LoadingBar';
4
+ import { SpriteTypes } from '../systems/RenderSystem';
5
+ export declare class NodeRender extends ComponentX {
6
+ nodeName?: string;
7
+ }
8
+ export declare class SpriteRender extends ComponentX {
9
+ spriteFrame: TextureSource;
10
+ type: SpriteTypes;
11
+ fillType: LoadingBarMode;
12
+ fillRange: number;
13
+ fillCenter: Point;
14
+ loadingBar: LoadingBar;
15
+ setFillRange(val: number): void;
16
+ getSpriteFrame(): TextureSource<any>;
17
+ setSpriteFrame(frame: any): void;
18
+ }
19
+ export declare class GraphicsRender extends ComponentX {
20
+ lineWidth: number;
21
+ strokeColor: ColorSource;
22
+ fillColor: ColorSource;
23
+ }
24
+ export declare class MaskRender extends ComponentX {
25
+ type: number;
26
+ segments: number;
27
+ inverted: boolean;
28
+ }
29
+ //# sourceMappingURL=RenderComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/components/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,qBAAa,UAAW,SAAQ,UAAU;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,YAAa,SAAQ,UAAU;IACnC,WAAW,EAAE,aAAa,CAAA;IAC1B,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,EAAE,cAAc,CAAqB;IAC7C,SAAS,SAAI;IACb,UAAU,EAAE,KAAK,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IAQtB,YAAY,CAAC,GAAG,EAAE,MAAM;IAMxB,cAAc;IAId,cAAc,CAAC,KAAK,KAAA;CAkBrB;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC5C,SAAS,SAAI;IACb,WAAW,EAAE,WAAW,CAAA;IACxB,SAAS,EAAE,WAAW,CAAA;CACvB;AAED,qBAAa,UAAW,SAAQ,UAAU;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;CAClB"}
@@ -0,0 +1,89 @@
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.MaskRender = exports.GraphicsRender = exports.SpriteRender = exports.NodeRender = void 0;
19
+ var pixi_js_1 = require("pixi.js");
20
+ var decorator_1 = require("../core/decorator");
21
+ var LoadingBar_1 = require("../core/LoadingBar");
22
+ var NodeRender = /** @class */ (function (_super) {
23
+ __extends(NodeRender, _super);
24
+ function NodeRender() {
25
+ return _super !== null && _super.apply(this, arguments) || this;
26
+ }
27
+ return NodeRender;
28
+ }(decorator_1.ComponentX));
29
+ exports.NodeRender = NodeRender;
30
+ var SpriteRender = /** @class */ (function (_super) {
31
+ __extends(SpriteRender, _super);
32
+ function SpriteRender() {
33
+ var _this = _super !== null && _super.apply(this, arguments) || this;
34
+ _this.fillType = LoadingBar_1.LoadingBarMode.BAR;
35
+ _this.fillRange = 1;
36
+ return _this;
37
+ }
38
+ // set fillStart(val: number) {
39
+ // if (this.node.instance instanceof cc.ProgressTimer) {
40
+ // this.node.instance.setMidpoint(cc.v2(val, val));
41
+ // }
42
+ // }
43
+ SpriteRender.prototype.setFillRange = function (val) {
44
+ if (this.loadingBar) {
45
+ this.loadingBar.progress = val;
46
+ }
47
+ };
48
+ SpriteRender.prototype.getSpriteFrame = function () {
49
+ return this.spriteFrame;
50
+ };
51
+ SpriteRender.prototype.setSpriteFrame = function (frame) {
52
+ this.spriteFrame = frame;
53
+ var sprite = this.node.instance;
54
+ // if (this.node.instance instanceof cc.Sprite) {
55
+ sprite.texture = pixi_js_1.Texture.from(frame);
56
+ // sprite.texture.rotate = 8
57
+ // } else if (this.node.instance instanceof ccui.ImageView) {
58
+ // if (this.texType) {
59
+ // this.node.instance.loadTexture(frame, this.texType);
60
+ // } else {
61
+ // this.node.instance.loadTexture(frame);
62
+ // }
63
+ // const sprite = new cc.Sprite(frame);
64
+ // this.node.setContentSize(sprite.getContentSize());
65
+ // } else if (this.node.instance instanceof ccui.Button) {
66
+ // this.node.instance.loadTextureNormal(frame);
67
+ // }
68
+ };
69
+ return SpriteRender;
70
+ }(decorator_1.ComponentX));
71
+ exports.SpriteRender = SpriteRender;
72
+ var GraphicsRender = /** @class */ (function (_super) {
73
+ __extends(GraphicsRender, _super);
74
+ function GraphicsRender() {
75
+ var _this = _super !== null && _super.apply(this, arguments) || this;
76
+ _this.lineWidth = 2;
77
+ return _this;
78
+ }
79
+ return GraphicsRender;
80
+ }(decorator_1.ComponentX));
81
+ exports.GraphicsRender = GraphicsRender;
82
+ var MaskRender = /** @class */ (function (_super) {
83
+ __extends(MaskRender, _super);
84
+ function MaskRender() {
85
+ return _super !== null && _super.apply(this, arguments) || this;
86
+ }
87
+ return MaskRender;
88
+ }(decorator_1.ComponentX));
89
+ exports.MaskRender = MaskRender;
@@ -0,0 +1,7 @@
1
+ export declare function Color4B(r: number, g: number, b: number, a: number): {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ };
7
+ //# sourceMappingURL=Color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../src/core/Color.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;;EAEjE"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Color4B = Color4B;
4
+ function Color4B(r, g, b, a) {
5
+ return ({ r: r, g: g, b: b, a: a });
6
+ }
@@ -0,0 +1,13 @@
1
+ import { Graphics, Point, Sprite } from 'pixi.js';
2
+ export declare enum LoadingBarMode {
3
+ BAR = 0,
4
+ RADIAL = 1
5
+ }
6
+ export declare class LoadingBar extends Graphics {
7
+ spriteComp: Sprite;
8
+ mode: LoadingBarMode;
9
+ fillCenter: Point;
10
+ constructor(mode: LoadingBarMode, spriteComp: Sprite);
11
+ set progress(val: number);
12
+ }
13
+ //# sourceMappingURL=LoadingBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingBar.d.ts","sourceRoot":"","sources":["../../src/core/LoadingBar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEjD,oBAAY,cAAc;IACxB,GAAG,IAAA;IACH,MAAM,IAAA;CACP;AAED,qBAAa,UAAW,SAAQ,QAAQ;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,cAAc,CAAA;IACpB,UAAU,QAAsB;gBACpB,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM;IAUpD,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAUvB;CACF"}
@@ -0,0 +1,55 @@
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.LoadingBar = exports.LoadingBarMode = void 0;
19
+ var pixi_js_1 = require("pixi.js");
20
+ var LoadingBarMode;
21
+ (function (LoadingBarMode) {
22
+ LoadingBarMode[LoadingBarMode["BAR"] = 0] = "BAR";
23
+ LoadingBarMode[LoadingBarMode["RADIAL"] = 1] = "RADIAL";
24
+ })(LoadingBarMode || (exports.LoadingBarMode = LoadingBarMode = {}));
25
+ var LoadingBar = /** @class */ (function (_super) {
26
+ __extends(LoadingBar, _super);
27
+ function LoadingBar(mode, spriteComp) {
28
+ var _this = _super.call(this) || this;
29
+ _this.fillCenter = new pixi_js_1.Point(0.5, 0.5);
30
+ _this.spriteComp = spriteComp;
31
+ _this.mode = mode || LoadingBarMode.BAR;
32
+ _this.beginFill(0xffffff);
33
+ _this.drawRect(0, 0, spriteComp.width, spriteComp.height);
34
+ spriteComp.mask = _this;
35
+ spriteComp.addChild(_this);
36
+ return _this;
37
+ }
38
+ Object.defineProperty(LoadingBar.prototype, "progress", {
39
+ set: function (val) {
40
+ this.clear();
41
+ this.beginFill(0xffffff);
42
+ if (this.mode === LoadingBarMode.BAR) {
43
+ var spriteComp = this.spriteComp;
44
+ this.drawRect(0, 0, spriteComp.width * val, spriteComp.height);
45
+ // console.log('new length', spriteComp.width)
46
+ this.x = -spriteComp.width * 0.5;
47
+ this.y = -spriteComp.height * 0.5;
48
+ }
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ return LoadingBar;
54
+ }(pixi_js_1.Graphics));
55
+ exports.LoadingBar = LoadingBar;
@@ -0,0 +1,6 @@
1
+ import { EnhancedComponent } from '../components/EnhancedComponent';
2
+ export declare class SceneComponent extends EnhancedComponent {
3
+ static boot: () => void;
4
+ static create(): SceneComponent;
5
+ }
6
+ //# sourceMappingURL=Scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAInE,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAA;IACvB,MAAM,CAAC,MAAM;CASd"}
@@ -0,0 +1,39 @@
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 app_1 = require("../app");
20
+ var EnhancedComponent_1 = require("../components/EnhancedComponent");
21
+ var NodeComp_1 = require("../components/NodeComp");
22
+ var gworld_1 = require("../gworld");
23
+ var SceneComponent = /** @class */ (function (_super) {
24
+ __extends(SceneComponent, _super);
25
+ function SceneComponent() {
26
+ return _super !== null && _super.apply(this, arguments) || this;
27
+ }
28
+ SceneComponent.create = function () {
29
+ var world = gworld_1.GameWorld.Instance;
30
+ world.entities.reset();
31
+ var root = world.entities.create();
32
+ var node = root.assign(new NodeComp_1.NodeComp(app_1.app.stage, root));
33
+ var sceneComponent = root.assign(new SceneComponent());
34
+ sceneComponent.node = node;
35
+ return sceneComponent;
36
+ };
37
+ return SceneComponent;
38
+ }(EnhancedComponent_1.EnhancedComponent));
39
+ exports.SceneComponent = SceneComponent;