gdcore-tools 2.0.0-gd-v5.5.223-autobuild → 2.0.0-gd-v5.5.225-autobuild
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/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject2D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +219 -108
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/AdMob/JsExtension.js +63 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
- package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
- package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/BBText/JsExtension.js +10 -9
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/JsExtension.js +4 -6
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
- package/dist/Runtime/Extensions/DraggableBehavior/draggableruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixi-filters/types/drop-shadow/types.d.ts +10 -4
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
- package/dist/Runtime/Extensions/FacebookInstantGames/facebookinstantgamestools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/A_firebasejs/firebase.d.ts +5 -4
- package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_cloudfirestoretools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_remoteconfigtools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/JsExtension.js +21 -21
- package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +1 -0
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/Lighting/lightobstacleruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +122 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +8 -10
- package/dist/Runtime/Extensions/P2P/peerjs.d.ts +8 -10
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/pixi-particles-pixi-renderer.d.ts +2 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +106 -106
- package/dist/Runtime/Extensions/Physics2Behavior/box2d.d.ts +13 -7
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PhysicsBehavior/physicsruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js +1 -1
- package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/JsExtension.js +5 -4
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Steamworks/JsExtension.js +12 -12
- package/dist/Runtime/Extensions/Steamworks/Z_steamworksinputtools.js.map +2 -2
- package/dist/Runtime/Extensions/Steamworks/steamworkstools.js.map +2 -2
- package/dist/Runtime/Extensions/TextEntryObject/textentryruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/JsExtension.js +20 -18
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +1 -3
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +1 -1
- package/dist/Runtime/Extensions/Video/JsExtension.js +2 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/InAppTutorialMessage.js +6 -0
- package/dist/Runtime/InAppTutorialMessage.js.map +7 -0
- package/dist/Runtime/Model3DManager.js.map +2 -2
- package/dist/Runtime/ResourceLoader.js.map +2 -2
- package/dist/Runtime/RuntimeCustomObjectLayer.js +1 -1
- package/dist/Runtime/RuntimeCustomObjectLayer.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js.map +1 -1
- package/dist/Runtime/RuntimeLayer.js.map +2 -2
- package/dist/Runtime/SpriteAnimator.js.map +2 -2
- package/dist/Runtime/affinetransformation.js.map +1 -1
- package/dist/Runtime/debugger-client/abstract-debugger-client.js.map +2 -2
- package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/debugger-client/websocket-debugger-client.js +1 -1
- package/dist/Runtime/debugger-client/websocket-debugger-client.js.map +2 -2
- package/dist/Runtime/events-tools/networktools.js +1 -1
- package/dist/Runtime/events-tools/networktools.js.map +2 -2
- package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
- package/dist/Runtime/gd.js.map +2 -2
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
- package/dist/Runtime/inputmanager.js.map +2 -2
- package/dist/Runtime/jsonmanager.js.map +2 -2
- package/dist/Runtime/layer.js.map +2 -2
- package/dist/Runtime/libs/nanomarkdown.js +5 -0
- package/dist/Runtime/libs/nanomarkdown.js.map +7 -0
- package/dist/Runtime/object-capabilities/AnimatableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/EffectBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/FlippableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/OpacityBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/ResizableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/ScalableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +2 -2
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/loadingscreen-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi.js +123 -177
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/profiler.js.map +2 -2
- package/dist/Runtime/runtimegame.js +1 -1
- package/dist/Runtime/runtimegame.js.map +2 -2
- package/dist/Runtime/runtimeobject.js +1 -1
- package/dist/Runtime/runtimeobject.js.map +2 -2
- package/dist/Runtime/runtimescene.js.map +2 -2
- package/dist/Runtime/runtimewatermark.js.map +2 -2
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +1 -1
- package/dist/lib/libGD.wasm +0 -0
- package/gd.d.ts +6 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare class EventEmitter<
|
|
6
6
|
EventTypes extends EventEmitter.ValidEventTypes = string | symbol,
|
|
7
|
-
Context extends any = any
|
|
7
|
+
Context extends any = any,
|
|
8
8
|
> {
|
|
9
9
|
static prefixed: string | boolean;
|
|
10
10
|
|
|
@@ -87,7 +87,7 @@ declare namespace EventEmitter {
|
|
|
87
87
|
export interface EventEmitterStatic {
|
|
88
88
|
new <
|
|
89
89
|
EventTypes extends ValidEventTypes = string | symbol,
|
|
90
|
-
Context = any
|
|
90
|
+
Context = any,
|
|
91
91
|
>(): EventEmitter<EventTypes, Context>;
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -110,13 +110,13 @@ declare namespace EventEmitter {
|
|
|
110
110
|
[K in keyof T]: T[K] extends (...args: any[]) => void
|
|
111
111
|
? Parameters<T[K]>
|
|
112
112
|
: T[K] extends any[]
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
? T[K]
|
|
114
|
+
: any[];
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
export type EventListener<
|
|
118
118
|
T extends ValidEventTypes,
|
|
119
|
-
K extends EventNames<T
|
|
119
|
+
K extends EventNames<T>,
|
|
120
120
|
> = T extends string | symbol
|
|
121
121
|
? (...args: any[]) => void
|
|
122
122
|
: (
|
|
@@ -125,7 +125,7 @@ declare namespace EventEmitter {
|
|
|
125
125
|
|
|
126
126
|
export type EventArgs<
|
|
127
127
|
T extends ValidEventTypes,
|
|
128
|
-
K extends EventNames<T
|
|
128
|
+
K extends EventNames<T>,
|
|
129
129
|
> = Parameters<EventListener<T, K>>;
|
|
130
130
|
|
|
131
131
|
export const EventEmitter: EventEmitterStatic;
|
|
@@ -170,9 +170,7 @@ declare namespace Peer {
|
|
|
170
170
|
validateId(id: string): boolean;
|
|
171
171
|
pack: any;
|
|
172
172
|
unpack: any;
|
|
173
|
-
chunk(
|
|
174
|
-
blob: Blob
|
|
175
|
-
): {
|
|
173
|
+
chunk(blob: Blob): {
|
|
176
174
|
__peerData: number;
|
|
177
175
|
n: number;
|
|
178
176
|
total: number;
|
|
@@ -267,7 +265,7 @@ declare namespace Peer {
|
|
|
267
265
|
};
|
|
268
266
|
abstract class BaseConnection<
|
|
269
267
|
T extends EventEmitter.ValidEventTypes,
|
|
270
|
-
TT
|
|
268
|
+
TT,
|
|
271
269
|
> extends EventEmitter<T & BaseConnectionEvents> {
|
|
272
270
|
readonly peer: string;
|
|
273
271
|
provider: Peer<TT>;
|
package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n class PanelSpriteRuntimeObjectPixiRenderer {\n _object: gdjs.PanelSpriteRuntimeObject;\n /**\n * The _wrapperContainer must be considered as the main container of this object\n * All transformations are applied on this container\n * See updateOpacity for more info why.\n */\n _wrapperContainer: PIXI.Container;\n /**\n * The _spritesContainer is used to create the sprites and apply cacheAsBitmap only.\n */\n _spritesContainer: PIXI.Container;\n _centerSprite: PIXI.Sprite | PIXI.TilingSprite;\n _borderSprites: Array<PIXI.Sprite | PIXI.TilingSprite>;\n _wasRendered: boolean = false;\n _textureWidth = 0;\n _textureHeight = 0;\n\n constructor(\n runtimeObject: gdjs.PanelSpriteRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer,\n textureName: string,\n tiled: boolean\n ) {\n this._object = runtimeObject;\n const texture = (instanceContainer\n .getGame()\n .getImageManager() as gdjs.PixiImageManager).getPIXITexture(\n textureName\n );\n const StretchedSprite = !tiled ? PIXI.Sprite : PIXI.TilingSprite;\n this._spritesContainer = new PIXI.Container();\n this._wrapperContainer = new PIXI.Container();\n\n // All these textures are going to be replaced in the call to `setTexture`.\n // But to be safe and preserve the invariant that \"these objects own their own\n // textures\", we create a new texture for each sprite.\n this._centerSprite = new StretchedSprite(\n new PIXI.Texture(texture.baseTexture)\n );\n this._borderSprites = [\n // Right\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Top-Right\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Top\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Top-Left\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Left\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom-Left\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom-Right\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n ];\n\n this.setTexture(textureName, instanceContainer);\n this._spritesContainer.removeChildren();\n this._spritesContainer.addChild(this._centerSprite);\n for (let i = 0; i < this._borderSprites.length; ++i) {\n this._spritesContainer.addChild(this._borderSprites[i]);\n }\n this._wrapperContainer.addChild(this._spritesContainer);\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._wrapperContainer, runtimeObject.getZOrder());\n }\n\n getRendererObject() {\n return this._wrapperContainer;\n }\n\n ensureUpToDate() {\n if (this._spritesContainer.visible && this._wasRendered) {\n // PIXI uses PIXI.SCALE_MODES.LINEAR for the cached image:\n // this._spritesContainer._cacheData.sprite._texture.baseTexture.scaleMode\n // There seems to be no way to configure this so the optimization is disabled.\n if (\n this._centerSprite.texture.baseTexture.scaleMode !==\n PIXI.SCALE_MODES.NEAREST\n ) {\n // Cache the rendered sprites as a bitmap to speed up rendering when\n // lots of panel sprites are on the scene.\n // Sadly, because of this, we need a wrapper container to workaround\n // a PixiJS issue with alpha (see updateOpacity).\n this._spritesContainer.cacheAsBitmap = true;\n }\n }\n this._wasRendered = true;\n }\n\n updateOpacity(): void {\n // The alpha is updated on a wrapper around the sprite because a known bug\n // in Pixi will create a flicker when cacheAsBitmap is set to true.\n // (see https://github.com/pixijs/pixijs/issues/4610)\n this._wrapperContainer.alpha = this._object.opacity / 255;\n // When the opacity is updated, the cache must be invalidated, otherwise\n // there is a risk of the panel sprite has been cached previously with a\n // different opacity (and cannot be updated anymore).\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n updateAngle(): void {\n this._wrapperContainer.rotation = gdjs.toRad(this._object.angle);\n }\n\n updatePosition(): void {\n this._wrapperContainer.position.x =\n this._object.x + this._object._width / 2;\n this._wrapperContainer.position.y =\n this._object.y + this._object._height / 2;\n }\n\n _updateLocalPositions() {\n const obj = this._object;\n this._centerSprite.position.x = obj._lBorder;\n this._centerSprite.position.y = obj._tBorder;\n\n //Right\n this._borderSprites[0].position.x = obj._width - obj._rBorder;\n this._borderSprites[0].position.y = obj._tBorder;\n\n //Top-right\n this._borderSprites[1].position.x =\n obj._width - this._borderSprites[1].width;\n this._borderSprites[1].position.y = 0;\n\n //Top\n this._borderSprites[2].position.x = obj._lBorder;\n this._borderSprites[2].position.y = 0;\n\n //Top-Left\n this._borderSprites[3].position.x = 0;\n this._borderSprites[3].position.y = 0;\n\n //Left\n this._borderSprites[4].position.x = 0;\n this._borderSprites[4].position.y = obj._tBorder;\n\n //Bottom-Left\n this._borderSprites[5].position.x = 0;\n this._borderSprites[5].position.y =\n obj._height - this._borderSprites[5].height;\n\n //Bottom\n this._borderSprites[6].position.x = obj._lBorder;\n this._borderSprites[6].position.y = obj._height - obj._bBorder;\n\n //Bottom-Right\n this._borderSprites[7].position.x =\n obj._width - this._borderSprites[7].width;\n this._borderSprites[7].position.y =\n obj._height - this._borderSprites[7].height;\n }\n\n _updateSpritesAndTexturesSize() {\n const obj = this._object;\n this._centerSprite.width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n this._centerSprite.height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Right\n this._borderSprites[0].width = obj._rBorder;\n this._borderSprites[0].height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Top\n this._borderSprites[2].height = obj._tBorder;\n this._borderSprites[2].width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n\n //Left\n this._borderSprites[4].width = obj._lBorder;\n this._borderSprites[4].height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Bottom\n this._borderSprites[6].height = obj._bBorder;\n this._borderSprites[6].width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n this._wasRendered = true;\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const obj = this._object;\n const texture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName).baseTexture;\n this._textureWidth = texture.width;\n this._textureHeight = texture.height;\n\n function makeInsideTexture(rect) {\n if (rect.width < 0) {\n rect.width = 0;\n }\n if (rect.height < 0) {\n rect.height = 0;\n }\n if (rect.x < 0) {\n rect.x = 0;\n }\n if (rect.y < 0) {\n rect.y = 0;\n }\n if (rect.x > texture.width) {\n rect.x = texture.width;\n }\n if (rect.y > texture.height) {\n rect.y = texture.height;\n }\n if (rect.x + rect.width > texture.width) {\n rect.width = texture.width - rect.x;\n }\n if (rect.y + rect.height > texture.height) {\n rect.height = texture.height - rect.y;\n }\n return rect;\n }\n this._centerSprite.texture.destroy(false);\n this._centerSprite.texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n obj._tBorder,\n texture.width - obj._lBorder - obj._rBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n\n //Top, Bottom, Right, Left borders:\n this._borderSprites[0].texture.destroy(false);\n this._borderSprites[0].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n obj._tBorder,\n obj._rBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n this._borderSprites[2].texture.destroy(false);\n this._borderSprites[2].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n 0,\n texture.width - obj._lBorder - obj._rBorder,\n obj._tBorder\n )\n )\n );\n this._borderSprites[4].texture.destroy(false);\n this._borderSprites[4].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n 0,\n obj._tBorder,\n obj._lBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n this._borderSprites[6].texture.destroy(false);\n this._borderSprites[6].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n texture.height - obj._bBorder,\n texture.width - obj._lBorder - obj._rBorder,\n obj._bBorder\n )\n )\n );\n this._borderSprites[1].texture.destroy(false);\n this._borderSprites[1].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n 0,\n obj._rBorder,\n obj._tBorder\n )\n )\n );\n this._borderSprites[3].texture.destroy(false);\n this._borderSprites[3].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(new PIXI.Rectangle(0, 0, obj._lBorder, obj._tBorder))\n );\n this._borderSprites[5].texture.destroy(false);\n this._borderSprites[5].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n 0,\n texture.height - obj._bBorder,\n obj._lBorder,\n obj._bBorder\n )\n )\n );\n this._borderSprites[7].texture.destroy(false);\n this._borderSprites[7].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n texture.height - obj._bBorder,\n obj._rBorder,\n obj._bBorder\n )\n )\n );\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n this._wrapperContainer.pivot.x = this._object._width / 2;\n this._wrapperContainer.pivot.y = this._object._height / 2;\n }\n\n updateWidth(): void {\n this._wrapperContainer.pivot.x = this._object._width / 2;\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n }\n\n updateHeight(): void {\n this._wrapperContainer.pivot.y = this._object._height / 2;\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n }\n\n setColor(rgbColor): void {\n const colors = rgbColor.split(';');\n if (colors.length < 3) {\n return;\n }\n this._centerSprite.tint = gdjs.rgbToHexNumber(\n parseInt(colors[0], 10),\n parseInt(colors[1], 10),\n parseInt(colors[2], 10)\n );\n for (\n let borderCounter = 0;\n borderCounter < this._borderSprites.length;\n borderCounter++\n ) {\n this._borderSprites[borderCounter].tint = gdjs.rgbToHexNumber(\n parseInt(colors[0], 10),\n parseInt(colors[1], 10),\n parseInt(colors[2], 10)\n );\n }\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n getColor() {\n const rgb = new PIXI.Color(this._centerSprite.tint).toRgbArray();\n return (\n Math.floor(rgb[0] * 255) +\n ';' +\n Math.floor(rgb[1] * 255) +\n ';' +\n Math.floor(rgb[2] * 255)\n );\n }\n\n getTextureWidth() {\n return this._textureWidth;\n }\n\n getTextureHeight() {\n return this._textureHeight;\n }\n\n destroy() {\n // Destroy textures because they are instantiated by this class:\n // all textures of borderSprites and centerSprite are \"owned\" by them.\n for (const borderSprite of this._borderSprites) {\n borderSprite.destroy({ texture: true });\n }\n this._centerSprite.destroy({ texture: true });\n // Destroy the containers without handling children because they are\n // already handled above.\n this._wrapperContainer.destroy(false);\n this._spritesContainer.destroy(false);\n }\n }\n\n export const PanelSpriteRuntimeObjectRenderer = PanelSpriteRuntimeObjectPixiRenderer;\n export type PanelSpriteRuntimeObjectRenderer = PanelSpriteRuntimeObjectPixiRenderer;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,OAA2C,CAkBzC,YACE,EACA,EACA,EACA,EACA,CATF,kBAAwB,GACxB,mBAAgB,EAChB,oBAAiB,EAQf,KAAK,QAAU,EACf,KAAM,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n class PanelSpriteRuntimeObjectPixiRenderer {\n _object: gdjs.PanelSpriteRuntimeObject;\n /**\n * The _wrapperContainer must be considered as the main container of this object\n * All transformations are applied on this container\n * See updateOpacity for more info why.\n */\n _wrapperContainer: PIXI.Container;\n /**\n * The _spritesContainer is used to create the sprites and apply cacheAsBitmap only.\n */\n _spritesContainer: PIXI.Container;\n _centerSprite: PIXI.Sprite | PIXI.TilingSprite;\n _borderSprites: Array<PIXI.Sprite | PIXI.TilingSprite>;\n _wasRendered: boolean = false;\n _textureWidth = 0;\n _textureHeight = 0;\n\n constructor(\n runtimeObject: gdjs.PanelSpriteRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer,\n textureName: string,\n tiled: boolean\n ) {\n this._object = runtimeObject;\n const texture = (\n instanceContainer.getGame().getImageManager() as gdjs.PixiImageManager\n ).getPIXITexture(textureName);\n const StretchedSprite = !tiled ? PIXI.Sprite : PIXI.TilingSprite;\n this._spritesContainer = new PIXI.Container();\n this._wrapperContainer = new PIXI.Container();\n\n // All these textures are going to be replaced in the call to `setTexture`.\n // But to be safe and preserve the invariant that \"these objects own their own\n // textures\", we create a new texture for each sprite.\n this._centerSprite = new StretchedSprite(\n new PIXI.Texture(texture.baseTexture)\n );\n this._borderSprites = [\n // Right\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Top-Right\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Top\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Top-Left\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Left\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom-Left\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom\n new StretchedSprite(new PIXI.Texture(texture.baseTexture)),\n // Bottom-Right\n new PIXI.Sprite(new PIXI.Texture(texture.baseTexture)),\n ];\n\n this.setTexture(textureName, instanceContainer);\n this._spritesContainer.removeChildren();\n this._spritesContainer.addChild(this._centerSprite);\n for (let i = 0; i < this._borderSprites.length; ++i) {\n this._spritesContainer.addChild(this._borderSprites[i]);\n }\n this._wrapperContainer.addChild(this._spritesContainer);\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._wrapperContainer, runtimeObject.getZOrder());\n }\n\n getRendererObject() {\n return this._wrapperContainer;\n }\n\n ensureUpToDate() {\n if (this._spritesContainer.visible && this._wasRendered) {\n // PIXI uses PIXI.SCALE_MODES.LINEAR for the cached image:\n // this._spritesContainer._cacheData.sprite._texture.baseTexture.scaleMode\n // There seems to be no way to configure this so the optimization is disabled.\n if (\n this._centerSprite.texture.baseTexture.scaleMode !==\n PIXI.SCALE_MODES.NEAREST\n ) {\n // Cache the rendered sprites as a bitmap to speed up rendering when\n // lots of panel sprites are on the scene.\n // Sadly, because of this, we need a wrapper container to workaround\n // a PixiJS issue with alpha (see updateOpacity).\n this._spritesContainer.cacheAsBitmap = true;\n }\n }\n this._wasRendered = true;\n }\n\n updateOpacity(): void {\n // The alpha is updated on a wrapper around the sprite because a known bug\n // in Pixi will create a flicker when cacheAsBitmap is set to true.\n // (see https://github.com/pixijs/pixijs/issues/4610)\n this._wrapperContainer.alpha = this._object.opacity / 255;\n // When the opacity is updated, the cache must be invalidated, otherwise\n // there is a risk of the panel sprite has been cached previously with a\n // different opacity (and cannot be updated anymore).\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n updateAngle(): void {\n this._wrapperContainer.rotation = gdjs.toRad(this._object.angle);\n }\n\n updatePosition(): void {\n this._wrapperContainer.position.x =\n this._object.x + this._object._width / 2;\n this._wrapperContainer.position.y =\n this._object.y + this._object._height / 2;\n }\n\n _updateLocalPositions() {\n const obj = this._object;\n this._centerSprite.position.x = obj._lBorder;\n this._centerSprite.position.y = obj._tBorder;\n\n //Right\n this._borderSprites[0].position.x = obj._width - obj._rBorder;\n this._borderSprites[0].position.y = obj._tBorder;\n\n //Top-right\n this._borderSprites[1].position.x =\n obj._width - this._borderSprites[1].width;\n this._borderSprites[1].position.y = 0;\n\n //Top\n this._borderSprites[2].position.x = obj._lBorder;\n this._borderSprites[2].position.y = 0;\n\n //Top-Left\n this._borderSprites[3].position.x = 0;\n this._borderSprites[3].position.y = 0;\n\n //Left\n this._borderSprites[4].position.x = 0;\n this._borderSprites[4].position.y = obj._tBorder;\n\n //Bottom-Left\n this._borderSprites[5].position.x = 0;\n this._borderSprites[5].position.y =\n obj._height - this._borderSprites[5].height;\n\n //Bottom\n this._borderSprites[6].position.x = obj._lBorder;\n this._borderSprites[6].position.y = obj._height - obj._bBorder;\n\n //Bottom-Right\n this._borderSprites[7].position.x =\n obj._width - this._borderSprites[7].width;\n this._borderSprites[7].position.y =\n obj._height - this._borderSprites[7].height;\n }\n\n _updateSpritesAndTexturesSize() {\n const obj = this._object;\n this._centerSprite.width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n this._centerSprite.height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Right\n this._borderSprites[0].width = obj._rBorder;\n this._borderSprites[0].height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Top\n this._borderSprites[2].height = obj._tBorder;\n this._borderSprites[2].width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n\n //Left\n this._borderSprites[4].width = obj._lBorder;\n this._borderSprites[4].height = Math.max(\n obj._height - obj._tBorder - obj._bBorder,\n 0\n );\n\n //Bottom\n this._borderSprites[6].height = obj._bBorder;\n this._borderSprites[6].width = Math.max(\n obj._width - obj._rBorder - obj._lBorder,\n 0\n );\n this._wasRendered = true;\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const obj = this._object;\n const texture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName).baseTexture;\n this._textureWidth = texture.width;\n this._textureHeight = texture.height;\n\n function makeInsideTexture(rect) {\n if (rect.width < 0) {\n rect.width = 0;\n }\n if (rect.height < 0) {\n rect.height = 0;\n }\n if (rect.x < 0) {\n rect.x = 0;\n }\n if (rect.y < 0) {\n rect.y = 0;\n }\n if (rect.x > texture.width) {\n rect.x = texture.width;\n }\n if (rect.y > texture.height) {\n rect.y = texture.height;\n }\n if (rect.x + rect.width > texture.width) {\n rect.width = texture.width - rect.x;\n }\n if (rect.y + rect.height > texture.height) {\n rect.height = texture.height - rect.y;\n }\n return rect;\n }\n this._centerSprite.texture.destroy(false);\n this._centerSprite.texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n obj._tBorder,\n texture.width - obj._lBorder - obj._rBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n\n //Top, Bottom, Right, Left borders:\n this._borderSprites[0].texture.destroy(false);\n this._borderSprites[0].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n obj._tBorder,\n obj._rBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n this._borderSprites[2].texture.destroy(false);\n this._borderSprites[2].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n 0,\n texture.width - obj._lBorder - obj._rBorder,\n obj._tBorder\n )\n )\n );\n this._borderSprites[4].texture.destroy(false);\n this._borderSprites[4].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n 0,\n obj._tBorder,\n obj._lBorder,\n texture.height - obj._tBorder - obj._bBorder\n )\n )\n );\n this._borderSprites[6].texture.destroy(false);\n this._borderSprites[6].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n obj._lBorder,\n texture.height - obj._bBorder,\n texture.width - obj._lBorder - obj._rBorder,\n obj._bBorder\n )\n )\n );\n this._borderSprites[1].texture.destroy(false);\n this._borderSprites[1].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n 0,\n obj._rBorder,\n obj._tBorder\n )\n )\n );\n this._borderSprites[3].texture.destroy(false);\n this._borderSprites[3].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(new PIXI.Rectangle(0, 0, obj._lBorder, obj._tBorder))\n );\n this._borderSprites[5].texture.destroy(false);\n this._borderSprites[5].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n 0,\n texture.height - obj._bBorder,\n obj._lBorder,\n obj._bBorder\n )\n )\n );\n this._borderSprites[7].texture.destroy(false);\n this._borderSprites[7].texture = new PIXI.Texture(\n texture,\n makeInsideTexture(\n new PIXI.Rectangle(\n texture.width - obj._rBorder,\n texture.height - obj._bBorder,\n obj._rBorder,\n obj._bBorder\n )\n )\n );\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n this._wrapperContainer.pivot.x = this._object._width / 2;\n this._wrapperContainer.pivot.y = this._object._height / 2;\n }\n\n updateWidth(): void {\n this._wrapperContainer.pivot.x = this._object._width / 2;\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n }\n\n updateHeight(): void {\n this._wrapperContainer.pivot.y = this._object._height / 2;\n this._updateSpritesAndTexturesSize();\n this._updateLocalPositions();\n this.updatePosition();\n }\n\n setColor(rgbColor): void {\n const colors = rgbColor.split(';');\n if (colors.length < 3) {\n return;\n }\n this._centerSprite.tint = gdjs.rgbToHexNumber(\n parseInt(colors[0], 10),\n parseInt(colors[1], 10),\n parseInt(colors[2], 10)\n );\n for (\n let borderCounter = 0;\n borderCounter < this._borderSprites.length;\n borderCounter++\n ) {\n this._borderSprites[borderCounter].tint = gdjs.rgbToHexNumber(\n parseInt(colors[0], 10),\n parseInt(colors[1], 10),\n parseInt(colors[2], 10)\n );\n }\n this._spritesContainer.cacheAsBitmap = false;\n }\n\n getColor() {\n const rgb = new PIXI.Color(this._centerSprite.tint).toRgbArray();\n return (\n Math.floor(rgb[0] * 255) +\n ';' +\n Math.floor(rgb[1] * 255) +\n ';' +\n Math.floor(rgb[2] * 255)\n );\n }\n\n getTextureWidth() {\n return this._textureWidth;\n }\n\n getTextureHeight() {\n return this._textureHeight;\n }\n\n destroy() {\n // Destroy textures because they are instantiated by this class:\n // all textures of borderSprites and centerSprite are \"owned\" by them.\n for (const borderSprite of this._borderSprites) {\n borderSprite.destroy({ texture: true });\n }\n this._centerSprite.destroy({ texture: true });\n // Destroy the containers without handling children because they are\n // already handled above.\n this._wrapperContainer.destroy(false);\n this._spritesContainer.destroy(false);\n }\n }\n\n export const PanelSpriteRuntimeObjectRenderer =\n PanelSpriteRuntimeObjectPixiRenderer;\n export type PanelSpriteRuntimeObjectRenderer =\n PanelSpriteRuntimeObjectPixiRenderer;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,OAA2C,CAkBzC,YACE,EACA,EACA,EACA,EACA,CATF,kBAAwB,GACxB,mBAAgB,EAChB,oBAAiB,EAQf,KAAK,QAAU,EACf,KAAM,GACJ,EAAkB,UAAU,kBAC5B,eAAe,GACX,EAAkB,AAAC,EAAsB,KAAK,aAAnB,KAAK,OACtC,KAAK,kBAAoB,GAAI,MAAK,UAClC,KAAK,kBAAoB,GAAI,MAAK,UAKlC,KAAK,cAAgB,GAAI,GACvB,GAAI,MAAK,QAAQ,EAAQ,cAE3B,KAAK,eAAiB,CAEpB,GAAI,GAAgB,GAAI,MAAK,QAAQ,EAAQ,cAE7C,GAAI,MAAK,OAAO,GAAI,MAAK,QAAQ,EAAQ,cAEzC,GAAI,GAAgB,GAAI,MAAK,QAAQ,EAAQ,cAE7C,GAAI,MAAK,OAAO,GAAI,MAAK,QAAQ,EAAQ,cAEzC,GAAI,GAAgB,GAAI,MAAK,QAAQ,EAAQ,cAE7C,GAAI,MAAK,OAAO,GAAI,MAAK,QAAQ,EAAQ,cAEzC,GAAI,GAAgB,GAAI,MAAK,QAAQ,EAAQ,cAE7C,GAAI,MAAK,OAAO,GAAI,MAAK,QAAQ,EAAQ,eAG3C,KAAK,WAAW,EAAa,GAC7B,KAAK,kBAAkB,iBACvB,KAAK,kBAAkB,SAAS,KAAK,eACrC,OAAS,GAAI,EAAG,EAAI,KAAK,eAAe,OAAQ,EAAE,EAChD,KAAK,kBAAkB,SAAS,KAA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K,eAAe,GAAe,KAAO,EAAK,eAC7C,SAAS,EAAO,GAAI,IACpB,SAAS,EAAO,GAAI,IACpB,SAAS,EAAO,GAAI,KAGxB,KAAK,kBAAkB,cAAgB,IAGzC,UAAW,CACT,KAAM,GAAM,GAAI,MAAK,MAAM,KAAK,cAAc,MAAM,aACpD,MACE,MAAK,MAAM,EAAI,GAAK,KACpB,IACA,KAAK,MAAM,EAAI,GAAK,KACpB,IACA,KAAK,MAAM,EAAI,GAAK,KAIxB,iBAAkB,CAChB,MAAO,MAAK,cAGd,kBAAmB,CACjB,MAAO,MAAK,eAGd,SAAU,CAGR,SAAW,KAAgB,MAAK,eAC9B,EAAa,QAAQ,CAAE,QAAS,KAElC,KAAK,cAAc,QAAQ,CAAE,QAAS,KAGtC,KAAK,kBAAkB,QAAQ,IAC/B,KAAK,kBAAkB,QAAQ,KAI5B,AAAM,mCACX,IAraM",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/PanelSpriteObject/panelspriteruntimeobject.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n export type PanelSpriteObjectDataType = {\n /** The right margin */\n rightMargin: number;\n /** The left margin */\n leftMargin: number;\n /** The top margin */\n topMargin: number;\n /** The bottom margin */\n bottomMargin: number;\n /** Are the central part and borders tiled? */\n tiled: boolean;\n /** The object width */\n width: number;\n /** The object height */\n height: number;\n /** The name of the resource containing the texture to use */\n texture: string;\n };\n\n export type PanelSpriteObjectData = ObjectData & PanelSpriteObjectDataType;\n\n export type PanelSpriteNetworkSyncDataType = {\n wid: number;\n hei: number;\n op: number;\n color: string;\n };\n\n export type PanelSpriteNetworkSyncData = ObjectNetworkSyncData &\n PanelSpriteNetworkSyncDataType;\n\n /**\n * The PanelSpriteRuntimeObject displays a tiled texture.\n */\n export class PanelSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler {\n _rBorder: integer;\n _lBorder: integer;\n _tBorder: integer;\n _bBorder: integer;\n _tiled: boolean;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.PanelSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param panelSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n panelSpriteObjectData: PanelSpriteObjectData\n ) {\n super(instanceContainer, panelSpriteObjectData);\n this._rBorder = panelSpriteObjectData.rightMargin;\n this._lBorder = panelSpriteObjectData.leftMargin;\n this._tBorder = panelSpriteObjectData.topMargin;\n this._bBorder = panelSpriteObjectData.bottomMargin;\n this._tiled = panelSpriteObjectData.tiled;\n this._width = panelSpriteObjectData.width;\n this._height = panelSpriteObjectData.height;\n this._renderer = new gdjs.PanelSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n panelSpriteObjectData.texture,\n panelSpriteObjectData.tiled\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: PanelSpriteObjectData,\n newObjectData: PanelSpriteObjectData\n ): boolean {\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n let updateTexture = false;\n if (oldObjectData.rightMargin !== newObjectData.rightMargin) {\n this._rBorder = newObjectData.rightMargin;\n updateTexture = true;\n }\n if (oldObjectData.leftMargin !== newObjectData.leftMargin) {\n this._lBorder = newObjectData.leftMargin;\n updateTexture = true;\n }\n if (oldObjectData.topMargin !== newObjectData.topMargin) {\n this._tBorder = newObjectData.topMargin;\n updateTexture = true;\n }\n if (oldObjectData.bottomMargin !== newObjectData.bottomMargin) {\n this._bBorder = newObjectData.bottomMargin;\n updateTexture = true;\n }\n if (oldObjectData.texture !== newObjectData.texture) {\n updateTexture = true;\n }\n if (updateTexture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.tiled !== newObjectData.tiled) {\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): PanelSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: PanelSpriteNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n /**\n * Set the x position of the panel sprite.\n * @param x The new x position in pixels.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the y position of the panel sprite.\n * @param y The new y position in pixels.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the texture of the panel sprite.\n * @param textureName The name of the texture.\n * @param instanceContainer The container the object lives in.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the panel sprite.\n * @param angle The new angle in degrees.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the panel sprite in pixels\n * @return The width in pixels\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the panel sprite in pixels\n * @return The height in pixels\n */\n getHeight(): float {\n return this._height;\n }\n\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.updateWidth();\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.updateHeight();\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the panel sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the panel sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'PanelSpriteObject::PanelSprite',\n gdjs.PanelSpriteRuntimeObject\n );\n}\n"],
|
|
5
|
-
"mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAmCS,eACG,GAAK,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n export type PanelSpriteObjectDataType = {\n /** The right margin */\n rightMargin: number;\n /** The left margin */\n leftMargin: number;\n /** The top margin */\n topMargin: number;\n /** The bottom margin */\n bottomMargin: number;\n /** Are the central part and borders tiled? */\n tiled: boolean;\n /** The object width */\n width: number;\n /** The object height */\n height: number;\n /** The name of the resource containing the texture to use */\n texture: string;\n };\n\n export type PanelSpriteObjectData = ObjectData & PanelSpriteObjectDataType;\n\n export type PanelSpriteNetworkSyncDataType = {\n wid: number;\n hei: number;\n op: number;\n color: string;\n };\n\n export type PanelSpriteNetworkSyncData = ObjectNetworkSyncData &\n PanelSpriteNetworkSyncDataType;\n\n /**\n * The PanelSpriteRuntimeObject displays a tiled texture.\n */\n export class PanelSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler\n {\n _rBorder: integer;\n _lBorder: integer;\n _tBorder: integer;\n _bBorder: integer;\n _tiled: boolean;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.PanelSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param panelSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n panelSpriteObjectData: PanelSpriteObjectData\n ) {\n super(instanceContainer, panelSpriteObjectData);\n this._rBorder = panelSpriteObjectData.rightMargin;\n this._lBorder = panelSpriteObjectData.leftMargin;\n this._tBorder = panelSpriteObjectData.topMargin;\n this._bBorder = panelSpriteObjectData.bottomMargin;\n this._tiled = panelSpriteObjectData.tiled;\n this._width = panelSpriteObjectData.width;\n this._height = panelSpriteObjectData.height;\n this._renderer = new gdjs.PanelSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n panelSpriteObjectData.texture,\n panelSpriteObjectData.tiled\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: PanelSpriteObjectData,\n newObjectData: PanelSpriteObjectData\n ): boolean {\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n let updateTexture = false;\n if (oldObjectData.rightMargin !== newObjectData.rightMargin) {\n this._rBorder = newObjectData.rightMargin;\n updateTexture = true;\n }\n if (oldObjectData.leftMargin !== newObjectData.leftMargin) {\n this._lBorder = newObjectData.leftMargin;\n updateTexture = true;\n }\n if (oldObjectData.topMargin !== newObjectData.topMargin) {\n this._tBorder = newObjectData.topMargin;\n updateTexture = true;\n }\n if (oldObjectData.bottomMargin !== newObjectData.bottomMargin) {\n this._bBorder = newObjectData.bottomMargin;\n updateTexture = true;\n }\n if (oldObjectData.texture !== newObjectData.texture) {\n updateTexture = true;\n }\n if (updateTexture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.tiled !== newObjectData.tiled) {\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): PanelSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: PanelSpriteNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n /**\n * Set the x position of the panel sprite.\n * @param x The new x position in pixels.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the y position of the panel sprite.\n * @param y The new y position in pixels.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the texture of the panel sprite.\n * @param textureName The name of the texture.\n * @param instanceContainer The container the object lives in.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the panel sprite.\n * @param angle The new angle in degrees.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the panel sprite in pixels\n * @return The width in pixels\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the panel sprite in pixels\n * @return The height in pixels\n */\n getHeight(): float {\n return this._height;\n }\n\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.updateWidth();\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.updateHeight();\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the panel sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the panel sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'PanelSpriteObject::PanelSprite',\n gdjs.PanelSpriteRuntimeObject\n );\n}\n"],
|
|
5
|
+
"mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAmCS,eACG,GAAK,aAEf,CAmBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAjB3B,aAAiB,IAkBf,KAAK,SAAW,EAAsB,YACtC,KAAK,SAAW,EAAsB,WACtC,KAAK,SAAW,EAAsB,UACtC,KAAK,SAAW,EAAsB,aACtC,KAAK,OAAS,EAAsB,MACpC,KAAK,OAAS,EAAsB,MACpC,KAAK,QAAU,EAAsB,OACrC,KAAK,UAAY,GAAI,GAAK,iCACxB,KACA,EACA,EAAsB,QACtB,EAAsB,OAIxB,KAAK,YAGP,qBACE,EACA,EACS,CACT,AAAI,EAAc,QAAU,EAAc,OACxC,KAAK,SAAS,EAAc,OAE1B,EAAc,SAAW,EAAc,QACzC,KAAK,UAAU,EAAc,QAE/B,GAAI,GAAgB,GAuBpB,MAtBI,GAAc,cAAgB,EAAc,aAC9C,MAAK,SAAW,EAAc,YAC9B,EAAgB,IAEd,EAAc,aAAe,EAAc,YAC7C,MAAK,SAAW,EAAc,WAC9B,EAAgB,IAEd,EAAc,YAAc,EAAc,WAC5C,MAAK,SAAW,EAAc,UAC9B,EAAgB,IAEd,EAAc,eAAiB,EAAc,cAC/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B,CAC/C,KAAK,SAAS,GACd,KAAK,UAAU,GAGjB,WAAW,EAAsB,CAC/B,AAAI,EAAU,GACZ,GAAU,GAER,EAAU,KACZ,GAAU,KAEZ,KAAK,QAAU,EACf,KAAK,UAAU,gBAGjB,YAAqB,CACnB,MAAO,MAAK,QAQd,SAAS,EAAwB,CAC/B,KAAK,UAAU,SAAS,GAQ1B,UAAmB,CACjB,MAAO,MAAK,UAAU,WAUxB,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,aACvB,EAAS,KAAK,IAAI,KAAK,aAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAMzD,WAAmB,CACjB,MAAO,MAAK,OAAS,KAAK,UAAU,kBAMtC,WAAmB,CACjB,MAAO,MAAK,QAAU,KAAK,UAAU,mBAOvC,SAAS,EAAuB,CAC9B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GACjD,KAAK,UAAU,KAAK,UAAU,mBAAqB,GAOrD,UAAU,EAAuB,CAC/B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GAOnD,UAAU,EAAuB,CAC/B,KAAK,UAAU,KAAK,UAAU,mBAAqB,IA3ShD,EAAM,2BA8Sb,EAAK,eACH,iCACA,EAAK,4BAnVC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nGDevelop - Particle System Extension\nCopyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\nThis project is released under the MIT License.\n*/\nnamespace gdjs {\n const setBoundsValues = (list: any, startValue: float, endValue: float) => {\n const first = list.first;\n first.value = startValue;\n first.next = first.next || {\n time: 1,\n value: 0,\n };\n first.next.value = endValue;\n };\n\n export class ParticleEmitterObjectPixiRenderer {\n renderer: PIXI.Container;\n emitter: PIXI.particles.Emitter;\n started: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n runtimeObject: gdjs.RuntimeObject,\n objectData: any\n ) {\n const pixiRenderer = instanceContainer\n .getGame()\n .getRenderer()\n .getPIXIRenderer();\n const imageManager = instanceContainer\n .getGame()\n .getImageManager() as gdjs.PixiImageManager;\n let particleTexture: PIXI.Texture = PIXI.Texture.WHITE;\n if (pixiRenderer) {\n if (objectData.rendererType === 'Point') {\n particleTexture = imageManager.getOrCreateDiskTexture(\n objectData.rendererParam1,\n pixiRenderer\n );\n } else if (objectData.rendererType === 'Line') {\n particleTexture = imageManager.getOrCreateRectangleTexture(\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n } else if (objectData.textureParticleName) {\n particleTexture = imageManager.getOrCreateScaledTexture(\n objectData.textureParticleName,\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n } else {\n particleTexture = imageManager.getOrCreateRectangleTexture(\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n }\n }\n\n const configuration = {\n ease: undefined,\n emit: undefined,\n lifetime: {\n min: objectData.particleLifeTimeMin,\n max: objectData.particleLifeTimeMax,\n },\n // A negative flow is \"infinite flow\" (all particles burst)\n frequency:\n objectData.flow < 0\n ? ParticleEmitterObjectPixiRenderer.frequencyMinimumValue\n : 1.0 / objectData.flow,\n spawnChance: 1,\n particlesPerWave: objectData.flow < 0 ? objectData.maxParticleNb : 1,\n maxParticles: objectData.maxParticleNb,\n // Lifetime can be computed from the tank (the number of particles available)\n // and the flow (number of particles emitted per seconds)\n emitterLifetime: ParticleEmitterObjectPixiRenderer.computeLifetime(\n objectData.flow,\n objectData.tank\n ),\n pos: { x: 0, y: 0 },\n addAtBack: false,\n behaviors: [\n {\n type: 'alpha',\n config: {\n alpha: {\n isStepped: false,\n list: [\n { time: 0, value: objectData.particleAlpha1 / 255.0 },\n { time: 1, value: objectData.particleAlpha2 / 255.0 },\n ],\n },\n },\n },\n {\n type: 'moveAcceleration',\n config: {\n accel: {\n x: objectData.particleGravityX,\n y: objectData.particleGravityY,\n },\n minStart: objectData.emitterForceMin,\n maxStart: objectData.emitterForceMax,\n // See _updateRotateFlagFromSpeed\n rotate:\n objectData.particleAngle1 === 0 &&\n objectData.particleAngle2 === 0 &&\n (objectData.particleGravityX !== 0 ||\n objectData.particleGravityY !== 0 ||\n objectData.emitterForceMin < 0 ||\n objectData.emitterForceMax < 0),\n },\n },\n {\n type: 'scale',\n config: {\n scale: {\n isStepped: false,\n list: [\n {\n time: 0,\n value:\n (objectData.particleSize1 / 100) *\n (1 + objectData.particleSizeRandomness1 / 100),\n },\n {\n time: 1,\n value:\n (objectData.particleSize2 / 100) *\n (1 + objectData.particleSizeRandomness2 / 100),\n },\n ],\n },\n },\n },\n {\n type: 'color',\n config: {\n color: {\n isStepped: false,\n list: [\n {\n time: 0,\n value: gdjs.rgbToHex(\n ...gdjs.rgbOrHexToRGBColor(objectData.particleColor1)\n ),\n },\n {\n time: 1,\n value: gdjs.rgbToHex(\n ...gdjs.rgbOrHexToRGBColor(objectData.particleColor2)\n ),\n },\n ],\n },\n },\n },\n {\n type: 'rotation',\n config: {\n accel: 0,\n // Angle of the spray cone\n minStart: -objectData.emitterAngleB / 2.0,\n maxStart: objectData.emitterAngleB / 2.0,\n // Rotation speed of the particles\n maxSpeed: objectData.particleAngle2,\n minSpeed: objectData.particleAngle1,\n },\n },\n {\n type: 'blendMode',\n config: {\n blendMode: objectData.additive ? 'ADD' : 'NORMAL',\n },\n },\n {\n type: 'textureSingle',\n config: {\n texture: particleTexture,\n },\n },\n {\n type: 'spawnShape',\n config: {\n type: 'torus',\n data: {\n affectRotation: false,\n innerRadius: 0,\n radius: objectData.zoneRadius,\n x: 0,\n y: 0,\n },\n },\n },\n ],\n };\n\n this.renderer = new PIXI.Container();\n // The embedded particle emitter is supposed to be the last minor version\n // of the version 5 of the particle emitter object\n // See source https://github.com/pixijs/particle-emitter/blob/v5.0.8/src/Emitter.ts\n this.emitter = new PIXI.particles.Emitter(this.renderer, configuration);\n this.start();\n const layer = instanceContainer.getLayer(runtimeObject.getLayer());\n if (layer) {\n layer\n .getRenderer()\n .addRendererObject(this.renderer, runtimeObject.getZOrder());\n }\n }\n\n getRendererObject() {\n return this.renderer;\n }\n\n update(delta: float): void {\n const wasEmitting = this.emitter.emit;\n this.emitter.update(delta);\n if (!this.started && wasEmitting) {\n this.started = true;\n }\n }\n\n setPosition(x: number, y: number): void {\n this.emitter.spawnPos.x = x;\n this.emitter.spawnPos.y = y;\n }\n\n setAngle(angle1: float, angle2: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('rotation');\n behavior.minStart = gdjs.toRad(angle1);\n behavior.maxStart = gdjs.toRad(angle2);\n }\n\n setForce(min: float, max: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('moveAcceleration');\n // If max force is zero, PIXI seems to not be able to compute correctly\n // the angle of the emitter, resulting in it staying at 0\u00B0 or 180\u00B0.\n // See https://github.com/4ian/GDevelop/issues/4312.\n behavior.maxStart = max || 0.000001;\n behavior.minStart = min;\n }\n\n setZoneRadius(radius: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('spawnShape');\n behavior.shape.radius = radius;\n }\n\n setLifeTime(min: float, max: float): void {\n this.emitter.minLifetime = min;\n this.emitter.maxLifetime = max;\n }\n\n setGravity(x: float, y: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('moveAcceleration');\n behavior.accel.x = x;\n behavior.accel.y = y;\n this._updateRotateFlagFromSpeed();\n }\n\n /**\n * When rotate from `moveAcceleration` is `true` the rotation is set\n * according to the speed direction. This is overriding the particle\n * rotation calculated by from `rotation`.\n */\n private _updateRotateFlagFromSpeed() {\n const rotation: any = this.emitter.getBehavior('rotation');\n const moveAcceleration: any = this.emitter.getBehavior(\n 'moveAcceleration'\n );\n moveAcceleration.rotate =\n rotation.minSpeed === 0 &&\n rotation.maxSpeed === 0 &&\n // This part is to avoid to do `atan` every frame when the object\n // direction doesn't change.\n (moveAcceleration.accel.x !== 0 ||\n moveAcceleration.accel.y !== 0 ||\n // Negative speeds need a 180\u00B0 rotation.\n moveAcceleration.minStart < 0 ||\n moveAcceleration.maxStart < 0);\n }\n\n setColor(color1: number, color2: number): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('color');\n const first = behavior.list.first;\n\n {\n const [r, g, b] = gdjs.hexNumberToRGBArray(color1);\n first.value.r = r;\n first.value.g = g;\n first.value.b = b;\n }\n\n first.next = first.next || {\n time: 1,\n value: {},\n };\n {\n const [r, g, b] = gdjs.hexNumberToRGBArray(color2);\n first.next.value.r = r;\n first.next.value.g = g;\n first.next.value.b = b;\n }\n }\n\n setSize(size1: float, size2: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('scale');\n setBoundsValues(behavior.list, size1 / 100.0, size2 / 100.0);\n }\n\n setParticleRotationSpeed(min: float, max: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('rotation');\n behavior.minSpeed = gdjs.toRad(min);\n behavior.maxSpeed = gdjs.toRad(max);\n this._updateRotateFlagFromSpeed();\n }\n\n setMaxParticlesCount(count: float): void {\n this.emitter.maxParticles = count;\n }\n\n setAdditiveRendering(enabled: boolean): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('blendMode');\n behavior.value = enabled ? 'ADD' : 'NORMAL';\n }\n\n setAlpha(alpha1: number, alpha2: number): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('alpha');\n setBoundsValues(behavior.list, alpha1 / 255.0, alpha2 / 255.0);\n }\n\n setFlow(flow: number, tank: number): void {\n this.emitter.frequency =\n flow < 0\n ? ParticleEmitterObjectPixiRenderer.frequencyMinimumValue\n : 1.0 / flow;\n this.emitter.emitterLifetime = ParticleEmitterObjectPixiRenderer.computeLifetime(\n flow,\n tank\n );\n }\n\n resetEmission(flow: number, tank: number): void {\n this.setFlow(flow, tank);\n const wasEmitting = this.emitter.emit;\n // The only way to recompute emitter lifetime is to start the emitter.\n this.start();\n if (!wasEmitting) this.stop();\n }\n\n isTextureNameValid(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): boolean {\n const invalidPixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getInvalidPIXITexture();\n const pixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(texture);\n return pixiTexture.valid && pixiTexture !== invalidPixiTexture;\n }\n\n setTextureName(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const invalidPixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getInvalidPIXITexture();\n const pixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(texture);\n if (pixiTexture.valid && pixiTexture !== invalidPixiTexture) {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('textureSingle');\n behavior.texture = pixiTexture;\n }\n }\n\n getParticleCount(): integer {\n return this.emitter.particleCount;\n }\n\n stop(): void {\n this.emitter.emit = false;\n }\n\n start(): void {\n this.emitter.emit = true;\n }\n\n recreate(): void {\n this.emitter.cleanup();\n }\n\n destroy(): void {\n this.emitter.destroy();\n }\n\n hasStarted(): boolean {\n return this.started;\n }\n\n /**\n * @returns `true` at the end of emission or at the start if it's paused.\n * Returns false if there is no limit.\n */\n _mayHaveEndedEmission(): boolean {\n return (\n // No end can be reached if there is no flow.\n this.emitter.frequency >\n ParticleEmitterObjectPixiRenderer.frequencyMinimumValue &&\n // No end can be reached when there is no limit.\n this.emitter.emitterLifetime >= 0 &&\n // Pixi stops the emission at the end.\n !this.emitter.emit &&\n // Pixi reset `_emitterLife` to `emitterLifetime` at the end of emission\n // so there is no way to know if it is the end or the start.\n // @ts-ignore Use a private attribute.\n this.emitter._emitterLife === this.emitter.emitterLifetime\n );\n }\n\n static computeLifetime(flow: number, tank: number): float {\n if (tank < 0) return -1;\n else if (flow < 0) return 0.001;\n else return (tank + 0.1) / flow;\n }\n\n private static readonly frequencyMinimumValue = 0.0001;\n }\n\n // @ts-ignore - Register the class to let the engine use it.\n export const ParticleEmitterObjectRenderer = ParticleEmitterObjectPixiRenderer;\n export type ParticleEmitterObjectRenderer = ParticleEmitterObjectPixiRenderer;\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAkB,CAAC,EAAW,EAAmB,IAAoB,CACzE,KAAM,GAAQ,EAAK,MACnB,EAAM,MAAQ,EACd,EAAM,KAAO,EAAM,MAAQ,CACzB,KAAM,EACN,MAAO,GAET,EAAM,KAAK,MAAQ,GAGd,OAAwC,CAK7C,YACE,EACA,EACA,EACA,CANF,aAAmB,GAOjB,KAAM,GAAe,EAClB,UACA,cACA,kBACG,EAAe,EAClB,UACA,kBACH,GAAI,GAAgC,KAAK,QAAQ,MACjD,AAAI,GACF,CAAI,EAAW,eAAiB,QAC9B,EAAkB,EAAa,uBAC7B,EAAW,eACX,GAEG,AAAI,EAAW,eAAiB,OACrC,EAAkB,EAAa,4BAC7B,EAAW,eACX,EAAW,eACX,GAEG,AAAI,EAAW,oBACpB,EAAkB,EAAa,yBAC7B,EAAW,oBACX,EAAW,eACX,EAAW,eACX,GAGF,EAAkB,EAAa,4BAC7B,EAAW,eACX,EAAW,eACX,IAKN,KAAM,GAAgB,CACpB,KAAM,OACN,KAAM,OACN,SAAU,CACR,IAAK,EAAW,oBAChB,IAAK,EAAW,qBAGlB,UACE,EAAW,KAAO,EACd,EAAkC,sBAClC,EAAM,EAAW,KACvB,YAAa,EACb,iBAAkB,EAAW,KAAO,EAAI,EAAW,cAAgB,EACnE,aAAc,EAAW,cAGzB,gBAAiB,EAAkC,gBACjD,EAAW,KACX,EAAW,MAEb,IAAK,CAAE,EAAG,EAAG,EAAG,G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AU,QAAQ,KAAK,SAAU,GACzD,KAAK,QACL,KAAM,GAAQ,EAAkB,SAAS,EAAc,YACvD,AAAI,GACF,EACG,cACA,kBAAkB,KAAK,SAAU,EAAc,aAItD,mBAAoB,CAClB,MAAO,MAAK,SAGd,OAAO,EAAoB,CACzB,KAAM,GAAc,KAAK,QAAQ,KACjC,KAAK,QAAQ,OAAO,GAChB,CAAC,KAAK,SAAW,GACnB,MAAK,QAAU,IAInB,YAAY,EAAW,EAAiB,CACtC,KAAK,QAAQ,SAAS,EAAI,EAC1B,KAAK,QAAQ,SAAS,EAAI,EAG5B,SAAS,EAAe,EAAqB,CAE3C,KAAM,GAAgB,KAAK,QAAQ,YAAY,YAC/C,EAAS,SAAW,EAAK,MAAM,GAC/B,EAAS,SAAW,EAAK,MAAM,GAGjC,SAAS,EAAY,EAAkB,CAErC,KAAM,GAAgB,KAAK,QAAQ,YAAY,oBAI/C,EAAS,SAAW,GAAO,KAC3B,EAAS,SAAW,EAGtB,cAAc,EAAqB,CAEjC,KAAM,GAAgB,KAAK,QAAQ,YAAY,cAC/C,EAAS,MAAM,OAAS,EAG1B,YAAY,EAAY,EAAkB,CACxC,KAAK,QAAQ,YAAc,EAC3B,KAAK,QAAQ,YAAc,EAG7B,WAAW,EAAU,EAAgB,CAEnC,KAAM,GAAgB,KAAK,QAAQ,YAAY,oBAC/C,EAAS,MAAM,EAAI,EACnB,EAAS,MAAM,EAAI,EACnB,KAAK,6BAQC,4BAA6B,CACnC,KAAM,GAAgB,KAAK,QAAQ,YAAY,YACzC,
|
|
4
|
+
"sourcesContent": ["/*\nGDevelop - Particle System Extension\nCopyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\nThis project is released under the MIT License.\n*/\nnamespace gdjs {\n const setBoundsValues = (list: any, startValue: float, endValue: float) => {\n const first = list.first;\n first.value = startValue;\n first.next = first.next || {\n time: 1,\n value: 0,\n };\n first.next.value = endValue;\n };\n\n export class ParticleEmitterObjectPixiRenderer {\n renderer: PIXI.Container;\n emitter: PIXI.particles.Emitter;\n started: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n runtimeObject: gdjs.RuntimeObject,\n objectData: any\n ) {\n const pixiRenderer = instanceContainer\n .getGame()\n .getRenderer()\n .getPIXIRenderer();\n const imageManager = instanceContainer\n .getGame()\n .getImageManager() as gdjs.PixiImageManager;\n let particleTexture: PIXI.Texture = PIXI.Texture.WHITE;\n if (pixiRenderer) {\n if (objectData.rendererType === 'Point') {\n particleTexture = imageManager.getOrCreateDiskTexture(\n objectData.rendererParam1,\n pixiRenderer\n );\n } else if (objectData.rendererType === 'Line') {\n particleTexture = imageManager.getOrCreateRectangleTexture(\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n } else if (objectData.textureParticleName) {\n particleTexture = imageManager.getOrCreateScaledTexture(\n objectData.textureParticleName,\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n } else {\n particleTexture = imageManager.getOrCreateRectangleTexture(\n objectData.rendererParam1,\n objectData.rendererParam2,\n pixiRenderer\n );\n }\n }\n\n const configuration = {\n ease: undefined,\n emit: undefined,\n lifetime: {\n min: objectData.particleLifeTimeMin,\n max: objectData.particleLifeTimeMax,\n },\n // A negative flow is \"infinite flow\" (all particles burst)\n frequency:\n objectData.flow < 0\n ? ParticleEmitterObjectPixiRenderer.frequencyMinimumValue\n : 1.0 / objectData.flow,\n spawnChance: 1,\n particlesPerWave: objectData.flow < 0 ? objectData.maxParticleNb : 1,\n maxParticles: objectData.maxParticleNb,\n // Lifetime can be computed from the tank (the number of particles available)\n // and the flow (number of particles emitted per seconds)\n emitterLifetime: ParticleEmitterObjectPixiRenderer.computeLifetime(\n objectData.flow,\n objectData.tank\n ),\n pos: { x: 0, y: 0 },\n addAtBack: false,\n behaviors: [\n {\n type: 'alpha',\n config: {\n alpha: {\n isStepped: false,\n list: [\n { time: 0, value: objectData.particleAlpha1 / 255.0 },\n { time: 1, value: objectData.particleAlpha2 / 255.0 },\n ],\n },\n },\n },\n {\n type: 'moveAcceleration',\n config: {\n accel: {\n x: objectData.particleGravityX,\n y: objectData.particleGravityY,\n },\n minStart: objectData.emitterForceMin,\n maxStart: objectData.emitterForceMax,\n // See _updateRotateFlagFromSpeed\n rotate:\n objectData.particleAngle1 === 0 &&\n objectData.particleAngle2 === 0 &&\n (objectData.particleGravityX !== 0 ||\n objectData.particleGravityY !== 0 ||\n objectData.emitterForceMin < 0 ||\n objectData.emitterForceMax < 0),\n },\n },\n {\n type: 'scale',\n config: {\n scale: {\n isStepped: false,\n list: [\n {\n time: 0,\n value:\n (objectData.particleSize1 / 100) *\n (1 + objectData.particleSizeRandomness1 / 100),\n },\n {\n time: 1,\n value:\n (objectData.particleSize2 / 100) *\n (1 + objectData.particleSizeRandomness2 / 100),\n },\n ],\n },\n },\n },\n {\n type: 'color',\n config: {\n color: {\n isStepped: false,\n list: [\n {\n time: 0,\n value: gdjs.rgbToHex(\n ...gdjs.rgbOrHexToRGBColor(objectData.particleColor1)\n ),\n },\n {\n time: 1,\n value: gdjs.rgbToHex(\n ...gdjs.rgbOrHexToRGBColor(objectData.particleColor2)\n ),\n },\n ],\n },\n },\n },\n {\n type: 'rotation',\n config: {\n accel: 0,\n // Angle of the spray cone\n minStart: -objectData.emitterAngleB / 2.0,\n maxStart: objectData.emitterAngleB / 2.0,\n // Rotation speed of the particles\n maxSpeed: objectData.particleAngle2,\n minSpeed: objectData.particleAngle1,\n },\n },\n {\n type: 'blendMode',\n config: {\n blendMode: objectData.additive ? 'ADD' : 'NORMAL',\n },\n },\n {\n type: 'textureSingle',\n config: {\n texture: particleTexture,\n },\n },\n {\n type: 'spawnShape',\n config: {\n type: 'torus',\n data: {\n affectRotation: false,\n innerRadius: 0,\n radius: objectData.zoneRadius,\n x: 0,\n y: 0,\n },\n },\n },\n ],\n };\n\n this.renderer = new PIXI.Container();\n // The embedded particle emitter is supposed to be the last minor version\n // of the version 5 of the particle emitter object\n // See source https://github.com/pixijs/particle-emitter/blob/v5.0.8/src/Emitter.ts\n this.emitter = new PIXI.particles.Emitter(this.renderer, configuration);\n this.start();\n const layer = instanceContainer.getLayer(runtimeObject.getLayer());\n if (layer) {\n layer\n .getRenderer()\n .addRendererObject(this.renderer, runtimeObject.getZOrder());\n }\n }\n\n getRendererObject() {\n return this.renderer;\n }\n\n update(delta: float): void {\n const wasEmitting = this.emitter.emit;\n this.emitter.update(delta);\n if (!this.started && wasEmitting) {\n this.started = true;\n }\n }\n\n setPosition(x: number, y: number): void {\n this.emitter.spawnPos.x = x;\n this.emitter.spawnPos.y = y;\n }\n\n setAngle(angle1: float, angle2: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('rotation');\n behavior.minStart = gdjs.toRad(angle1);\n behavior.maxStart = gdjs.toRad(angle2);\n }\n\n setForce(min: float, max: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('moveAcceleration');\n // If max force is zero, PIXI seems to not be able to compute correctly\n // the angle of the emitter, resulting in it staying at 0\u00B0 or 180\u00B0.\n // See https://github.com/4ian/GDevelop/issues/4312.\n behavior.maxStart = max || 0.000001;\n behavior.minStart = min;\n }\n\n setZoneRadius(radius: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('spawnShape');\n behavior.shape.radius = radius;\n }\n\n setLifeTime(min: float, max: float): void {\n this.emitter.minLifetime = min;\n this.emitter.maxLifetime = max;\n }\n\n setGravity(x: float, y: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('moveAcceleration');\n behavior.accel.x = x;\n behavior.accel.y = y;\n this._updateRotateFlagFromSpeed();\n }\n\n /**\n * When rotate from `moveAcceleration` is `true` the rotation is set\n * according to the speed direction. This is overriding the particle\n * rotation calculated by from `rotation`.\n */\n private _updateRotateFlagFromSpeed() {\n const rotation: any = this.emitter.getBehavior('rotation');\n const moveAcceleration: any =\n this.emitter.getBehavior('moveAcceleration');\n moveAcceleration.rotate =\n rotation.minSpeed === 0 &&\n rotation.maxSpeed === 0 &&\n // This part is to avoid to do `atan` every frame when the object\n // direction doesn't change.\n (moveAcceleration.accel.x !== 0 ||\n moveAcceleration.accel.y !== 0 ||\n // Negative speeds need a 180\u00B0 rotation.\n moveAcceleration.minStart < 0 ||\n moveAcceleration.maxStart < 0);\n }\n\n setColor(color1: number, color2: number): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('color');\n const first = behavior.list.first;\n\n {\n const [r, g, b] = gdjs.hexNumberToRGBArray(color1);\n first.value.r = r;\n first.value.g = g;\n first.value.b = b;\n }\n\n first.next = first.next || {\n time: 1,\n value: {},\n };\n {\n const [r, g, b] = gdjs.hexNumberToRGBArray(color2);\n first.next.value.r = r;\n first.next.value.g = g;\n first.next.value.b = b;\n }\n }\n\n setSize(size1: float, size2: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('scale');\n setBoundsValues(behavior.list, size1 / 100.0, size2 / 100.0);\n }\n\n setParticleRotationSpeed(min: float, max: float): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('rotation');\n behavior.minSpeed = gdjs.toRad(min);\n behavior.maxSpeed = gdjs.toRad(max);\n this._updateRotateFlagFromSpeed();\n }\n\n setMaxParticlesCount(count: float): void {\n this.emitter.maxParticles = count;\n }\n\n setAdditiveRendering(enabled: boolean): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('blendMode');\n behavior.value = enabled ? 'ADD' : 'NORMAL';\n }\n\n setAlpha(alpha1: number, alpha2: number): void {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('alpha');\n setBoundsValues(behavior.list, alpha1 / 255.0, alpha2 / 255.0);\n }\n\n setFlow(flow: number, tank: number): void {\n this.emitter.frequency =\n flow < 0\n ? ParticleEmitterObjectPixiRenderer.frequencyMinimumValue\n : 1.0 / flow;\n this.emitter.emitterLifetime =\n ParticleEmitterObjectPixiRenderer.computeLifetime(flow, tank);\n }\n\n resetEmission(flow: number, tank: number): void {\n this.setFlow(flow, tank);\n const wasEmitting = this.emitter.emit;\n // The only way to recompute emitter lifetime is to start the emitter.\n this.start();\n if (!wasEmitting) this.stop();\n }\n\n isTextureNameValid(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): boolean {\n const invalidPixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getInvalidPIXITexture();\n const pixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(texture);\n return pixiTexture.valid && pixiTexture !== invalidPixiTexture;\n }\n\n setTextureName(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const invalidPixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getInvalidPIXITexture();\n const pixiTexture = instanceContainer\n .getGame()\n .getImageManager()\n .getPIXITexture(texture);\n if (pixiTexture.valid && pixiTexture !== invalidPixiTexture) {\n // Access private members of the behavior to apply changes right away.\n const behavior: any = this.emitter.getBehavior('textureSingle');\n behavior.texture = pixiTexture;\n }\n }\n\n getParticleCount(): integer {\n return this.emitter.particleCount;\n }\n\n stop(): void {\n this.emitter.emit = false;\n }\n\n start(): void {\n this.emitter.emit = true;\n }\n\n recreate(): void {\n this.emitter.cleanup();\n }\n\n destroy(): void {\n this.emitter.destroy();\n }\n\n hasStarted(): boolean {\n return this.started;\n }\n\n /**\n * @returns `true` at the end of emission or at the start if it's paused.\n * Returns false if there is no limit.\n */\n _mayHaveEndedEmission(): boolean {\n return (\n // No end can be reached if there is no flow.\n this.emitter.frequency >\n ParticleEmitterObjectPixiRenderer.frequencyMinimumValue &&\n // No end can be reached when there is no limit.\n this.emitter.emitterLifetime >= 0 &&\n // Pixi stops the emission at the end.\n !this.emitter.emit &&\n // Pixi reset `_emitterLife` to `emitterLifetime` at the end of emission\n // so there is no way to know if it is the end or the start.\n // @ts-ignore Use a private attribute.\n this.emitter._emitterLife === this.emitter.emitterLifetime\n );\n }\n\n static computeLifetime(flow: number, tank: number): float {\n if (tank < 0) return -1;\n else if (flow < 0) return 0.001;\n else return (tank + 0.1) / flow;\n }\n\n private static readonly frequencyMinimumValue = 0.0001;\n }\n\n // @ts-ignore - Register the class to let the engine use it.\n export const ParticleEmitterObjectRenderer =\n ParticleEmitterObjectPixiRenderer;\n export type ParticleEmitterObjectRenderer = ParticleEmitterObjectPixiRenderer;\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAkB,CAAC,EAAW,EAAmB,IAAoB,CACzE,KAAM,GAAQ,EAAK,MACnB,EAAM,MAAQ,EACd,EAAM,KAAO,EAAM,MAAQ,CACzB,KAAM,EACN,MAAO,GAET,EAAM,KAAK,MAAQ,GAGd,OAAwC,CAK7C,YACE,EACA,EACA,EACA,CANF,aAAmB,GAOjB,KAAM,GAAe,EAClB,UACA,cACA,kBACG,EAAe,EAClB,UACA,kBACH,GAAI,GAAgC,KAAK,QAAQ,MACjD,AAAI,GACF,CAAI,EAAW,eAAiB,QAC9B,EAAkB,EAAa,uBAC7B,EAAW,eACX,GAEG,AAAI,EAAW,eAAiB,OACrC,EAAkB,EAAa,4BAC7B,EAAW,eACX,EAAW,eACX,GAEG,AAAI,EAAW,oBACpB,EAAkB,EAAa,yBAC7B,EAAW,oBACX,EAAW,eACX,EAAW,eACX,GAGF,EAAkB,EAAa,4BAC7B,EAAW,eACX,EAAW,eACX,IAKN,KAAM,GAAgB,CACpB,KAAM,OACN,KAAM,OACN,SAAU,CACR,IAAK,EAAW,oBAChB,IAAK,EAAW,qBAGlB,UACE,EAAW,KAAO,EACd,EAAkC,sBAClC,EAAM,EAAW,KACvB,YAAa,EACb,iBAAkB,EAAW,KAAO,EAAI,EAAW,cAAgB,EACnE,aAAc,EAAW,cAGzB,gBAAiB,EAAkC,gBACjD,EAAW,KACX,EAAW,MAEb,IAAK,CAAE,EAAG,EAAG,E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AqB,EACxB,UACA,kBACA,wBACG,EAAc,EACjB,UACA,kBACA,eAAe,GAClB,GAAI,EAAY,OAAS,IAAgB,EAAoB,CAE3D,KAAM,GAAgB,KAAK,QAAQ,YAAY,iBAC/C,EAAS,QAAU,GAIvB,kBAA4B,CAC1B,MAAO,MAAK,QAAQ,cAGtB,MAAa,CACX,KAAK,QAAQ,KAAO,GAGtB,OAAc,CACZ,KAAK,QAAQ,KAAO,GAGtB,UAAiB,CACf,KAAK,QAAQ,UAGf,SAAgB,CACd,KAAK,QAAQ,UAGf,YAAsB,CACpB,MAAO,MAAK,QAOd,uBAAiC,CAC/B,MAEE,MAAK,QAAQ,UACX,EAAkC,uBAEpC,KAAK,QAAQ,iBAAmB,GAEhC,CAAC,KAAK,QAAQ,MAId,KAAK,QAAQ,eAAiB,KAAK,QAAQ,sBAIxC,iBAAgB,EAAc,EAAqB,CACxD,MAAI,GAAO,EAAU,GACZ,EAAO,EAAU,KACb,GAAO,IAAO,IAzaxB,QA4amB,AA5anB,EA4amB,sBAAwB,KA5a3C,EAAM,oCAgbA,gCACX,IA5bM",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/ParticleSystem/particleemitterobject.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop - Particle System Extension\n * Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\n * This project is released under the MIT License.\n */\n\nnamespace gdjs {\n export type ParticleEmitterObjectDataType = {\n /**\n * @deprecated Data not used\n */\n emitterAngleA: number;\n emitterForceMin: number;\n /**\n * Cone spray angle (degrees)\n */\n emitterAngleB: number;\n zoneRadius: number;\n emitterForceMax: number;\n particleLifeTimeMax: number;\n particleLifeTimeMin: number;\n particleGravityY: number;\n particleGravityX: number;\n particleColor2: string;\n particleColor1: string;\n particleSize2: number;\n particleSize1: number;\n /**\n * Particle max rotation speed (degrees/second)\n */\n particleAngle2: number;\n /**\n * Particle min rotation speed (degrees/second)\n */\n particleAngle1: number;\n particleAlpha1: number;\n rendererType: string;\n particleAlpha2: number;\n rendererParam2: number;\n rendererParam1: number;\n particleSizeRandomness1: number;\n particleSizeRandomness2: number;\n maxParticleNb: number;\n additive: boolean;\n /** Resource name for image in particle */\n textureParticleName: string;\n tank: number;\n flow: number;\n /** Destroy the object when there is no particles? */\n destroyWhenNoParticles: boolean;\n jumpForwardInTimeOnCreation: number;\n };\n\n export type ParticleEmitterObjectData = ObjectData &\n ParticleEmitterObjectDataType;\n\n export type ParticleEmitterObjectNetworkSyncDataType = {\n // Technically, all attributes can change at runtime, so we sync as many as possible.\n // TODO: ensure we only send props that change to optimize the sync.\n // dirty attributes are not synced, they are defined by the update method if the value has changed.\n // Particle Rotation Speed\n prms: number;\n prmx: number;\n // Max Particles Count\n mpc: number;\n // Additive Rendering\n addr: boolean;\n // Angle\n angb: number;\n // Force\n formin: number;\n formax: number;\n // Zone Radius\n zr: number;\n // Life Time\n ltmin: number;\n ltmax: number;\n // Gravity\n gravx: number;\n gravy: number;\n // Color\n color1: number;\n color2: number;\n // Size\n size1: number;\n size2: number;\n // Alpha\n alp1: number;\n alp2: number;\n // Flow\n flow: number;\n // Tank\n tank: number;\n // Texture\n text: string;\n // Pause\n paused: boolean;\n };\n\n export type ParticleEmitterObjectNetworkSyncData = ObjectNetworkSyncData &\n ParticleEmitterObjectNetworkSyncDataType;\n\n /**\n * Displays particles.\n */\n export class ParticleEmitterObject extends gdjs.RuntimeObject {\n /**\n * @deprecated Data not used\n */\n angleA: number;\n angleB: number;\n forceMin: number;\n forceMax: float;\n zoneRadius: number;\n lifeTimeMin: number;\n lifeTimeMax: float;\n gravityX: number;\n gravityY: number;\n color1: number;\n color2: number;\n size1: number;\n size2: number;\n alpha1: number;\n alpha2: number;\n rendererType: string;\n rendererParam1: number;\n rendererParam2: number;\n texture: string;\n flow: number;\n tank: number;\n destroyWhenNoParticles: boolean;\n particleRotationMinSpeed: number;\n particleRotationMaxSpeed: number;\n maxParticlesCount: number;\n additiveRendering: boolean;\n jumpForwardInTimeOnCreation: number;\n _jumpForwardInTimeCompleted: boolean = false;\n _posDirty: boolean = true;\n _angleDirty: boolean = true;\n _forceDirty: boolean = true;\n _zoneRadiusDirty: boolean = true;\n _lifeTimeDirty: boolean = true;\n _gravityDirty: boolean = true;\n _colorDirty: boolean = true;\n _sizeDirty: boolean = true;\n _alphaDirty: boolean = true;\n _flowDirty: boolean = true;\n _tankDirty: boolean = true;\n _particleRotationSpeedDirty: boolean = true;\n _maxParticlesCountDirty: boolean = true;\n _additiveRenderingDirty: boolean = true;\n // Don't mark texture as dirty if not using one.\n _textureDirty: boolean;\n /**\n * `true` only when the emission is paused by events.\n * It allows to tell the end of emission apart from it.\n */\n _isEmissionPaused: boolean = false;\n\n // @ts-ignore\n _renderer: gdjs.ParticleEmitterObjectRenderer;\n\n /**\n * @param instanceContainer the container the object belongs to\n * @param particleObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n particleObjectData: ParticleEmitterObjectData\n ) {\n super(instanceContainer, particleObjectData);\n this._renderer = new gdjs.ParticleEmitterObjectRenderer(\n instanceContainer,\n this,\n particleObjectData\n );\n this.angleA = particleObjectData.emitterAngleA;\n this.angleB = particleObjectData.emitterAngleB;\n this.forceMin = particleObjectData.emitterForceMin;\n this.forceMax = particleObjectData.emitterForceMax;\n this.zoneRadius = particleObjectData.zoneRadius;\n this.lifeTimeMin = particleObjectData.particleLifeTimeMin;\n this.lifeTimeMax = particleObjectData.particleLifeTimeMax;\n this.gravityX = particleObjectData.particleGravityX;\n this.gravityY = particleObjectData.particleGravityY;\n this.color1 = gdjs.rgbOrHexStringToNumber(\n particleObjectData.particleColor1\n );\n this.color2 = gdjs.rgbOrHexStringToNumber(\n particleObjectData.particleColor2\n );\n this.size1 = particleObjectData.particleSize1;\n this.size2 = particleObjectData.particleSize2;\n this.alpha1 = particleObjectData.particleAlpha1;\n this.alpha2 = particleObjectData.particleAlpha2;\n this.rendererType = particleObjectData.rendererType;\n this.rendererParam1 = particleObjectData.rendererParam1;\n this.rendererParam2 = particleObjectData.rendererParam2;\n this.texture = particleObjectData.textureParticleName;\n this.flow = particleObjectData.flow;\n this.tank = particleObjectData.tank;\n this.destroyWhenNoParticles = particleObjectData.destroyWhenNoParticles;\n this.particleRotationMinSpeed = particleObjectData.particleAngle1;\n this.particleRotationMaxSpeed = particleObjectData.particleAngle2;\n this.maxParticlesCount = particleObjectData.maxParticleNb;\n this.additiveRendering = particleObjectData.additive;\n this.jumpForwardInTimeOnCreation =\n particleObjectData.jumpForwardInTimeOnCreation;\n this._textureDirty = this.texture !== '';\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n setX(x: number): void {\n if (this.x !== x) {\n this._posDirty = true;\n }\n super.setX(x);\n }\n\n setY(y: number): void {\n if (this.y !== y) {\n this._posDirty = true;\n }\n super.setY(y);\n }\n\n setAngle(angle): void {\n if (this.angle !== angle) {\n this._angleDirty = true;\n }\n super.setAngle(angle);\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: ParticleEmitterObjectData,\n newObjectData: ParticleEmitterObjectData\n ): boolean {\n if (oldObjectData.emitterAngleA !== newObjectData.emitterAngleA) {\n this.setEmitterAngleA(newObjectData.emitterAngleA);\n }\n if (oldObjectData.emitterAngleB !== newObjectData.emitterAngleB) {\n this.setEmitterAngleB(newObjectData.emitterAngleB);\n }\n if (oldObjectData.emitterForceMin !== newObjectData.emitterForceMin) {\n this.setEmitterForceMin(newObjectData.emitterForceMin);\n }\n if (oldObjectData.particleAngle1 !== newObjectData.particleAngle1) {\n this.setParticleRotationMinSpeed(newObjectData.particleAngle1);\n }\n if (oldObjectData.particleAngle2 !== newObjectData.particleAngle2) {\n this.setParticleRotationMaxSpeed(newObjectData.particleAngle2);\n }\n if (oldObjectData.maxParticleNb !== newObjectData.maxParticleNb) {\n this.setMaxParticlesCount(newObjectData.maxParticleNb);\n }\n if (oldObjectData.additive !== newObjectData.additive) {\n this.setAdditiveRendering(newObjectData.additive);\n }\n if (oldObjectData.emitterForceMax !== newObjectData.emitterForceMax) {\n this.setEmitterForceMax(newObjectData.emitterForceMax);\n }\n if (oldObjectData.zoneRadius !== newObjectData.zoneRadius) {\n this.setZoneRadius(newObjectData.zoneRadius);\n }\n if (\n oldObjectData.particleLifeTimeMin !== newObjectData.particleLifeTimeMin\n ) {\n this.setParticleLifeTimeMin(newObjectData.particleLifeTimeMin);\n }\n if (\n oldObjectData.particleLifeTimeMax !== newObjectData.particleLifeTimeMax\n ) {\n this.setParticleLifeTimeMax(newObjectData.particleLifeTimeMax);\n }\n if (oldObjectData.particleGravityX !== newObjectData.particleGravityX) {\n this.setParticleGravityX(newObjectData.particleGravityX);\n }\n if (oldObjectData.particleGravityY !== newObjectData.particleGravityY) {\n this.setParticleGravityY(newObjectData.particleGravityY);\n }\n if (oldObjectData.particleColor1 !== newObjectData.particleColor1) {\n this.setParticleColor1(newObjectData.particleColor1);\n }\n if (oldObjectData.particleColor2 !== newObjectData.particleColor2) {\n this.setParticleColor2(newObjectData.particleColor2);\n }\n if (oldObjectData.particleSize1 !== newObjectData.particleSize1) {\n this.setParticleSize1(newObjectData.particleSize1);\n }\n if (oldObjectData.particleSize2 !== newObjectData.particleSize2) {\n this.setParticleSize2(newObjectData.particleSize2);\n }\n if (oldObjectData.particleAlpha1 !== newObjectData.particleAlpha1) {\n this.setParticleAlpha1(newObjectData.particleAlpha1);\n }\n if (oldObjectData.particleAlpha2 !== newObjectData.particleAlpha2) {\n this.setParticleAlpha2(newObjectData.particleAlpha2);\n }\n if (\n oldObjectData.textureParticleName !== newObjectData.textureParticleName\n ) {\n this.setTexture(\n newObjectData.textureParticleName,\n this.getRuntimeScene()\n );\n }\n if (oldObjectData.flow !== newObjectData.flow) {\n this.setFlow(newObjectData.flow);\n }\n if (oldObjectData.tank !== newObjectData.tank) {\n this.setTank(newObjectData.tank);\n }\n if (\n oldObjectData.destroyWhenNoParticles !==\n newObjectData.destroyWhenNoParticles\n ) {\n this.destroyWhenNoParticles = newObjectData.destroyWhenNoParticles;\n }\n if (\n oldObjectData.particleSizeRandomness1 !==\n newObjectData.particleSizeRandomness1 ||\n oldObjectData.particleSizeRandomness2 !==\n newObjectData.particleSizeRandomness2 ||\n oldObjectData.particleAngle1 !== newObjectData.particleAngle1 ||\n oldObjectData.particleAngle2 !== newObjectData.particleAngle2 ||\n oldObjectData.maxParticleNb !== newObjectData.maxParticleNb ||\n oldObjectData.additive !== newObjectData.additive ||\n oldObjectData.rendererType !== newObjectData.rendererType ||\n oldObjectData.rendererParam1 !== newObjectData.rendererParam1 ||\n oldObjectData.rendererParam2 !== newObjectData.rendererParam2\n ) {\n // Destroy the renderer, ensure it's removed from the layer.\n const layer = this.getInstanceContainer().getLayer(this.layer);\n layer\n .getRenderer()\n .removeRendererObject(this._renderer.getRendererObject());\n this._renderer.destroy();\n\n // and recreate the renderer, which will add itself to the layer.\n this._renderer = new gdjs.ParticleEmitterObjectRenderer(\n this.getInstanceContainer(),\n this,\n newObjectData\n );\n\n // Consider every state dirty as the renderer was just re-created, so it needs\n // to be repositioned, angle updated, etc...\n this._posDirty = this._angleDirty = this._forceDirty = this._zoneRadiusDirty = true;\n this._lifeTimeDirty = this._gravityDirty = this._colorDirty = this._sizeDirty = true;\n this._alphaDirty = this._flowDirty = this._tankDirty = this._textureDirty = true;\n }\n return true;\n }\n\n getNetworkSyncData(): ParticleEmitterObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n prms: this.particleRotationMinSpeed,\n prmx: this.particleRotationMaxSpeed,\n mpc: this.maxParticlesCount,\n addr: this.additiveRendering,\n angb: this.angleB,\n formin: this.forceMin,\n formax: this.forceMax,\n zr: this.zoneRadius,\n ltmin: this.lifeTimeMin,\n ltmax: this.lifeTimeMax,\n gravx: this.gravityX,\n gravy: this.gravityY,\n color1: this.color1,\n color2: this.color2,\n size1: this.size1,\n size2: this.size2,\n alp1: this.alpha1,\n alp2: this.alpha2,\n flow: this.flow,\n tank: this.tank,\n text: this.texture,\n paused: this._isEmissionPaused,\n };\n }\n\n updateFromNetworkSyncData(\n syncData: ParticleEmitterObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(syncData);\n if (syncData.x !== undefined) {\n this.setX(syncData.x);\n }\n if (syncData.y !== undefined) {\n this.setY(syncData.y);\n }\n if (syncData.a !== undefined) {\n this.setAngle(syncData.a);\n }\n if (syncData.prms !== undefined) {\n this.setParticleRotationMinSpeed(syncData.prms);\n }\n if (syncData.prmx !== undefined) {\n this.setParticleRotationMaxSpeed(syncData.prmx);\n }\n if (syncData.mpc !== undefined) {\n this.setMaxParticlesCount(syncData.mpc);\n }\n if (syncData.addr !== undefined) {\n this.setAdditiveRendering(syncData.addr);\n }\n if (syncData.angb !== undefined) {\n this.setEmitterAngleB(syncData.angb);\n }\n if (syncData.formin !== undefined) {\n this.setEmitterForceMin(syncData.formin);\n }\n if (syncData.formax !== undefined) {\n this.setEmitterForceMax(syncData.formax);\n }\n if (syncData.zr !== undefined) {\n this.setZoneRadius(syncData.zr);\n }\n if (syncData.ltmin !== undefined) {\n this.setParticleLifeTimeMin(syncData.ltmin);\n }\n if (syncData.ltmax !== undefined) {\n this.setParticleLifeTimeMax(syncData.ltmax);\n }\n if (syncData.gravx !== undefined) {\n this.setParticleGravityX(syncData.gravx);\n }\n if (syncData.gravy !== undefined) {\n this.setParticleGravityY(syncData.gravy);\n }\n if (syncData.color1 !== undefined) {\n this.setParticleColor1AsNumber(syncData.color1);\n }\n if (syncData.color2 !== undefined) {\n this.setParticleColor2AsNumber(syncData.color2);\n }\n if (syncData.size1 !== undefined) {\n this.setParticleSize1(syncData.size1);\n }\n if (syncData.size2 !== undefined) {\n this.setParticleSize2(syncData.size2);\n }\n if (syncData.alp1 !== undefined) {\n this.setParticleAlpha1(syncData.alp1);\n }\n if (syncData.alp2 !== undefined) {\n this.setParticleAlpha2(syncData.alp2);\n }\n if (syncData.flow !== undefined) {\n this.setFlow(syncData.flow);\n }\n if (syncData.tank !== undefined) {\n this.setTank(syncData.tank);\n }\n if (syncData.text !== undefined) {\n this.setTexture(syncData.text, this.getRuntimeScene());\n }\n if (syncData.paused !== undefined) {\n if (syncData.paused) {\n this.stopEmission();\n } else {\n this.startEmission();\n }\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._posDirty) {\n this._renderer.setPosition(this.getX(), this.getY());\n }\n if (this._particleRotationSpeedDirty) {\n this._renderer.setParticleRotationSpeed(\n this.particleRotationMinSpeed,\n this.particleRotationMaxSpeed\n );\n }\n if (this._maxParticlesCountDirty) {\n this._renderer.setMaxParticlesCount(this.maxParticlesCount);\n }\n if (this._additiveRenderingDirty) {\n this._renderer.setAdditiveRendering(this.additiveRendering);\n }\n if (this._angleDirty) {\n const angle = this.getAngle();\n this._renderer.setAngle(\n angle - this.angleB / 2.0,\n angle + this.angleB / 2.0\n );\n }\n if (this._forceDirty) {\n this._renderer.setForce(this.forceMin, this.forceMax);\n }\n if (this._zoneRadiusDirty) {\n this._renderer.setZoneRadius(this.zoneRadius);\n }\n if (this._lifeTimeDirty) {\n this._renderer.setLifeTime(this.lifeTimeMin, this.lifeTimeMax);\n }\n if (this._gravityDirty) {\n this._renderer.setGravity(this.gravityX, this.gravityY);\n }\n if (this._colorDirty) {\n this._renderer.setColor(this.color1, this.color2);\n }\n if (this._sizeDirty) {\n this._renderer.setSize(this.size1, this.size2);\n }\n if (this._alphaDirty) {\n this._renderer.setAlpha(this.alpha1, this.alpha2);\n }\n if (this._flowDirty || this._tankDirty) {\n this._renderer.resetEmission(this.flow, this.tank);\n }\n if (this._textureDirty) {\n this._renderer.setTextureName(this.texture, instanceContainer);\n }\n this._posDirty = this._angleDirty = this._forceDirty = this._zoneRadiusDirty = false;\n this._lifeTimeDirty = this._gravityDirty = this._colorDirty = this._sizeDirty = false;\n this._alphaDirty = this._flowDirty = this._textureDirty = this._tankDirty = false;\n this._additiveRenderingDirty = this._maxParticlesCountDirty = this._particleRotationSpeedDirty = false;\n this._renderer.update(this.getElapsedTime() / 1000.0);\n if (\n this.destroyWhenNoParticles &&\n this.getParticleCount() === 0 &&\n this._renderer.hasStarted() &&\n !this._isEmissionPaused &&\n this._renderer._mayHaveEndedEmission()\n ) {\n this.deleteFromScene(instanceContainer);\n }\n if (\n this.jumpForwardInTimeOnCreation > 0 &&\n this._jumpForwardInTimeCompleted === false\n ) {\n this._renderer.update(this.jumpForwardInTimeOnCreation);\n this._jumpForwardInTimeCompleted = true;\n }\n }\n\n onDestroyed(): void {\n this._renderer.destroy();\n super.onDestroyed();\n }\n\n getEmitterForceMin(): number {\n return this.forceMin;\n }\n\n setEmitterForceMin(force: float): void {\n if (force < 0) {\n force = 0;\n }\n if (this.forceMin !== force) {\n this._forceDirty = true;\n this.forceMin = force;\n }\n }\n\n getEmitterForceMax(): number {\n return this.forceMax;\n }\n\n setEmitterForceMax(force: float): void {\n if (force < 0) {\n force = 0;\n }\n if (this.forceMax !== force) {\n this._forceDirty = true;\n this.forceMax = force;\n }\n }\n\n setParticleRotationMinSpeed(speed: number): void {\n if (this.particleRotationMinSpeed !== speed) {\n this._particleRotationSpeedDirty = true;\n this.particleRotationMinSpeed = speed;\n }\n }\n\n getParticleRotationMinSpeed(): number {\n return this.particleRotationMinSpeed;\n }\n\n setParticleRotationMaxSpeed(speed: number): void {\n if (this.particleRotationMaxSpeed !== speed) {\n this._particleRotationSpeedDirty = true;\n this.particleRotationMaxSpeed = speed;\n }\n }\n\n getParticleRotationMaxSpeed(): number {\n return this.particleRotationMaxSpeed;\n }\n\n setMaxParticlesCount(count: number): void {\n if (this.maxParticlesCount !== count) {\n this._maxParticlesCountDirty = true;\n this.maxParticlesCount = count;\n }\n }\n\n getMaxParticlesCount(): number {\n return this.maxParticlesCount;\n }\n\n setAdditiveRendering(enabled: boolean) {\n if (this.additiveRendering !== enabled) {\n this._additiveRenderingDirty = true;\n this.additiveRendering = enabled;\n }\n }\n\n getAdditiveRendering(): boolean {\n return this.additiveRendering;\n }\n\n /**\n * @deprecated Prefer using getAngle\n */\n getEmitterAngle(): float {\n return (this.angleA + this.angleB) / 2.0;\n }\n\n /**\n * @deprecated Prefer using setAngle\n */\n setEmitterAngle(angle: float): void {\n const oldAngle = this.getEmitterAngle();\n if (angle !== oldAngle) {\n this._angleDirty = true;\n this.angleA += angle - oldAngle;\n this.angleB += angle - oldAngle;\n }\n }\n\n /**\n * @deprecated This function returns data that is not used.\n */\n getEmitterAngleA(): float {\n return this.angleA;\n }\n\n /**\n * @deprecated This function sets data that is not used.\n */\n setEmitterAngleA(angle: float): void {\n if (this.angleA !== angle) {\n this._angleDirty = true;\n this.angleA = angle;\n }\n }\n\n getEmitterAngleB(): float {\n return this.angleB;\n }\n\n setEmitterAngleB(angle: float): void {\n if (this.angleB !== angle) {\n this._angleDirty = true;\n this.angleB = angle;\n }\n }\n\n getConeSprayAngle(): float {\n return this.getEmitterAngleB();\n }\n\n setConeSprayAngle(angle: float): void {\n this.setEmitterAngleB(angle);\n }\n\n getZoneRadius(): float {\n return this.zoneRadius;\n }\n\n setZoneRadius(radius: float): void {\n if (radius < 0) {\n radius = 0;\n }\n if (this.zoneRadius !== radius && radius > 0) {\n this._zoneRadiusDirty = true;\n this.zoneRadius = radius;\n }\n }\n\n getParticleLifeTimeMin(): float {\n return this.lifeTimeMin;\n }\n\n setParticleLifeTimeMin(lifeTime: float): void {\n if (lifeTime < 0) {\n lifeTime = 0;\n }\n if (this.lifeTimeMin !== lifeTime) {\n this._lifeTimeDirty = true;\n this.lifeTimeMin = lifeTime;\n }\n }\n\n getParticleLifeTimeMax(): float {\n return this.lifeTimeMax;\n }\n\n setParticleLifeTimeMax(lifeTime: float): void {\n if (lifeTime < 0) {\n lifeTime = 0;\n }\n if (this.lifeTimeMax !== lifeTime) {\n this._lifeTimeDirty = true;\n this.lifeTimeMax = lifeTime;\n }\n }\n\n getParticleGravityX(): float {\n return this.gravityX;\n }\n\n setParticleGravityX(x: float): void {\n if (this.gravityX !== x) {\n this._gravityDirty = true;\n this.gravityX = x;\n }\n }\n\n getParticleGravityY(): float {\n return this.gravityY;\n }\n\n setParticleGravityY(y: float): void {\n if (this.gravityY !== y) {\n this._gravityDirty = true;\n this.gravityY = y;\n }\n }\n\n getParticleGravityAngle(): float {\n return (Math.atan2(this.gravityY, this.gravityX) * 180.0) / Math.PI;\n }\n\n setParticleGravityAngle(angle: float): void {\n const oldAngle = this.getParticleGravityAngle();\n if (oldAngle !== angle) {\n this._gravityDirty = true;\n const length = this.getParticleGravityLength();\n this.gravityX = length * Math.cos((angle * Math.PI) / 180.0);\n this.gravityY = length * Math.sin((angle * Math.PI) / 180.0);\n }\n }\n\n getParticleGravityLength(): float {\n return Math.sqrt(\n this.gravityX * this.gravityX + this.gravityY * this.gravityY\n );\n }\n\n setParticleGravityLength(length: float): void {\n if (length < 0) {\n length = 0;\n }\n const oldLength = this.getParticleGravityLength();\n if (oldLength !== length) {\n this._gravityDirty = true;\n this.gravityX *= length / oldLength;\n this.gravityY *= length / oldLength;\n }\n }\n\n getParticleRed1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[0];\n }\n\n setParticleRed1(red: number): void {\n if (red < 0) {\n red = 0;\n }\n if (red > 255) {\n red = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(red, existingColor[1], existingColor[2])\n );\n }\n\n getParticleRed2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[0];\n }\n\n setParticleRed2(red: number): void {\n if (red < 0) {\n red = 0;\n }\n if (red > 255) {\n red = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(red, existingColor[1], existingColor[2])\n );\n }\n\n getParticleGreen1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[1];\n }\n\n setParticleGreen1(green: number): void {\n if (green < 0) {\n green = 0;\n }\n if (green > 255) {\n green = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], green, existingColor[2])\n );\n }\n\n getParticleGreen2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[1];\n }\n\n setParticleGreen2(green: number): void {\n if (green < 0) {\n green = 0;\n }\n if (green > 255) {\n green = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], green, existingColor[2])\n );\n }\n\n getParticleBlue1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[2];\n }\n\n setParticleBlue1(blue: number): void {\n if (blue < 0) {\n blue = 0;\n }\n if (blue > 255) {\n blue = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], existingColor[1], blue)\n );\n }\n\n getParticleBlue2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[2];\n }\n\n setParticleBlue2(blue: number): void {\n if (blue < 0) {\n blue = 0;\n }\n if (blue > 255) {\n blue = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], existingColor[1], blue)\n );\n }\n\n setParticleColor1AsNumber(color: number): void {\n this.color1 = color;\n this._colorDirty = true;\n }\n\n setParticleColor1(rgbOrHexColor: string): void {\n this.setParticleColor1AsNumber(\n gdjs.rgbOrHexStringToNumber(rgbOrHexColor)\n );\n }\n\n setParticleColor2AsNumber(color: number): void {\n this.color2 = color;\n this._colorDirty = true;\n }\n\n setParticleColor2(rgbOrHexColor: string): void {\n this.setParticleColor2AsNumber(\n gdjs.rgbOrHexStringToNumber(rgbOrHexColor)\n );\n }\n\n getParticleSize1(): float {\n return this.size1;\n }\n\n setParticleSize1(size: float): void {\n if (size < 0) {\n size = 0;\n }\n if (this.size1 !== size) {\n this._sizeDirty = true;\n this.size1 = size;\n }\n }\n\n getParticleSize2(): float {\n return this.size2;\n }\n\n setParticleSize2(size: float): void {\n if (this.size2 !== size) {\n this._sizeDirty = true;\n this.size2 = size;\n }\n }\n\n getParticleAlpha1(): number {\n return this.alpha1;\n }\n\n setParticleAlpha1(alpha: number): void {\n if (this.alpha1 !== alpha) {\n this._alphaDirty = true;\n this.alpha1 = alpha;\n }\n }\n\n getParticleAlpha2(): number {\n return this.alpha2;\n }\n\n setParticleAlpha2(alpha: number): void {\n if (this.alpha2 !== alpha) {\n this._alphaDirty = true;\n this.alpha2 = alpha;\n }\n }\n\n startEmission(): void {\n this._isEmissionPaused = false;\n this._renderer.start();\n }\n\n stopEmission(): void {\n this._isEmissionPaused = true;\n this._renderer.stop();\n }\n\n isEmitting(): boolean {\n return this._renderer.emitter.emit;\n }\n\n noMoreParticles(): boolean {\n return !this.isEmitting();\n }\n\n recreateParticleSystem(): void {\n this._renderer.recreate();\n }\n\n getFlow(): number {\n return this.flow;\n }\n\n setFlow(flow: number): void {\n if (this.flow !== flow) {\n this.flow = flow;\n this._flowDirty = true;\n }\n }\n\n getParticleCount(): number {\n return this._renderer.getParticleCount();\n }\n\n getTank(): number {\n return this.tank;\n }\n\n setTank(tank: number): void {\n this.tank = tank;\n this._tankDirty = true;\n }\n\n getTexture(): string {\n return this.texture;\n }\n\n setTexture(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n if (this.texture !== texture) {\n if (this._renderer.isTextureNameValid(texture, instanceContainer)) {\n this.texture = texture;\n this._textureDirty = true;\n }\n }\n }\n\n jumpEmitterForwardInTime(timeSkipped: number): void {\n this._renderer.update(timeSkipped);\n }\n }\n gdjs.registerObject(\n 'ParticleSystem::ParticleEmitter',\n gdjs.ParticleEmitterObject\n );\n}\n"],
|
|
5
|
-
"mappings": "AAMA,GAAU,M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iBAAmB,EAAc,gBACjD,KAAK,kBAAkB,EAAc,gBAGrC,EAAc,sBAAwB,EAAc,qBAEpD,KAAK,WACH,EAAc,oBACd,KAAK,mBAGL,EAAc,OAAS,EAAc,MACvC,KAAK,QAAQ,EAAc,MAEzB,EAAc,OAAS,EAAc,MACvC,KAAK,QAAQ,EAAc,MAG3B,EAAc,yBACd,EAAc,wBAEd,MAAK,uBAAyB,EAAc,wBAG5C,GAAc,0BACZ,EAAc,yBAChB,EAAc,0BACZ,EAAc,yBAChB,EAAc,iBAAmB,EAAc,gBAC/C,EAAc,iBAAmB,EAAc,gBAC/C,EAAc,gBAAkB,EAAc,eAC9C,EAAc,WAAa,EAAc,UACzC,EAAc,eAAiB,EAAc,cAC7C,EAAc,iBAAmB,EAAc,gBAC/C,EAAc,iBAAmB,EAAc,iBAI/C,CADc,KAAK,uBAAuB,SAAS,KAAK,OAErD,cACA,qBAAqB,KAAK,UAAU,qBACvC,KAAK,UAAU,UAGf,KAAK,UAAY,GAAI,GAAK,8BACxB,KAAK,uBACL,KACA,GAKF,KAAK,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop - Particle System Extension\n * Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\n * This project is released under the MIT License.\n */\n\nnamespace gdjs {\n export type ParticleEmitterObjectDataType = {\n /**\n * @deprecated Data not used\n */\n emitterAngleA: number;\n emitterForceMin: number;\n /**\n * Cone spray angle (degrees)\n */\n emitterAngleB: number;\n zoneRadius: number;\n emitterForceMax: number;\n particleLifeTimeMax: number;\n particleLifeTimeMin: number;\n particleGravityY: number;\n particleGravityX: number;\n particleColor2: string;\n particleColor1: string;\n particleSize2: number;\n particleSize1: number;\n /**\n * Particle max rotation speed (degrees/second)\n */\n particleAngle2: number;\n /**\n * Particle min rotation speed (degrees/second)\n */\n particleAngle1: number;\n particleAlpha1: number;\n rendererType: string;\n particleAlpha2: number;\n rendererParam2: number;\n rendererParam1: number;\n particleSizeRandomness1: number;\n particleSizeRandomness2: number;\n maxParticleNb: number;\n additive: boolean;\n /** Resource name for image in particle */\n textureParticleName: string;\n tank: number;\n flow: number;\n /** Destroy the object when there is no particles? */\n destroyWhenNoParticles: boolean;\n jumpForwardInTimeOnCreation: number;\n };\n\n export type ParticleEmitterObjectData = ObjectData &\n ParticleEmitterObjectDataType;\n\n export type ParticleEmitterObjectNetworkSyncDataType = {\n // Technically, all attributes can change at runtime, so we sync as many as possible.\n // TODO: ensure we only send props that change to optimize the sync.\n // dirty attributes are not synced, they are defined by the update method if the value has changed.\n // Particle Rotation Speed\n prms: number;\n prmx: number;\n // Max Particles Count\n mpc: number;\n // Additive Rendering\n addr: boolean;\n // Angle\n angb: number;\n // Force\n formin: number;\n formax: number;\n // Zone Radius\n zr: number;\n // Life Time\n ltmin: number;\n ltmax: number;\n // Gravity\n gravx: number;\n gravy: number;\n // Color\n color1: number;\n color2: number;\n // Size\n size1: number;\n size2: number;\n // Alpha\n alp1: number;\n alp2: number;\n // Flow\n flow: number;\n // Tank\n tank: number;\n // Texture\n text: string;\n // Pause\n paused: boolean;\n };\n\n export type ParticleEmitterObjectNetworkSyncData = ObjectNetworkSyncData &\n ParticleEmitterObjectNetworkSyncDataType;\n\n /**\n * Displays particles.\n */\n export class ParticleEmitterObject extends gdjs.RuntimeObject {\n /**\n * @deprecated Data not used\n */\n angleA: number;\n angleB: number;\n forceMin: number;\n forceMax: float;\n zoneRadius: number;\n lifeTimeMin: number;\n lifeTimeMax: float;\n gravityX: number;\n gravityY: number;\n color1: number;\n color2: number;\n size1: number;\n size2: number;\n alpha1: number;\n alpha2: number;\n rendererType: string;\n rendererParam1: number;\n rendererParam2: number;\n texture: string;\n flow: number;\n tank: number;\n destroyWhenNoParticles: boolean;\n particleRotationMinSpeed: number;\n particleRotationMaxSpeed: number;\n maxParticlesCount: number;\n additiveRendering: boolean;\n jumpForwardInTimeOnCreation: number;\n _jumpForwardInTimeCompleted: boolean = false;\n _posDirty: boolean = true;\n _angleDirty: boolean = true;\n _forceDirty: boolean = true;\n _zoneRadiusDirty: boolean = true;\n _lifeTimeDirty: boolean = true;\n _gravityDirty: boolean = true;\n _colorDirty: boolean = true;\n _sizeDirty: boolean = true;\n _alphaDirty: boolean = true;\n _flowDirty: boolean = true;\n _tankDirty: boolean = true;\n _particleRotationSpeedDirty: boolean = true;\n _maxParticlesCountDirty: boolean = true;\n _additiveRenderingDirty: boolean = true;\n // Don't mark texture as dirty if not using one.\n _textureDirty: boolean;\n /**\n * `true` only when the emission is paused by events.\n * It allows to tell the end of emission apart from it.\n */\n _isEmissionPaused: boolean = false;\n\n // @ts-ignore\n _renderer: gdjs.ParticleEmitterObjectRenderer;\n\n /**\n * @param instanceContainer the container the object belongs to\n * @param particleObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n particleObjectData: ParticleEmitterObjectData\n ) {\n super(instanceContainer, particleObjectData);\n this._renderer = new gdjs.ParticleEmitterObjectRenderer(\n instanceContainer,\n this,\n particleObjectData\n );\n this.angleA = particleObjectData.emitterAngleA;\n this.angleB = particleObjectData.emitterAngleB;\n this.forceMin = particleObjectData.emitterForceMin;\n this.forceMax = particleObjectData.emitterForceMax;\n this.zoneRadius = particleObjectData.zoneRadius;\n this.lifeTimeMin = particleObjectData.particleLifeTimeMin;\n this.lifeTimeMax = particleObjectData.particleLifeTimeMax;\n this.gravityX = particleObjectData.particleGravityX;\n this.gravityY = particleObjectData.particleGravityY;\n this.color1 = gdjs.rgbOrHexStringToNumber(\n particleObjectData.particleColor1\n );\n this.color2 = gdjs.rgbOrHexStringToNumber(\n particleObjectData.particleColor2\n );\n this.size1 = particleObjectData.particleSize1;\n this.size2 = particleObjectData.particleSize2;\n this.alpha1 = particleObjectData.particleAlpha1;\n this.alpha2 = particleObjectData.particleAlpha2;\n this.rendererType = particleObjectData.rendererType;\n this.rendererParam1 = particleObjectData.rendererParam1;\n this.rendererParam2 = particleObjectData.rendererParam2;\n this.texture = particleObjectData.textureParticleName;\n this.flow = particleObjectData.flow;\n this.tank = particleObjectData.tank;\n this.destroyWhenNoParticles = particleObjectData.destroyWhenNoParticles;\n this.particleRotationMinSpeed = particleObjectData.particleAngle1;\n this.particleRotationMaxSpeed = particleObjectData.particleAngle2;\n this.maxParticlesCount = particleObjectData.maxParticleNb;\n this.additiveRendering = particleObjectData.additive;\n this.jumpForwardInTimeOnCreation =\n particleObjectData.jumpForwardInTimeOnCreation;\n this._textureDirty = this.texture !== '';\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n setX(x: number): void {\n if (this.x !== x) {\n this._posDirty = true;\n }\n super.setX(x);\n }\n\n setY(y: number): void {\n if (this.y !== y) {\n this._posDirty = true;\n }\n super.setY(y);\n }\n\n setAngle(angle): void {\n if (this.angle !== angle) {\n this._angleDirty = true;\n }\n super.setAngle(angle);\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: ParticleEmitterObjectData,\n newObjectData: ParticleEmitterObjectData\n ): boolean {\n if (oldObjectData.emitterAngleA !== newObjectData.emitterAngleA) {\n this.setEmitterAngleA(newObjectData.emitterAngleA);\n }\n if (oldObjectData.emitterAngleB !== newObjectData.emitterAngleB) {\n this.setEmitterAngleB(newObjectData.emitterAngleB);\n }\n if (oldObjectData.emitterForceMin !== newObjectData.emitterForceMin) {\n this.setEmitterForceMin(newObjectData.emitterForceMin);\n }\n if (oldObjectData.particleAngle1 !== newObjectData.particleAngle1) {\n this.setParticleRotationMinSpeed(newObjectData.particleAngle1);\n }\n if (oldObjectData.particleAngle2 !== newObjectData.particleAngle2) {\n this.setParticleRotationMaxSpeed(newObjectData.particleAngle2);\n }\n if (oldObjectData.maxParticleNb !== newObjectData.maxParticleNb) {\n this.setMaxParticlesCount(newObjectData.maxParticleNb);\n }\n if (oldObjectData.additive !== newObjectData.additive) {\n this.setAdditiveRendering(newObjectData.additive);\n }\n if (oldObjectData.emitterForceMax !== newObjectData.emitterForceMax) {\n this.setEmitterForceMax(newObjectData.emitterForceMax);\n }\n if (oldObjectData.zoneRadius !== newObjectData.zoneRadius) {\n this.setZoneRadius(newObjectData.zoneRadius);\n }\n if (\n oldObjectData.particleLifeTimeMin !== newObjectData.particleLifeTimeMin\n ) {\n this.setParticleLifeTimeMin(newObjectData.particleLifeTimeMin);\n }\n if (\n oldObjectData.particleLifeTimeMax !== newObjectData.particleLifeTimeMax\n ) {\n this.setParticleLifeTimeMax(newObjectData.particleLifeTimeMax);\n }\n if (oldObjectData.particleGravityX !== newObjectData.particleGravityX) {\n this.setParticleGravityX(newObjectData.particleGravityX);\n }\n if (oldObjectData.particleGravityY !== newObjectData.particleGravityY) {\n this.setParticleGravityY(newObjectData.particleGravityY);\n }\n if (oldObjectData.particleColor1 !== newObjectData.particleColor1) {\n this.setParticleColor1(newObjectData.particleColor1);\n }\n if (oldObjectData.particleColor2 !== newObjectData.particleColor2) {\n this.setParticleColor2(newObjectData.particleColor2);\n }\n if (oldObjectData.particleSize1 !== newObjectData.particleSize1) {\n this.setParticleSize1(newObjectData.particleSize1);\n }\n if (oldObjectData.particleSize2 !== newObjectData.particleSize2) {\n this.setParticleSize2(newObjectData.particleSize2);\n }\n if (oldObjectData.particleAlpha1 !== newObjectData.particleAlpha1) {\n this.setParticleAlpha1(newObjectData.particleAlpha1);\n }\n if (oldObjectData.particleAlpha2 !== newObjectData.particleAlpha2) {\n this.setParticleAlpha2(newObjectData.particleAlpha2);\n }\n if (\n oldObjectData.textureParticleName !== newObjectData.textureParticleName\n ) {\n this.setTexture(\n newObjectData.textureParticleName,\n this.getRuntimeScene()\n );\n }\n if (oldObjectData.flow !== newObjectData.flow) {\n this.setFlow(newObjectData.flow);\n }\n if (oldObjectData.tank !== newObjectData.tank) {\n this.setTank(newObjectData.tank);\n }\n if (\n oldObjectData.destroyWhenNoParticles !==\n newObjectData.destroyWhenNoParticles\n ) {\n this.destroyWhenNoParticles = newObjectData.destroyWhenNoParticles;\n }\n if (\n oldObjectData.particleSizeRandomness1 !==\n newObjectData.particleSizeRandomness1 ||\n oldObjectData.particleSizeRandomness2 !==\n newObjectData.particleSizeRandomness2 ||\n oldObjectData.particleAngle1 !== newObjectData.particleAngle1 ||\n oldObjectData.particleAngle2 !== newObjectData.particleAngle2 ||\n oldObjectData.maxParticleNb !== newObjectData.maxParticleNb ||\n oldObjectData.additive !== newObjectData.additive ||\n oldObjectData.rendererType !== newObjectData.rendererType ||\n oldObjectData.rendererParam1 !== newObjectData.rendererParam1 ||\n oldObjectData.rendererParam2 !== newObjectData.rendererParam2\n ) {\n // Destroy the renderer, ensure it's removed from the layer.\n const layer = this.getInstanceContainer().getLayer(this.layer);\n layer\n .getRenderer()\n .removeRendererObject(this._renderer.getRendererObject());\n this._renderer.destroy();\n\n // and recreate the renderer, which will add itself to the layer.\n this._renderer = new gdjs.ParticleEmitterObjectRenderer(\n this.getInstanceContainer(),\n this,\n newObjectData\n );\n\n // Consider every state dirty as the renderer was just re-created, so it needs\n // to be repositioned, angle updated, etc...\n this._posDirty =\n this._angleDirty =\n this._forceDirty =\n this._zoneRadiusDirty =\n true;\n this._lifeTimeDirty =\n this._gravityDirty =\n this._colorDirty =\n this._sizeDirty =\n true;\n this._alphaDirty =\n this._flowDirty =\n this._tankDirty =\n this._textureDirty =\n true;\n }\n return true;\n }\n\n getNetworkSyncData(): ParticleEmitterObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n prms: this.particleRotationMinSpeed,\n prmx: this.particleRotationMaxSpeed,\n mpc: this.maxParticlesCount,\n addr: this.additiveRendering,\n angb: this.angleB,\n formin: this.forceMin,\n formax: this.forceMax,\n zr: this.zoneRadius,\n ltmin: this.lifeTimeMin,\n ltmax: this.lifeTimeMax,\n gravx: this.gravityX,\n gravy: this.gravityY,\n color1: this.color1,\n color2: this.color2,\n size1: this.size1,\n size2: this.size2,\n alp1: this.alpha1,\n alp2: this.alpha2,\n flow: this.flow,\n tank: this.tank,\n text: this.texture,\n paused: this._isEmissionPaused,\n };\n }\n\n updateFromNetworkSyncData(\n syncData: ParticleEmitterObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(syncData);\n if (syncData.x !== undefined) {\n this.setX(syncData.x);\n }\n if (syncData.y !== undefined) {\n this.setY(syncData.y);\n }\n if (syncData.a !== undefined) {\n this.setAngle(syncData.a);\n }\n if (syncData.prms !== undefined) {\n this.setParticleRotationMinSpeed(syncData.prms);\n }\n if (syncData.prmx !== undefined) {\n this.setParticleRotationMaxSpeed(syncData.prmx);\n }\n if (syncData.mpc !== undefined) {\n this.setMaxParticlesCount(syncData.mpc);\n }\n if (syncData.addr !== undefined) {\n this.setAdditiveRendering(syncData.addr);\n }\n if (syncData.angb !== undefined) {\n this.setEmitterAngleB(syncData.angb);\n }\n if (syncData.formin !== undefined) {\n this.setEmitterForceMin(syncData.formin);\n }\n if (syncData.formax !== undefined) {\n this.setEmitterForceMax(syncData.formax);\n }\n if (syncData.zr !== undefined) {\n this.setZoneRadius(syncData.zr);\n }\n if (syncData.ltmin !== undefined) {\n this.setParticleLifeTimeMin(syncData.ltmin);\n }\n if (syncData.ltmax !== undefined) {\n this.setParticleLifeTimeMax(syncData.ltmax);\n }\n if (syncData.gravx !== undefined) {\n this.setParticleGravityX(syncData.gravx);\n }\n if (syncData.gravy !== undefined) {\n this.setParticleGravityY(syncData.gravy);\n }\n if (syncData.color1 !== undefined) {\n this.setParticleColor1AsNumber(syncData.color1);\n }\n if (syncData.color2 !== undefined) {\n this.setParticleColor2AsNumber(syncData.color2);\n }\n if (syncData.size1 !== undefined) {\n this.setParticleSize1(syncData.size1);\n }\n if (syncData.size2 !== undefined) {\n this.setParticleSize2(syncData.size2);\n }\n if (syncData.alp1 !== undefined) {\n this.setParticleAlpha1(syncData.alp1);\n }\n if (syncData.alp2 !== undefined) {\n this.setParticleAlpha2(syncData.alp2);\n }\n if (syncData.flow !== undefined) {\n this.setFlow(syncData.flow);\n }\n if (syncData.tank !== undefined) {\n this.setTank(syncData.tank);\n }\n if (syncData.text !== undefined) {\n this.setTexture(syncData.text, this.getRuntimeScene());\n }\n if (syncData.paused !== undefined) {\n if (syncData.paused) {\n this.stopEmission();\n } else {\n this.startEmission();\n }\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._posDirty) {\n this._renderer.setPosition(this.getX(), this.getY());\n }\n if (this._particleRotationSpeedDirty) {\n this._renderer.setParticleRotationSpeed(\n this.particleRotationMinSpeed,\n this.particleRotationMaxSpeed\n );\n }\n if (this._maxParticlesCountDirty) {\n this._renderer.setMaxParticlesCount(this.maxParticlesCount);\n }\n if (this._additiveRenderingDirty) {\n this._renderer.setAdditiveRendering(this.additiveRendering);\n }\n if (this._angleDirty) {\n const angle = this.getAngle();\n this._renderer.setAngle(\n angle - this.angleB / 2.0,\n angle + this.angleB / 2.0\n );\n }\n if (this._forceDirty) {\n this._renderer.setForce(this.forceMin, this.forceMax);\n }\n if (this._zoneRadiusDirty) {\n this._renderer.setZoneRadius(this.zoneRadius);\n }\n if (this._lifeTimeDirty) {\n this._renderer.setLifeTime(this.lifeTimeMin, this.lifeTimeMax);\n }\n if (this._gravityDirty) {\n this._renderer.setGravity(this.gravityX, this.gravityY);\n }\n if (this._colorDirty) {\n this._renderer.setColor(this.color1, this.color2);\n }\n if (this._sizeDirty) {\n this._renderer.setSize(this.size1, this.size2);\n }\n if (this._alphaDirty) {\n this._renderer.setAlpha(this.alpha1, this.alpha2);\n }\n if (this._flowDirty || this._tankDirty) {\n this._renderer.resetEmission(this.flow, this.tank);\n }\n if (this._textureDirty) {\n this._renderer.setTextureName(this.texture, instanceContainer);\n }\n this._posDirty =\n this._angleDirty =\n this._forceDirty =\n this._zoneRadiusDirty =\n false;\n this._lifeTimeDirty =\n this._gravityDirty =\n this._colorDirty =\n this._sizeDirty =\n false;\n this._alphaDirty =\n this._flowDirty =\n this._textureDirty =\n this._tankDirty =\n false;\n this._additiveRenderingDirty =\n this._maxParticlesCountDirty =\n this._particleRotationSpeedDirty =\n false;\n this._renderer.update(this.getElapsedTime() / 1000.0);\n if (\n this.destroyWhenNoParticles &&\n this.getParticleCount() === 0 &&\n this._renderer.hasStarted() &&\n !this._isEmissionPaused &&\n this._renderer._mayHaveEndedEmission()\n ) {\n this.deleteFromScene(instanceContainer);\n }\n if (\n this.jumpForwardInTimeOnCreation > 0 &&\n this._jumpForwardInTimeCompleted === false\n ) {\n this._renderer.update(this.jumpForwardInTimeOnCreation);\n this._jumpForwardInTimeCompleted = true;\n }\n }\n\n onDestroyed(): void {\n this._renderer.destroy();\n super.onDestroyed();\n }\n\n getEmitterForceMin(): number {\n return this.forceMin;\n }\n\n setEmitterForceMin(force: float): void {\n if (force < 0) {\n force = 0;\n }\n if (this.forceMin !== force) {\n this._forceDirty = true;\n this.forceMin = force;\n }\n }\n\n getEmitterForceMax(): number {\n return this.forceMax;\n }\n\n setEmitterForceMax(force: float): void {\n if (force < 0) {\n force = 0;\n }\n if (this.forceMax !== force) {\n this._forceDirty = true;\n this.forceMax = force;\n }\n }\n\n setParticleRotationMinSpeed(speed: number): void {\n if (this.particleRotationMinSpeed !== speed) {\n this._particleRotationSpeedDirty = true;\n this.particleRotationMinSpeed = speed;\n }\n }\n\n getParticleRotationMinSpeed(): number {\n return this.particleRotationMinSpeed;\n }\n\n setParticleRotationMaxSpeed(speed: number): void {\n if (this.particleRotationMaxSpeed !== speed) {\n this._particleRotationSpeedDirty = true;\n this.particleRotationMaxSpeed = speed;\n }\n }\n\n getParticleRotationMaxSpeed(): number {\n return this.particleRotationMaxSpeed;\n }\n\n setMaxParticlesCount(count: number): void {\n if (this.maxParticlesCount !== count) {\n this._maxParticlesCountDirty = true;\n this.maxParticlesCount = count;\n }\n }\n\n getMaxParticlesCount(): number {\n return this.maxParticlesCount;\n }\n\n setAdditiveRendering(enabled: boolean) {\n if (this.additiveRendering !== enabled) {\n this._additiveRenderingDirty = true;\n this.additiveRendering = enabled;\n }\n }\n\n getAdditiveRendering(): boolean {\n return this.additiveRendering;\n }\n\n /**\n * @deprecated Prefer using getAngle\n */\n getEmitterAngle(): float {\n return (this.angleA + this.angleB) / 2.0;\n }\n\n /**\n * @deprecated Prefer using setAngle\n */\n setEmitterAngle(angle: float): void {\n const oldAngle = this.getEmitterAngle();\n if (angle !== oldAngle) {\n this._angleDirty = true;\n this.angleA += angle - oldAngle;\n this.angleB += angle - oldAngle;\n }\n }\n\n /**\n * @deprecated This function returns data that is not used.\n */\n getEmitterAngleA(): float {\n return this.angleA;\n }\n\n /**\n * @deprecated This function sets data that is not used.\n */\n setEmitterAngleA(angle: float): void {\n if (this.angleA !== angle) {\n this._angleDirty = true;\n this.angleA = angle;\n }\n }\n\n getEmitterAngleB(): float {\n return this.angleB;\n }\n\n setEmitterAngleB(angle: float): void {\n if (this.angleB !== angle) {\n this._angleDirty = true;\n this.angleB = angle;\n }\n }\n\n getConeSprayAngle(): float {\n return this.getEmitterAngleB();\n }\n\n setConeSprayAngle(angle: float): void {\n this.setEmitterAngleB(angle);\n }\n\n getZoneRadius(): float {\n return this.zoneRadius;\n }\n\n setZoneRadius(radius: float): void {\n if (radius < 0) {\n radius = 0;\n }\n if (this.zoneRadius !== radius && radius > 0) {\n this._zoneRadiusDirty = true;\n this.zoneRadius = radius;\n }\n }\n\n getParticleLifeTimeMin(): float {\n return this.lifeTimeMin;\n }\n\n setParticleLifeTimeMin(lifeTime: float): void {\n if (lifeTime < 0) {\n lifeTime = 0;\n }\n if (this.lifeTimeMin !== lifeTime) {\n this._lifeTimeDirty = true;\n this.lifeTimeMin = lifeTime;\n }\n }\n\n getParticleLifeTimeMax(): float {\n return this.lifeTimeMax;\n }\n\n setParticleLifeTimeMax(lifeTime: float): void {\n if (lifeTime < 0) {\n lifeTime = 0;\n }\n if (this.lifeTimeMax !== lifeTime) {\n this._lifeTimeDirty = true;\n this.lifeTimeMax = lifeTime;\n }\n }\n\n getParticleGravityX(): float {\n return this.gravityX;\n }\n\n setParticleGravityX(x: float): void {\n if (this.gravityX !== x) {\n this._gravityDirty = true;\n this.gravityX = x;\n }\n }\n\n getParticleGravityY(): float {\n return this.gravityY;\n }\n\n setParticleGravityY(y: float): void {\n if (this.gravityY !== y) {\n this._gravityDirty = true;\n this.gravityY = y;\n }\n }\n\n getParticleGravityAngle(): float {\n return (Math.atan2(this.gravityY, this.gravityX) * 180.0) / Math.PI;\n }\n\n setParticleGravityAngle(angle: float): void {\n const oldAngle = this.getParticleGravityAngle();\n if (oldAngle !== angle) {\n this._gravityDirty = true;\n const length = this.getParticleGravityLength();\n this.gravityX = length * Math.cos((angle * Math.PI) / 180.0);\n this.gravityY = length * Math.sin((angle * Math.PI) / 180.0);\n }\n }\n\n getParticleGravityLength(): float {\n return Math.sqrt(\n this.gravityX * this.gravityX + this.gravityY * this.gravityY\n );\n }\n\n setParticleGravityLength(length: float): void {\n if (length < 0) {\n length = 0;\n }\n const oldLength = this.getParticleGravityLength();\n if (oldLength !== length) {\n this._gravityDirty = true;\n this.gravityX *= length / oldLength;\n this.gravityY *= length / oldLength;\n }\n }\n\n getParticleRed1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[0];\n }\n\n setParticleRed1(red: number): void {\n if (red < 0) {\n red = 0;\n }\n if (red > 255) {\n red = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(red, existingColor[1], existingColor[2])\n );\n }\n\n getParticleRed2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[0];\n }\n\n setParticleRed2(red: number): void {\n if (red < 0) {\n red = 0;\n }\n if (red > 255) {\n red = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(red, existingColor[1], existingColor[2])\n );\n }\n\n getParticleGreen1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[1];\n }\n\n setParticleGreen1(green: number): void {\n if (green < 0) {\n green = 0;\n }\n if (green > 255) {\n green = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], green, existingColor[2])\n );\n }\n\n getParticleGreen2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[1];\n }\n\n setParticleGreen2(green: number): void {\n if (green < 0) {\n green = 0;\n }\n if (green > 255) {\n green = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], green, existingColor[2])\n );\n }\n\n getParticleBlue1(): number {\n return gdjs.hexNumberToRGBArray(this.color1)[2];\n }\n\n setParticleBlue1(blue: number): void {\n if (blue < 0) {\n blue = 0;\n }\n if (blue > 255) {\n blue = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color1);\n this.setParticleColor1AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], existingColor[1], blue)\n );\n }\n\n getParticleBlue2(): number {\n return gdjs.hexNumberToRGBArray(this.color2)[2];\n }\n\n setParticleBlue2(blue: number): void {\n if (blue < 0) {\n blue = 0;\n }\n if (blue > 255) {\n blue = 255;\n }\n const existingColor = gdjs.hexNumberToRGBArray(this.color2);\n this.setParticleColor2AsNumber(\n gdjs.rgbToHexNumber(existingColor[0], existingColor[1], blue)\n );\n }\n\n setParticleColor1AsNumber(color: number): void {\n this.color1 = color;\n this._colorDirty = true;\n }\n\n setParticleColor1(rgbOrHexColor: string): void {\n this.setParticleColor1AsNumber(\n gdjs.rgbOrHexStringToNumber(rgbOrHexColor)\n );\n }\n\n setParticleColor2AsNumber(color: number): void {\n this.color2 = color;\n this._colorDirty = true;\n }\n\n setParticleColor2(rgbOrHexColor: string): void {\n this.setParticleColor2AsNumber(\n gdjs.rgbOrHexStringToNumber(rgbOrHexColor)\n );\n }\n\n getParticleSize1(): float {\n return this.size1;\n }\n\n setParticleSize1(size: float): void {\n if (size < 0) {\n size = 0;\n }\n if (this.size1 !== size) {\n this._sizeDirty = true;\n this.size1 = size;\n }\n }\n\n getParticleSize2(): float {\n return this.size2;\n }\n\n setParticleSize2(size: float): void {\n if (this.size2 !== size) {\n this._sizeDirty = true;\n this.size2 = size;\n }\n }\n\n getParticleAlpha1(): number {\n return this.alpha1;\n }\n\n setParticleAlpha1(alpha: number): void {\n if (this.alpha1 !== alpha) {\n this._alphaDirty = true;\n this.alpha1 = alpha;\n }\n }\n\n getParticleAlpha2(): number {\n return this.alpha2;\n }\n\n setParticleAlpha2(alpha: number): void {\n if (this.alpha2 !== alpha) {\n this._alphaDirty = true;\n this.alpha2 = alpha;\n }\n }\n\n startEmission(): void {\n this._isEmissionPaused = false;\n this._renderer.start();\n }\n\n stopEmission(): void {\n this._isEmissionPaused = true;\n this._renderer.stop();\n }\n\n isEmitting(): boolean {\n return this._renderer.emitter.emit;\n }\n\n noMoreParticles(): boolean {\n return !this.isEmitting();\n }\n\n recreateParticleSystem(): void {\n this._renderer.recreate();\n }\n\n getFlow(): number {\n return this.flow;\n }\n\n setFlow(flow: number): void {\n if (this.flow !== flow) {\n this.flow = flow;\n this._flowDirty = true;\n }\n }\n\n getParticleCount(): number {\n return this._renderer.getParticleCount();\n }\n\n getTank(): number {\n return this.tank;\n }\n\n setTank(tank: number): void {\n this.tank = tank;\n this._tankDirty = true;\n }\n\n getTexture(): string {\n return this.texture;\n }\n\n setTexture(\n texture: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n if (this.texture !== texture) {\n if (this._renderer.isTextureNameValid(texture, instanceContainer)) {\n this.texture = texture;\n this._textureDirty = true;\n }\n }\n }\n\n jumpEmitterForwardInTime(timeSkipped: number): void {\n this._renderer.update(timeSkipped);\n }\n }\n gdjs.registerObject(\n 'ParticleSystem::ParticleEmitter',\n gdjs.ParticleEmitterObject\n );\n}\n"],
|
|
5
|
+
"mappings": "AAMA,GAAU,MAAV,UAAU,EAAV,CAmGS,eAAoC,GAAK,aAAc,CA6D5D,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAlC3B,iCAAuC,GACvC,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AAoB,CAC1B,KAAK,KAAO,EACZ,KAAK,WAAa,GAGpB,YAAqB,CACnB,MAAO,MAAK,QAGd,WACE,EACA,EACM,CACN,AAAI,KAAK,UAAY,GACf,KAAK,UAAU,mBAAmB,EAAS,IAC7C,MAAK,QAAU,EACf,KAAK,cAAgB,IAK3B,yBAAyB,EAA2B,CAClD,KAAK,UAAU,OAAO,IAl6BnB,EAAM,wBAq6Bb,EAAK,eACH,kCACA,EAAK,yBA1gCC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nGDevelop - Pathfinding Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n export interface RuntimeInstanceContainer {\n pathfindingObstaclesManager: gdjs.PathfindingObstaclesManager;\n }\n declare var rbush: any;\n\n /**\n * PathfindingObstaclesManager manages the common objects shared by objects\n * having a pathfinding behavior: In particular, the obstacles behaviors are\n * required to declare themselves (see\n * `PathfindingObstaclesManager.addObstacle`) to the manager of their\n * associated container (see\n * `gdjs.PathfindingRuntimeBehavior.obstaclesManagers`).\n */\n export class PathfindingObstaclesManager {\n _obstaclesRBush: any;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer) {\n this._obstaclesRBush = new rbush();\n }\n\n /**\n * Get the obstacles manager of an instance container.\n */\n static getManager(instanceContainer: gdjs.RuntimeInstanceContainer) {\n if (!instanceContainer.pathfindingObstaclesManager) {\n //Create the shared manager if necessary.\n instanceContainer.pathfindingObstaclesManager
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAcS,OAAkC,CAGvC,YAAY,EAAkD,CAC5D,KAAK,gBAAkB,GAAI,aAMtB,YAAW,EAAkD,CAClE,MAAK,GAAkB,6BAErB,GAAkB,
|
|
4
|
+
"sourcesContent": ["/*\nGDevelop - Pathfinding Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n export interface RuntimeInstanceContainer {\n pathfindingObstaclesManager: gdjs.PathfindingObstaclesManager;\n }\n declare var rbush: any;\n\n /**\n * PathfindingObstaclesManager manages the common objects shared by objects\n * having a pathfinding behavior: In particular, the obstacles behaviors are\n * required to declare themselves (see\n * `PathfindingObstaclesManager.addObstacle`) to the manager of their\n * associated container (see\n * `gdjs.PathfindingRuntimeBehavior.obstaclesManagers`).\n */\n export class PathfindingObstaclesManager {\n _obstaclesRBush: any;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer) {\n this._obstaclesRBush = new rbush();\n }\n\n /**\n * Get the obstacles manager of an instance container.\n */\n static getManager(instanceContainer: gdjs.RuntimeInstanceContainer) {\n if (!instanceContainer.pathfindingObstaclesManager) {\n //Create the shared manager if necessary.\n instanceContainer.pathfindingObstaclesManager =\n new gdjs.PathfindingObstaclesManager(instanceContainer);\n }\n return instanceContainer.pathfindingObstaclesManager;\n }\n\n /**\n * Add a obstacle to the list of existing obstacles.\n */\n addObstacle(\n pathfindingObstacleBehavior: PathfindingObstacleRuntimeBehavior\n ) {\n if (pathfindingObstacleBehavior.currentRBushAABB)\n pathfindingObstacleBehavior.currentRBushAABB.updateAABBFromOwner();\n else\n pathfindingObstacleBehavior.currentRBushAABB =\n new gdjs.BehaviorRBushAABB(pathfindingObstacleBehavior);\n\n this._obstaclesRBush.insert(pathfindingObstacleBehavior.currentRBushAABB);\n }\n\n /**\n * Remove a obstacle from the list of existing obstacles. Be sure that the obstacle was\n * added before.\n */\n removeObstacle(\n pathfindingObstacleBehavior: PathfindingObstacleRuntimeBehavior\n ) {\n this._obstaclesRBush.remove(pathfindingObstacleBehavior.currentRBushAABB);\n }\n\n /**\n * Returns all the platforms around the specified object.\n * @param x The center X of the area to search.\n * @param y The center Y of the area to search.\n * @param radius The maximum distance, in pixels, the object is going to do.\n * @param result An array returned with all platforms near the object.\n */\n getAllObstaclesAround(\n x: float,\n y: float,\n radius: float,\n result: gdjs.PathfindingObstacleRuntimeBehavior[]\n ): void {\n const searchArea = gdjs.staticObject(\n PathfindingObstaclesManager.prototype.getAllObstaclesAround\n );\n // @ts-ignore\n searchArea.minX = x - radius;\n // @ts-ignore\n searchArea.minY = y - radius;\n // @ts-ignore\n searchArea.maxX = x + radius;\n // @ts-ignore\n searchArea.maxY = y + radius;\n const nearbyObstacles: gdjs.BehaviorRBushAABB<gdjs.PathfindingObstacleRuntimeBehavior>[] =\n this._obstaclesRBush.search(searchArea);\n result.length = 0;\n nearbyObstacles.forEach((nearbyObstacle) =>\n result.push(nearbyObstacle.behavior)\n );\n }\n }\n\n /**\n * PathfindingObstacleRuntimeBehavior represents a behavior allowing objects to be\n * considered as a obstacle by objects having Pathfinding Behavior.\n */\n export class PathfindingObstacleRuntimeBehavior extends gdjs.RuntimeBehavior {\n _impassable: boolean;\n _cost: float;\n _oldX: float = 0;\n _oldY: float = 0;\n _oldWidth: float = 0;\n _oldHeight: float = 0;\n _manager: PathfindingObstaclesManager;\n _registeredInManager: boolean = false;\n currentRBushAABB: gdjs.BehaviorRBushAABB<PathfindingObstacleRuntimeBehavior> | null =\n null;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject\n ) {\n super(instanceContainer, behaviorData, owner);\n this._impassable = behaviorData.impassable;\n this._cost = behaviorData.cost;\n this._manager = PathfindingObstaclesManager.getManager(instanceContainer);\n\n //Note that we can't use getX(), getWidth()... of owner here:\n //The owner is not yet fully constructed.\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.impassable !== newBehaviorData.impassable) {\n this.setImpassable(newBehaviorData.impassable);\n }\n if (oldBehaviorData.cost !== newBehaviorData.cost) {\n this.setCost(newBehaviorData.cost);\n }\n return true;\n }\n\n onDestroy() {\n if (this._manager && this._registeredInManager) {\n this._manager.removeObstacle(this);\n }\n }\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n //Make sure the obstacle is or is not in the obstacles manager.\n if (!this.activated() && this._registeredInManager) {\n this._manager.removeObstacle(this);\n this._registeredInManager = false;\n } else {\n if (this.activated() && !this._registeredInManager) {\n this._manager.addObstacle(this);\n this._registeredInManager = true;\n }\n }\n\n //Track changes in size or position\n if (\n this._oldX !== this.owner.getX() ||\n this._oldY !== this.owner.getY() ||\n this._oldWidth !== this.owner.getWidth() ||\n this._oldHeight !== this.owner.getHeight()\n ) {\n if (this._registeredInManager) {\n this._manager.removeObstacle(this);\n this._manager.addObstacle(this);\n }\n this._oldX = this.owner.getX();\n this._oldY = this.owner.getY();\n this._oldWidth = this.owner.getWidth();\n this._oldHeight = this.owner.getHeight();\n }\n }\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n getAABB() {\n return this.owner.getAABB();\n }\n\n onActivate() {\n if (this._registeredInManager) {\n return;\n }\n this._manager.addObstacle(this);\n this._registeredInManager = true;\n }\n\n onDeActivate() {\n if (!this._registeredInManager) {\n return;\n }\n this._manager.removeObstacle(this);\n this._registeredInManager = false;\n }\n\n getCost() {\n return this._cost;\n }\n\n setCost(cost: float): void {\n this._cost = cost;\n }\n\n isImpassable(): boolean {\n return this._impassable;\n }\n\n setImpassable(impassable: boolean): void {\n this._impassable = impassable;\n }\n }\n gdjs.registerBehavior(\n 'PathfindingBehavior::PathfindingObstacleBehavior',\n gdjs.PathfindingObstacleRuntimeBehavior\n );\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAcS,OAAkC,CAGvC,YAAY,EAAkD,CAC5D,KAAK,gBAAkB,GAAI,aAMtB,YAAW,EAAkD,CAClE,MAAK,GAAkB,6BA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