bard-legends-framework 0.11.0 → 0.12.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.
- package/dist/actions-performance.test.d.ts +1 -0
- package/dist/actions-performance.test.js +83 -0
- package/dist/game-entities/controller/controller.d.ts +2 -2
- package/dist/game-entities/controller/controller.js +8 -8
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +7 -7
- package/dist/game-entities/entity/entity.js +18 -12
- package/dist/game-entities/entity/entity.test.js +93 -30
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +3 -3
- package/dist/game-entities/entity/helpers/entity-store.helper.js +12 -12
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +11 -11
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +6 -6
- package/dist/game-entities/entity/helpers/entity-views.helper.js +25 -22
- package/dist/game-entities/entity/singleton-entity.test.js +9 -4
- package/dist/game-entities/hard-reset.d.ts +5 -0
- package/dist/game-entities/hard-reset.js +14 -0
- package/dist/game-entities/index.d.ts +1 -1
- package/dist/game-entities/index.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +13 -13
- package/dist/game-entities/scene/scene.js +41 -46
- package/dist/game-entities/scene/scene.test.js +95 -37
- package/dist/game-entities/service/service.d.ts +1 -4
- package/dist/game-entities/service/service.js +12 -13
- package/dist/game-entities/service/service.test.js +33 -12
- package/dist/game-entities/unit-test.helper.js +1 -1
- package/dist/game-entities/update-cycle.d.ts +7 -17
- package/dist/game-entities/update-cycle.js +25 -19
- package/dist/game-entities/view/view.d.ts +6 -6
- package/dist/game-entities/view/view.js +15 -21
- package/dist/game-entities/view/view.test.js +40 -9
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -1
- package/dist/physics/entity-types/immovable-physics-entity.js +4 -4
- package/dist/physics/entity-types/movable-entity.d.ts +1 -1
- package/dist/physics/entity-types/movable-entity.js +2 -2
- package/dist/physics/entity-types/movable-physics-entity.d.ts +8 -8
- package/dist/physics/entity-types/movable-physics-entity.js +27 -27
- package/dist/physics/entity-types/physics-entity.d.ts +10 -14
- package/dist/physics/entity-types/physics-entity.js +27 -26
- package/dist/physics/interfaces.d.ts +6 -6
- package/dist/physics/interfaces.js +4 -4
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +19 -19
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
- package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +27 -26
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +43 -42
- package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
- package/dist/pixi/components/display-object-array.d.ts +5 -5
- package/dist/pixi/components/display-object-array.js +14 -14
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
- package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
- package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
- package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
- package/dist/pixi/components/menu/menu-entity.js +48 -0
- package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
- package/dist/pixi/components/menu/menu.ui.js +97 -0
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +11 -11
- package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
- package/dist/pixi/components/scroll-area.ui.js +9 -9
- package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
- package/dist/pixi/components/scroll-mask.ui.js +25 -24
- package/dist/pixi/display-object/container-attributes.d.ts +24 -25
- package/dist/pixi/display-object/container-attributes.js +26 -26
- package/dist/pixi/display-object/container.d.ts +3 -3
- package/dist/pixi/display-object/container.js +2 -2
- package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
- package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
- package/dist/pixi/display-object/filters.d.ts +7 -7
- package/dist/pixi/display-object/filters.js +34 -34
- package/dist/pixi/display-object/index.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
- package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +7 -7
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +26 -25
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
- package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
- package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
- package/dist/pixi/display-object/objects/text/text.js +34 -35
- package/dist/pixi/game.d.ts +20 -15
- package/dist/pixi/game.js +40 -35
- package/dist/pixi/helpers/game-assets.d.ts +5 -5
- package/dist/pixi/helpers/game-assets.js +14 -11
- package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
- package/dist/pixi/helpers/position-conversion.helper.js +3 -3
- package/dist/pixi/index.d.ts +3 -37
- package/dist/pixi/index.js +6 -22
- package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
- package/dist/pixi/modules/CAMERA/camera.js +9 -9
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +49 -48
- package/dist/pixi/pixi-definitions.d.ts +38 -0
- package/dist/pixi/pixi-definitions.js +37 -0
- package/dist/pixi/services/keyboard/keyboard.d.ts +2 -2
- package/dist/pixi/services/keyboard/keyboard.js +9 -9
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +10 -10
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +28 -28
- package/dist/pixi/services/mouse/mouse.service.d.ts +1 -1
- package/dist/pixi/services/mouse/mouse.service.js +5 -5
- package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/animations.d.ts +14 -6
- package/dist/utilities/animator/animations.js +15 -11
- package/dist/utilities/animator/animator/animator.d.ts +44 -0
- package/dist/utilities/animator/animator/animator.js +234 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
- package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.test.js +1046 -0
- package/dist/utilities/animator/animator.d.ts +2 -3
- package/dist/utilities/animator/animator.js +66 -59
- package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator.performance.test.js +46 -0
- package/dist/utilities/animator/animator.test.js +89 -28
- package/dist/utilities/animator/animator2/animator.d.ts +42 -0
- package/dist/utilities/animator/animator2/animator.js +222 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
- package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.test.js +1007 -0
- package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
- package/dist/utilities/animator/animator_old/animator.js +337 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
- package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.test.js +996 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
- package/dist/utilities/animator/index.d.ts +6 -6
- package/dist/utilities/animator/index.js +6 -6
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +30 -30
- package/dist/utilities/animator/state-animation/state-animation.js +7 -7
- package/dist/utilities/animator/state-animation/state-animation.test.js +24 -24
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +30 -30
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +1 -1
- package/dist/utilities/data-structures/vector-set/vector-set.js +5 -5
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +1 -1
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +5 -5
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +21 -21
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +9 -9
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +14 -14
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +43 -43
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +21 -21
- package/package.json +7 -5
|
@@ -25,16 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Graphics = void 0;
|
|
27
27
|
const helpers_lib_1 = require("helpers-lib");
|
|
28
|
-
const
|
|
28
|
+
const Pixi = __importStar(require("pixi.js"));
|
|
29
29
|
const game_1 = require("../../../game");
|
|
30
30
|
const game_assets_1 = require("../../../helpers/game-assets");
|
|
31
31
|
const container_1 = require("../../container");
|
|
32
32
|
const sprite_1 = require("../sprite/sprite");
|
|
33
33
|
const dashed_line_helper_1 = require("./helpers/dashed-line.helper");
|
|
34
34
|
class Graphics extends container_1.Container {
|
|
35
|
-
static { this.
|
|
35
|
+
static { this._drawnTextureCache = new Map(); }
|
|
36
36
|
static createArrow(size, color) {
|
|
37
|
-
let pixiGraphics = new
|
|
37
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
38
38
|
let polygon = [
|
|
39
39
|
[
|
|
40
40
|
{ x: 0, y: -size / 2 },
|
|
@@ -54,7 +54,7 @@ class Graphics extends container_1.Container {
|
|
|
54
54
|
];
|
|
55
55
|
pixiGraphics.beginFill(color);
|
|
56
56
|
polygon.forEach(vertices => {
|
|
57
|
-
pixiGraphics.drawPolygon(vertices.map(vertex => new
|
|
57
|
+
pixiGraphics.drawPolygon(vertices.map(vertex => new Pixi.Point(vertex.x, vertex.y)));
|
|
58
58
|
});
|
|
59
59
|
pixiGraphics.endFill();
|
|
60
60
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'arrow', size, color }));
|
|
@@ -69,7 +69,7 @@ class Graphics extends container_1.Container {
|
|
|
69
69
|
color: helpers_lib_1.ColorHelper.white,
|
|
70
70
|
...partialOptions
|
|
71
71
|
};
|
|
72
|
-
let pixiGraphics = new
|
|
72
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
73
73
|
pixiGraphics.lineStyle(options.width, options.color);
|
|
74
74
|
let lines = dashed_line_helper_1.DashedLineHelper.getLines(from, to, options);
|
|
75
75
|
lines.forEach(line => {
|
|
@@ -78,7 +78,7 @@ class Graphics extends container_1.Container {
|
|
|
78
78
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'dashedLine', from, to, options }));
|
|
79
79
|
}
|
|
80
80
|
static createVector(from, to, color) {
|
|
81
|
-
let pixiGraphics = new
|
|
81
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
82
82
|
pixiGraphics.lineStyle(2, color);
|
|
83
83
|
pixiGraphics.moveTo(from.x, from.y);
|
|
84
84
|
pixiGraphics.lineTo(to.x, to.y);
|
|
@@ -89,7 +89,7 @@ class Graphics extends container_1.Container {
|
|
|
89
89
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'line', start: from, end: to, color }));
|
|
90
90
|
}
|
|
91
91
|
static createRectangleBorders(size, borderSize, color) {
|
|
92
|
-
let pixiGraphics = new
|
|
92
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
93
93
|
pixiGraphics.beginFill(color);
|
|
94
94
|
pixiGraphics.drawRect(0, 0, size.x, borderSize);
|
|
95
95
|
pixiGraphics.drawRect(0, borderSize, borderSize, size.y - borderSize * 2);
|
|
@@ -99,38 +99,38 @@ class Graphics extends container_1.Container {
|
|
|
99
99
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'rectangle-borders', size, borderSize, color }));
|
|
100
100
|
}
|
|
101
101
|
static createRectangle(size, color = helpers_lib_1.ColorHelper.white) {
|
|
102
|
-
let pixiGraphics = new
|
|
102
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
103
103
|
pixiGraphics.beginFill(color);
|
|
104
104
|
pixiGraphics.drawRect(0, 0, size.x, size.y);
|
|
105
105
|
pixiGraphics.endFill();
|
|
106
106
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'rectangle', size, color }));
|
|
107
107
|
}
|
|
108
108
|
static createCircle(radius, color) {
|
|
109
|
-
let pixiGraphics = new
|
|
109
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
110
110
|
pixiGraphics.beginFill(color);
|
|
111
111
|
pixiGraphics.drawCircle(0, 0, radius);
|
|
112
112
|
pixiGraphics.endFill();
|
|
113
113
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'circle', radius, color }));
|
|
114
114
|
}
|
|
115
115
|
static createElipse(size, color) {
|
|
116
|
-
let pixiGraphics = new
|
|
116
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
117
117
|
pixiGraphics.beginFill(color);
|
|
118
118
|
pixiGraphics.drawEllipse(0, 0, size.x, size.y);
|
|
119
119
|
pixiGraphics.endFill();
|
|
120
120
|
return new Graphics(pixiGraphics, JSON.stringify({ type: 'elipse', size, color }));
|
|
121
121
|
}
|
|
122
122
|
static createPolygon(polygon, color) {
|
|
123
|
-
let pixiGraphics = new
|
|
123
|
+
let pixiGraphics = new Pixi.Graphics();
|
|
124
124
|
let cacheName = JSON.stringify({ type: 'polygon', polygon, color });
|
|
125
125
|
pixiGraphics.beginFill(color);
|
|
126
126
|
polygon.forEach(vertices => {
|
|
127
|
-
pixiGraphics.drawPolygon(vertices.map(vertex => new
|
|
127
|
+
pixiGraphics.drawPolygon(vertices.map(vertex => new Pixi.Point(vertex.x, vertex.y)));
|
|
128
128
|
});
|
|
129
129
|
pixiGraphics.endFill();
|
|
130
130
|
return new Graphics(pixiGraphics, cacheName);
|
|
131
131
|
}
|
|
132
132
|
static createRegularPolygon(sides, radius, color) {
|
|
133
|
-
let polygon = new
|
|
133
|
+
let polygon = new Pixi.Graphics();
|
|
134
134
|
let anglePerStep = new helpers_lib_1.Radian(helpers_lib_1.PI_360 / sides);
|
|
135
135
|
polygon.beginFill(color);
|
|
136
136
|
polygon.moveTo(radius, 0);
|
|
@@ -148,24 +148,24 @@ class Graphics extends container_1.Container {
|
|
|
148
148
|
super();
|
|
149
149
|
this.pixiContainer.addChild(pixiGraphics);
|
|
150
150
|
this.pixiGraphics = pixiGraphics;
|
|
151
|
-
this.
|
|
151
|
+
this._cacheName = cacheName;
|
|
152
152
|
}
|
|
153
153
|
destroy() {
|
|
154
154
|
if (!this.destroyed) {
|
|
155
|
-
!this.pixiGraphics.destroyed && this.pixiGraphics.destroy();
|
|
156
155
|
super.destroy();
|
|
156
|
+
!this.pixiGraphics.destroyed && this.pixiGraphics.destroy();
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
toSprite(partialOptions) {
|
|
160
160
|
let options = {
|
|
161
|
-
cacheName: this.
|
|
161
|
+
cacheName: this._cacheName,
|
|
162
162
|
keepBounds: true,
|
|
163
163
|
cache: false,
|
|
164
164
|
...partialOptions
|
|
165
165
|
};
|
|
166
|
-
let textureConversion = this.
|
|
166
|
+
let textureConversion = this._getTexture(options.cacheName, options.cache);
|
|
167
167
|
let spriteDefinition = {
|
|
168
|
-
id: textureConversion.
|
|
168
|
+
id: textureConversion.assetID,
|
|
169
169
|
scale: 1,
|
|
170
170
|
size: textureConversion.bounds,
|
|
171
171
|
anchor: { x: 0, y: 0 },
|
|
@@ -177,24 +177,24 @@ class Graphics extends container_1.Container {
|
|
|
177
177
|
this.destroy();
|
|
178
178
|
return sprite;
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
_getTexture(cacheName, cache) {
|
|
181
181
|
if (cache) {
|
|
182
|
-
let textureOfGraphics = Graphics.
|
|
182
|
+
let textureOfGraphics = Graphics._drawnTextureCache.get(cacheName);
|
|
183
183
|
if (!textureOfGraphics) {
|
|
184
|
-
textureOfGraphics = this.
|
|
185
|
-
Graphics.
|
|
184
|
+
textureOfGraphics = this._createTextureFromGraphics();
|
|
185
|
+
Graphics._drawnTextureCache.set(cacheName, textureOfGraphics);
|
|
186
186
|
}
|
|
187
187
|
return textureOfGraphics;
|
|
188
188
|
}
|
|
189
189
|
else {
|
|
190
|
-
return this.
|
|
190
|
+
return this._createTextureFromGraphics();
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
_createTextureFromGraphics() {
|
|
194
194
|
let texture = game_1.Game.instance.renderer.generateTexture(this.pixiGraphics);
|
|
195
195
|
texture.id = game_assets_1.GameAssets.insertAsset(texture);
|
|
196
196
|
let graphicsBounds = this.pixiGraphics.getBounds();
|
|
197
|
-
return {
|
|
197
|
+
return { assetID: texture.id, bounds: new helpers_lib_1.Vector(graphicsBounds.x, graphicsBounds.y) };
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
exports.Graphics = Graphics;
|
|
@@ -24,21 +24,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Placeholder = void 0;
|
|
27
|
-
const
|
|
27
|
+
const Pixi = __importStar(require("pixi.js"));
|
|
28
28
|
const container_1 = require("../container");
|
|
29
29
|
class Placeholder extends container_1.Container {
|
|
30
30
|
constructor(size) {
|
|
31
31
|
super();
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.pixiContainer.addChild(this.
|
|
32
|
+
this._pixiGraphics = new Pixi.Graphics();
|
|
33
|
+
this._pixiGraphics.beginFill(0x000000, 0.000000001);
|
|
34
|
+
this._pixiGraphics.drawRect(0, 0, size.x, size.y);
|
|
35
|
+
this._pixiGraphics.endFill();
|
|
36
|
+
this.pixiContainer.addChild(this._pixiGraphics);
|
|
37
37
|
}
|
|
38
38
|
destroy() {
|
|
39
39
|
if (!this.destroyed) {
|
|
40
|
-
this.pixiGraphics.destroy();
|
|
41
40
|
super.destroy();
|
|
41
|
+
this._pixiGraphics.destroy();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { GlowEffectOptions } from '
|
|
1
|
+
import * as Pixi from 'pixi.js';
|
|
2
|
+
import { GlowEffectOptions } from '../../../pixi-definitions';
|
|
3
3
|
export declare class GlowSpriteGenerator {
|
|
4
|
-
private static
|
|
5
|
-
static createGlowSpriteFromSprite(pixiSprite:
|
|
6
|
-
private static
|
|
7
|
-
private static
|
|
8
|
-
private static
|
|
9
|
-
private static
|
|
10
|
-
private static
|
|
4
|
+
private static _glowTextureCache;
|
|
5
|
+
static createGlowSpriteFromSprite(pixiSprite: Pixi.Sprite, partialOptions: GlowEffectOptions, cache: boolean): Pixi.Sprite;
|
|
6
|
+
private static _getGlowTexture;
|
|
7
|
+
private static _getGlowTextureFromSprite;
|
|
8
|
+
private static _setEquavelentAnchorByExtendedBounds;
|
|
9
|
+
private static _extendBounds;
|
|
10
|
+
private static _completeOptions;
|
|
11
11
|
}
|
|
@@ -25,61 +25,62 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.GlowSpriteGenerator = void 0;
|
|
27
27
|
const helpers_lib_1 = require("helpers-lib");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
28
|
+
const Pixi = __importStar(require("pixi.js"));
|
|
29
|
+
const hard_reset_1 = require("../../../../game-entities/hard-reset");
|
|
30
|
+
const game_1 = require("../../../game");
|
|
31
31
|
const game_assets_1 = require("../../../helpers/game-assets");
|
|
32
|
+
const pixi_definitions_1 = require("../../../pixi-definitions");
|
|
32
33
|
const glow_filter_1 = require("../../filters/composite-filters/glow-filter");
|
|
33
34
|
class GlowSpriteGenerator {
|
|
34
|
-
static { this.
|
|
35
|
+
static { this._glowTextureCache = new Map(); }
|
|
35
36
|
static createGlowSpriteFromSprite(pixiSprite, partialOptions, cache) {
|
|
36
|
-
let options = this.
|
|
37
|
+
let options = this._completeOptions(partialOptions);
|
|
37
38
|
let blurRadiusVector = helpers_lib_1.Comparator.isNumber(options.blurRadius)
|
|
38
39
|
? new helpers_lib_1.Vector(options.blurRadius, options.blurRadius)
|
|
39
40
|
: options.blurRadius;
|
|
40
|
-
let glowBaseTexture = this.
|
|
41
|
-
let glowSprite = new
|
|
42
|
-
this.
|
|
41
|
+
let glowBaseTexture = this._getGlowTexture(pixiSprite.texture, blurRadiusVector, options.expand, options.color, cache);
|
|
42
|
+
let glowSprite = new Pixi.Sprite(glowBaseTexture);
|
|
43
|
+
this._setEquavelentAnchorByExtendedBounds(glowSprite, helpers_lib_1.Vector.fromVec2(pixiSprite.anchor), Math.max(blurRadiusVector.x, blurRadiusVector.y) + options.expand);
|
|
43
44
|
glowSprite.alpha = options.glowAlpha;
|
|
44
45
|
glowSprite.blendMode = options.blendMode;
|
|
45
46
|
return glowSprite;
|
|
46
47
|
}
|
|
47
|
-
static
|
|
48
|
+
static _getGlowTexture(baseTexture, blurRadius, expand, color, cache) {
|
|
48
49
|
if (!baseTexture.id) {
|
|
49
50
|
throw new Error('GlowSpriteGenerator: baseTexture should have an id');
|
|
50
51
|
}
|
|
51
52
|
if (cache) {
|
|
52
53
|
let cacheName = `${baseTexture.id}-${expand}-${blurRadius.x}-${blurRadius.y}-${color.r}-${color.g}-${color.b}`;
|
|
53
|
-
if (GlowSpriteGenerator.
|
|
54
|
-
return GlowSpriteGenerator.
|
|
54
|
+
if (GlowSpriteGenerator._glowTextureCache.has(cacheName)) {
|
|
55
|
+
return GlowSpriteGenerator._glowTextureCache.get(cacheName);
|
|
55
56
|
}
|
|
56
57
|
else {
|
|
57
|
-
let texture = this.
|
|
58
|
-
GlowSpriteGenerator.
|
|
58
|
+
let texture = this._getGlowTextureFromSprite(baseTexture, blurRadius, expand, color);
|
|
59
|
+
GlowSpriteGenerator._glowTextureCache.set(cacheName, texture);
|
|
59
60
|
return texture;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
|
-
return this.
|
|
64
|
+
return this._getGlowTextureFromSprite(baseTexture, blurRadius, expand, color);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
static
|
|
67
|
-
let glowBaseSprite = new
|
|
68
|
-
this.
|
|
67
|
+
static _getGlowTextureFromSprite(baseTexture, blurRadius, expand, color) {
|
|
68
|
+
let glowBaseSprite = new Pixi.Sprite(baseTexture);
|
|
69
|
+
this._extendBounds(glowBaseSprite, Math.max(blurRadius.x, blurRadius.y) + expand);
|
|
69
70
|
glowBaseSprite.filters = [new glow_filter_1.GlowFilter({ blurRadius, expand, color })];
|
|
70
|
-
let texture =
|
|
71
|
+
let texture = game_1.Game.instance.renderer.generateTexture(glowBaseSprite);
|
|
71
72
|
texture.id = game_assets_1.GameAssets.insertAsset(texture);
|
|
72
73
|
glowBaseSprite.destroy();
|
|
73
74
|
return texture;
|
|
74
75
|
}
|
|
75
|
-
static
|
|
76
|
+
static _setEquavelentAnchorByExtendedBounds(sprite, anchor, amount) {
|
|
76
77
|
let x = (amount + (sprite.width - amount * 2) * anchor.x) / sprite.width;
|
|
77
78
|
let y = (amount + (sprite.height - amount * 2) * anchor.y) / sprite.height;
|
|
78
79
|
sprite.anchor.set(x, y);
|
|
79
80
|
}
|
|
80
|
-
static
|
|
81
|
+
static _extendBounds(container, amount) {
|
|
81
82
|
if (container.isSprite) {
|
|
82
|
-
let graphics = new
|
|
83
|
+
let graphics = new Pixi.Graphics();
|
|
83
84
|
container.addChild(graphics);
|
|
84
85
|
}
|
|
85
86
|
let width = container.width;
|
|
@@ -89,13 +90,13 @@ class GlowSpriteGenerator {
|
|
|
89
90
|
this._bounds.addFrame(this.transform, -amount, -amount, width + amount, height + amount);
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
static
|
|
93
|
+
static _completeOptions(partialOptions) {
|
|
93
94
|
let options = {
|
|
94
95
|
glowAlpha: 1,
|
|
95
96
|
blurRadius: 5,
|
|
96
97
|
expand: 0,
|
|
97
98
|
color: helpers_lib_1.ColorHelper.white,
|
|
98
|
-
blendMode:
|
|
99
|
+
blendMode: pixi_definitions_1.BlendMode.Add
|
|
99
100
|
};
|
|
100
101
|
if (partialOptions) {
|
|
101
102
|
options = { ...options, ...partialOptions };
|
|
@@ -104,9 +105,9 @@ class GlowSpriteGenerator {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
exports.GlowSpriteGenerator = GlowSpriteGenerator;
|
|
107
|
-
|
|
108
|
+
hard_reset_1.BardLegendsHardReset.onHardReset
|
|
108
109
|
.subscribe(() => {
|
|
109
|
-
GlowSpriteGenerator['
|
|
110
|
+
GlowSpriteGenerator['_glowTextureCache'].clear();
|
|
110
111
|
})
|
|
111
112
|
.attachToRoot();
|
|
112
113
|
//# sourceMappingURL=glow-sprite-generator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RGBColor, Vector } from 'helpers-lib';
|
|
2
|
-
import * as
|
|
3
|
-
import { BlendMode, GlowEffectOptions, SpriteDefinition } from '
|
|
2
|
+
import * as Pixi from 'pixi.js';
|
|
3
|
+
import { BlendMode, GlowEffectOptions, SpriteDefinition } from '../../../pixi-definitions';
|
|
4
4
|
import { Container } from '../../container';
|
|
5
5
|
export interface SpriteOptions {
|
|
6
6
|
readonly textureSize?: Vector;
|
|
@@ -8,12 +8,13 @@ export interface SpriteOptions {
|
|
|
8
8
|
readonly ignoreAnchor?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare class Sprite extends Container {
|
|
11
|
+
static createByName(spriteName: string): Sprite;
|
|
11
12
|
static createSnapshotSprite(container: Container): Sprite;
|
|
12
|
-
readonly pixiSprite:
|
|
13
|
-
private
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
13
|
+
readonly pixiSprite: Pixi.Sprite;
|
|
14
|
+
private _spriteDefinition;
|
|
15
|
+
private _maskSprite;
|
|
16
|
+
private _boundingShape;
|
|
17
|
+
private _pixiGlowSprite;
|
|
17
18
|
constructor(spriteDefinition: SpriteDefinition, options?: SpriteOptions);
|
|
18
19
|
destroy(): void;
|
|
19
20
|
private _textureScale;
|
|
@@ -21,7 +22,7 @@ export declare class Sprite extends Container {
|
|
|
21
22
|
get textureScale(): number;
|
|
22
23
|
set textureScale(value: number);
|
|
23
24
|
get size(): Vector;
|
|
24
|
-
protected getMask():
|
|
25
|
+
protected getMask(): Pixi.Container;
|
|
25
26
|
set interactive(value: boolean);
|
|
26
27
|
setMipmap(value: boolean): this;
|
|
27
28
|
get mipmap(): boolean;
|
|
@@ -46,6 +47,6 @@ export declare class Sprite extends Container {
|
|
|
46
47
|
setGlowEffect(partialOptions: GlowEffectOptions | undefined): this;
|
|
47
48
|
showBoundingShape(value: boolean): this;
|
|
48
49
|
getBoundingMask(): Sprite;
|
|
49
|
-
private
|
|
50
|
+
private _createBoundingShapeImage;
|
|
50
51
|
download(): this;
|
|
51
52
|
}
|
|
@@ -25,33 +25,40 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Sprite = void 0;
|
|
27
27
|
const helpers_lib_1 = require("helpers-lib");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const Pixi = __importStar(require("pixi.js"));
|
|
29
|
+
const game_1 = require("../../../game");
|
|
30
30
|
const game_assets_1 = require("../../../helpers/game-assets");
|
|
31
31
|
const position_conversion_helper_1 = require("../../../helpers/position-conversion.helper");
|
|
32
32
|
const container_1 = require("../../container");
|
|
33
33
|
const graphics_1 = require("../graphics/graphics");
|
|
34
34
|
const glow_sprite_generator_1 = require("./glow-sprite-generator");
|
|
35
35
|
class Sprite extends container_1.Container {
|
|
36
|
+
static createByName(spriteName) {
|
|
37
|
+
let spriteDefinition = game_1.Game.setupOptions.spriteDefinitions[spriteName];
|
|
38
|
+
if (!spriteDefinition) {
|
|
39
|
+
throw new Error(`Sprite: Could not find sprite definition with name ${spriteName}.`);
|
|
40
|
+
}
|
|
41
|
+
return new Sprite(spriteDefinition);
|
|
42
|
+
}
|
|
36
43
|
static createSnapshotSprite(container) {
|
|
37
|
-
let pixiContainer = container
|
|
44
|
+
let pixiContainer = container.pixiContainer;
|
|
38
45
|
let parent = pixiContainer.parent;
|
|
39
46
|
// The "renderer.generateTexture" is not working if the sprite has a parent with the PIXI version 7.4.2
|
|
40
47
|
// TODO: Check if this is still the case with a newer version of PIXI
|
|
41
48
|
if (parent) {
|
|
42
49
|
parent.removeChild(pixiContainer);
|
|
43
50
|
}
|
|
44
|
-
let texture =
|
|
51
|
+
let texture = game_1.Game.instance.renderer.generateTexture(pixiContainer, {
|
|
45
52
|
resolution: 2,
|
|
46
|
-
scaleMode:
|
|
47
|
-
multisample:
|
|
53
|
+
scaleMode: Pixi.SCALE_MODES.LINEAR,
|
|
54
|
+
multisample: Pixi.MSAA_QUALITY.HIGH
|
|
48
55
|
});
|
|
49
56
|
if (parent) {
|
|
50
57
|
parent.addChild(pixiContainer); // TODO: removing and re-adding the child changes the order, it would break the z-index order
|
|
51
58
|
}
|
|
52
|
-
let
|
|
59
|
+
let assetID = game_assets_1.GameAssets.insertAsset(texture);
|
|
53
60
|
let spriteDefinition = {
|
|
54
|
-
id:
|
|
61
|
+
id: assetID,
|
|
55
62
|
scale: container.scale,
|
|
56
63
|
size: container.size,
|
|
57
64
|
anchor: helpers_lib_1.Vector.zero,
|
|
@@ -66,8 +73,8 @@ class Sprite extends container_1.Container {
|
|
|
66
73
|
if (!spriteDefinition) {
|
|
67
74
|
throw new Error(`Sprite: spriteDefinition cannot be nullish!`);
|
|
68
75
|
}
|
|
69
|
-
this.
|
|
70
|
-
this.pixiSprite = new
|
|
76
|
+
this._spriteDefinition = spriteDefinition;
|
|
77
|
+
this.pixiSprite = new Pixi.Sprite(game_assets_1.GameAssets.getAsset(spriteDefinition.id));
|
|
71
78
|
this.pixiContainer.addChild(this.pixiSprite);
|
|
72
79
|
this.setTextureScale(spriteDefinition.scale);
|
|
73
80
|
if (options.textureSize) {
|
|
@@ -83,16 +90,18 @@ class Sprite extends container_1.Container {
|
|
|
83
90
|
}
|
|
84
91
|
destroy() {
|
|
85
92
|
if (!this.destroyed) {
|
|
86
|
-
!this.pixiGlowSprite?.destroyed && this.pixiGlowSprite?.destroy();
|
|
87
|
-
this.pixiGlowSprite = undefined;
|
|
88
|
-
this.mask?.destroy();
|
|
89
|
-
this.mask = undefined;
|
|
90
|
-
this.boundingShape?.destroy();
|
|
91
|
-
this.boundingShape = undefined;
|
|
92
|
-
if (this.spriteDefinition.destroyAssetOnDestroy) {
|
|
93
|
-
game_assets_1.GameAssets.destroyAsset(this.spriteDefinition.id);
|
|
94
|
-
}
|
|
95
93
|
super.destroy();
|
|
94
|
+
this._maskSprite?.destroy();
|
|
95
|
+
this._boundingShape?.destroy();
|
|
96
|
+
if (this._spriteDefinition.destroyAssetOnDestroy) {
|
|
97
|
+
game_assets_1.GameAssets.destroyAsset(this._spriteDefinition.id);
|
|
98
|
+
if (this._pixiGlowSprite) {
|
|
99
|
+
game_assets_1.GameAssets.destroyAsset(this._pixiGlowSprite.texture.id);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (this._pixiGlowSprite && !this._pixiGlowSprite.destroyed) {
|
|
103
|
+
this._pixiGlowSprite.destroy();
|
|
104
|
+
}
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
setTextureScale(value) {
|
|
@@ -115,8 +124,8 @@ class Sprite extends container_1.Container {
|
|
|
115
124
|
}
|
|
116
125
|
set interactive(value) {
|
|
117
126
|
super.interactive = value;
|
|
118
|
-
if (value && this.
|
|
119
|
-
this.pixiContainer.hitArea = new position_conversion_helper_1.CompositeHitArea(this.
|
|
127
|
+
if (value && this._spriteDefinition.boundingShapes && !this.pixiContainer.hitArea) {
|
|
128
|
+
this.pixiContainer.hitArea = new position_conversion_helper_1.CompositeHitArea(this._spriteDefinition.boundingShapes, this.size, helpers_lib_1.Vector.fromVec2(this._spriteDefinition.anchor));
|
|
120
129
|
}
|
|
121
130
|
}
|
|
122
131
|
setMipmap(value) {
|
|
@@ -124,14 +133,14 @@ class Sprite extends container_1.Container {
|
|
|
124
133
|
return this;
|
|
125
134
|
}
|
|
126
135
|
get mipmap() {
|
|
127
|
-
return this.pixiSprite.texture.baseTexture.mipmap ===
|
|
136
|
+
return this.pixiSprite.texture.baseTexture.mipmap === Pixi.MIPMAP_MODES.ON;
|
|
128
137
|
}
|
|
129
138
|
set mipmap(value) {
|
|
130
139
|
if (value) {
|
|
131
|
-
this.pixiSprite.texture.baseTexture.mipmap =
|
|
140
|
+
this.pixiSprite.texture.baseTexture.mipmap = Pixi.MIPMAP_MODES.ON;
|
|
132
141
|
}
|
|
133
142
|
else {
|
|
134
|
-
this.pixiSprite.texture.baseTexture.mipmap =
|
|
143
|
+
this.pixiSprite.texture.baseTexture.mipmap = Pixi.MIPMAP_MODES.OFF;
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
146
|
setBlendMode(value) {
|
|
@@ -149,7 +158,7 @@ class Sprite extends container_1.Container {
|
|
|
149
158
|
return this;
|
|
150
159
|
}
|
|
151
160
|
get tint() {
|
|
152
|
-
return new
|
|
161
|
+
return new Pixi.Color(this.pixiSprite.tint).toRgb();
|
|
153
162
|
}
|
|
154
163
|
set tint(value) {
|
|
155
164
|
this.pixiSprite.tint = value;
|
|
@@ -169,16 +178,16 @@ class Sprite extends container_1.Container {
|
|
|
169
178
|
return this;
|
|
170
179
|
}
|
|
171
180
|
get glowAlpha() {
|
|
172
|
-
if (this.
|
|
173
|
-
return this.
|
|
181
|
+
if (this._pixiGlowSprite) {
|
|
182
|
+
return this._pixiGlowSprite.alpha;
|
|
174
183
|
}
|
|
175
184
|
else {
|
|
176
185
|
throw new Error(`Sprite: getGlowFilterAlpha cannot be called before glow filter is added.`);
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
set glowAlpha(value) {
|
|
180
|
-
if (this.
|
|
181
|
-
this.
|
|
189
|
+
if (this._pixiGlowSprite) {
|
|
190
|
+
this._pixiGlowSprite.alpha = value;
|
|
182
191
|
}
|
|
183
192
|
else {
|
|
184
193
|
throw new Error(`Sprite: setGlowFilterAlpha cannot be called before glow filter is added.`);
|
|
@@ -189,56 +198,56 @@ class Sprite extends container_1.Container {
|
|
|
189
198
|
* @returns the vector of the alignment to set the position for the children
|
|
190
199
|
*/
|
|
191
200
|
getAlignmentVector(alignment) {
|
|
192
|
-
let direction = helpers_lib_1.Vector.fromVec2(this.
|
|
201
|
+
let direction = helpers_lib_1.Vector.fromVec2(this._spriteDefinition.anchor).to(alignment);
|
|
193
202
|
return new helpers_lib_1.Vector(this.size.x * direction.x, this.size.y * direction.y);
|
|
194
203
|
}
|
|
195
204
|
setGlowEffect(partialOptions) {
|
|
196
|
-
if (this.
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
205
|
+
if (this._pixiGlowSprite) {
|
|
206
|
+
this._pixiGlowSprite.destroy();
|
|
207
|
+
this._pixiGlowSprite = undefined;
|
|
199
208
|
}
|
|
200
209
|
if (partialOptions) {
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
203
|
-
this.
|
|
204
|
-
this.pixiContainer.addChild(this.
|
|
210
|
+
this._pixiGlowSprite = glow_sprite_generator_1.GlowSpriteGenerator.createGlowSpriteFromSprite(this.pixiSprite, partialOptions, !this._spriteDefinition.destroyAssetOnDestroy);
|
|
211
|
+
this._pixiGlowSprite.position.set(this.pixiSprite.x, this.pixiSprite.y);
|
|
212
|
+
this._pixiGlowSprite.scale.set(this.pixiSprite.scale.x, this.pixiSprite.scale.y);
|
|
213
|
+
this.pixiContainer.addChild(this._pixiGlowSprite);
|
|
205
214
|
}
|
|
206
215
|
return this;
|
|
207
216
|
}
|
|
208
217
|
showBoundingShape(value) {
|
|
209
218
|
if (value) {
|
|
210
|
-
if (!this.
|
|
211
|
-
this.
|
|
219
|
+
if (!this._boundingShape) {
|
|
220
|
+
this._boundingShape = this._createBoundingShapeImage().setAlpha(0.3).setTint({ r: 0, g: 0, b: 200 }).displayParent(this);
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
|
-
else if (this.
|
|
215
|
-
this.
|
|
216
|
-
this.
|
|
223
|
+
else if (this._boundingShape) {
|
|
224
|
+
this._boundingShape.destroy();
|
|
225
|
+
this._boundingShape = undefined;
|
|
217
226
|
}
|
|
218
227
|
return this;
|
|
219
228
|
}
|
|
220
229
|
getBoundingMask() {
|
|
221
|
-
if (!this.
|
|
222
|
-
if (!this.
|
|
230
|
+
if (!this._maskSprite) {
|
|
231
|
+
if (!this._spriteDefinition.boundingShapes) {
|
|
223
232
|
throw new Error(`Sprite: cropOverflowingParts cannot be used without polygonDefinition!`);
|
|
224
233
|
}
|
|
225
|
-
this.
|
|
234
|
+
this._maskSprite = this._createBoundingShapeImage();
|
|
226
235
|
// PixiJS prevents mask sprites from being rendered, but when there is display object left that uses the mask, it will be rendered.
|
|
227
236
|
// to prevent this, we set the mask's renderable property to false and set the mask's maskRefCount to Number.POSITIVE_INFINITY
|
|
228
|
-
this.
|
|
229
|
-
this.
|
|
230
|
-
this.
|
|
237
|
+
this._maskSprite.pixiSprite['_maskRefCount'] = Number.POSITIVE_INFINITY;
|
|
238
|
+
this._maskSprite.pixiSprite.renderable = false;
|
|
239
|
+
this._maskSprite.displayParent(this);
|
|
231
240
|
}
|
|
232
|
-
return this.
|
|
241
|
+
return this._maskSprite;
|
|
233
242
|
}
|
|
234
|
-
|
|
235
|
-
if (!this.
|
|
243
|
+
_createBoundingShapeImage() {
|
|
244
|
+
if (!this._spriteDefinition.boundingShapes) {
|
|
236
245
|
throw new Error(`Sprite: bounding shape cannot be created without polygonDefinition!`);
|
|
237
246
|
}
|
|
238
|
-
return graphics_1.Graphics.createPolygon(this.
|
|
247
|
+
return graphics_1.Graphics.createPolygon(this._spriteDefinition.boundingShapes, helpers_lib_1.ColorHelper.white).toSprite().attach(this);
|
|
239
248
|
}
|
|
240
249
|
download() {
|
|
241
|
-
let canvas =
|
|
250
|
+
let canvas = game_1.Game.instance.renderer.extract.canvas(this.pixiContainer);
|
|
242
251
|
if (!canvas.toBlob) {
|
|
243
252
|
throw new Error(`Sprite: canvas.toBlob is undefined!`);
|
|
244
253
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Radian, RGBColor } from 'helpers-lib';
|
|
2
|
-
import * as
|
|
2
|
+
import * as Pixi from 'pixi.js';
|
|
3
3
|
export interface DropShadowOptions {
|
|
4
4
|
readonly blur: number;
|
|
5
5
|
readonly angle: Radian;
|
|
@@ -7,9 +7,10 @@ export interface DropShadowOptions {
|
|
|
7
7
|
readonly color: RGBColor;
|
|
8
8
|
readonly alpha: number;
|
|
9
9
|
}
|
|
10
|
+
export type TextAlignment = 'center' | 'left' | 'right';
|
|
10
11
|
export interface TextOptions {
|
|
11
12
|
readonly color: RGBColor;
|
|
12
|
-
readonly align:
|
|
13
|
+
readonly align: TextAlignment;
|
|
13
14
|
readonly fontFamily: string;
|
|
14
15
|
readonly fontSize: number;
|
|
15
16
|
readonly fontStyle: 'normal' | 'italic' | 'oblique';
|
|
@@ -21,7 +22,7 @@ export interface TextOptions {
|
|
|
21
22
|
export type PartialTextOptions = Partial<Omit<TextOptions, 'dropShadow'>> & {
|
|
22
23
|
dropShadow?: Partial<DropShadowOptions> | true;
|
|
23
24
|
};
|
|
24
|
-
export interface ExtendedPixiTextStyle extends Partial<
|
|
25
|
+
export interface ExtendedPixiTextStyle extends Partial<Pixi.ITextStyle> {
|
|
25
26
|
readonly lineThrough: boolean;
|
|
26
27
|
}
|
|
27
28
|
export declare class TextStyleConverter {
|
|
@@ -10,10 +10,10 @@ export interface TagsWithStyles {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class RichTextDataInConverter {
|
|
12
12
|
static process(text: string, options: RichTextOptions): ChunkData[][];
|
|
13
|
-
private static
|
|
14
|
-
private static
|
|
15
|
-
private static
|
|
16
|
-
private static
|
|
17
|
-
private static
|
|
18
|
-
private static
|
|
13
|
+
private static _includeStylesToTags;
|
|
14
|
+
private static _getCombinedStyle;
|
|
15
|
+
private static _combineStyles;
|
|
16
|
+
private static _applyNewLines;
|
|
17
|
+
private static _splitIntoChunks;
|
|
18
|
+
private static _splitToChunks;
|
|
19
19
|
}
|