@safe-engine/pixi 8.4.1 → 8.4.3
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.
- package/dist/app.d.ts +3 -3
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -2
- package/dist/base/gworld.d.ts +2 -1
- package/dist/base/gworld.d.ts.map +1 -1
- package/dist/base/index.d.ts +8 -0
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/utils.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.d.ts +2 -1
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.js +6 -5
- package/dist/box2d-wasm/debugDraw.d.ts +1 -1
- package/dist/box2d-wasm/debugDraw.d.ts.map +1 -1
- package/dist/box2d-wasm/debugDraw.js +7 -7
- package/dist/components/NodeComp.d.ts +10 -8
- package/dist/components/NodeComp.d.ts.map +1 -1
- package/dist/components/NodeComp.js +17 -11
- package/dist/core/Vec2.d.ts +30 -0
- package/dist/core/Vec2.d.ts.map +1 -0
- package/dist/core/Vec2.js +88 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/loader.d.ts +3 -0
- package/dist/core/loader.d.ts.map +1 -0
- package/dist/core/loader.js +21 -0
- package/dist/core/math.d.ts +1 -0
- package/dist/core/math.d.ts.map +1 -1
- package/dist/core/math.js +9 -0
- package/dist/gui/GUISystem.d.ts.map +1 -1
- package/dist/gui/GUISystem.js +4 -4
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/norender/NoRenderComponent.d.ts +2 -2
- package/dist/norender/NoRenderComponent.d.ts.map +1 -1
- package/dist/norender/NoRenderSystem.d.ts.map +1 -1
- package/dist/norender/NoRenderSystem.js +7 -6
- package/dist/norender/Touch.d.ts +32 -0
- package/dist/norender/Touch.d.ts.map +1 -0
- package/dist/norender/Touch.js +32 -0
- package/dist/render/RenderComponent.d.ts +3 -3
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +18 -28
- package/dist/render/RenderSystem.d.ts.map +1 -1
- package/dist/render/RenderSystem.js +3 -2
- package/package.json +2 -1
- package/src/app.ts +10 -4
- package/src/base/gworld.ts +2 -1
- package/src/base/index.ts +11 -0
- package/src/base/utils.ts +4 -4
- package/src/box2d-wasm/PhysicsSystem.ts +45 -48
- package/src/box2d-wasm/debugDraw.ts +80 -88
- package/src/components/NodeComp.ts +30 -30
- package/src/core/Vec2.ts +108 -0
- package/src/core/index.ts +7 -0
- package/src/core/loader.ts +12 -0
- package/src/core/math.ts +9 -0
- package/src/gui/GUISystem.ts +15 -9
- package/src/index.ts +3 -5
- package/src/norender/NoRenderComponent.ts +2 -2
- package/src/norender/NoRenderSystem.ts +12 -11
- package/src/norender/Touch.ts +37 -0
- package/src/render/RenderComponent.ts +35 -41
- package/src/render/RenderSystem.ts +5 -8
- package/dist/helper/html-text-parser.d.ts +0 -20
- package/dist/helper/html-text-parser.d.ts.map +0 -1
- package/dist/helper/html-text-parser.js +0 -64
package/dist/app.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Application } from 'pixi.js';
|
|
2
|
-
export declare function startGame(defaultFont: any, designedResolution
|
|
1
|
+
import { Application, AssetsClass } from 'pixi.js';
|
|
2
|
+
export declare function startGame(defaultFont: any, designedResolution: {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
|
-
}, id?: string): Promise<Application<import("pixi.js").Renderer>>;
|
|
5
|
+
}, assetManager: AssetsClass, id?: string): Promise<Application<import("pixi.js").Renderer>>;
|
|
6
6
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAQlD,wBAAsB,SAAS,CAC7B,WAAW,KAAA,EACX,kBAAkB;;;CAA+B,EACjD,YAAY,EAAE,WAAW,EACzB,EAAE,SAAe,oDA+BlB"}
|
package/dist/app.js
CHANGED
|
@@ -15,7 +15,7 @@ import { GUISystem } from './gui/GUISystem';
|
|
|
15
15
|
import { NoRenderSystem } from './norender/NoRenderSystem';
|
|
16
16
|
import { RenderSystem } from './render/RenderSystem';
|
|
17
17
|
export function startGame(defaultFont_1) {
|
|
18
|
-
return __awaiter(this, arguments, void 0, function* (defaultFont, designedResolution = { width: 720, height: 1280 }, id = '
|
|
18
|
+
return __awaiter(this, arguments, void 0, function* (defaultFont, designedResolution = { width: 720, height: 1280 }, assetManager, id = 'gameCanvas') {
|
|
19
19
|
const app = new Application();
|
|
20
20
|
yield app.init({
|
|
21
21
|
antialias: true,
|
|
@@ -28,7 +28,7 @@ export function startGame(defaultFont_1) {
|
|
|
28
28
|
click: true,
|
|
29
29
|
wheel: false,
|
|
30
30
|
},
|
|
31
|
-
canvas: document.getElementById(id)
|
|
31
|
+
canvas: document.getElementById(id),
|
|
32
32
|
});
|
|
33
33
|
// GameWorld.Instance.setup(NodeComp, app.stage)
|
|
34
34
|
Object.assign(app.canvas.style, {
|
|
@@ -41,6 +41,7 @@ export function startGame(defaultFont_1) {
|
|
|
41
41
|
// app.stage.position.y = app.renderer.height / app.renderer.resolution
|
|
42
42
|
// app.stage.scale.y = -1
|
|
43
43
|
GameWorld.Instance.app = app;
|
|
44
|
+
GameWorld.Instance.assetManager = assetManager;
|
|
44
45
|
initWorld(defaultFont);
|
|
45
46
|
startGameLoop(GameWorld.Instance);
|
|
46
47
|
return app;
|
package/dist/base/gworld.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Constructor, System, World } from 'entityx-ts';
|
|
2
|
-
import { Application } from 'pixi.js';
|
|
2
|
+
import { Application, AssetsClass } from 'pixi.js';
|
|
3
3
|
export declare class GameWorld extends World {
|
|
4
4
|
listUpdate: (System | Constructor<System>)[];
|
|
5
5
|
app: Application;
|
|
6
|
+
assetManager: AssetsClass;
|
|
6
7
|
update(dt: number): void;
|
|
7
8
|
private static _instance;
|
|
8
9
|
static get Instance(): GameWorld;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gworld.d.ts","sourceRoot":"","sources":["../../src/base/gworld.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"gworld.d.ts","sourceRoot":"","sources":["../../src/base/gworld.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAElD,qBAAa,SAAU,SAAQ,KAAK;IAClC,UAAU,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAK;IACjD,GAAG,EAAE,WAAW,CAAA;IAChB,YAAY,EAAE,WAAW,CAAA;IACzB,MAAM,CAAC,EAAE,EAAE,MAAM;IAMjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAEnC,WAAkB,QAAQ,cAGzB;CACF"}
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import { NodeComp } from '../components/NodeComp';
|
|
1
2
|
export * from './EnhancedComponent';
|
|
2
3
|
export * from './gworld';
|
|
3
4
|
export * from './utils';
|
|
5
|
+
export interface BaseComponentProps<T> {
|
|
6
|
+
$ref?: T;
|
|
7
|
+
$push?: T[];
|
|
8
|
+
$refNode?: NodeComp;
|
|
9
|
+
$pushNode?: NodeComp[];
|
|
10
|
+
node?: Partial<NodeComp>;
|
|
11
|
+
}
|
|
4
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/base/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAEzB"}
|
package/dist/base/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE/G,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAQtG;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,QAK5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
|
-
import { Graphics
|
|
2
|
+
import { Graphics } from 'pixi.js';
|
|
3
|
+
import { Vec2 } from '..';
|
|
3
4
|
export declare let box2D: typeof Box2D;
|
|
4
5
|
export declare function initBox2d(): Promise<void>;
|
|
5
6
|
export declare function setColliderMatrix(colliderMatrix?: boolean[][]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsSystem.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/PhysicsSystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,EAAoC,IAAI,EAAE,MAAM,IAAI,CAAA;AAmB3D,eAAO,IAAI,KAAK,EAAE,OAAO,KAAK,CAAA;AAC9B,wBAAsB,SAAS,kBAE9B;AAED,wBAAgB,iBAAiB,CAAC,cAAc,cAAW,QAG1D;AAOD,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAA;IACpB,cAAc,EAAE,IAAI,EAAE,CAAK;IAC3B,eAAe,EAAE,KAAK,CAAC,OAAO,EAAE,CAAK;IACrC,cAAc,cAAW;IACzB,QAAQ,EAAE,QAAQ,CAAA;IAElB,QAAQ;IAKR,SAAS,CAAC,aAAa,EAAE,YAAY;IA0ErC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IAYhE,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAIpB;CACF"}
|
|
@@ -20,7 +20,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
import Box2DFactory from 'box2d-wasm';
|
|
22
22
|
import { EventTypes } from 'entityx-ts';
|
|
23
|
-
import {
|
|
23
|
+
import { Graphics } from 'pixi.js';
|
|
24
|
+
import { GameWorld, instantiate, NodeComp } from '..';
|
|
24
25
|
import { makeContactListener } from './ContactListener';
|
|
25
26
|
import { makeDebugDraw } from './debugDraw';
|
|
26
27
|
import { BoxColliderPhysics, CircleColliderPhysics, ColliderPhysics, PhysicsMaterial, PolygonColliderPhysics, RigidBody, } from './PhysicsComponent';
|
|
@@ -74,7 +75,7 @@ export class PhysicsSystem {
|
|
|
74
75
|
rigidBody = instantiate(RigidBody);
|
|
75
76
|
entity.assign(rigidBody);
|
|
76
77
|
}
|
|
77
|
-
const { type = 'static', gravityScale = 1
|
|
78
|
+
const { type = 'static', gravityScale = 1 } = rigidBody.props;
|
|
78
79
|
const physicsMaterial = entity.getComponent(PhysicsMaterial);
|
|
79
80
|
const { density = 1, friction = 0.5, restitution = 0.3 } = (physicsMaterial === null || physicsMaterial === void 0 ? void 0 : physicsMaterial.props) || {};
|
|
80
81
|
const box = component;
|
|
@@ -112,9 +113,9 @@ export class PhysicsSystem {
|
|
|
112
113
|
physicsCollide.node = node;
|
|
113
114
|
box.node = node;
|
|
114
115
|
});
|
|
115
|
-
event_manager.subscribe(EventTypes.ComponentAdded,
|
|
116
|
-
event_manager.subscribe(EventTypes.ComponentAdded,
|
|
117
|
-
event_manager.subscribe(EventTypes.ComponentRemoved,
|
|
116
|
+
event_manager.subscribe(EventTypes.ComponentAdded, CircleColliderPhysics, () => { });
|
|
117
|
+
event_manager.subscribe(EventTypes.ComponentAdded, PolygonColliderPhysics, () => { });
|
|
118
|
+
event_manager.subscribe(EventTypes.ComponentRemoved, NodeComp, () => {
|
|
118
119
|
// log('ComponentRemovedEvent NodeComp', event);
|
|
119
120
|
// const node = event.entity.getComponent(NodeComp)
|
|
120
121
|
// if (node.instance instanceof Sprite) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugDraw.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/debugDraw.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"debugDraw.d.ts","sourceRoot":"","sources":["../../src/box2d-wasm/debugDraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,QAAQ,EAAE,mBAAc,EAAE,OAAO,OAAO,KAAK;IA6IjF;;;;;OAKG;;IAQH;;;;;OAKG;;IAQH;;;;;OAKG;;IAOH;;;;;OAKG;;IAQH;;;;;;OAMG;;IAQH;;;OAGG;;IAKH;;;;;OAKG;;CAUN,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color4B } from
|
|
1
|
+
import { Color4B } from '..';
|
|
2
2
|
/**
|
|
3
3
|
* Forked from Box2D.js
|
|
4
4
|
* @see https://github.com/kripken/box2d.js/blob/f75077b/helpers/embox2d-helpers.js
|
|
@@ -15,7 +15,7 @@ import { Color4B } from "..";
|
|
|
15
15
|
* @param {typeof Box2D & EmscriptenModule} box2D
|
|
16
16
|
*/
|
|
17
17
|
export const makeDebugDraw = (graphics, pixelsPerMeter, box2D) => {
|
|
18
|
-
const { b2Color, b2Draw: { e_shapeBit }, b2Transform, b2Vec2, JSDraw, wrapPointer } = box2D;
|
|
18
|
+
const { b2Color, b2Draw: { e_shapeBit }, b2Transform, b2Vec2, JSDraw, wrapPointer, } = box2D;
|
|
19
19
|
/**
|
|
20
20
|
* to replace original C++ operator =
|
|
21
21
|
* @param {Box2D.b2Vec2} vec
|
|
@@ -73,13 +73,13 @@ export const makeDebugDraw = (graphics, pixelsPerMeter, box2D) => {
|
|
|
73
73
|
let angle = 0;
|
|
74
74
|
const angleStep = 32;
|
|
75
75
|
const n = 360 / angleStep;
|
|
76
|
-
let x = radius * Math.cos(angle * Math.PI / 180);
|
|
77
|
-
let y = radius * Math.sin(angle * Math.PI / 180);
|
|
76
|
+
let x = radius * Math.cos((angle * Math.PI) / 180);
|
|
77
|
+
let y = radius * Math.sin((angle * Math.PI) / 180);
|
|
78
78
|
graphics.moveTo(center.x + x, center.y + y);
|
|
79
79
|
angle += angleStep;
|
|
80
80
|
for (let i = 0; i < n; i++) {
|
|
81
|
-
x = radius * Math.cos(angle * Math.PI / 180);
|
|
82
|
-
y = radius * Math.sin(angle * Math.PI / 180);
|
|
81
|
+
x = radius * Math.cos((angle * Math.PI) / 180);
|
|
82
|
+
y = radius * Math.sin((angle * Math.PI) / 180);
|
|
83
83
|
graphics.lineTo(center.x + x, center.y + y);
|
|
84
84
|
angle += angleStep;
|
|
85
85
|
}
|
|
@@ -217,7 +217,7 @@ export const makeDebugDraw = (graphics, pixelsPerMeter, box2D) => {
|
|
|
217
217
|
setCtxColor(getRgbStr(color));
|
|
218
218
|
const vertex = wrapPointer(vertex_p, b2Vec2);
|
|
219
219
|
drawPoint(vertex, sizeMetres);
|
|
220
|
-
}
|
|
220
|
+
},
|
|
221
221
|
});
|
|
222
222
|
debugDraw.SetFlags(e_shapeBit);
|
|
223
223
|
return debugDraw;
|
|
@@ -2,13 +2,14 @@ import { Constructor, Entity } from 'entityx-ts';
|
|
|
2
2
|
import { Action, Animation } from 'pixi-action-ease';
|
|
3
3
|
import { Color, ColorSource, Container, Point } from 'pixi.js';
|
|
4
4
|
import { ComponentType, EnhancedComponent } from '../base';
|
|
5
|
+
import { Vec2 } from '../core';
|
|
5
6
|
import { Size } from '../core/Size';
|
|
6
7
|
export type EventCallbackType = (...args: any[]) => void;
|
|
7
8
|
export interface EventMap {
|
|
8
9
|
[key: string]: [EventCallbackType];
|
|
9
10
|
}
|
|
10
11
|
type TouchEventCallback = (target: {
|
|
11
|
-
location:
|
|
12
|
+
location: Vec2;
|
|
12
13
|
}) => void;
|
|
13
14
|
export declare class NodeComp<C extends Container = Container> {
|
|
14
15
|
entity: Entity;
|
|
@@ -32,8 +33,8 @@ export declare class NodeComp<C extends Container = Container> {
|
|
|
32
33
|
setOnTouchCancel(cb: TouchEventCallback): void;
|
|
33
34
|
constructor(instance: C, entity: Entity);
|
|
34
35
|
get uuid(): number;
|
|
35
|
-
get position():
|
|
36
|
-
set position(val:
|
|
36
|
+
get position(): Vec2;
|
|
37
|
+
set position(val: Vec2);
|
|
37
38
|
get posX(): number;
|
|
38
39
|
set posX(val: number);
|
|
39
40
|
get posY(): number;
|
|
@@ -76,10 +77,10 @@ export declare class NodeComp<C extends Container = Container> {
|
|
|
76
77
|
getComponent<T extends Constructor<ComponentType>>(component: T): InstanceType<T>;
|
|
77
78
|
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
78
79
|
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
79
|
-
convertToNodeSpace(point:
|
|
80
|
-
convertToNodeSpaceAR(point:
|
|
81
|
-
convertToWorldSpaceAR(point:
|
|
82
|
-
getPosition():
|
|
80
|
+
convertToNodeSpace(point: Vec2): Point;
|
|
81
|
+
convertToNodeSpaceAR(point: Vec2): Point;
|
|
82
|
+
convertToWorldSpaceAR(point: Vec2): Point;
|
|
83
|
+
getPosition(): Vec2;
|
|
83
84
|
setPosition(x: number | Point, y?: number): void;
|
|
84
85
|
setRotation(deg: number): void;
|
|
85
86
|
getRotation(): number;
|
|
@@ -94,10 +95,11 @@ export declare class NodeComp<C extends Container = Container> {
|
|
|
94
95
|
removeFromParent(): void;
|
|
95
96
|
addChild(child: NodeComp, zOrder?: number): void;
|
|
96
97
|
destroyAllChildren(): void;
|
|
98
|
+
removeAllChildren(): void;
|
|
97
99
|
on(name: string, callback: EventCallbackType, target?: any): void;
|
|
98
100
|
off(name: string): void;
|
|
99
101
|
emit(name: string, ...params: any): void;
|
|
100
|
-
resolveComponent(component: EnhancedComponent<
|
|
102
|
+
resolveComponent(component: EnhancedComponent<object, NodeComp>): void;
|
|
101
103
|
getData<T>(key: string): T;
|
|
102
104
|
setData<T>(key: string, value: T): void;
|
|
103
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,MAAM,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,MAAM,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAe,MAAM,SAAS,CAAA;AACvE,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAA;AAC3C,OAA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G;IAS1D,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;IAMjC,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAY/D,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAM1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;CASjC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { actionManager } from 'pixi-action-ease';
|
|
2
2
|
import { Point, Sprite, Text } from 'pixi.js';
|
|
3
3
|
import { instantiate } from '../base';
|
|
4
|
+
import { updatePoint, Vec2 } from '../core';
|
|
4
5
|
import { ProgressBarComp } from '../gui/GUIComponent';
|
|
5
6
|
import { ExtraDataComp } from '../norender/NoRenderComponent';
|
|
6
7
|
export class NodeComp {
|
|
@@ -8,28 +9,28 @@ export class NodeComp {
|
|
|
8
9
|
this.onTouchStart = cb;
|
|
9
10
|
this.instance.on('touchstart', (event) => {
|
|
10
11
|
const { global } = event;
|
|
11
|
-
this.onTouchStart({ location: global });
|
|
12
|
+
this.onTouchStart({ location: updatePoint(global) });
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
setOnTouchMove(cb) {
|
|
15
16
|
this.onTouchMove = cb;
|
|
16
17
|
this.instance.on('touchmove', (event) => {
|
|
17
18
|
const { global } = event;
|
|
18
|
-
this.onTouchMove({ location: global });
|
|
19
|
+
this.onTouchMove({ location: updatePoint(global) });
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
setOnTouchEnd(cb) {
|
|
22
23
|
this.onTouchEnd = cb;
|
|
23
24
|
this.instance.on('touchend', (event) => {
|
|
24
25
|
const { global } = event;
|
|
25
|
-
this.onTouchEnd({ location: global });
|
|
26
|
+
this.onTouchEnd({ location: updatePoint(global) });
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
setOnTouchCancel(cb) {
|
|
29
30
|
this.onTouchCancel = cb;
|
|
30
31
|
this.instance.on('touchcancel', (event) => {
|
|
31
32
|
const { global } = event;
|
|
32
|
-
this.onTouchCancel({ location: global });
|
|
33
|
+
this.onTouchCancel({ location: updatePoint(global) });
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
constructor(instance, entity) {
|
|
@@ -86,21 +87,21 @@ export class NodeComp {
|
|
|
86
87
|
this.instance.scale.y = val;
|
|
87
88
|
}
|
|
88
89
|
get anchorX() {
|
|
89
|
-
if (
|
|
90
|
+
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
90
91
|
return this.instance.anchor.x;
|
|
91
92
|
return 0;
|
|
92
93
|
}
|
|
93
94
|
set anchorX(val) {
|
|
94
|
-
if (
|
|
95
|
+
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
95
96
|
this.instance.anchor.x = val;
|
|
96
97
|
}
|
|
97
98
|
get anchorY() {
|
|
98
|
-
if (
|
|
99
|
+
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
99
100
|
return this.instance.anchor.y;
|
|
100
101
|
return 0;
|
|
101
102
|
}
|
|
102
103
|
set anchorY(val) {
|
|
103
|
-
if (
|
|
104
|
+
if (this.instance instanceof Sprite || this.instance instanceof Text)
|
|
104
105
|
this.instance.anchor.y = val;
|
|
105
106
|
}
|
|
106
107
|
/** rotation is in radians */
|
|
@@ -199,14 +200,14 @@ export class NodeComp {
|
|
|
199
200
|
return this.instance.toGlobal(point);
|
|
200
201
|
}
|
|
201
202
|
getPosition() {
|
|
202
|
-
return this.instance.position;
|
|
203
|
+
return updatePoint(this.instance.position);
|
|
203
204
|
}
|
|
204
205
|
setPosition(x, y) {
|
|
205
206
|
if (typeof x !== 'number') {
|
|
206
|
-
this.instance.position =
|
|
207
|
+
this.instance.position = Vec2(x.x, x.y);
|
|
207
208
|
}
|
|
208
209
|
else {
|
|
209
|
-
this.instance.position =
|
|
210
|
+
this.instance.position = Vec2(x, y);
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
setRotation(deg) {
|
|
@@ -301,6 +302,11 @@ export class NodeComp {
|
|
|
301
302
|
child.destroy();
|
|
302
303
|
});
|
|
303
304
|
}
|
|
305
|
+
removeAllChildren() {
|
|
306
|
+
this.children.forEach((child) => {
|
|
307
|
+
child.removeFromParent();
|
|
308
|
+
});
|
|
309
|
+
}
|
|
304
310
|
on(name, callback, target) {
|
|
305
311
|
const bound = target ? callback.bind(target) : callback;
|
|
306
312
|
if (this.events[name]) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Point } from 'pixi.js';
|
|
2
|
+
export declare function updatePoint(p: any): _Vec2;
|
|
3
|
+
declare class _Vec2 {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
static ZERO: any;
|
|
7
|
+
constructor(x?: number | object, y?: number);
|
|
8
|
+
equals(other: _Vec2): boolean;
|
|
9
|
+
add(value: Point | Vec2): _Vec2;
|
|
10
|
+
addSelf(value: Point | Vec2): _Vec2;
|
|
11
|
+
sub(value: Point | Vec2): _Vec2;
|
|
12
|
+
mul(multiply: number): _Vec2;
|
|
13
|
+
mulSelf(multiply: number): _Vec2;
|
|
14
|
+
mag(): number;
|
|
15
|
+
normalizeSelf(): _Vec2;
|
|
16
|
+
normalize(): _Vec2;
|
|
17
|
+
cross(other: Vec2): number;
|
|
18
|
+
signAngle(other: Vec2): number;
|
|
19
|
+
lengthSqr(): number;
|
|
20
|
+
dot(other: Vec2): number;
|
|
21
|
+
angle(other: Vec2): number;
|
|
22
|
+
distance(other: _Vec2): number;
|
|
23
|
+
}
|
|
24
|
+
export type Vec2 = _Vec2;
|
|
25
|
+
export declare function Vec2(x?: number | object, y?: number): Vec2;
|
|
26
|
+
export declare namespace Vec2 {
|
|
27
|
+
var ZERO: Readonly<_Vec2>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=V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
export function updatePoint(p) {
|
|
4
|
+
const { x, y } = p;
|
|
5
|
+
return Vec2(x, y);
|
|
6
|
+
}
|
|
7
|
+
class _Vec2 {
|
|
8
|
+
constructor(x = 0, y = 0) {
|
|
9
|
+
if (!(this instanceof _Vec2)) {
|
|
10
|
+
return new _Vec2(x, y);
|
|
11
|
+
}
|
|
12
|
+
if (typeof x === 'object') {
|
|
13
|
+
this.x = x.x;
|
|
14
|
+
this.y = x.y;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.x = x;
|
|
18
|
+
this.y = y;
|
|
19
|
+
}
|
|
20
|
+
equals(other) {
|
|
21
|
+
return this.x === other.x && this.y === other.y;
|
|
22
|
+
}
|
|
23
|
+
add(value) {
|
|
24
|
+
return updatePoint(new Point(this.x, this.y).add(value));
|
|
25
|
+
}
|
|
26
|
+
addSelf(value) {
|
|
27
|
+
const nor = updatePoint(new Point(this.x, this.y).add(value));
|
|
28
|
+
this.x = nor.x;
|
|
29
|
+
this.y = nor.y;
|
|
30
|
+
return nor;
|
|
31
|
+
}
|
|
32
|
+
sub(value) {
|
|
33
|
+
return updatePoint(new Point(this.x, this.y).subtract(value));
|
|
34
|
+
}
|
|
35
|
+
mul(multiply) {
|
|
36
|
+
return updatePoint(new Point(this.x, this.y).multiply(new Point(multiply, multiply)));
|
|
37
|
+
}
|
|
38
|
+
mulSelf(multiply) {
|
|
39
|
+
const nor = updatePoint(new Point(this.x, this.y).multiply(new Point(multiply, multiply)));
|
|
40
|
+
this.x = nor.x;
|
|
41
|
+
this.y = nor.y;
|
|
42
|
+
return nor;
|
|
43
|
+
}
|
|
44
|
+
mag() {
|
|
45
|
+
return new Point(this.x, this.y).magnitude();
|
|
46
|
+
}
|
|
47
|
+
normalizeSelf() {
|
|
48
|
+
const nor = updatePoint(new Point(this.x, this.y).normalize());
|
|
49
|
+
this.x = nor.x;
|
|
50
|
+
this.y = nor.y;
|
|
51
|
+
return nor;
|
|
52
|
+
}
|
|
53
|
+
normalize() {
|
|
54
|
+
return updatePoint(new Point(this.x, this.y).normalize());
|
|
55
|
+
}
|
|
56
|
+
cross(other) {
|
|
57
|
+
return this.x * other.y - this.y * other.x;
|
|
58
|
+
}
|
|
59
|
+
signAngle(other) {
|
|
60
|
+
const angle = this.angle(other);
|
|
61
|
+
return this.cross(other) < 0 ? -angle : angle;
|
|
62
|
+
}
|
|
63
|
+
lengthSqr() {
|
|
64
|
+
return this.x * this.x + this.y * this.y;
|
|
65
|
+
}
|
|
66
|
+
dot(other) {
|
|
67
|
+
return this.x * other.x + this.y * other.y;
|
|
68
|
+
}
|
|
69
|
+
angle(other) {
|
|
70
|
+
const magSqr1 = this.lengthSqr();
|
|
71
|
+
const magSqr2 = other.lengthSqr();
|
|
72
|
+
if (magSqr1 === 0 || magSqr2 === 0) {
|
|
73
|
+
console.warn('Cant get angle between zero vector');
|
|
74
|
+
return 0.0;
|
|
75
|
+
}
|
|
76
|
+
const dot = this.dot(other);
|
|
77
|
+
let theta = dot / Math.sqrt(magSqr1 * magSqr2);
|
|
78
|
+
theta = clampf(theta, -1.0, 1.0);
|
|
79
|
+
return Math.acos(theta);
|
|
80
|
+
}
|
|
81
|
+
distance(other) {
|
|
82
|
+
return this.sub(other).mag();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function Vec2(x, y) {
|
|
86
|
+
return new _Vec2(x, y);
|
|
87
|
+
}
|
|
88
|
+
Vec2.ZERO = Object.freeze(Vec2(0, 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAE1B,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/core/loader.ts"],"names":[],"mappings":"AAGA,wBAAsB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAInE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAExD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Assets } from 'pixi.js';
|
|
11
|
+
const jsonCache = {};
|
|
12
|
+
export function loadJsonAsync(filePath) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const json = yield Assets.load(filePath);
|
|
15
|
+
jsonCache[filePath] = json;
|
|
16
|
+
return json;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function loadJsonFromCache(filePath) {
|
|
20
|
+
return jsonCache[filePath];
|
|
21
|
+
}
|
package/dist/core/math.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function randomRangeInt(minInclude: Integer, maxExclude: Integer): number;
|
|
2
2
|
export declare function degreesToRadians(deg: Float): number;
|
|
3
3
|
export declare function radiansToDegrees(rad: Float): number;
|
|
4
|
+
export declare function clampf(theta: number, arg1: number, arg2: number): number;
|
|
4
5
|
//# sourceMappingURL=math.d.ts.map
|
package/dist/core/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/core/math.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,UAEtE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,KAAK,UAE1C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,KAAK,UAE1C"}
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/core/math.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,UAEtE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,KAAK,UAE1C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,KAAK,UAE1C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxE"}
|
package/dist/core/math.js
CHANGED
|
@@ -8,3 +8,12 @@ export function degreesToRadians(deg) {
|
|
|
8
8
|
export function radiansToDegrees(rad) {
|
|
9
9
|
return RAD_TO_DEG * rad;
|
|
10
10
|
}
|
|
11
|
+
export function clampf(theta, arg1, arg2) {
|
|
12
|
+
if (theta < arg1) {
|
|
13
|
+
return arg1;
|
|
14
|
+
}
|
|
15
|
+
else if (theta > arg2) {
|
|
16
|
+
return arg2;
|
|
17
|
+
}
|
|
18
|
+
return theta;
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"GUISystem.d.ts","sourceRoot":"","sources":["../../src/gui/GUISystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAcnC,qBAAa,SAAU,YAAW,MAAM;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,SAAS,CAAC;CAmGjD"}
|
package/dist/gui/GUISystem.js
CHANGED
|
@@ -4,7 +4,7 @@ import { callFunc, easeBackIn, scaleTo, sequence } from 'pixi-action-ease';
|
|
|
4
4
|
import { Text } from 'pixi.js';
|
|
5
5
|
import { NodeComp } from '..';
|
|
6
6
|
import { LoadingBarMode, ProgressTimer } from '../core/LoadingBar';
|
|
7
|
-
import { ButtonComp, CheckBoxComp, LabelComp, LabelOutlineComp, LabelShadowComp, ListComp, ProgressTimerComp, RadioGroupComp, ScrollView } from './GUIComponent';
|
|
7
|
+
import { ButtonComp, CheckBoxComp, LabelComp, LabelOutlineComp, LabelShadowComp, ListComp, ProgressTimerComp, RadioGroupComp, ScrollView, } from './GUIComponent';
|
|
8
8
|
export class GUISystem {
|
|
9
9
|
configure(event_manager) {
|
|
10
10
|
event_manager.subscribe(EventTypes.ComponentAdded, ButtonComp, ({ entity, component }) => {
|
|
@@ -78,9 +78,9 @@ export class GUISystem {
|
|
|
78
78
|
component.node = entity.assign(new NodeComp(node, entity));
|
|
79
79
|
const { string = '', font = this.defaultFont, size = 64 } = component.props;
|
|
80
80
|
if (font)
|
|
81
|
-
component.font =
|
|
82
|
-
component.size =
|
|
83
|
-
component.string =
|
|
81
|
+
component.font = font;
|
|
82
|
+
component.size = size;
|
|
83
|
+
component.string = string;
|
|
84
84
|
});
|
|
85
85
|
event_manager.subscribe(EventTypes.ComponentAdded, LabelOutlineComp, ({ entity, component }) => {
|
|
86
86
|
const { color, width } = component.props;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from 'pixi-action-ease';
|
|
2
2
|
export * from 'pixi.js';
|
|
3
|
-
export { Vec2 } from 'planck';
|
|
4
3
|
export * from './app';
|
|
5
4
|
export * from './base';
|
|
6
5
|
export * from './collider';
|
|
@@ -8,15 +7,13 @@ export * from './collider/helper/Intersection';
|
|
|
8
7
|
export * from './components/BaseComponent';
|
|
9
8
|
export * from './components/NodeComp';
|
|
10
9
|
export * from './components/Scene';
|
|
11
|
-
export * from './core
|
|
12
|
-
export * from './core/director';
|
|
13
|
-
export * from './core/math';
|
|
14
|
-
export * from './core/NodePool';
|
|
10
|
+
export * from './core';
|
|
15
11
|
export * from './dragonbones';
|
|
16
12
|
export * from './gui/GUIComponent';
|
|
17
13
|
export * from './gui/GUISystem';
|
|
18
14
|
export * from './helper/utils';
|
|
19
15
|
export * from './norender/NoRenderComponent';
|
|
16
|
+
export * from './norender/Touch';
|
|
20
17
|
export * from './render/RenderComponent';
|
|
21
18
|
export * from './render/RenderSystem';
|
|
22
19
|
export * from './richtext';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|