gdcore-tools 2.0.0-gd-v5.5.224-autobuild → 2.0.0-gd-v5.5.226-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 +1 -1
- 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.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 +1 -1
- 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/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 +5 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../GDevelop/GDJS/Runtime/debugger-client/hot-reloader.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n const logger = new gdjs.Logger('Hot reloader');\n export type HotReloaderLog = {\n message: string;\n kind: 'fatal' | 'error' | 'warning' | 'info';\n };\n\n export type ChangedRuntimeBehavior = {\n oldBehaviorConstructor: Function;\n newBehaviorConstructor: Function;\n behaviorTypeName: string;\n };\n\n /**\n * Reload scripts/data of an exported game and applies the changes\n * to the running runtime game.\n */\n export class HotReloader {\n _runtimeGame: gdjs.RuntimeGame;\n _reloadedScriptElement: Record<string, HTMLScriptElement> = {};\n _logs: HotReloaderLog[] = [];\n _alreadyLoadedScriptFiles: Record<string, boolean> = {};\n\n /**\n * @param runtimeGame - The `gdjs.RuntimeGame` to be hot-reloaded.\n */\n constructor(runtimeGame: gdjs.RuntimeGame) {\n this._runtimeGame = runtimeGame;\n }\n\n static indexByPersistentUuid<\n ObjectWithPersistentId extends { persistentUuid: string | null }\n >(\n objectsWithPersistentId: ObjectWithPersistentId[]\n ): Map<string, ObjectWithPersistentId> {\n return objectsWithPersistentId.reduce(function (objectsMap, object) {\n if (object.persistentUuid) {\n objectsMap.set(object.persistentUuid, object);\n }\n return objectsMap;\n }, new Map<string, ObjectWithPersistentId>());\n }\n\n static indexByName<E extends { name: string | null }>(\n objectsWithName: E[]\n ): Map<string, E> {\n return objectsWithName.reduce(function (objectsMap, object) {\n if (object.name) {\n objectsMap.set(object.name, object);\n }\n return objectsMap;\n }, new Map<string, E>());\n }\n\n _canReloadScriptFile(srcFilename: string): boolean {\n function endsWith(str: string, suffix: string): boolean {\n const suffixPosition = str.indexOf(suffix);\n return (\n suffixPosition !== -1 && suffixPosition === str.length - suffix.length\n );\n }\n\n // Never reload .h script files, as they are leaking by mistake from C++ extensions.\n if (endsWith(srcFilename, '.h')) {\n return false;\n }\n\n // Make sure some files are loaded only once.\n if (this._alreadyLoadedScriptFiles[srcFilename]) {\n if (\n // Don't reload Box2d as it would confuse and crash the asm.js library.\n endsWith(srcFilename, 'box2d.js') ||\n // Don't reload sha256.js library.\n endsWith(srcFilename, 'sha256.js') ||\n // Don't reload shopify-buy library.\n endsWith(srcFilename, 'shopify-buy.umd.polyfilled.min.js') ||\n // Don't reload pixi-multistyle-text library.\n endsWith(srcFilename, 'pixi-multistyle-text.umd.js') ||\n // Don't reload pixi-tilemap library.\n endsWith(srcFilename, 'pixi-tilemap.umd.js') ||\n // Don't reload bondage.js library.\n endsWith(srcFilename, 'bondage.min.js') ||\n // Don't reload pixi-particles library.\n endsWith(srcFilename, 'pixi-particles-pixi-renderer.min.js') ||\n // Don't reload pixi-tilemap amd pixi-tilemap-helper libraries.\n endsWith(srcFilename, 'pixi-tilemap.umd.js') ||\n endsWith(srcFilename, 'pixi-tilemap-helper.js') ||\n // Don't reload pako library (used in pixi-tilemap)\n endsWith(srcFilename, 'pako/dist/pako.min')\n ) {\n return false;\n }\n }\n return true;\n }\n\n _reloadScript(srcFilename: string): Promise<void> {\n function endsWith(str: string, suffix: string): boolean {\n const suffixPosition = str.indexOf(suffix);\n return (\n suffixPosition !== -1 && suffixPosition === str.length - suffix.length\n );\n }\n if (!this._canReloadScriptFile(srcFilename)) {\n this._logs.push({\n kind: 'info',\n message:\n 'Not reloading ' +\n srcFilename +\n ' as it is blocked for hot-reloading.',\n });\n return Promise.resolve();\n }\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n return Promise.reject(\n new Error('No head element found, are you in a navigator?')\n );\n }\n return new Promise((resolve, reject) => {\n const existingScriptElement = this._reloadedScriptElement[srcFilename];\n if (existingScriptElement) {\n head.removeChild(existingScriptElement);\n } else {\n // Check if there is an existing scriptElement in head\n const headScriptElements = head.getElementsByTagName('script');\n for (let i = 0; i < headScriptElements.length; ++i) {\n const scriptElement = headScriptElements[i];\n if (endsWith(scriptElement.src, srcFilename)) {\n head.removeChild(scriptElement);\n }\n }\n }\n const reloadedScriptElement = document.createElement('script');\n reloadedScriptElement.src = srcFilename + '?timestamp=' + Date.now();\n reloadedScriptElement.onload = () => {\n resolve();\n };\n reloadedScriptElement.onerror = (event) => {\n reject(event);\n };\n head.appendChild(reloadedScriptElement);\n this._reloadedScriptElement[srcFilename] = reloadedScriptElement;\n });\n }\n\n hotReload(): Promise<HotReloaderLog[]> {\n logger.info('Hot reload started');\n this._runtimeGame.pause(true);\n this._logs = [];\n\n // Save old data of the project, to be used to compute\n // the difference between the old and new project data:\n\n const oldProjectData: ProjectData = gdjs.projectData;\n\n const oldScriptFiles = gdjs.runtimeGameOptions\n .scriptFiles as RuntimeGameOptionsScriptFile[];\n\n oldScriptFiles.forEach((scriptFile) => {\n this._alreadyLoadedScriptFiles[scriptFile.path] = true;\n });\n const oldBehaviorConstructors: { [key: string]: Function } = {};\n\n for (let behaviorTypeName in gdjs.behaviorsTypes.items) {\n oldBehaviorConstructors[behaviorTypeName] =\n gdjs.behaviorsTypes.items[behaviorTypeName];\n }\n\n // Reload projectData and runtimeGameOptions stored by convention in data.js:\n return this._reloadScript('data.js').then(() => {\n const newProjectData: ProjectData = gdjs.projectData;\n\n const newRuntimeGameOptions: RuntimeGameOptions =\n gdjs.runtimeGameOptions;\n\n const newScriptFiles = newRuntimeGameOptions.scriptFiles as RuntimeGameOptionsScriptFile[];\n const projectDataOnlyExport = !!newRuntimeGameOptions.projectDataOnlyExport;\n\n // Reload the changed scripts, which will have the side effects of re-running\n // the new scripts, potentially replacing the code of the free functions from\n // extensions (which is fine) and registering updated behaviors (which will\n // need to be re-instantiated in runtime objects).\n return this.reloadScriptFiles(\n newProjectData,\n oldScriptFiles,\n newScriptFiles,\n projectDataOnlyExport\n )\n .then(() => {\n const changedRuntimeBehaviors = this._computeChangedRuntimeBehaviors(\n oldBehaviorConstructors,\n gdjs.behaviorsTypes.items\n );\n return this._hotReloadRuntimeGame(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n this._runtimeGame\n );\n })\n .catch((error) => {\n const errorTarget = error.target;\n if (errorTarget instanceof HTMLScriptElement) {\n this._logs.push({\n kind: 'fatal',\n message: 'Unable to reload script: ' + errorTarget.src,\n });\n } else {\n this._logs.push({\n kind: 'fatal',\n message:\n 'Unexpected error happened while hot-reloading: ' +\n error.message,\n });\n }\n })\n .then(() => {\n logger.info(\n 'Hot reload finished with logs:',\n this._logs.map((log) => '\\n' + log.kind + ': ' + log.message)\n );\n this._runtimeGame.pause(false);\n return this._logs;\n });\n });\n }\n\n _computeChangedRuntimeBehaviors(\n oldBehaviorConstructors: Record<string, Function>,\n newBehaviorConstructors: Record<string, Function>\n ): ChangedRuntimeBehavior[] {\n const changedRuntimeBehaviors: ChangedRuntimeBehavior[] = [];\n for (let behaviorTypeName in oldBehaviorConstructors) {\n const oldBehaviorConstructor =\n oldBehaviorConstructors[behaviorTypeName];\n const newBehaviorConstructor =\n newBehaviorConstructors[behaviorTypeName];\n if (!newBehaviorConstructor) {\n this._logs.push({\n kind: 'warning',\n message:\n 'Behavior with type ' +\n behaviorTypeName +\n ' was removed from the registered behaviors in gdjs.',\n });\n } else {\n if (oldBehaviorConstructor !== newBehaviorConstructor) {\n this._logs.push({\n kind: 'info',\n message:\n 'Behavior with type ' +\n behaviorTypeName +\n ' was changed, and will be re-instantiated in gdjs.RuntimeObjects using it.',\n });\n changedRuntimeBehaviors.push({\n oldBehaviorConstructor,\n newBehaviorConstructor,\n behaviorTypeName,\n });\n }\n }\n }\n return changedRuntimeBehaviors;\n }\n\n reloadScriptFiles(\n newProjectData: ProjectData,\n oldScriptFiles: RuntimeGameOptionsScriptFile[],\n newScriptFiles: RuntimeGameOptionsScriptFile[],\n projectDataOnlyExport: boolean\n ): Promise<void[]> {\n const reloadPromises: Array<Promise<void>> = [];\n\n // Reload events, only if they were exported.\n if (!projectDataOnlyExport) {\n newProjectData.layouts.forEach((_layoutData, index) => {\n reloadPromises.push(this._reloadScript('code' + index + '.js'));\n });\n }\n for (let i = 0; i < newScriptFiles.length; ++i) {\n const newScriptFile = newScriptFiles[i];\n const oldScriptFile = oldScriptFiles.filter(\n (scriptFile) => scriptFile.path === newScriptFile.path\n )[0];\n if (!oldScriptFile) {\n // Script file added\n this._logs.push({\n kind: 'info',\n message:\n 'Loading ' +\n newScriptFile.path +\n ' as it was added to the list of scripts.',\n });\n reloadPromises.push(this._reloadScript(newScriptFile.path));\n } else {\n // Script file changed, which can be the case for extensions created\n // from the editor, containing free functions or behaviors.\n if (newScriptFile.hash !== oldScriptFile.hash) {\n this._logs.push({\n kind: 'info',\n message:\n 'Reloading ' + newScriptFile.path + ' because it was changed.',\n });\n reloadPromises.push(this._reloadScript(newScriptFile.path));\n }\n }\n }\n for (let i = 0; i < oldScriptFiles.length; ++i) {\n const oldScriptFile = oldScriptFiles[i];\n const newScriptFile = newScriptFiles.filter(\n (scriptFile) => scriptFile.path === oldScriptFile.path\n )[0];\n\n // A file may be removed because of a partial preview.\n if (!newScriptFile && !projectDataOnlyExport) {\n this._logs.push({\n kind: 'warning',\n message: 'Script file ' + oldScriptFile.path + ' was removed.',\n });\n }\n }\n return Promise.all(reloadPromises);\n }\n\n async _hotReloadRuntimeGame(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeGame: gdjs.RuntimeGame\n ): Promise<void> {\n const sceneStack = runtimeGame.getSceneStack();\n const currentScene = sceneStack.getCurrentScene();\n if (!currentScene) {\n // It can't actually happen.\n this._logs.push({\n kind: 'error',\n message: \"Can't hot-reload as no scene are opened.\",\n });\n return;\n }\n // Update project data and re-load assets (sound/image/font/json managers\n // will take care of reloading only what is needed).\n runtimeGame.setProjectData(newProjectData);\n await runtimeGame.loadFirstAssetsAndStartBackgroundLoading(\n currentScene.getName(),\n () => {}\n );\n this._hotReloadVariablesContainer(\n oldProjectData.variables,\n newProjectData.variables,\n runtimeGame.getVariables()\n );\n\n // Update extension's global variables.\n for (const newExtensionData of newProjectData.eventsFunctionsExtensions) {\n const oldExtensionData = oldProjectData.eventsFunctionsExtensions.find(\n (oldExtensionData) => oldExtensionData.name === newExtensionData.name\n );\n\n const oldGlobalVariables = oldExtensionData\n ? oldExtensionData.globalVariables\n : [];\n const newGlobalVariables = newExtensionData.globalVariables;\n\n if (oldGlobalVariables.length > 0 || newGlobalVariables.length > 0) {\n const currentVariables = runtimeGame.getVariablesForExtension(\n newExtensionData.name\n );\n if (currentVariables) {\n this._hotReloadVariablesContainer(\n oldGlobalVariables,\n newGlobalVariables,\n currentVariables\n );\n } else {\n runtimeGame._variablesByExtensionName.set(\n newExtensionData.name,\n new gdjs.VariablesContainer(newGlobalVariables)\n );\n }\n }\n }\n\n const oldlayoutDataMap = HotReloader.indexByName(oldProjectData.layouts);\n const newlayoutDataMap = HotReloader.indexByName(newProjectData.layouts);\n\n // Reload runtime scenes\n sceneStack._stack.forEach((runtimeScene) => {\n const oldLayoutData = oldlayoutDataMap.get(runtimeScene.getName());\n const newLayoutData = newlayoutDataMap.get(runtimeScene.getName());\n if (oldLayoutData && newLayoutData) {\n this._hotReloadRuntimeScene(\n oldProjectData,\n newProjectData,\n oldLayoutData,\n newLayoutData,\n changedRuntimeBehaviors,\n runtimeScene\n );\n\n // Update extension's scene variables.\n for (const newExtensionData of newProjectData.eventsFunctionsExtensions) {\n const oldExtensionData = oldProjectData.eventsFunctionsExtensions.find(\n (oldExtensionData) =>\n oldExtensionData.name === newExtensionData.name\n );\n\n const oldSceneVariables = oldExtensionData\n ? oldExtensionData.sceneVariables\n : [];\n const newSceneVariables = newExtensionData.sceneVariables;\n\n if (oldSceneVariables.length > 0 || newSceneVariables.length > 0) {\n const currentVariables = runtimeScene.getVariablesForExtension(\n newExtensionData.name\n );\n if (currentVariables) {\n this._hotReloadVariablesContainer(\n oldSceneVariables,\n newSceneVariables,\n currentVariables\n );\n } else {\n runtimeScene._variablesByExtensionName.set(\n newExtensionData.name,\n new gdjs.VariablesContainer(newSceneVariables)\n );\n }\n }\n }\n } else {\n // A scene was removed. Not hot-reloading this.\n this._logs.push({\n kind: 'error',\n message:\n 'Scene ' +\n (oldLayoutData && oldLayoutData.name) +\n ' was removed. A fresh preview should be launched.',\n });\n }\n });\n\n // Reload changes in external layouts\n newProjectData.externalLayouts.forEach((newExternalLayoutData) => {\n const oldExternalLayoutData = oldProjectData.externalLayouts.filter(\n (externalLayoutData) =>\n externalLayoutData.name === newExternalLayoutData.name\n )[0];\n if (\n oldExternalLayoutData &&\n // Check if there are actual changes, to avoid useless work trying to\n // hot-reload all the scenes.\n !HotReloader.deepEqual(oldExternalLayoutData, newExternalLayoutData)\n ) {\n const oldLayoutData = oldlayoutDataMap.get(\n oldExternalLayoutData.associatedLayout\n );\n const newLayoutData = newlayoutDataMap.get(\n newExternalLayoutData.associatedLayout\n );\n\n sceneStack._stack.forEach((runtimeScene) => {\n this._hotReloadRuntimeSceneInstances(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldLayoutData ? oldLayoutData.objects : [],\n newLayoutData ? newLayoutData.objects : [],\n oldExternalLayoutData.instances,\n newExternalLayoutData.instances,\n runtimeScene\n );\n });\n }\n });\n }\n\n _hotReloadVariablesContainer(\n oldVariablesData: RootVariableData[],\n newVariablesData: RootVariableData[],\n variablesContainer: gdjs.VariablesContainer\n ): void {\n newVariablesData.forEach((newVariableData) => {\n const variableName = newVariableData.name;\n const oldVariableData = oldVariablesData.find(\n (variable) => variable.name === variableName\n );\n const variable = variablesContainer.get(newVariableData.name);\n\n if (!oldVariableData) {\n // New variable\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n } else if (\n gdjs.Variable.isPrimitive(newVariableData.type || 'number') &&\n (oldVariableData.value !== newVariableData.value ||\n !gdjs.Variable.isPrimitive(oldVariableData.type || 'number'))\n ) {\n // Variable value was changed or was converted from\n // a structure to a variable with value.\n variablesContainer.remove(variableName);\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n } else if (\n !gdjs.Variable.isPrimitive(newVariableData.type || 'number')\n ) {\n // Variable is a structure or array (or was converted from a primitive\n // to one of those).\n if (newVariableData.type === 'structure')\n this._hotReloadStructureVariable(\n //@ts-ignore If the type is structure, it is assured that the children have a name\n oldVariableData.children,\n newVariableData.children,\n variable\n );\n else {\n // Arrays cannot be hot reloaded.\n // As indices can change at runtime, and in the IDE, they can be desynchronized.\n // It will in that case mess up the whole array,\n // and there is no way to know if that was the case.\n //\n // We therefore just replace the old array with the new one.\n variablesContainer.remove(variableName);\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n }\n }\n });\n oldVariablesData.forEach((oldVariableData) => {\n const newVariableData = newVariablesData.find(\n (variable) => variable.name === oldVariableData.name\n );\n\n if (!newVariableData) {\n // Variable was removed\n variablesContainer.remove(oldVariableData.name);\n }\n });\n variablesContainer.rebuildIndexFrom(newVariablesData);\n }\n\n _hotReloadStructureVariable(\n oldChildren: RootVariableData[],\n newChildren: RootVariableData[],\n variable: gdjs.Variable\n ): void {\n if (oldChildren) {\n oldChildren.forEach((oldChildVariableData) => {\n const newChildVariableData = newChildren.find(\n (childVariableData) =>\n childVariableData.name === oldChildVariableData.name\n );\n\n if (!newChildVariableData) {\n // Child variable was removed.\n variable.removeChild(oldChildVariableData.name);\n } else if (\n gdjs.Variable.isPrimitive(newChildVariableData.type || 'number') &&\n (oldChildVariableData.value !== newChildVariableData.value ||\n !gdjs.Variable.isPrimitive(oldChildVariableData.type || 'number'))\n ) {\n // The child variable value was changed or was converted from\n // structure to a variable with value.\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n } else if (\n !gdjs.Variable.isPrimitive(newChildVariableData.type || 'number')\n ) {\n // Variable is a structure or array (or was converted from a primitive\n // to one of those).\n if (newChildVariableData.type === 'structure')\n this._hotReloadStructureVariable(\n //@ts-ignore If the type is structure, it is assured that the children have a name\n oldChildVariableData.children,\n newChildVariableData.children as Required<VariableData>[],\n variable.getChild(newChildVariableData.name)\n );\n else {\n // Arrays cannot be hot reloaded.\n // As indices can change at runtime, and in the IDE, they can be desynchronized.\n // It will in that case mess up the whole array,\n // and there is no way to know if that was the case.\n //\n // We therefore just replace the old array with the new one.\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n }\n }\n });\n newChildren.forEach((newChildVariableData) => {\n const oldChildVariableData = oldChildren.find(\n (childVariableData) =>\n childVariableData.name === newChildVariableData.name\n );\n\n if (!oldChildVariableData) {\n // Child variable was added\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n }\n });\n } else {\n // Variable was converted from a value to a structure:\n newChildren.forEach((newChildVariableData) => {\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n });\n }\n }\n\n _hotReloadRuntimeScene(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n oldLayoutData: LayoutData,\n newLayoutData: LayoutData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeScene: gdjs.RuntimeScene\n ): void {\n runtimeScene.setBackgroundColor(\n newLayoutData.r,\n newLayoutData.v,\n newLayoutData.b\n );\n if (oldLayoutData.title !== newLayoutData.title) {\n runtimeScene\n .getGame()\n .getRenderer()\n .setWindowTitle(newLayoutData.title);\n }\n this._hotReloadVariablesContainer(\n oldLayoutData.variables as Required<VariableData>[],\n newLayoutData.variables as Required<VariableData>[],\n runtimeScene.getVariables()\n );\n this._hotReloadRuntimeSceneBehaviorsSharedData(\n oldLayoutData.behaviorsSharedData,\n newLayoutData.behaviorsSharedData,\n runtimeScene\n );\n\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldLayoutData,\n newLayoutData,\n changedRuntimeBehaviors,\n runtimeScene\n );\n\n // Update the events generated code launched at each frame. Events generated code\n // script files were already reloaded at the beginning of the hot-reload. Note that\n // if they have not changed, it's still fine to call this, it will be basically a\n // no-op.\n runtimeScene.setEventsGeneratedCodeFunction(newLayoutData);\n }\n\n static resolveCustomObjectConfigurations(\n projectData: ProjectData,\n objectDatas: ObjectData[]\n ): ObjectData[] {\n return objectDatas.map((objectData) => {\n const [extensionName, eventsBasedObjectName] = objectData.type.split(\n '::'\n );\n\n const extensionData = projectData.eventsFunctionsExtensions.find(\n (extension) => extension.name === extensionName\n );\n if (!extensionData) {\n return objectData;\n }\n\n const eventsBasedObjectData =\n extensionData &&\n extensionData.eventsBasedObjects.find(\n (object) => object.name === eventsBasedObjectName\n );\n if (!eventsBasedObjectData) {\n return objectData;\n }\n\n const customObjectConfiguration = objectData as ObjectData &\n CustomObjectConfiguration;\n\n const mergedChildObjectDataList = customObjectConfiguration.childrenContent\n ? eventsBasedObjectData.objects.map((objectData) => ({\n ...objectData,\n ...customObjectConfiguration.childrenContent[objectData.name],\n }))\n : eventsBasedObjectData.objects;\n\n const mergedObjectConfiguration = {\n ...eventsBasedObjectData,\n ...objectData,\n // ObjectData doesn't have an `objects` attribute.\n // This is a small optimization to avoid to create an\n // InstanceContainerData for each instance to hot-reload their inner\n // scene (see `_hotReloadRuntimeInstanceContainer` call from\n // `_hotReloadRuntimeSceneInstances`).\n objects: mergedChildObjectDataList,\n childrenContent: mergedChildObjectDataList,\n };\n return mergedObjectConfiguration;\n });\n }\n\n _hotReloadRuntimeInstanceContainer(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n oldLayoutData: InstanceContainerData,\n newLayoutData: InstanceContainerData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const oldObjectDataList = HotReloader.resolveCustomObjectConfigurations(\n oldProjectData,\n oldLayoutData.objects\n );\n const newObjectDataList = HotReloader.resolveCustomObjectConfigurations(\n newProjectData,\n newLayoutData.objects\n );\n\n // Re-instantiate any gdjs.RuntimeBehavior that was changed.\n this._reinstantiateRuntimeSceneRuntimeBehaviors(\n changedRuntimeBehaviors,\n newObjectDataList,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneObjects(\n oldObjectDataList,\n newObjectDataList,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneInstances(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldObjectDataList,\n newObjectDataList,\n oldLayoutData.instances,\n newLayoutData.instances,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneLayers(\n oldLayoutData.layers,\n newLayoutData.layers,\n runtimeInstanceContainer\n );\n }\n\n _hotReloadRuntimeSceneBehaviorsSharedData(\n oldBehaviorsSharedData: BehaviorSharedData[],\n newBehaviorsSharedData: BehaviorSharedData[],\n runtimeScene: gdjs.RuntimeScene\n ): void {\n oldBehaviorsSharedData.forEach((oldBehaviorSharedData) => {\n const name = oldBehaviorSharedData.name;\n const newBehaviorSharedData = newBehaviorsSharedData.filter(\n (behaviorSharedData) => behaviorSharedData.name === name\n )[0];\n if (!newBehaviorSharedData) {\n // Behavior shared data was removed.\n runtimeScene.setInitialSharedDataForBehavior(\n oldBehaviorSharedData.name,\n null\n );\n } else {\n if (\n !HotReloader.deepEqual(oldBehaviorSharedData, newBehaviorSharedData)\n ) {\n // Behavior shared data was modified\n runtimeScene.setInitialSharedDataForBehavior(\n newBehaviorSharedData.name,\n newBehaviorSharedData\n );\n }\n }\n });\n newBehaviorsSharedData.forEach((newBehaviorSharedData) => {\n const name = newBehaviorSharedData.name;\n const oldBehaviorSharedData = oldBehaviorsSharedData.filter(\n (behaviorSharedData) => behaviorSharedData.name === name\n )[0];\n if (!oldBehaviorSharedData) {\n // Behavior shared data was added\n runtimeScene.setInitialSharedDataForBehavior(\n newBehaviorSharedData.name,\n newBehaviorSharedData\n );\n }\n });\n }\n\n _reinstantiateRuntimeSceneRuntimeBehaviors(\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n newObjects: ObjectData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n newObjects.forEach((newObjectData) => {\n const objectName = newObjectData.name;\n const newBehaviors = newObjectData.behaviors;\n const runtimeObjects = runtimeInstanceContainer.getObjects(objectName)!;\n changedRuntimeBehaviors.forEach((changedRuntimeBehavior) => {\n const behaviorTypeName = changedRuntimeBehavior.behaviorTypeName;\n\n // If the changed behavior is used by the object, re-instantiate\n // it.\n newBehaviors\n .filter((behaviorData) => behaviorData.type === behaviorTypeName)\n .forEach((changedBehaviorNewData) => {\n const name = changedBehaviorNewData.name;\n this._logs.push({\n kind: 'info',\n message:\n 'Re-instantiating behavior named \"' +\n name +\n '\" for instances of object \"' +\n objectName +\n '\".',\n });\n runtimeObjects.forEach((runtimeObject) => {\n this._reinstantiateRuntimeObjectRuntimeBehavior(\n changedBehaviorNewData,\n runtimeObject\n );\n });\n });\n });\n });\n }\n\n _reinstantiateRuntimeObjectRuntimeBehavior(\n behaviorData: BehaviorData,\n runtimeObject: gdjs.RuntimeObject\n ): void {\n const behaviorName = behaviorData.name;\n const oldRuntimeBehavior = runtimeObject.getBehavior(behaviorName);\n if (!oldRuntimeBehavior) {\n return;\n }\n\n // Remove and re-add the behavior so that it's using the newly\n // registered gdjs.RuntimeBehavior.\n runtimeObject.removeBehavior(behaviorName);\n runtimeObject.addNewBehavior(behaviorData);\n const newRuntimeBehavior = runtimeObject.getBehavior(behaviorName);\n if (!newRuntimeBehavior) {\n this._logs.push({\n kind: 'error',\n message:\n 'Could not create behavior ' +\n behaviorName +\n ' (type: ' +\n behaviorData.type +\n ') for object ' +\n runtimeObject.getName(),\n });\n return;\n }\n\n // Copy the properties from the old behavior to the new one.\n for (let behaviorProperty in oldRuntimeBehavior) {\n if (!oldRuntimeBehavior.hasOwnProperty(behaviorProperty)) {\n continue;\n }\n if (behaviorProperty === '_behaviorData') {\n // For property \"_behaviorData\" that we know to be an object,\n // do a copy of each property of\n // this object so that we keep the new ones (useful if a new property was added).\n newRuntimeBehavior[behaviorProperty] =\n newRuntimeBehavior[behaviorProperty] || {};\n for (let property in oldRuntimeBehavior[behaviorProperty]) {\n newRuntimeBehavior[behaviorProperty][property] =\n oldRuntimeBehavior[behaviorProperty][property];\n }\n } else {\n newRuntimeBehavior[behaviorProperty] =\n oldRuntimeBehavior[behaviorProperty];\n }\n }\n return;\n }\n\n _hotReloadRuntimeSceneObjects(\n oldObjects: ObjectData[],\n newObjects: ObjectData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n oldObjects.forEach((oldObjectData) => {\n const name = oldObjectData.name;\n const newObjectData = newObjects.filter(\n (objectData) => objectData.name === name\n )[0];\n\n // Note: if an object is renamed in the editor, it will be considered as removed,\n // and the new object name as a new object to register.\n // It's not ideal because living instances of the object will be destroyed,\n // but it would be complex to iterate over instances of the object and change\n // its name (it's not expected to change).\n if (!newObjectData || oldObjectData.type !== newObjectData.type) {\n // Object was removed or object type was changed (considered as a removal of the old object)\n runtimeInstanceContainer.unregisterObject(name);\n } else {\n if (runtimeInstanceContainer.isObjectRegistered(name)) {\n this._hotReloadRuntimeSceneObject(\n oldObjectData,\n newObjectData,\n runtimeInstanceContainer\n );\n }\n }\n });\n newObjects.forEach((newObjectData) => {\n const name = newObjectData.name;\n const oldObjectData = oldObjects.filter(\n (layerData) => layerData.name === name\n )[0];\n if (\n (!oldObjectData || oldObjectData.type !== newObjectData.type) &&\n !runtimeInstanceContainer.isObjectRegistered(name)\n ) {\n // Object was added or object type was changed (considered as adding the new object)\n runtimeInstanceContainer.registerObject(newObjectData);\n }\n });\n }\n\n _hotReloadRuntimeSceneObject(\n oldObjectData: ObjectData,\n newObjectData: ObjectData,\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n let hotReloadSucceeded = true;\n if (!HotReloader.deepEqual(oldObjectData, newObjectData)) {\n this._logs.push({\n kind: 'info',\n message:\n 'Object \"' +\n newObjectData.name +\n '\" was modified and is hot-reloaded.',\n });\n\n // Register the updated object data, used for new instances.\n runtimeInstanceContainer.updateObject(newObjectData);\n\n // Update existing instances\n const runtimeObjects = runtimeInstanceContainer.getObjects(\n newObjectData.name\n )!;\n\n // Update instances state\n runtimeObjects.forEach((runtimeObject) => {\n // Update the runtime object\n hotReloadSucceeded =\n runtimeObject.updateFromObjectData(oldObjectData, newObjectData) &&\n hotReloadSucceeded;\n });\n\n // Don't update behaviors and effects for each runtime object to avoid\n // doing the check for differences for every single object.\n\n // Update behaviors\n this._hotReloadRuntimeObjectsBehaviors(\n oldObjectData.behaviors,\n newObjectData.behaviors,\n runtimeObjects\n );\n\n // Update effects\n this._hotReloadRuntimeObjectsEffects(\n oldObjectData.effects,\n newObjectData.effects,\n runtimeObjects\n );\n }\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n 'Object \"' +\n newObjectData.name +\n '\" could not be hot-reloaded. A fresh preview should be run.',\n });\n }\n }\n\n _hotReloadRuntimeObjectsBehaviors(\n oldBehaviors: BehaviorData[],\n newBehaviors: BehaviorData[],\n runtimeObjects: gdjs.RuntimeObject[]\n ): void {\n oldBehaviors.forEach((oldBehaviorData) => {\n const name = oldBehaviorData.name;\n const newBehaviorData = newBehaviors.filter(\n (behaviorData) => behaviorData.name === name\n )[0];\n if (!newBehaviorData) {\n // Behavior was removed\n runtimeObjects.forEach((runtimeObject) => {\n if (runtimeObject.hasBehavior(name)) {\n if (!runtimeObject.removeBehavior(name)) {\n this._logs.push({\n kind: 'error',\n message:\n 'Behavior ' +\n name +\n ' could not be removed from object' +\n runtimeObject.getName(),\n });\n }\n }\n });\n } else {\n if (!HotReloader.deepEqual(oldBehaviorData, newBehaviorData)) {\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n const runtimeBehavior = runtimeObject.getBehavior(\n newBehaviorData.name\n );\n if (runtimeBehavior) {\n hotReloadSucceeded =\n this._hotReloadRuntimeBehavior(\n oldBehaviorData,\n newBehaviorData,\n runtimeBehavior\n ) && hotReloadSucceeded;\n }\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newBehaviorData.name + ' behavior could not be hot-reloaded.',\n });\n }\n }\n }\n });\n newBehaviors.forEach((newBehaviorData) => {\n const name = newBehaviorData.name;\n const oldBehaviorData = oldBehaviors.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldBehaviorData) {\n // Behavior was added\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n hotReloadSucceeded =\n runtimeObject.addNewBehavior(newBehaviorData) &&\n hotReloadSucceeded;\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newBehaviorData.name +\n ' behavior could not be added during hot-reload.',\n });\n }\n }\n });\n }\n\n _hotReloadRuntimeObjectsEffects(\n oldEffects: EffectData[],\n newEffects: EffectData[],\n runtimeObjects: RuntimeObject[]\n ): void {\n oldEffects.forEach((oldEffectData) => {\n const name = oldEffectData.name;\n const newEffectData = newEffects.filter(\n (effectData) => effectData.name === name\n )[0];\n if (!newEffectData) {\n // Effect was removed.\n runtimeObjects.forEach((runtimeObject) => {\n if (runtimeObject.hasEffect(name)) {\n if (!runtimeObject.removeEffect(name)) {\n this._logs.push({\n kind: 'error',\n message:\n 'Effect ' +\n name +\n ' could not be removed from object' +\n runtimeObject.getName(),\n });\n }\n }\n });\n } else {\n if (!HotReloader.deepEqual(oldEffectData, newEffectData)) {\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n if (oldEffectData.effectType === newEffectData.effectType) {\n hotReloadSucceeded =\n runtimeObject.updateAllEffectParameters(newEffectData) &&\n hotReloadSucceeded;\n } else {\n // Another effect type was applied\n runtimeObject.removeEffect(oldEffectData.name);\n runtimeObject.addEffect(newEffectData);\n }\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newEffectData.name + ' effect could not be hot-reloaded.',\n });\n }\n }\n }\n });\n newEffects.forEach((newEffectData) => {\n const name = newEffectData.name;\n const oldEffectData = oldEffects.filter(\n (oldEffectData) => oldEffectData.name === name\n )[0];\n if (!oldEffectData) {\n // Effect was added\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n hotReloadSucceeded =\n runtimeObject.addEffect(newEffectData) && hotReloadSucceeded;\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newEffectData.name +\n ' effect could not be added during hot-reload.',\n });\n }\n }\n });\n }\n\n /**\n * @returns true if hot-reload succeeded, false otherwise.\n */\n _hotReloadRuntimeBehavior(\n oldBehaviorData: BehaviorData,\n newBehaviorData: BehaviorData,\n runtimeBehavior: gdjs.RuntimeBehavior\n ): boolean {\n // Don't check here for deep equality between oldBehaviorData and newBehaviorData.\n // This would be too costly to do for each runtime object.\n // It's supposed to be done once by the caller.\n return runtimeBehavior.updateFromBehaviorData(\n oldBehaviorData,\n newBehaviorData\n );\n }\n\n _hotReloadRuntimeSceneLayers(\n oldLayers: LayerData[],\n newLayers: LayerData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n oldLayers.forEach((oldLayerData) => {\n const name = oldLayerData.name;\n const newLayerData = newLayers.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!newLayerData) {\n // Layer was removed\n runtimeInstanceContainer.removeLayer(name);\n } else {\n if (runtimeInstanceContainer.hasLayer(name)) {\n const layer = runtimeInstanceContainer.getLayer(name);\n this._hotReloadRuntimeLayer(oldLayerData, newLayerData, layer);\n }\n }\n });\n newLayers.forEach((newLayerData) => {\n const name = newLayerData.name;\n const oldLayerData = oldLayers.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldLayerData && !runtimeInstanceContainer.hasLayer(name)) {\n // Layer was added\n runtimeInstanceContainer.addLayer(newLayerData);\n }\n });\n newLayers.forEach((newLayerData, index) => {\n runtimeInstanceContainer.setLayerIndex(newLayerData.name, index);\n });\n }\n\n _hotReloadRuntimeLayer(\n oldLayer: LayerData,\n newLayer: LayerData,\n runtimeLayer: gdjs.RuntimeLayer\n ): void {\n // Properties\n if (oldLayer.visibility !== newLayer.visibility) {\n runtimeLayer.show(newLayer.visibility);\n }\n if (newLayer.isLightingLayer) {\n if (\n oldLayer.ambientLightColorR !== newLayer.ambientLightColorR ||\n oldLayer.ambientLightColorG !== newLayer.ambientLightColorG ||\n oldLayer.ambientLightColorB !== newLayer.ambientLightColorB\n ) {\n runtimeLayer.setClearColor(\n newLayer.ambientLightColorR,\n newLayer.ambientLightColorG,\n newLayer.ambientLightColorB\n );\n }\n if (oldLayer.followBaseLayerCamera !== newLayer.followBaseLayerCamera) {\n runtimeLayer.setFollowBaseLayerCamera(newLayer.followBaseLayerCamera);\n }\n }\n\n // Rendering type can't be easily changed at runtime.\n if (oldLayer.renderingType !== newLayer.renderingType) {\n this._logs.push({\n kind: 'error',\n message: `Could not change the rendering type (2D, 3D...) layer at runtime (for layer \"${newLayer.name}\").`,\n });\n }\n if (newLayer.isLightingLayer !== oldLayer.isLightingLayer) {\n this._logs.push({\n kind: 'error',\n message: `Could not add/remove a lighting layer at runtime (for layer \"${newLayer.name}\").`,\n });\n }\n\n // Effects\n this._hotReloadRuntimeLayerEffects(\n oldLayer.effects,\n newLayer.effects,\n runtimeLayer\n );\n }\n\n _hotReloadRuntimeLayerEffects(\n oldEffectsData: EffectData[],\n newEffectsData: EffectData[],\n runtimeLayer: gdjs.RuntimeLayer\n ): void {\n oldEffectsData.forEach((oldEffectData) => {\n const name = oldEffectData.name;\n const newEffectData = newEffectsData.filter(\n (effectData) => effectData.name === name\n )[0];\n if (!newEffectData) {\n // Effect was removed\n runtimeLayer.removeEffect(name);\n } else {\n if (runtimeLayer.hasEffect(name)) {\n if (oldEffectData.effectType !== newEffectData.effectType) {\n // Effect changed type, consider it was removed and added back.\n runtimeLayer.removeEffect(name);\n runtimeLayer.addEffect(newEffectData);\n } else {\n this._hotReloadRuntimeLayerEffect(\n oldEffectData,\n newEffectData,\n runtimeLayer,\n name\n );\n }\n }\n }\n });\n newEffectsData.forEach((newEffectData) => {\n const name = newEffectData.name;\n const oldEffectData = oldEffectsData.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldEffectData && !runtimeLayer.hasEffect(name)) {\n // Effect was added\n runtimeLayer.addEffect(newEffectData);\n }\n });\n }\n\n _hotReloadRuntimeLayerEffect(\n oldEffectData: EffectData,\n newEffectData: EffectData,\n runtimeLayer: gdjs.RuntimeLayer,\n effectName: string\n ): void {\n // We consider oldEffectData.effectType and newEffectData.effectType\n // are the same - it's responsibility of the caller to verify this.\n for (let parameterName in newEffectData.booleanParameters) {\n const value = newEffectData.booleanParameters[parameterName];\n if (value !== oldEffectData.booleanParameters[parameterName]) {\n runtimeLayer.setEffectBooleanParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n for (let parameterName in newEffectData.doubleParameters) {\n const value = newEffectData.doubleParameters[parameterName];\n if (value !== oldEffectData.doubleParameters[parameterName]) {\n runtimeLayer.setEffectDoubleParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n for (let parameterName in newEffectData.stringParameters) {\n const value = newEffectData.stringParameters[parameterName];\n if (value !== oldEffectData.stringParameters[parameterName]) {\n runtimeLayer.setEffectStringParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n }\n\n _hotReloadRuntimeSceneInstances(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n oldObjects: ObjectData[],\n newObjects: ObjectData[],\n oldInstances: InstanceData[],\n newInstances: InstanceData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const runtimeObjects = runtimeInstanceContainer.getAdhocListOfAllInstances();\n const oldInstanceByUuid = HotReloader.indexByPersistentUuid(oldInstances);\n const newInstanceByUuid = HotReloader.indexByPersistentUuid(newInstances);\n const runtimeObjectByUuid = HotReloader.indexByPersistentUuid(\n runtimeObjects\n );\n\n const oldObjectsMap = HotReloader.indexByName(oldObjects);\n const newObjectsMap = HotReloader.indexByName(newObjects);\n\n for (const persistentUuid of oldInstanceByUuid.keys()) {\n const oldInstance = oldInstanceByUuid.get(persistentUuid);\n const newInstance = newInstanceByUuid.get(persistentUuid);\n const runtimeObject = runtimeObjectByUuid.get(persistentUuid);\n\n if (\n oldInstance &&\n (!newInstance || oldInstance.name !== newInstance.name)\n ) {\n // Instance was deleted (or object name changed, in which case it will be re-created later)\n if (runtimeObject) {\n runtimeObject.deleteFromScene(runtimeInstanceContainer);\n }\n } else {\n }\n }\n\n for (const runtimeObject of runtimeObjects) {\n const oldObjectData = oldObjectsMap.get(runtimeObject.getName());\n const newObjectData = newObjectsMap.get(runtimeObject.getName());\n if (!runtimeObject || !oldObjectData || !newObjectData) {\n // New objects or deleted objects can't have instances to hot-reload.\n continue;\n }\n const oldInstance = oldInstanceByUuid.get(\n // @ts-ignore Private attribute\n runtimeObject.persistentUuid\n );\n const newInstance = newInstanceByUuid.get(\n // @ts-ignore Private attribute\n runtimeObject.persistentUuid\n );\n if (oldInstance && newInstance) {\n // Instance was not deleted nor created, maybe modified (or not):\n this._hotReloadRuntimeInstance(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldObjectData,\n newObjectData,\n oldInstance,\n newInstance,\n runtimeObject\n );\n } else {\n // Reload objects that were created at runtime.\n\n // Update variables\n this._hotReloadVariablesContainer(\n oldObjectData.variables,\n newObjectData.variables,\n runtimeObject.getVariables()\n );\n\n if (runtimeObject instanceof gdjs.CustomRuntimeObject) {\n const childrenInstanceContainer = runtimeObject.getChildrenContainer();\n\n // The `objects` attribute is already resolved by `resolveCustomObjectConfigurations()`.\n const oldCustomObjectData = oldObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n const newCustomObjectData = newObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n\n // Reload the content of custom objects that were created at runtime.\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldCustomObjectData,\n newCustomObjectData,\n changedRuntimeBehaviors,\n childrenInstanceContainer\n );\n }\n }\n }\n\n for (const persistentUuid of newInstanceByUuid.keys()) {\n const oldInstance = oldInstanceByUuid.get(persistentUuid);\n const newInstance = newInstanceByUuid.get(persistentUuid);\n const runtimeObject = runtimeObjectByUuid.get(persistentUuid);\n if (\n newInstance &&\n (!oldInstance || oldInstance.name !== newInstance.name) &&\n !runtimeObject\n ) {\n // Instance was created (or object name changed, in which case it was destroyed previously)\n // and we verified that runtimeObject does not exist.\n runtimeInstanceContainer.createObjectsFrom(\n [newInstance],\n 0,\n 0,\n 0,\n /*trackByPersistentUuid=*/\n true\n );\n }\n }\n }\n\n _hotReloadRuntimeInstance(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n oldObjectData: ObjectData,\n newObjectData: ObjectData,\n oldInstance: InstanceData,\n newInstance: InstanceData,\n runtimeObject: gdjs.RuntimeObject\n ): void {\n let somethingChanged = false;\n\n // Check if default properties changed\n if (oldInstance.x !== newInstance.x) {\n runtimeObject.setX(newInstance.x);\n somethingChanged = true;\n }\n if (oldInstance.y !== newInstance.y) {\n runtimeObject.setY(newInstance.y);\n somethingChanged = true;\n }\n if (oldInstance.angle !== newInstance.angle) {\n runtimeObject.setAngle(newInstance.angle);\n somethingChanged = true;\n }\n if (oldInstance.zOrder !== newInstance.zOrder) {\n runtimeObject.setZOrder(newInstance.zOrder);\n somethingChanged = true;\n }\n if (oldInstance.layer !== newInstance.layer) {\n runtimeObject.setLayer(newInstance.layer);\n somethingChanged = true;\n }\n if (gdjs.Base3DHandler && gdjs.Base3DHandler.is3D(runtimeObject)) {\n if (oldInstance.z !== newInstance.z && newInstance.z !== undefined) {\n runtimeObject.setZ(newInstance.z);\n somethingChanged = true;\n }\n if (\n oldInstance.rotationX !== newInstance.rotationX &&\n newInstance.rotationX !== undefined\n ) {\n runtimeObject.setRotationX(newInstance.rotationX);\n somethingChanged = true;\n }\n if (\n oldInstance.rotationY !== newInstance.rotationY &&\n newInstance.rotationY !== undefined\n ) {\n runtimeObject.setRotationY(newInstance.rotationY);\n somethingChanged = true;\n }\n }\n\n // Check if size changed\n let sizeChanged = false;\n if (newInstance.customSize) {\n if (!oldInstance.customSize) {\n // A custom size was set\n runtimeObject.setWidth(newInstance.width);\n runtimeObject.setHeight(newInstance.height);\n somethingChanged = true;\n sizeChanged = true;\n } else {\n // The custom size was changed\n if (oldInstance.width !== newInstance.width) {\n runtimeObject.setWidth(newInstance.width);\n somethingChanged = true;\n sizeChanged = true;\n }\n if (oldInstance.height !== newInstance.height) {\n runtimeObject.setHeight(newInstance.height);\n somethingChanged = true;\n sizeChanged = true;\n }\n }\n } else {\n if (!newInstance.customSize && oldInstance.customSize) {\n // The custom size was removed. Just flag the size as changed\n // and hope the object will handle this in\n // `extraInitializationFromInitialInstance`.\n sizeChanged = true;\n }\n }\n if (gdjs.Base3DHandler && gdjs.Base3DHandler.is3D(runtimeObject)) {\n // A custom depth was set or changed\n if (\n oldInstance.depth !== newInstance.depth &&\n newInstance.depth !== undefined\n ) {\n runtimeObject.setDepth(newInstance.depth);\n somethingChanged = true;\n sizeChanged = true;\n } else if (\n newInstance.depth === undefined &&\n oldInstance.depth !== undefined\n ) {\n // The custom depth was removed. Just flag the depth as changed\n // and hope the object will handle this in\n // `extraInitializationFromInitialInstance`.\n sizeChanged = true;\n }\n }\n if (runtimeObject instanceof gdjs.CustomRuntimeObject) {\n const childrenInstanceContainer = runtimeObject.getChildrenContainer();\n\n // The `objects` attribute is already resolved by `resolveCustomObjectConfigurations()`.\n const oldCustomObjectData = oldObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n const newCustomObjectData = newObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldCustomObjectData,\n newCustomObjectData,\n changedRuntimeBehaviors,\n childrenInstanceContainer\n );\n }\n\n // Update variables\n this._hotReloadVariablesContainer(\n this._mergeObjectVariablesData(\n oldObjectData.variables,\n oldInstance.initialVariables\n ),\n this._mergeObjectVariablesData(\n newObjectData.variables,\n newInstance.initialVariables\n ),\n runtimeObject.getVariables()\n );\n\n // Check if custom properties changed (specific to each object type)\n const numberPropertiesChanged = newInstance.numberProperties.some(\n (numberProperty) => {\n const name = numberProperty.name;\n const value = numberProperty.value;\n const oldNumberProperty = oldInstance.numberProperties.filter(\n (numberProperty) => numberProperty.name === name\n )[0];\n return !oldNumberProperty || oldNumberProperty.value !== value;\n }\n );\n const stringPropertiesChanged = newInstance.stringProperties.some(\n (stringProperty) => {\n const name = stringProperty.name;\n const value = stringProperty.value;\n const oldStringProperty = oldInstance.stringProperties.filter(\n (stringProperty) => stringProperty.name === name\n )[0];\n return !oldStringProperty || oldStringProperty.value !== value;\n }\n );\n if (numberPropertiesChanged || stringPropertiesChanged || sizeChanged) {\n runtimeObject.extraInitializationFromInitialInstance(newInstance);\n somethingChanged = true;\n }\n if (somethingChanged) {\n // If we changed the runtime object position/size/angle or another property,\n // notify behaviors that the runtime object was reloaded.\n // This is useful for behaviors like the physics engine that are watching the\n // object position/size and need to be notified when changed (otherwise, they\n // would continue using the previous position, so the object would not be moved\n // or updated according to the changes made in the project instance).\n runtimeObject.notifyBehaviorsObjectHotReloaded();\n }\n }\n\n _mergeObjectVariablesData(\n objectVariablesData: RootVariableData[],\n instanceVariablesData: RootVariableData[]\n ): RootVariableData[] {\n if (instanceVariablesData.length === 0) {\n return objectVariablesData;\n }\n const variablesData = [...objectVariablesData];\n for (const instanceVariableData of instanceVariablesData) {\n const index = variablesData.indexOf(\n (variableData) => variableData.name === instanceVariableData.name\n );\n if (index >= 0) {\n variablesData[index] = instanceVariableData;\n }\n }\n return variablesData;\n }\n\n /**\n * Deep check equality between the two objects/arrays/primitives.\n *\n * Inspired from https://github.com/epoberezkin/fast-deep-equal\n * @param a The first object/array/primitive to compare\n * @param b The second object/array/primitive to compare\n */\n static deepEqual(a: any, b: any): boolean {\n if (a === b) {\n return true;\n }\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) {\n return false;\n }\n let length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) {\n return false;\n }\n for (i = length; i-- !== 0; ) {\n if (!HotReloader.deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (a.valueOf !== Object.prototype.valueOf) {\n return a.valueOf() === b.valueOf();\n }\n if (a.toString !== Object.prototype.toString) {\n return a.toString() === b.toString();\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0; ) {\n const key = keys[i];\n if (!HotReloader.deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,gBAgBxB,OAAkB,CASvB,YAAY,EAA+B,CAP3C,4BAA4D,GAC5D,WAA0B,GAC1B,+BAAqD,GAMnD,KAAK,aAAe,QAGf,uBAGL,EACqC,CACrC,MAAO,GAAwB,OAAO,SAAU,EAAY,EAAQ,CAClE,MAAI,GAAO,gBACT,EAAW,IAAI,EAAO,eAAgB,GAEjC,GACN,GAAI,YAGF,aACL,EACgB,CAChB,MAAO,GAAgB,OAAO,SAAU,EAAY,EAAQ,CAC1D,MAAI,GAAO,MACT,EAAW,IAAI,EAAO,KAAM,GAEvB,GACN,GAAI,MAGT,qBAAqB,EAA8B,CACjD,WAAkB,EAAa,EAAyB,CACtD,KAAM,GAAiB,EAAI,QAAQ,GACnC,MACE,KAAmB,IAAM,IAAmB,EAAI,OAAS,EAAO,OAUpE,MALI,IAAS,EAAa,OAKtB,KAAK,0BAA0B,IAG/B,GAAS,EAAa,aAEtB,EAAS,EAAa,cAEtB,EAAS,EAAa,sCAEtB,EAAS,EAAa,gCAEtB,EAAS,EAAa,wBAEtB,EAAS,EAAa,mBAEtB,EAAS,EAAa,wCAEtB,EAAS,EAAa,wBACtB,EAAS,EAAa,2BAEtB,EAAS,EAAa,wBAQ5B,cAAc,EAAoC,CAChD,WAAkB,EAAa,EAAyB,CACtD,KAAM,GAAiB,EAAI,QAAQ,GACnC,MACE,KAAmB,IAAM,IAAmB,EAAI,OAAS,EAAO,OAGpE,GAAI,CAAC,KAAK,qBAA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AAI,GAAQ,EAAG,EACf,GAAI,MAAM,QAAQ,GAAI,CAEpB,GADA,EAAS,EAAE,OACP,GAAU,EAAE,OACd,MAAO,GAET,IAAK,EAAI,EAAQ,KAAQ,GACvB,GAAI,CAAC,EAAY,UAAU,EAAE,GAAI,EAAE,IACjC,MAAO,GAGX,MAAO,GAET,GAAI,EAAE,UAAY,OAAO,UAAU,QACjC,MAAO,GAAE,YAAc,EAAE,UAE3B,GAAI,EAAE,WAAa,OAAO,UAAU,SAClC,MAAO,GAAE,aAAe,EAAE,WAI5B,GAFA,EAAO,OAAO,KAAK,GACnB,EAAS,EAAK,OACV,IAAW,OAAO,KAAK,GAAG,OAC5B,MAAO,GAET,IAAK,EAAI,EAAQ,KAAQ,GACvB,GAAI,CAAC,OAAO,UAAU,eAAe,KAAK,EAAG,EAAK,IAChD,MAAO,GAGX,IAAK,EAAI,EAAQ,KAAQ,GAAK,CAC5B,KAAM,GAAM,EAAK,GACjB,GAAI,CAAC,EAAY,UAAU,EAAE,GAAM,EAAE,IACnC,MAAO,GAGX,MAAO,GAIT,MAAO,KAAM,GAAK,IAAM,GArpDrB,EAAM,gBAjBL",
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n const logger = new gdjs.Logger('Hot reloader');\n export type HotReloaderLog = {\n message: string;\n kind: 'fatal' | 'error' | 'warning' | 'info';\n };\n\n export type ChangedRuntimeBehavior = {\n oldBehaviorConstructor: Function;\n newBehaviorConstructor: Function;\n behaviorTypeName: string;\n };\n\n /**\n * Reload scripts/data of an exported game and applies the changes\n * to the running runtime game.\n */\n export class HotReloader {\n _runtimeGame: gdjs.RuntimeGame;\n _reloadedScriptElement: Record<string, HTMLScriptElement> = {};\n _logs: HotReloaderLog[] = [];\n _alreadyLoadedScriptFiles: Record<string, boolean> = {};\n\n /**\n * @param runtimeGame - The `gdjs.RuntimeGame` to be hot-reloaded.\n */\n constructor(runtimeGame: gdjs.RuntimeGame) {\n this._runtimeGame = runtimeGame;\n }\n\n static indexByPersistentUuid<\n ObjectWithPersistentId extends { persistentUuid: string | null },\n >(\n objectsWithPersistentId: ObjectWithPersistentId[]\n ): Map<string, ObjectWithPersistentId> {\n return objectsWithPersistentId.reduce(function (objectsMap, object) {\n if (object.persistentUuid) {\n objectsMap.set(object.persistentUuid, object);\n }\n return objectsMap;\n }, new Map<string, ObjectWithPersistentId>());\n }\n\n static indexByName<E extends { name: string | null }>(\n objectsWithName: E[]\n ): Map<string, E> {\n return objectsWithName.reduce(function (objectsMap, object) {\n if (object.name) {\n objectsMap.set(object.name, object);\n }\n return objectsMap;\n }, new Map<string, E>());\n }\n\n _canReloadScriptFile(srcFilename: string): boolean {\n function endsWith(str: string, suffix: string): boolean {\n const suffixPosition = str.indexOf(suffix);\n return (\n suffixPosition !== -1 && suffixPosition === str.length - suffix.length\n );\n }\n\n // Never reload .h script files, as they are leaking by mistake from C++ extensions.\n if (endsWith(srcFilename, '.h')) {\n return false;\n }\n\n // Make sure some files are loaded only once.\n if (this._alreadyLoadedScriptFiles[srcFilename]) {\n if (\n // Don't reload Box2d as it would confuse and crash the asm.js library.\n endsWith(srcFilename, 'box2d.js') ||\n // Don't reload sha256.js library.\n endsWith(srcFilename, 'sha256.js') ||\n // Don't reload shopify-buy library.\n endsWith(srcFilename, 'shopify-buy.umd.polyfilled.min.js') ||\n // Don't reload pixi-multistyle-text library.\n endsWith(srcFilename, 'pixi-multistyle-text.umd.js') ||\n // Don't reload pixi-tilemap library.\n endsWith(srcFilename, 'pixi-tilemap.umd.js') ||\n // Don't reload bondage.js library.\n endsWith(srcFilename, 'bondage.min.js') ||\n // Don't reload pixi-particles library.\n endsWith(srcFilename, 'pixi-particles-pixi-renderer.min.js') ||\n // Don't reload pixi-tilemap amd pixi-tilemap-helper libraries.\n endsWith(srcFilename, 'pixi-tilemap.umd.js') ||\n endsWith(srcFilename, 'pixi-tilemap-helper.js') ||\n // Don't reload pako library (used in pixi-tilemap)\n endsWith(srcFilename, 'pako/dist/pako.min')\n ) {\n return false;\n }\n }\n return true;\n }\n\n _reloadScript(srcFilename: string): Promise<void> {\n function endsWith(str: string, suffix: string): boolean {\n const suffixPosition = str.indexOf(suffix);\n return (\n suffixPosition !== -1 && suffixPosition === str.length - suffix.length\n );\n }\n if (!this._canReloadScriptFile(srcFilename)) {\n this._logs.push({\n kind: 'info',\n message:\n 'Not reloading ' +\n srcFilename +\n ' as it is blocked for hot-reloading.',\n });\n return Promise.resolve();\n }\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n return Promise.reject(\n new Error('No head element found, are you in a navigator?')\n );\n }\n return new Promise((resolve, reject) => {\n const existingScriptElement = this._reloadedScriptElement[srcFilename];\n if (existingScriptElement) {\n head.removeChild(existingScriptElement);\n } else {\n // Check if there is an existing scriptElement in head\n const headScriptElements = head.getElementsByTagName('script');\n for (let i = 0; i < headScriptElements.length; ++i) {\n const scriptElement = headScriptElements[i];\n if (endsWith(scriptElement.src, srcFilename)) {\n head.removeChild(scriptElement);\n }\n }\n }\n const reloadedScriptElement = document.createElement('script');\n reloadedScriptElement.src = srcFilename + '?timestamp=' + Date.now();\n reloadedScriptElement.onload = () => {\n resolve();\n };\n reloadedScriptElement.onerror = (event) => {\n reject(event);\n };\n head.appendChild(reloadedScriptElement);\n this._reloadedScriptElement[srcFilename] = reloadedScriptElement;\n });\n }\n\n hotReload(): Promise<HotReloaderLog[]> {\n logger.info('Hot reload started');\n this._runtimeGame.pause(true);\n this._logs = [];\n\n // Save old data of the project, to be used to compute\n // the difference between the old and new project data:\n\n const oldProjectData: ProjectData = gdjs.projectData;\n\n const oldScriptFiles = gdjs.runtimeGameOptions\n .scriptFiles as RuntimeGameOptionsScriptFile[];\n\n oldScriptFiles.forEach((scriptFile) => {\n this._alreadyLoadedScriptFiles[scriptFile.path] = true;\n });\n const oldBehaviorConstructors: { [key: string]: Function } = {};\n\n for (let behaviorTypeName in gdjs.behaviorsTypes.items) {\n oldBehaviorConstructors[behaviorTypeName] =\n gdjs.behaviorsTypes.items[behaviorTypeName];\n }\n\n // Reload projectData and runtimeGameOptions stored by convention in data.js:\n return this._reloadScript('data.js').then(() => {\n const newProjectData: ProjectData = gdjs.projectData;\n\n const newRuntimeGameOptions: RuntimeGameOptions =\n gdjs.runtimeGameOptions;\n\n if (gdjs.inAppTutorialMessage) {\n gdjs.inAppTutorialMessage.displayInAppTutorialMessage(\n this._runtimeGame,\n newRuntimeGameOptions.inAppTutorialMessageInPreview,\n newRuntimeGameOptions.inAppTutorialMessagePositionInPreview || ''\n );\n }\n\n const newScriptFiles =\n newRuntimeGameOptions.scriptFiles as RuntimeGameOptionsScriptFile[];\n const projectDataOnlyExport =\n !!newRuntimeGameOptions.projectDataOnlyExport;\n\n // Reload the changed scripts, which will have the side effects of re-running\n // the new scripts, potentially replacing the code of the free functions from\n // extensions (which is fine) and registering updated behaviors (which will\n // need to be re-instantiated in runtime objects).\n return this.reloadScriptFiles(\n newProjectData,\n oldScriptFiles,\n newScriptFiles,\n projectDataOnlyExport\n )\n .then(() => {\n const changedRuntimeBehaviors =\n this._computeChangedRuntimeBehaviors(\n oldBehaviorConstructors,\n gdjs.behaviorsTypes.items\n );\n return this._hotReloadRuntimeGame(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n this._runtimeGame\n );\n })\n .catch((error) => {\n const errorTarget = error.target;\n if (errorTarget instanceof HTMLScriptElement) {\n this._logs.push({\n kind: 'fatal',\n message: 'Unable to reload script: ' + errorTarget.src,\n });\n } else {\n this._logs.push({\n kind: 'fatal',\n message:\n 'Unexpected error happened while hot-reloading: ' +\n error.message,\n });\n }\n })\n .then(() => {\n logger.info(\n 'Hot reload finished with logs:',\n this._logs.map((log) => '\\n' + log.kind + ': ' + log.message)\n );\n this._runtimeGame.pause(false);\n return this._logs;\n });\n });\n }\n\n _computeChangedRuntimeBehaviors(\n oldBehaviorConstructors: Record<string, Function>,\n newBehaviorConstructors: Record<string, Function>\n ): ChangedRuntimeBehavior[] {\n const changedRuntimeBehaviors: ChangedRuntimeBehavior[] = [];\n for (let behaviorTypeName in oldBehaviorConstructors) {\n const oldBehaviorConstructor =\n oldBehaviorConstructors[behaviorTypeName];\n const newBehaviorConstructor =\n newBehaviorConstructors[behaviorTypeName];\n if (!newBehaviorConstructor) {\n this._logs.push({\n kind: 'warning',\n message:\n 'Behavior with type ' +\n behaviorTypeName +\n ' was removed from the registered behaviors in gdjs.',\n });\n } else {\n if (oldBehaviorConstructor !== newBehaviorConstructor) {\n this._logs.push({\n kind: 'info',\n message:\n 'Behavior with type ' +\n behaviorTypeName +\n ' was changed, and will be re-instantiated in gdjs.RuntimeObjects using it.',\n });\n changedRuntimeBehaviors.push({\n oldBehaviorConstructor,\n newBehaviorConstructor,\n behaviorTypeName,\n });\n }\n }\n }\n return changedRuntimeBehaviors;\n }\n\n reloadScriptFiles(\n newProjectData: ProjectData,\n oldScriptFiles: RuntimeGameOptionsScriptFile[],\n newScriptFiles: RuntimeGameOptionsScriptFile[],\n projectDataOnlyExport: boolean\n ): Promise<void[]> {\n const reloadPromises: Array<Promise<void>> = [];\n\n // Reload events, only if they were exported.\n if (!projectDataOnlyExport) {\n newProjectData.layouts.forEach((_layoutData, index) => {\n reloadPromises.push(this._reloadScript('code' + index + '.js'));\n });\n }\n for (let i = 0; i < newScriptFiles.length; ++i) {\n const newScriptFile = newScriptFiles[i];\n const oldScriptFile = oldScriptFiles.filter(\n (scriptFile) => scriptFile.path === newScriptFile.path\n )[0];\n if (!oldScriptFile) {\n // Script file added\n this._logs.push({\n kind: 'info',\n message:\n 'Loading ' +\n newScriptFile.path +\n ' as it was added to the list of scripts.',\n });\n reloadPromises.push(this._reloadScript(newScriptFile.path));\n } else {\n // Script file changed, which can be the case for extensions created\n // from the editor, containing free functions or behaviors.\n if (newScriptFile.hash !== oldScriptFile.hash) {\n this._logs.push({\n kind: 'info',\n message:\n 'Reloading ' + newScriptFile.path + ' because it was changed.',\n });\n reloadPromises.push(this._reloadScript(newScriptFile.path));\n }\n }\n }\n for (let i = 0; i < oldScriptFiles.length; ++i) {\n const oldScriptFile = oldScriptFiles[i];\n const newScriptFile = newScriptFiles.filter(\n (scriptFile) => scriptFile.path === oldScriptFile.path\n )[0];\n\n // A file may be removed because of a partial preview.\n if (!newScriptFile && !projectDataOnlyExport) {\n this._logs.push({\n kind: 'warning',\n message: 'Script file ' + oldScriptFile.path + ' was removed.',\n });\n }\n }\n return Promise.all(reloadPromises);\n }\n\n async _hotReloadRuntimeGame(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeGame: gdjs.RuntimeGame\n ): Promise<void> {\n const sceneStack = runtimeGame.getSceneStack();\n const currentScene = sceneStack.getCurrentScene();\n if (!currentScene) {\n // It can't actually happen.\n this._logs.push({\n kind: 'error',\n message: \"Can't hot-reload as no scene are opened.\",\n });\n return;\n }\n // Update project data and re-load assets (sound/image/font/json managers\n // will take care of reloading only what is needed).\n runtimeGame.setProjectData(newProjectData);\n await runtimeGame.loadFirstAssetsAndStartBackgroundLoading(\n currentScene.getName(),\n () => {}\n );\n this._hotReloadVariablesContainer(\n oldProjectData.variables,\n newProjectData.variables,\n runtimeGame.getVariables()\n );\n\n // Update extension's global variables.\n for (const newExtensionData of newProjectData.eventsFunctionsExtensions) {\n const oldExtensionData = oldProjectData.eventsFunctionsExtensions.find(\n (oldExtensionData) => oldExtensionData.name === newExtensionData.name\n );\n\n const oldGlobalVariables = oldExtensionData\n ? oldExtensionData.globalVariables\n : [];\n const newGlobalVariables = newExtensionData.globalVariables;\n\n if (oldGlobalVariables.length > 0 || newGlobalVariables.length > 0) {\n const currentVariables = runtimeGame.getVariablesForExtension(\n newExtensionData.name\n );\n if (currentVariables) {\n this._hotReloadVariablesContainer(\n oldGlobalVariables,\n newGlobalVariables,\n currentVariables\n );\n } else {\n runtimeGame._variablesByExtensionName.set(\n newExtensionData.name,\n new gdjs.VariablesContainer(newGlobalVariables)\n );\n }\n }\n }\n\n const oldlayoutDataMap = HotReloader.indexByName(oldProjectData.layouts);\n const newlayoutDataMap = HotReloader.indexByName(newProjectData.layouts);\n\n // Reload runtime scenes\n sceneStack._stack.forEach((runtimeScene) => {\n const oldLayoutData = oldlayoutDataMap.get(runtimeScene.getName());\n const newLayoutData = newlayoutDataMap.get(runtimeScene.getName());\n if (oldLayoutData && newLayoutData) {\n this._hotReloadRuntimeScene(\n oldProjectData,\n newProjectData,\n oldLayoutData,\n newLayoutData,\n changedRuntimeBehaviors,\n runtimeScene\n );\n\n // Update extension's scene variables.\n for (const newExtensionData of newProjectData.eventsFunctionsExtensions) {\n const oldExtensionData =\n oldProjectData.eventsFunctionsExtensions.find(\n (oldExtensionData) =>\n oldExtensionData.name === newExtensionData.name\n );\n\n const oldSceneVariables = oldExtensionData\n ? oldExtensionData.sceneVariables\n : [];\n const newSceneVariables = newExtensionData.sceneVariables;\n\n if (oldSceneVariables.length > 0 || newSceneVariables.length > 0) {\n const currentVariables = runtimeScene.getVariablesForExtension(\n newExtensionData.name\n );\n if (currentVariables) {\n this._hotReloadVariablesContainer(\n oldSceneVariables,\n newSceneVariables,\n currentVariables\n );\n } else {\n runtimeScene._variablesByExtensionName.set(\n newExtensionData.name,\n new gdjs.VariablesContainer(newSceneVariables)\n );\n }\n }\n }\n } else {\n // A scene was removed. Not hot-reloading this.\n this._logs.push({\n kind: 'error',\n message:\n 'Scene ' +\n (oldLayoutData && oldLayoutData.name) +\n ' was removed. A fresh preview should be launched.',\n });\n }\n });\n\n // Reload changes in external layouts\n newProjectData.externalLayouts.forEach((newExternalLayoutData) => {\n const oldExternalLayoutData = oldProjectData.externalLayouts.filter(\n (externalLayoutData) =>\n externalLayoutData.name === newExternalLayoutData.name\n )[0];\n if (\n oldExternalLayoutData &&\n // Check if there are actual changes, to avoid useless work trying to\n // hot-reload all the scenes.\n !HotReloader.deepEqual(oldExternalLayoutData, newExternalLayoutData)\n ) {\n const oldLayoutData = oldlayoutDataMap.get(\n oldExternalLayoutData.associatedLayout\n );\n const newLayoutData = newlayoutDataMap.get(\n newExternalLayoutData.associatedLayout\n );\n\n sceneStack._stack.forEach((runtimeScene) => {\n this._hotReloadRuntimeSceneInstances(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldLayoutData ? oldLayoutData.objects : [],\n newLayoutData ? newLayoutData.objects : [],\n oldExternalLayoutData.instances,\n newExternalLayoutData.instances,\n runtimeScene\n );\n });\n }\n });\n }\n\n _hotReloadVariablesContainer(\n oldVariablesData: RootVariableData[],\n newVariablesData: RootVariableData[],\n variablesContainer: gdjs.VariablesContainer\n ): void {\n newVariablesData.forEach((newVariableData) => {\n const variableName = newVariableData.name;\n const oldVariableData = oldVariablesData.find(\n (variable) => variable.name === variableName\n );\n const variable = variablesContainer.get(newVariableData.name);\n\n if (!oldVariableData) {\n // New variable\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n } else if (\n gdjs.Variable.isPrimitive(newVariableData.type || 'number') &&\n (oldVariableData.value !== newVariableData.value ||\n !gdjs.Variable.isPrimitive(oldVariableData.type || 'number'))\n ) {\n // Variable value was changed or was converted from\n // a structure to a variable with value.\n variablesContainer.remove(variableName);\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n } else if (\n !gdjs.Variable.isPrimitive(newVariableData.type || 'number')\n ) {\n // Variable is a structure or array (or was converted from a primitive\n // to one of those).\n if (newVariableData.type === 'structure')\n this._hotReloadStructureVariable(\n //@ts-ignore If the type is structure, it is assured that the children have a name\n oldVariableData.children,\n newVariableData.children,\n variable\n );\n else {\n // Arrays cannot be hot reloaded.\n // As indices can change at runtime, and in the IDE, they can be desynchronized.\n // It will in that case mess up the whole array,\n // and there is no way to know if that was the case.\n //\n // We therefore just replace the old array with the new one.\n variablesContainer.remove(variableName);\n variablesContainer.add(\n variableName,\n new gdjs.Variable(newVariableData)\n );\n }\n }\n });\n oldVariablesData.forEach((oldVariableData) => {\n const newVariableData = newVariablesData.find(\n (variable) => variable.name === oldVariableData.name\n );\n\n if (!newVariableData) {\n // Variable was removed\n variablesContainer.remove(oldVariableData.name);\n }\n });\n variablesContainer.rebuildIndexFrom(newVariablesData);\n }\n\n _hotReloadStructureVariable(\n oldChildren: RootVariableData[],\n newChildren: RootVariableData[],\n variable: gdjs.Variable\n ): void {\n if (oldChildren) {\n oldChildren.forEach((oldChildVariableData) => {\n const newChildVariableData = newChildren.find(\n (childVariableData) =>\n childVariableData.name === oldChildVariableData.name\n );\n\n if (!newChildVariableData) {\n // Child variable was removed.\n variable.removeChild(oldChildVariableData.name);\n } else if (\n gdjs.Variable.isPrimitive(newChildVariableData.type || 'number') &&\n (oldChildVariableData.value !== newChildVariableData.value ||\n !gdjs.Variable.isPrimitive(oldChildVariableData.type || 'number'))\n ) {\n // The child variable value was changed or was converted from\n // structure to a variable with value.\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n } else if (\n !gdjs.Variable.isPrimitive(newChildVariableData.type || 'number')\n ) {\n // Variable is a structure or array (or was converted from a primitive\n // to one of those).\n if (newChildVariableData.type === 'structure')\n this._hotReloadStructureVariable(\n //@ts-ignore If the type is structure, it is assured that the children have a name\n oldChildVariableData.children,\n newChildVariableData.children as Required<VariableData>[],\n variable.getChild(newChildVariableData.name)\n );\n else {\n // Arrays cannot be hot reloaded.\n // As indices can change at runtime, and in the IDE, they can be desynchronized.\n // It will in that case mess up the whole array,\n // and there is no way to know if that was the case.\n //\n // We therefore just replace the old array with the new one.\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n }\n }\n });\n newChildren.forEach((newChildVariableData) => {\n const oldChildVariableData = oldChildren.find(\n (childVariableData) =>\n childVariableData.name === newChildVariableData.name\n );\n\n if (!oldChildVariableData) {\n // Child variable was added\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n }\n });\n } else {\n // Variable was converted from a value to a structure:\n newChildren.forEach((newChildVariableData) => {\n variable.addChild(\n newChildVariableData.name,\n new gdjs.Variable(newChildVariableData)\n );\n });\n }\n }\n\n _hotReloadRuntimeScene(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n oldLayoutData: LayoutData,\n newLayoutData: LayoutData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeScene: gdjs.RuntimeScene\n ): void {\n runtimeScene.setBackgroundColor(\n newLayoutData.r,\n newLayoutData.v,\n newLayoutData.b\n );\n if (oldLayoutData.title !== newLayoutData.title) {\n runtimeScene\n .getGame()\n .getRenderer()\n .setWindowTitle(newLayoutData.title);\n }\n this._hotReloadVariablesContainer(\n oldLayoutData.variables as Required<VariableData>[],\n newLayoutData.variables as Required<VariableData>[],\n runtimeScene.getVariables()\n );\n this._hotReloadRuntimeSceneBehaviorsSharedData(\n oldLayoutData.behaviorsSharedData,\n newLayoutData.behaviorsSharedData,\n runtimeScene\n );\n\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldLayoutData,\n newLayoutData,\n changedRuntimeBehaviors,\n runtimeScene\n );\n\n // Update the events generated code launched at each frame. Events generated code\n // script files were already reloaded at the beginning of the hot-reload. Note that\n // if they have not changed, it's still fine to call this, it will be basically a\n // no-op.\n runtimeScene.setEventsGeneratedCodeFunction(newLayoutData);\n }\n\n static resolveCustomObjectConfigurations(\n projectData: ProjectData,\n objectDatas: ObjectData[]\n ): ObjectData[] {\n return objectDatas.map((objectData) => {\n const [extensionName, eventsBasedObjectName] =\n objectData.type.split('::');\n\n const extensionData = projectData.eventsFunctionsExtensions.find(\n (extension) => extension.name === extensionName\n );\n if (!extensionData) {\n return objectData;\n }\n\n const eventsBasedObjectData =\n extensionData &&\n extensionData.eventsBasedObjects.find(\n (object) => object.name === eventsBasedObjectName\n );\n if (!eventsBasedObjectData) {\n return objectData;\n }\n\n const customObjectConfiguration = objectData as ObjectData &\n CustomObjectConfiguration;\n\n const mergedChildObjectDataList =\n customObjectConfiguration.childrenContent\n ? eventsBasedObjectData.objects.map((objectData) => ({\n ...objectData,\n ...customObjectConfiguration.childrenContent[objectData.name],\n }))\n : eventsBasedObjectData.objects;\n\n const mergedObjectConfiguration = {\n ...eventsBasedObjectData,\n ...objectData,\n // ObjectData doesn't have an `objects` attribute.\n // This is a small optimization to avoid to create an\n // InstanceContainerData for each instance to hot-reload their inner\n // scene (see `_hotReloadRuntimeInstanceContainer` call from\n // `_hotReloadRuntimeSceneInstances`).\n objects: mergedChildObjectDataList,\n childrenContent: mergedChildObjectDataList,\n };\n return mergedObjectConfiguration;\n });\n }\n\n _hotReloadRuntimeInstanceContainer(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n oldLayoutData: InstanceContainerData,\n newLayoutData: InstanceContainerData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const oldObjectDataList = HotReloader.resolveCustomObjectConfigurations(\n oldProjectData,\n oldLayoutData.objects\n );\n const newObjectDataList = HotReloader.resolveCustomObjectConfigurations(\n newProjectData,\n newLayoutData.objects\n );\n\n // Re-instantiate any gdjs.RuntimeBehavior that was changed.\n this._reinstantiateRuntimeSceneRuntimeBehaviors(\n changedRuntimeBehaviors,\n newObjectDataList,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneObjects(\n oldObjectDataList,\n newObjectDataList,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneInstances(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldObjectDataList,\n newObjectDataList,\n oldLayoutData.instances,\n newLayoutData.instances,\n runtimeInstanceContainer\n );\n this._hotReloadRuntimeSceneLayers(\n oldLayoutData.layers,\n newLayoutData.layers,\n runtimeInstanceContainer\n );\n }\n\n _hotReloadRuntimeSceneBehaviorsSharedData(\n oldBehaviorsSharedData: BehaviorSharedData[],\n newBehaviorsSharedData: BehaviorSharedData[],\n runtimeScene: gdjs.RuntimeScene\n ): void {\n oldBehaviorsSharedData.forEach((oldBehaviorSharedData) => {\n const name = oldBehaviorSharedData.name;\n const newBehaviorSharedData = newBehaviorsSharedData.filter(\n (behaviorSharedData) => behaviorSharedData.name === name\n )[0];\n if (!newBehaviorSharedData) {\n // Behavior shared data was removed.\n runtimeScene.setInitialSharedDataForBehavior(\n oldBehaviorSharedData.name,\n null\n );\n } else {\n if (\n !HotReloader.deepEqual(oldBehaviorSharedData, newBehaviorSharedData)\n ) {\n // Behavior shared data was modified\n runtimeScene.setInitialSharedDataForBehavior(\n newBehaviorSharedData.name,\n newBehaviorSharedData\n );\n }\n }\n });\n newBehaviorsSharedData.forEach((newBehaviorSharedData) => {\n const name = newBehaviorSharedData.name;\n const oldBehaviorSharedData = oldBehaviorsSharedData.filter(\n (behaviorSharedData) => behaviorSharedData.name === name\n )[0];\n if (!oldBehaviorSharedData) {\n // Behavior shared data was added\n runtimeScene.setInitialSharedDataForBehavior(\n newBehaviorSharedData.name,\n newBehaviorSharedData\n );\n }\n });\n }\n\n _reinstantiateRuntimeSceneRuntimeBehaviors(\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n newObjects: ObjectData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n newObjects.forEach((newObjectData) => {\n const objectName = newObjectData.name;\n const newBehaviors = newObjectData.behaviors;\n const runtimeObjects = runtimeInstanceContainer.getObjects(objectName)!;\n changedRuntimeBehaviors.forEach((changedRuntimeBehavior) => {\n const behaviorTypeName = changedRuntimeBehavior.behaviorTypeName;\n\n // If the changed behavior is used by the object, re-instantiate\n // it.\n newBehaviors\n .filter((behaviorData) => behaviorData.type === behaviorTypeName)\n .forEach((changedBehaviorNewData) => {\n const name = changedBehaviorNewData.name;\n this._logs.push({\n kind: 'info',\n message:\n 'Re-instantiating behavior named \"' +\n name +\n '\" for instances of object \"' +\n objectName +\n '\".',\n });\n runtimeObjects.forEach((runtimeObject) => {\n this._reinstantiateRuntimeObjectRuntimeBehavior(\n changedBehaviorNewData,\n runtimeObject\n );\n });\n });\n });\n });\n }\n\n _reinstantiateRuntimeObjectRuntimeBehavior(\n behaviorData: BehaviorData,\n runtimeObject: gdjs.RuntimeObject\n ): void {\n const behaviorName = behaviorData.name;\n const oldRuntimeBehavior = runtimeObject.getBehavior(behaviorName);\n if (!oldRuntimeBehavior) {\n return;\n }\n\n // Remove and re-add the behavior so that it's using the newly\n // registered gdjs.RuntimeBehavior.\n runtimeObject.removeBehavior(behaviorName);\n runtimeObject.addNewBehavior(behaviorData);\n const newRuntimeBehavior = runtimeObject.getBehavior(behaviorName);\n if (!newRuntimeBehavior) {\n this._logs.push({\n kind: 'error',\n message:\n 'Could not create behavior ' +\n behaviorName +\n ' (type: ' +\n behaviorData.type +\n ') for object ' +\n runtimeObject.getName(),\n });\n return;\n }\n\n // Copy the properties from the old behavior to the new one.\n for (let behaviorProperty in oldRuntimeBehavior) {\n if (!oldRuntimeBehavior.hasOwnProperty(behaviorProperty)) {\n continue;\n }\n if (behaviorProperty === '_behaviorData') {\n // For property \"_behaviorData\" that we know to be an object,\n // do a copy of each property of\n // this object so that we keep the new ones (useful if a new property was added).\n newRuntimeBehavior[behaviorProperty] =\n newRuntimeBehavior[behaviorProperty] || {};\n for (let property in oldRuntimeBehavior[behaviorProperty]) {\n newRuntimeBehavior[behaviorProperty][property] =\n oldRuntimeBehavior[behaviorProperty][property];\n }\n } else {\n newRuntimeBehavior[behaviorProperty] =\n oldRuntimeBehavior[behaviorProperty];\n }\n }\n return;\n }\n\n _hotReloadRuntimeSceneObjects(\n oldObjects: ObjectData[],\n newObjects: ObjectData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n oldObjects.forEach((oldObjectData) => {\n const name = oldObjectData.name;\n const newObjectData = newObjects.filter(\n (objectData) => objectData.name === name\n )[0];\n\n // Note: if an object is renamed in the editor, it will be considered as removed,\n // and the new object name as a new object to register.\n // It's not ideal because living instances of the object will be destroyed,\n // but it would be complex to iterate over instances of the object and change\n // its name (it's not expected to change).\n if (!newObjectData || oldObjectData.type !== newObjectData.type) {\n // Object was removed or object type was changed (considered as a removal of the old object)\n runtimeInstanceContainer.unregisterObject(name);\n } else {\n if (runtimeInstanceContainer.isObjectRegistered(name)) {\n this._hotReloadRuntimeSceneObject(\n oldObjectData,\n newObjectData,\n runtimeInstanceContainer\n );\n }\n }\n });\n newObjects.forEach((newObjectData) => {\n const name = newObjectData.name;\n const oldObjectData = oldObjects.filter(\n (layerData) => layerData.name === name\n )[0];\n if (\n (!oldObjectData || oldObjectData.type !== newObjectData.type) &&\n !runtimeInstanceContainer.isObjectRegistered(name)\n ) {\n // Object was added or object type was changed (considered as adding the new object)\n runtimeInstanceContainer.registerObject(newObjectData);\n }\n });\n }\n\n _hotReloadRuntimeSceneObject(\n oldObjectData: ObjectData,\n newObjectData: ObjectData,\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n let hotReloadSucceeded = true;\n if (!HotReloader.deepEqual(oldObjectData, newObjectData)) {\n this._logs.push({\n kind: 'info',\n message:\n 'Object \"' +\n newObjectData.name +\n '\" was modified and is hot-reloaded.',\n });\n\n // Register the updated object data, used for new instances.\n runtimeInstanceContainer.updateObject(newObjectData);\n\n // Update existing instances\n const runtimeObjects = runtimeInstanceContainer.getObjects(\n newObjectData.name\n )!;\n\n // Update instances state\n runtimeObjects.forEach((runtimeObject) => {\n // Update the runtime object\n hotReloadSucceeded =\n runtimeObject.updateFromObjectData(oldObjectData, newObjectData) &&\n hotReloadSucceeded;\n });\n\n // Don't update behaviors and effects for each runtime object to avoid\n // doing the check for differences for every single object.\n\n // Update behaviors\n this._hotReloadRuntimeObjectsBehaviors(\n oldObjectData.behaviors,\n newObjectData.behaviors,\n runtimeObjects\n );\n\n // Update effects\n this._hotReloadRuntimeObjectsEffects(\n oldObjectData.effects,\n newObjectData.effects,\n runtimeObjects\n );\n }\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n 'Object \"' +\n newObjectData.name +\n '\" could not be hot-reloaded. A fresh preview should be run.',\n });\n }\n }\n\n _hotReloadRuntimeObjectsBehaviors(\n oldBehaviors: BehaviorData[],\n newBehaviors: BehaviorData[],\n runtimeObjects: gdjs.RuntimeObject[]\n ): void {\n oldBehaviors.forEach((oldBehaviorData) => {\n const name = oldBehaviorData.name;\n const newBehaviorData = newBehaviors.filter(\n (behaviorData) => behaviorData.name === name\n )[0];\n if (!newBehaviorData) {\n // Behavior was removed\n runtimeObjects.forEach((runtimeObject) => {\n if (runtimeObject.hasBehavior(name)) {\n if (!runtimeObject.removeBehavior(name)) {\n this._logs.push({\n kind: 'error',\n message:\n 'Behavior ' +\n name +\n ' could not be removed from object' +\n runtimeObject.getName(),\n });\n }\n }\n });\n } else {\n if (!HotReloader.deepEqual(oldBehaviorData, newBehaviorData)) {\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n const runtimeBehavior = runtimeObject.getBehavior(\n newBehaviorData.name\n );\n if (runtimeBehavior) {\n hotReloadSucceeded =\n this._hotReloadRuntimeBehavior(\n oldBehaviorData,\n newBehaviorData,\n runtimeBehavior\n ) && hotReloadSucceeded;\n }\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newBehaviorData.name + ' behavior could not be hot-reloaded.',\n });\n }\n }\n }\n });\n newBehaviors.forEach((newBehaviorData) => {\n const name = newBehaviorData.name;\n const oldBehaviorData = oldBehaviors.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldBehaviorData) {\n // Behavior was added\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n hotReloadSucceeded =\n runtimeObject.addNewBehavior(newBehaviorData) &&\n hotReloadSucceeded;\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newBehaviorData.name +\n ' behavior could not be added during hot-reload.',\n });\n }\n }\n });\n }\n\n _hotReloadRuntimeObjectsEffects(\n oldEffects: EffectData[],\n newEffects: EffectData[],\n runtimeObjects: RuntimeObject[]\n ): void {\n oldEffects.forEach((oldEffectData) => {\n const name = oldEffectData.name;\n const newEffectData = newEffects.filter(\n (effectData) => effectData.name === name\n )[0];\n if (!newEffectData) {\n // Effect was removed.\n runtimeObjects.forEach((runtimeObject) => {\n if (runtimeObject.hasEffect(name)) {\n if (!runtimeObject.removeEffect(name)) {\n this._logs.push({\n kind: 'error',\n message:\n 'Effect ' +\n name +\n ' could not be removed from object' +\n runtimeObject.getName(),\n });\n }\n }\n });\n } else {\n if (!HotReloader.deepEqual(oldEffectData, newEffectData)) {\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n if (oldEffectData.effectType === newEffectData.effectType) {\n hotReloadSucceeded =\n runtimeObject.updateAllEffectParameters(newEffectData) &&\n hotReloadSucceeded;\n } else {\n // Another effect type was applied\n runtimeObject.removeEffect(oldEffectData.name);\n runtimeObject.addEffect(newEffectData);\n }\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newEffectData.name + ' effect could not be hot-reloaded.',\n });\n }\n }\n }\n });\n newEffects.forEach((newEffectData) => {\n const name = newEffectData.name;\n const oldEffectData = oldEffects.filter(\n (oldEffectData) => oldEffectData.name === name\n )[0];\n if (!oldEffectData) {\n // Effect was added\n let hotReloadSucceeded = true;\n runtimeObjects.forEach((runtimeObject) => {\n hotReloadSucceeded =\n runtimeObject.addEffect(newEffectData) && hotReloadSucceeded;\n });\n if (!hotReloadSucceeded) {\n this._logs.push({\n kind: 'error',\n message:\n newEffectData.name +\n ' effect could not be added during hot-reload.',\n });\n }\n }\n });\n }\n\n /**\n * @returns true if hot-reload succeeded, false otherwise.\n */\n _hotReloadRuntimeBehavior(\n oldBehaviorData: BehaviorData,\n newBehaviorData: BehaviorData,\n runtimeBehavior: gdjs.RuntimeBehavior\n ): boolean {\n // Don't check here for deep equality between oldBehaviorData and newBehaviorData.\n // This would be too costly to do for each runtime object.\n // It's supposed to be done once by the caller.\n return runtimeBehavior.updateFromBehaviorData(\n oldBehaviorData,\n newBehaviorData\n );\n }\n\n _hotReloadRuntimeSceneLayers(\n oldLayers: LayerData[],\n newLayers: LayerData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n oldLayers.forEach((oldLayerData) => {\n const name = oldLayerData.name;\n const newLayerData = newLayers.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!newLayerData) {\n // Layer was removed\n runtimeInstanceContainer.removeLayer(name);\n } else {\n if (runtimeInstanceContainer.hasLayer(name)) {\n const layer = runtimeInstanceContainer.getLayer(name);\n this._hotReloadRuntimeLayer(oldLayerData, newLayerData, layer);\n }\n }\n });\n newLayers.forEach((newLayerData) => {\n const name = newLayerData.name;\n const oldLayerData = oldLayers.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldLayerData && !runtimeInstanceContainer.hasLayer(name)) {\n // Layer was added\n runtimeInstanceContainer.addLayer(newLayerData);\n }\n });\n newLayers.forEach((newLayerData, index) => {\n runtimeInstanceContainer.setLayerIndex(newLayerData.name, index);\n });\n }\n\n _hotReloadRuntimeLayer(\n oldLayer: LayerData,\n newLayer: LayerData,\n runtimeLayer: gdjs.RuntimeLayer\n ): void {\n // Properties\n if (oldLayer.visibility !== newLayer.visibility) {\n runtimeLayer.show(newLayer.visibility);\n }\n if (newLayer.isLightingLayer) {\n if (\n oldLayer.ambientLightColorR !== newLayer.ambientLightColorR ||\n oldLayer.ambientLightColorG !== newLayer.ambientLightColorG ||\n oldLayer.ambientLightColorB !== newLayer.ambientLightColorB\n ) {\n runtimeLayer.setClearColor(\n newLayer.ambientLightColorR,\n newLayer.ambientLightColorG,\n newLayer.ambientLightColorB\n );\n }\n if (oldLayer.followBaseLayerCamera !== newLayer.followBaseLayerCamera) {\n runtimeLayer.setFollowBaseLayerCamera(newLayer.followBaseLayerCamera);\n }\n }\n\n // Rendering type can't be easily changed at runtime.\n if (oldLayer.renderingType !== newLayer.renderingType) {\n this._logs.push({\n kind: 'error',\n message: `Could not change the rendering type (2D, 3D...) layer at runtime (for layer \"${newLayer.name}\").`,\n });\n }\n if (newLayer.isLightingLayer !== oldLayer.isLightingLayer) {\n this._logs.push({\n kind: 'error',\n message: `Could not add/remove a lighting layer at runtime (for layer \"${newLayer.name}\").`,\n });\n }\n\n // Effects\n this._hotReloadRuntimeLayerEffects(\n oldLayer.effects,\n newLayer.effects,\n runtimeLayer\n );\n }\n\n _hotReloadRuntimeLayerEffects(\n oldEffectsData: EffectData[],\n newEffectsData: EffectData[],\n runtimeLayer: gdjs.RuntimeLayer\n ): void {\n oldEffectsData.forEach((oldEffectData) => {\n const name = oldEffectData.name;\n const newEffectData = newEffectsData.filter(\n (effectData) => effectData.name === name\n )[0];\n if (!newEffectData) {\n // Effect was removed\n runtimeLayer.removeEffect(name);\n } else {\n if (runtimeLayer.hasEffect(name)) {\n if (oldEffectData.effectType !== newEffectData.effectType) {\n // Effect changed type, consider it was removed and added back.\n runtimeLayer.removeEffect(name);\n runtimeLayer.addEffect(newEffectData);\n } else {\n this._hotReloadRuntimeLayerEffect(\n oldEffectData,\n newEffectData,\n runtimeLayer,\n name\n );\n }\n }\n }\n });\n newEffectsData.forEach((newEffectData) => {\n const name = newEffectData.name;\n const oldEffectData = oldEffectsData.filter(\n (layerData) => layerData.name === name\n )[0];\n if (!oldEffectData && !runtimeLayer.hasEffect(name)) {\n // Effect was added\n runtimeLayer.addEffect(newEffectData);\n }\n });\n }\n\n _hotReloadRuntimeLayerEffect(\n oldEffectData: EffectData,\n newEffectData: EffectData,\n runtimeLayer: gdjs.RuntimeLayer,\n effectName: string\n ): void {\n // We consider oldEffectData.effectType and newEffectData.effectType\n // are the same - it's responsibility of the caller to verify this.\n for (let parameterName in newEffectData.booleanParameters) {\n const value = newEffectData.booleanParameters[parameterName];\n if (value !== oldEffectData.booleanParameters[parameterName]) {\n runtimeLayer.setEffectBooleanParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n for (let parameterName in newEffectData.doubleParameters) {\n const value = newEffectData.doubleParameters[parameterName];\n if (value !== oldEffectData.doubleParameters[parameterName]) {\n runtimeLayer.setEffectDoubleParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n for (let parameterName in newEffectData.stringParameters) {\n const value = newEffectData.stringParameters[parameterName];\n if (value !== oldEffectData.stringParameters[parameterName]) {\n runtimeLayer.setEffectStringParameter(\n effectName,\n parameterName,\n value\n );\n }\n }\n }\n\n _hotReloadRuntimeSceneInstances(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n oldObjects: ObjectData[],\n newObjects: ObjectData[],\n oldInstances: InstanceData[],\n newInstances: InstanceData[],\n runtimeInstanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n const runtimeObjects =\n runtimeInstanceContainer.getAdhocListOfAllInstances();\n const oldInstanceByUuid = HotReloader.indexByPersistentUuid(oldInstances);\n const newInstanceByUuid = HotReloader.indexByPersistentUuid(newInstances);\n const runtimeObjectByUuid =\n HotReloader.indexByPersistentUuid(runtimeObjects);\n\n const oldObjectsMap = HotReloader.indexByName(oldObjects);\n const newObjectsMap = HotReloader.indexByName(newObjects);\n\n for (const persistentUuid of oldInstanceByUuid.keys()) {\n const oldInstance = oldInstanceByUuid.get(persistentUuid);\n const newInstance = newInstanceByUuid.get(persistentUuid);\n const runtimeObject = runtimeObjectByUuid.get(persistentUuid);\n\n if (\n oldInstance &&\n (!newInstance || oldInstance.name !== newInstance.name)\n ) {\n // Instance was deleted (or object name changed, in which case it will be re-created later)\n if (runtimeObject) {\n runtimeObject.deleteFromScene(runtimeInstanceContainer);\n }\n } else {\n }\n }\n\n for (const runtimeObject of runtimeObjects) {\n const oldObjectData = oldObjectsMap.get(runtimeObject.getName());\n const newObjectData = newObjectsMap.get(runtimeObject.getName());\n if (!runtimeObject || !oldObjectData || !newObjectData) {\n // New objects or deleted objects can't have instances to hot-reload.\n continue;\n }\n const oldInstance = oldInstanceByUuid.get(\n // @ts-ignore Private attribute\n runtimeObject.persistentUuid\n );\n const newInstance = newInstanceByUuid.get(\n // @ts-ignore Private attribute\n runtimeObject.persistentUuid\n );\n if (oldInstance && newInstance) {\n // Instance was not deleted nor created, maybe modified (or not):\n this._hotReloadRuntimeInstance(\n oldProjectData,\n newProjectData,\n changedRuntimeBehaviors,\n oldObjectData,\n newObjectData,\n oldInstance,\n newInstance,\n runtimeObject\n );\n } else {\n // Reload objects that were created at runtime.\n\n // Update variables\n this._hotReloadVariablesContainer(\n oldObjectData.variables,\n newObjectData.variables,\n runtimeObject.getVariables()\n );\n\n if (runtimeObject instanceof gdjs.CustomRuntimeObject) {\n const childrenInstanceContainer =\n runtimeObject.getChildrenContainer();\n\n // The `objects` attribute is already resolved by `resolveCustomObjectConfigurations()`.\n const oldCustomObjectData = oldObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n const newCustomObjectData = newObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n\n // Reload the content of custom objects that were created at runtime.\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldCustomObjectData,\n newCustomObjectData,\n changedRuntimeBehaviors,\n childrenInstanceContainer\n );\n }\n }\n }\n\n for (const persistentUuid of newInstanceByUuid.keys()) {\n const oldInstance = oldInstanceByUuid.get(persistentUuid);\n const newInstance = newInstanceByUuid.get(persistentUuid);\n const runtimeObject = runtimeObjectByUuid.get(persistentUuid);\n if (\n newInstance &&\n (!oldInstance || oldInstance.name !== newInstance.name) &&\n !runtimeObject\n ) {\n // Instance was created (or object name changed, in which case it was destroyed previously)\n // and we verified that runtimeObject does not exist.\n runtimeInstanceContainer.createObjectsFrom(\n [newInstance],\n 0,\n 0,\n 0,\n /*trackByPersistentUuid=*/\n true\n );\n }\n }\n }\n\n _hotReloadRuntimeInstance(\n oldProjectData: ProjectData,\n newProjectData: ProjectData,\n changedRuntimeBehaviors: ChangedRuntimeBehavior[],\n oldObjectData: ObjectData,\n newObjectData: ObjectData,\n oldInstance: InstanceData,\n newInstance: InstanceData,\n runtimeObject: gdjs.RuntimeObject\n ): void {\n let somethingChanged = false;\n\n // Check if default properties changed\n if (oldInstance.x !== newInstance.x) {\n runtimeObject.setX(newInstance.x);\n somethingChanged = true;\n }\n if (oldInstance.y !== newInstance.y) {\n runtimeObject.setY(newInstance.y);\n somethingChanged = true;\n }\n if (oldInstance.angle !== newInstance.angle) {\n runtimeObject.setAngle(newInstance.angle);\n somethingChanged = true;\n }\n if (oldInstance.zOrder !== newInstance.zOrder) {\n runtimeObject.setZOrder(newInstance.zOrder);\n somethingChanged = true;\n }\n if (oldInstance.layer !== newInstance.layer) {\n runtimeObject.setLayer(newInstance.layer);\n somethingChanged = true;\n }\n if (gdjs.Base3DHandler && gdjs.Base3DHandler.is3D(runtimeObject)) {\n if (oldInstance.z !== newInstance.z && newInstance.z !== undefined) {\n runtimeObject.setZ(newInstance.z);\n somethingChanged = true;\n }\n if (\n oldInstance.rotationX !== newInstance.rotationX &&\n newInstance.rotationX !== undefined\n ) {\n runtimeObject.setRotationX(newInstance.rotationX);\n somethingChanged = true;\n }\n if (\n oldInstance.rotationY !== newInstance.rotationY &&\n newInstance.rotationY !== undefined\n ) {\n runtimeObject.setRotationY(newInstance.rotationY);\n somethingChanged = true;\n }\n }\n\n // Check if size changed\n let sizeChanged = false;\n if (newInstance.customSize) {\n if (!oldInstance.customSize) {\n // A custom size was set\n runtimeObject.setWidth(newInstance.width);\n runtimeObject.setHeight(newInstance.height);\n somethingChanged = true;\n sizeChanged = true;\n } else {\n // The custom size was changed\n if (oldInstance.width !== newInstance.width) {\n runtimeObject.setWidth(newInstance.width);\n somethingChanged = true;\n sizeChanged = true;\n }\n if (oldInstance.height !== newInstance.height) {\n runtimeObject.setHeight(newInstance.height);\n somethingChanged = true;\n sizeChanged = true;\n }\n }\n } else {\n if (!newInstance.customSize && oldInstance.customSize) {\n // The custom size was removed. Just flag the size as changed\n // and hope the object will handle this in\n // `extraInitializationFromInitialInstance`.\n sizeChanged = true;\n }\n }\n if (gdjs.Base3DHandler && gdjs.Base3DHandler.is3D(runtimeObject)) {\n // A custom depth was set or changed\n if (\n oldInstance.depth !== newInstance.depth &&\n newInstance.depth !== undefined\n ) {\n runtimeObject.setDepth(newInstance.depth);\n somethingChanged = true;\n sizeChanged = true;\n } else if (\n newInstance.depth === undefined &&\n oldInstance.depth !== undefined\n ) {\n // The custom depth was removed. Just flag the depth as changed\n // and hope the object will handle this in\n // `extraInitializationFromInitialInstance`.\n sizeChanged = true;\n }\n }\n if (runtimeObject instanceof gdjs.CustomRuntimeObject) {\n const childrenInstanceContainer = runtimeObject.getChildrenContainer();\n\n // The `objects` attribute is already resolved by `resolveCustomObjectConfigurations()`.\n const oldCustomObjectData = oldObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n const newCustomObjectData = newObjectData as ObjectData &\n CustomObjectConfiguration &\n InstanceContainerData;\n\n this._hotReloadRuntimeInstanceContainer(\n oldProjectData,\n newProjectData,\n oldCustomObjectData,\n newCustomObjectData,\n changedRuntimeBehaviors,\n childrenInstanceContainer\n );\n }\n\n // Update variables\n this._hotReloadVariablesContainer(\n this._mergeObjectVariablesData(\n oldObjectData.variables,\n oldInstance.initialVariables\n ),\n this._mergeObjectVariablesData(\n newObjectData.variables,\n newInstance.initialVariables\n ),\n runtimeObject.getVariables()\n );\n\n // Check if custom properties changed (specific to each object type)\n const numberPropertiesChanged = newInstance.numberProperties.some(\n (numberProperty) => {\n const name = numberProperty.name;\n const value = numberProperty.value;\n const oldNumberProperty = oldInstance.numberProperties.filter(\n (numberProperty) => numberProperty.name === name\n )[0];\n return !oldNumberProperty || oldNumberProperty.value !== value;\n }\n );\n const stringPropertiesChanged = newInstance.stringProperties.some(\n (stringProperty) => {\n const name = stringProperty.name;\n const value = stringProperty.value;\n const oldStringProperty = oldInstance.stringProperties.filter(\n (stringProperty) => stringProperty.name === name\n )[0];\n return !oldStringProperty || oldStringProperty.value !== value;\n }\n );\n if (numberPropertiesChanged || stringPropertiesChanged || sizeChanged) {\n runtimeObject.extraInitializationFromInitialInstance(newInstance);\n somethingChanged = true;\n }\n if (somethingChanged) {\n // If we changed the runtime object position/size/angle or another property,\n // notify behaviors that the runtime object was reloaded.\n // This is useful for behaviors like the physics engine that are watching the\n // object position/size and need to be notified when changed (otherwise, they\n // would continue using the previous position, so the object would not be moved\n // or updated according to the changes made in the project instance).\n runtimeObject.notifyBehaviorsObjectHotReloaded();\n }\n }\n\n _mergeObjectVariablesData(\n objectVariablesData: RootVariableData[],\n instanceVariablesData: RootVariableData[]\n ): RootVariableData[] {\n if (instanceVariablesData.length === 0) {\n return objectVariablesData;\n }\n const variablesData = [...objectVariablesData];\n for (const instanceVariableData of instanceVariablesData) {\n const index = variablesData.indexOf(\n (variableData) => variableData.name === instanceVariableData.name\n );\n if (index >= 0) {\n variablesData[index] = instanceVariableData;\n }\n }\n return variablesData;\n }\n\n /**\n * Deep check equality between the two objects/arrays/primitives.\n *\n * Inspired from https://github.com/epoberezkin/fast-deep-equal\n * @param a The first object/array/primitive to compare\n * @param b The second object/array/primitive to compare\n */\n static deepEqual(a: any, b: any): boolean {\n if (a === b) {\n return true;\n }\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) {\n return false;\n }\n let length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) {\n return false;\n }\n for (i = length; i-- !== 0; ) {\n if (!HotReloader.deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (a.valueOf !== Object.prototype.valueOf) {\n return a.valueOf() === b.valueOf();\n }\n if (a.toString !== Object.prototype.toString) {\n return a.toString() === b.toString();\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0; ) {\n const key = keys[i];\n if (!HotReloader.deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n }\n }\n}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,GAAI,EAAE,IACjC,MAAO,GAGX,MAAO,GAET,GAAI,EAAE,UAAY,OAAO,UAAU,QACjC,MAAO,GAAE,YAAc,EAAE,UAE3B,GAAI,EAAE,WAAa,OAAO,UAAU,SAClC,MAAO,GAAE,aAAe,EAAE,WAI5B,GAFA,EAAO,OAAO,KAAK,GACnB,EAAS,EAAK,OACV,IAAW,OAAO,KAAK,GAAG,OAC5B,MAAO,GAET,IAAK,EAAI,EAAQ,KAAQ,GACvB,GAAI,CAAC,OAAO,UAAU,eAAe,KAAK,EAAG,EAAK,IAChD,MAAO,GAGX,IAAK,EAAI,EAAQ,KAAQ,GAAK,CAC5B,KAAM,GAAM,EAAK,GACjB,GAAI,CAAC,EAAY,UAAU,EAAE,GAAM,EAAE,IACnC,MAAO,GAGX,MAAO,GAIT,MAAO,KAAM,GAAK,IAAM,GAlqDrB,EAAM,gBAjBL",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(r){const t=new r.Logger("Debugger client (websocket)");class c extends r.AbstractDebuggerClient{constructor(n){super(n);this.hasLoggedError=!1;if(this._ws=null,typeof WebSocket=="undefined"){t.log("WebSocket is not defined, the debugger won't work.");return}const i=this;try{const e=n.getAdditionalOptions(),o=e&&e.websocketDebuggerServerAddress||"127.0.0.1",s=e&&e.websocketDebuggerServerPort||"3030";this._ws=new WebSocket("ws://"+o+":"+s+"/")}catch{try{this._ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.hostname+":"+location.port+"/")}catch{try{this._ws=new WebSocket("ws://localhost:3030/")}catch{t.log("WebSocket could not initialize, debugger/hot-reload won't work.");return}}}this._ws.onopen=function(){t.info("Debugger connection open")},this._ws.onclose=function(){t.info("Debugger connection closed")},this._ws.onerror=function(o){t.warn("Debugger client error:",o)},this._ws.onmessage=function(o){let s=null;try{s=JSON.parse(o.data)}catch(a){t.info("Debugger received a badly formatted message:",a)}i.handleCommand(s)}}_sendMessage(n){if(!this._ws){this.hasLoggedError||(this.hasLoggedError=!0,t.warn("No connection to debugger opened to send a message."));return}this._ws.readyState===
|
|
1
|
+
var gdjs;(function(r){const t=new r.Logger("Debugger client (websocket)");class c extends r.AbstractDebuggerClient{constructor(n){super(n);this.hasLoggedError=!1;if(this._ws=null,typeof WebSocket=="undefined"){t.log("WebSocket is not defined, the debugger won't work.");return}const i=this;try{const e=n.getAdditionalOptions(),o=e&&e.websocketDebuggerServerAddress||"127.0.0.1",s=e&&e.websocketDebuggerServerPort||"3030";this._ws=new WebSocket("ws://"+o+":"+s+"/")}catch{try{this._ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.hostname+":"+location.port+"/")}catch{try{this._ws=new WebSocket("ws://localhost:3030/")}catch{t.log("WebSocket could not initialize, debugger/hot-reload won't work.");return}}}this._ws.onopen=function(){t.info("Debugger connection open")},this._ws.onclose=function(){t.info("Debugger connection closed")},this._ws.onerror=function(o){t.warn("Debugger client error:",o)},this._ws.onmessage=function(o){let s=null;try{s=JSON.parse(o.data)}catch(a){t.info("Debugger received a badly formatted message:",a)}i.handleCommand(s)}}_sendMessage(n){if(!this._ws){this.hasLoggedError||(this.hasLoggedError=!0,t.warn("No connection to debugger opened to send a message."));return}this._ws.readyState===WebSocket.OPEN&&this._ws.send(n)}}r.WebsocketDebuggerClient=c,r.DebuggerClient=c})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=websocket-debugger-client.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../GDevelop/GDJS/Runtime/debugger-client/websocket-debugger-client.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n const logger = new gdjs.Logger('Debugger client (websocket)');\n\n /**\n * This debugger client connects to a websocket server, exchanging\n * and receiving messages with this server.\n */\n export class WebsocketDebuggerClient extends gdjs.AbstractDebuggerClient {\n _ws: WebSocket | null;\n\n constructor(runtimeGame: RuntimeGame) {\n super(runtimeGame);\n this._ws = null;\n if (typeof WebSocket === 'undefined') {\n logger.log(\"WebSocket is not defined, the debugger won't work.\");\n return;\n }\n\n const that = this;\n try {\n // Find the WebSocket server to connect to using the address that was stored\n // in the options by the editor. If not, try the default address, though it's unlikely\n // to work - which is ok, the game can run without a debugger server.\n const runtimeGameOptions = runtimeGame.getAdditionalOptions();\n const address =\n (runtimeGameOptions &&\n runtimeGameOptions.websocketDebuggerServerAddress) ||\n '127.0.0.1';\n const port =\n (runtimeGameOptions &&\n runtimeGameOptions.websocketDebuggerServerPort) ||\n '3030';\n this._ws = new WebSocket('ws://' + address + ':' + port + '/');\n } catch {\n try {\n this._ws = new WebSocket(\n (location.protocol === 'https:' ? 'wss://' : 'ws://') +\n location.hostname +\n ':' +\n location.port +\n '/'\n );\n } catch {\n try {\n this._ws = new WebSocket('ws://localhost:3030/');\n } catch {\n logger.log(\n \"WebSocket could not initialize, debugger/hot-reload won't work.\"\n );\n return;\n }\n }\n }\n this._ws.onopen = function open() {\n logger.info('Debugger connection open');\n };\n this._ws.onclose = function close() {\n logger.info('Debugger connection closed');\n };\n this._ws.onerror = function errored(error) {\n logger.warn('Debugger client error:', error);\n };\n this._ws.onmessage = function incoming(message) {\n let data: any = null;\n try {\n data = JSON.parse(message.data);\n } catch (error) {\n logger.info('Debugger received a badly formatted message:', error);\n }\n that.handleCommand(data);\n };\n }\n\n private hasLoggedError: boolean = false;\n protected _sendMessage(message: string) {\n if (!this._ws) {\n // The error can be logged only once, since logger.warn will call this function again,\n // leading to an endless recursive call if we do not call it only once.\n if (!this.hasLoggedError) {\n this.hasLoggedError = true;\n logger.warn('No connection to debugger opened to send a message.');\n }\n return;\n }\n if (this._ws.readyState ===
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,+BAMxB,eAAsC,GAAK,sBAAuB,CAGvE,YAAY,EAA0B,CACpC,MAAM,GA8DA,oBAA0B,GA5DhC,GADA,KAAK,IAAM,KACP,MAAO,YAAc,YAAa,CACpC,EAAO,IAAI,sDACX,OAGF,KAAM,GAAO,KACb,GAAI,CAIF,KAAM,GAAqB,EAAY,uBACjC,EACH,GACC,EAAmB,gCACrB,YACI,EACH,GACC,EAAmB,6BACrB,OACF,KAAK,IAAM,GAAI,WAAU,QAAU,EAAU,IAAM,EAAO,UAC1D,CACA,GAAI,CACF,KAAK,IAAM,GAAI,WACZ,UAAS,WAAa,SAAW,SAAW,SAC3C,SAAS,SACT,IACA,SAAS,KACT,UAEJ,CACA,GAAI,CACF,KAAK,IAAM,GAAI,WAAU,6BACzB,CACA,EAAO,IACL,mEAEF,SAIN,KAAK,IAAI,OAAS,UAAgB,CAChC,EAAO,KAAK,6BAEd,KAAK,IAAI,QAAU,UAAiB,CAClC,EAAO,KAAK,+BAEd,KAAK,IAAI,QAAU,SAAiB,EAAO,CACzC,EAAO,KAAK,yBAA0B,IAExC,KAAK,IAAI,UAAY,SAAkB,EAAS,CAC9C,GAAI,GAAY,KAChB,GAAI,CACF,EAAO,KAAK,MAAM,EAAQ,YACnB,EAAP,CACA,EAAO,KAAK,+CAAgD,GAE9D,EAAK,cAAc,IAKb,aAAa,EAAiB,CACtC,GAAI,CAAC,KAAK,IAAK,CAGb,AAAK,KAAK,gBACR,MAAK,eAAiB,GACtB,EAAO,KAAK,wDAEd,OAEF,AAAI,KAAK,IAAI,aAAe,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n const logger = new gdjs.Logger('Debugger client (websocket)');\n\n /**\n * This debugger client connects to a websocket server, exchanging\n * and receiving messages with this server.\n */\n export class WebsocketDebuggerClient extends gdjs.AbstractDebuggerClient {\n _ws: WebSocket | null;\n\n constructor(runtimeGame: RuntimeGame) {\n super(runtimeGame);\n this._ws = null;\n if (typeof WebSocket === 'undefined') {\n logger.log(\"WebSocket is not defined, the debugger won't work.\");\n return;\n }\n\n const that = this;\n try {\n // Find the WebSocket server to connect to using the address that was stored\n // in the options by the editor. If not, try the default address, though it's unlikely\n // to work - which is ok, the game can run without a debugger server.\n const runtimeGameOptions = runtimeGame.getAdditionalOptions();\n const address =\n (runtimeGameOptions &&\n runtimeGameOptions.websocketDebuggerServerAddress) ||\n '127.0.0.1';\n const port =\n (runtimeGameOptions &&\n runtimeGameOptions.websocketDebuggerServerPort) ||\n '3030';\n this._ws = new WebSocket('ws://' + address + ':' + port + '/');\n } catch {\n try {\n this._ws = new WebSocket(\n (location.protocol === 'https:' ? 'wss://' : 'ws://') +\n location.hostname +\n ':' +\n location.port +\n '/'\n );\n } catch {\n try {\n this._ws = new WebSocket('ws://localhost:3030/');\n } catch {\n logger.log(\n \"WebSocket could not initialize, debugger/hot-reload won't work.\"\n );\n return;\n }\n }\n }\n this._ws.onopen = function open() {\n logger.info('Debugger connection open');\n };\n this._ws.onclose = function close() {\n logger.info('Debugger connection closed');\n };\n this._ws.onerror = function errored(error) {\n logger.warn('Debugger client error:', error);\n };\n this._ws.onmessage = function incoming(message) {\n let data: any = null;\n try {\n data = JSON.parse(message.data);\n } catch (error) {\n logger.info('Debugger received a badly formatted message:', error);\n }\n that.handleCommand(data);\n };\n }\n\n private hasLoggedError: boolean = false;\n protected _sendMessage(message: string) {\n if (!this._ws) {\n // The error can be logged only once, since logger.warn will call this function again,\n // leading to an endless recursive call if we do not call it only once.\n if (!this.hasLoggedError) {\n this.hasLoggedError = true;\n logger.warn('No connection to debugger opened to send a message.');\n }\n return;\n }\n if (this._ws.readyState === WebSocket.OPEN) this._ws.send(message);\n }\n }\n\n //Register the class to let the engine use it.\n // @ts-ignore\n export const DebuggerClient = WebsocketDebuggerClient;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,+BAMxB,eAAsC,GAAK,sBAAuB,CAGvE,YAAY,EAA0B,CACpC,MAAM,GA8DA,oBAA0B,GA5DhC,GADA,KAAK,IAAM,KACP,MAAO,YAAc,YAAa,CACpC,EAAO,IAAI,sDACX,OAGF,KAAM,GAAO,KACb,GAAI,CAIF,KAAM,GAAqB,EAAY,uBACjC,EACH,GACC,EAAmB,gCACrB,YACI,EACH,GACC,EAAmB,6BACrB,OACF,KAAK,IAAM,GAAI,WAAU,QAAU,EAAU,IAAM,EAAO,UAC1D,CACA,GAAI,CACF,KAAK,IAAM,GAAI,WACZ,UAAS,WAAa,SAAW,SAAW,SAC3C,SAAS,SACT,IACA,SAAS,KACT,UAEJ,CACA,GAAI,CACF,KAAK,IAAM,GAAI,WAAU,6BACzB,CACA,EAAO,IACL,mEAEF,SAIN,KAAK,IAAI,OAAS,UAAgB,CAChC,EAAO,KAAK,6BAEd,KAAK,IAAI,QAAU,UAAiB,CAClC,EAAO,KAAK,+BAEd,KAAK,IAAI,QAAU,SAAiB,EAAO,CACzC,EAAO,KAAK,yBAA0B,IAExC,KAAK,IAAI,UAAY,SAAkB,EAAS,CAC9C,GAAI,GAAY,KAChB,GAAI,CACF,EAAO,KAAK,MAAM,EAAQ,YACnB,EAAP,CACA,EAAO,KAAK,+CAAgD,GAE9D,EAAK,cAAc,IAKb,aAAa,EAAiB,CACtC,GAAI,CAAC,KAAK,IAAK,CAGb,AAAK,KAAK,gBACR,MAAK,eAAiB,GACtB,EAAO,KAAK,wDAEd,OAEF,AAAI,KAAK,IAAI,aAAe,UAAU,MAAM,KAAK,IAAI,KAAK,IA7EvD,EAAM,0BAmFA,iBAAiB,IA1FtB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(u){let
|
|
1
|
+
var gdjs;(function(u){let d;(function(g){let p;(function(r){r.sendAsyncRequest=function(e,s,i,c,a,o){const n=t=>{t instanceof ProgressEvent&&t.currentTarget&&t.currentTarget instanceof XMLHttpRequest&&t.currentTarget.status===0?o.setString("REQUEST_NOT_SENT"):o.setString(""+t)};try{const t=new XMLHttpRequest;t.onerror=n,t.ontimeout=n,t.onabort=n,t.onreadystatechange=()=>{t.readyState===XMLHttpRequest.DONE&&(t.status>=400&&n(""+t.status),a.setString(t.responseText))},t.open(i,e),t.setRequestHeader("Content-Type",c===""?"application/x-www-form-urlencoded":c),t.send(s)}catch(t){n(t)}},r.sendAwaitableAsyncRequest=(e,s,i,c,a,o)=>new u.PromiseTask(fetch(e,{body:i!=="GET"?s:void 0,method:i,headers:{"Content-Type":c||"application/x-www-form-urlencoded"}}).then(async n=>{const t=await n.text();n.status>=400&&o.setString(""+n.status),a.setString(t)},n=>{o.setString(""+n)}));const b=e=>new Promise(s=>setTimeout(s,e));r.retryIfFailed=async({times:e,delayInMs:s},i)=>{let c=0,a=null;for(;c<e;){c++,a=null;try{return await i()}catch(o){s&&await b(s),a=o}}throw a},r.sendDeprecatedSynchronousRequest=function(e,s,i,c,a,o){try{let n;if(typeof XMLHttpRequest!="undefined")n=new XMLHttpRequest;else{const t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"];for(let l=0,f=t.length;l<f;l++)try{n=new ActiveXObject(t[l]);break}catch{}}if(n===void 0)return;n.open(c,e+s,!1),n.setRequestHeader("Content-Type",a===""?"application/x-www-form-urlencoded":a),n.send(i),o.setString(n.responseText)}catch{}},r.enableMetrics=function(e,s){e.getGame().enableMetrics(s)},r.variableStructureToJSON=function(e){return JSON.stringify(e.toJSObject())},r.objectVariableStructureToJSON=function(e,s){return JSON.stringify(s.toJSObject())},r._objectToVariable=function(e,s){s.fromJSObject(e)},r.jsonToVariableStructure=function(e,s){s.fromJSON(e)},r.jsonToObjectVariableStructure=function(e,s,i){i.fromJSON(e)}})(p=g.network||(g.network={}))})(d=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=networktools.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../GDevelop/GDJS/Runtime/events-tools/networktools.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n export namespace evtTools {\n export namespace network {\n /**\n * Send an asynchronous request to the specified URL, with the specified (text)\n * body, method and contentType (defaults to `application/x-www-form-urlencoded`).\n * The result is stored in the specified response variable. Any error is stored in\n * the specified error variable.\n *\n * @param url The URL to send the request to.\n * @param body The content to be sent.\n * @param method The method to use (\"GET\", \"POST\", \"PUT\", \"HEAD\", \"DELETE\", \"PATCH\", \"OPTIONS\")\n * @param contentType The content type. Defaults to `application/x-www-form-urlencoded` if empty.\n * @param responseVar The variable where to store the response text.\n * @param errorVar The variable where to store the error message or status code (if status >= 400).\n */\n export const sendAsyncRequest = function (\n url: string,\n body: string,\n method: string,\n contentType: string,\n responseVar: gdjs.Variable,\n errorVar: gdjs.Variable\n ) {\n const onError = (err) => {\n if (\n err instanceof ProgressEvent &&\n err.currentTarget &&\n err.currentTarget instanceof XMLHttpRequest &&\n err.currentTarget.status === 0\n ) {\n errorVar.setString('REQUEST_NOT_SENT');\n } else {\n errorVar.setString('' + err);\n }\n };\n try {\n const request = new XMLHttpRequest();\n request.onerror = onError;\n request.ontimeout = onError;\n request.onabort = onError;\n request.onreadystatechange = () => {\n
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CAcE,AAAM,mBAAmB,SAC9B,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAM,GAAU,AAAC,GAAQ,CACvB,AACE,YAAe,gBACf,EAAI,eACJ,EAAI,wBAAyB,iBAC7B,EAAI,cAAc,SAAW,EAE7B,EAAS,UAAU,oBAEnB,EAAS,UAAU,GAAK,IAG5B,GAAI,CACF,KAAM,GAAU,GAAI,gBACpB,EAAQ,QAAU,EAClB,EAAQ,UAAY,EACpB,EAAQ,QAAU,EAClB,EAAQ,mBAAqB,IAAM,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n export namespace evtTools {\n export namespace network {\n /**\n * Send an asynchronous request to the specified URL, with the specified (text)\n * body, method and contentType (defaults to `application/x-www-form-urlencoded`).\n * The result is stored in the specified response variable. Any error is stored in\n * the specified error variable.\n *\n * @param url The URL to send the request to.\n * @param body The content to be sent.\n * @param method The method to use (\"GET\", \"POST\", \"PUT\", \"HEAD\", \"DELETE\", \"PATCH\", \"OPTIONS\")\n * @param contentType The content type. Defaults to `application/x-www-form-urlencoded` if empty.\n * @param responseVar The variable where to store the response text.\n * @param errorVar The variable where to store the error message or status code (if status >= 400).\n */\n export const sendAsyncRequest = function (\n url: string,\n body: string,\n method: string,\n contentType: string,\n responseVar: gdjs.Variable,\n errorVar: gdjs.Variable\n ) {\n const onError = (err) => {\n if (\n err instanceof ProgressEvent &&\n err.currentTarget &&\n err.currentTarget instanceof XMLHttpRequest &&\n err.currentTarget.status === 0\n ) {\n errorVar.setString('REQUEST_NOT_SENT');\n } else {\n errorVar.setString('' + err);\n }\n };\n try {\n const request = new XMLHttpRequest();\n request.onerror = onError;\n request.ontimeout = onError;\n request.onabort = onError;\n request.onreadystatechange = () => {\n if (request.readyState === XMLHttpRequest.DONE) {\n if (request.status >= 400) {\n onError('' + request.status);\n }\n responseVar.setString(request.responseText);\n }\n };\n request.open(method, url);\n request.setRequestHeader(\n 'Content-Type',\n contentType === ''\n ? 'application/x-www-form-urlencoded'\n : contentType\n );\n request.send(body);\n } catch (err) {\n onError(err);\n }\n };\n\n export const sendAwaitableAsyncRequest = (\n url: string,\n body: string,\n method: string,\n contentType: string,\n responseVar: gdjs.Variable,\n errorVar: gdjs.Variable\n ) => {\n return new gdjs.PromiseTask(\n fetch(url, {\n body: method !== 'GET' ? body : undefined,\n method,\n headers: {\n 'Content-Type':\n contentType || 'application/x-www-form-urlencoded',\n },\n }).then(\n async (response) => {\n const result = await response.text();\n if (response.status >= 400) {\n errorVar.setString('' + response.status);\n }\n responseVar.setString(result);\n },\n (error) => {\n errorVar.setString('' + error);\n }\n )\n );\n };\n\n const delay = (ms: number): Promise<void> =>\n new Promise((res) => setTimeout(res, ms));\n\n export const retryIfFailed = async <T>(\n { times, delayInMs }: { times: number; delayInMs?: number },\n functionCalled: () => Promise<T>\n ): Promise<T> => {\n let tries = 0;\n let latestError = null;\n while (tries < times) {\n tries++;\n latestError = null;\n try {\n const latestReturnValue = await functionCalled();\n return latestReturnValue;\n } catch (error) {\n if (delayInMs) await delay(delayInMs);\n latestError = error;\n }\n }\n\n throw latestError;\n };\n /**\n * @deprecated\n */\n export const sendDeprecatedSynchronousRequest = function (\n host,\n uri,\n body,\n method,\n contentType,\n responseVar\n ) {\n try {\n let xhr;\n if (typeof XMLHttpRequest !== 'undefined') {\n xhr = new XMLHttpRequest();\n } else {\n const versions = [\n 'MSXML2.XmlHttp.5.0',\n 'MSXML2.XmlHttp.4.0',\n 'MSXML2.XmlHttp.3.0',\n 'MSXML2.XmlHttp.2.0',\n 'Microsoft.XmlHttp',\n ];\n for (let i = 0, len = versions.length; i < len; i++) {\n try {\n xhr = new ActiveXObject(versions[i]);\n break;\n } catch (e) {}\n }\n }\n\n // end for\n if (xhr === undefined) {\n return;\n }\n xhr.open(method, host + uri, false);\n xhr.setRequestHeader(\n 'Content-Type',\n contentType === ''\n ? 'application/x-www-form-urlencoded'\n : contentType\n );\n xhr.send(body);\n responseVar.setString(xhr.responseText);\n } catch (e) {}\n };\n\n export const enableMetrics = function (\n instanceContainer: gdjs.RuntimeInstanceContainer,\n enable: boolean\n ) {\n instanceContainer.getGame().enableMetrics(enable);\n };\n\n /**\n * Convert a variable to JSON.\n * @param variable The variable to convert to JSON\n * @returns The JSON string representing the variable\n *\n * @deprecated Use `JSON.stringify(variable.toJSObject())` instead.\n */\n export const variableStructureToJSON = function (\n variable: gdjs.Variable\n ): string {\n return JSON.stringify(variable.toJSObject());\n };\n\n /**\n * @deprecated Use `JSON.stringify(variable.toJSObject())` instead.\n */\n export const objectVariableStructureToJSON = function (\n object: gdjs.RuntimeObject | null,\n variable: gdjs.Variable\n ): string {\n return JSON.stringify(variable.toJSObject());\n };\n\n /**\n * @deprecated Use `variable.fromJSObject` instead.\n */\n export const _objectToVariable = function (\n obj: any,\n variable: gdjs.Variable\n ) {\n variable.fromJSObject(obj);\n };\n\n /**\n * Parse the given JSON and fill the content of the variable with it.\n *\n * @param jsonStr The JSON string\n * @param variable The variable where to put the parsed JSON\n * @returns true if JSON was properly parsed\n *\n * @deprecated Use `variable.fromJSON` instead.\n */\n export const jsonToVariableStructure = function (\n jsonStr: string,\n variable: gdjs.Variable\n ): void {\n variable.fromJSON(jsonStr);\n };\n\n /**\n * @deprecated Use `variable.fromJSON` instead.\n */\n export const jsonToObjectVariableStructure = function (\n jsonStr: string,\n object: gdjs.RuntimeObject | null,\n variable: gdjs.Variable\n ) {\n variable.fromJSON(jsonStr);\n };\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CAcE,AAAM,mBAAmB,SAC9B,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAM,GAAU,AAAC,GAAQ,CACvB,AACE,YAAe,gBACf,EAAI,eACJ,EAAI,wBAAyB,iBAC7B,EAAI,cAAc,SAAW,EAE7B,EAAS,UAAU,oBAEnB,EAAS,UAAU,GAAK,IAG5B,GAAI,CACF,KAAM,GAAU,GAAI,gBACpB,EAAQ,QAAU,EAClB,EAAQ,UAAY,EACpB,EAAQ,QAAU,EAClB,EAAQ,mBAAqB,IAAM,CACjC,AAAI,EAAQ,aAAe,eAAe,MACpC,GAAQ,QAAU,KACpB,EAAQ,GAAK,E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AAc,IAU/B,0BAA0B,SACrC,EACQ,CACR,MAAO,MAAK,UAAU,EAAS,eAMpB,gCAAgC,SAC3C,EACA,EACQ,CACR,MAAO,MAAK,UAAU,EAAS,eAMpB,oBAAoB,SAC/B,EACA,EACA,CACA,EAAS,aAAa,IAYX,0BAA0B,SACrC,EACA,EACM,CACN,EAAS,SAAS,IAMP,gCAAgC,SAC3C,EACA,EACA,EACA,CACA,EAAS,SAAS,MAjOL,+BADF,iCADT",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../GDevelop/GDJS/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Font manager');\n\n const resourceKinds: Array<ResourceKind> = ['font'];\n\n /**\n * FontFaceObserverFontManager loads fonts (using `FontFace` or `fontfaceobserver` library)\n * from the game resources (see `loadFonts`), and allow to access to\n * the font families of the loaded fonts during the game (see `getFontFamily`).\n */\n export class FontFaceObserverFontManager implements gdjs.ResourceManager {\n _resourceLoader: gdjs.ResourceLoader;\n // Associate font resource names to the loaded font family\n _loadedFontFamily = new gdjs.ResourceCache<string>();\n _loadedFontFamilySet = new Set<string>();\n\n /**\n * @param
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,gBAEzB,EAAqC,CAAC,QAOrC,OAAkE,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Font manager');\n\n const resourceKinds: Array<ResourceKind> = ['font'];\n\n /**\n * FontFaceObserverFontManager loads fonts (using `FontFace` or `fontfaceobserver` library)\n * from the game resources (see `loadFonts`), and allow to access to\n * the font families of the loaded fonts during the game (see `getFontFamily`).\n */\n export class FontFaceObserverFontManager implements gdjs.ResourceManager {\n _resourceLoader: gdjs.ResourceLoader;\n // Associate font resource names to the loaded font family\n _loadedFontFamily = new gdjs.ResourceCache<string>();\n _loadedFontFamilySet = new Set<string>();\n\n /**\n * @param resourceLoader The resources loader of the game.\n */\n constructor(resourceLoader: gdjs.ResourceLoader) {\n this._resourceLoader = resourceLoader;\n }\n\n getResourceKinds(): ResourceKind[] {\n return resourceKinds;\n }\n\n /**\n * Return the font family associated to the specified font resource name.\n * The font resource must have been loaded before. If that's not the case,\n * a default font family will be returned (\"Arial\").\n *\n * @param resourceName The name of the resource to get.\n * @returns The font family to be used for this font resource,\n * or \"Arial\" if not loaded.\n */\n getFontFamily(resourceName: string): string {\n return this._loadedFontFamily.getFromName(resourceName) || 'Arial';\n }\n\n /**\n * Return the font file associated to the specified font resource name.\n * The font resource must have been loaded before. If that's not the case,\n * the resource name will be returned (to\n * keep compatibility with GDevelop 5.0-beta56 and previous).\n *\n * Should only be useful for renderers running on a non HTML5/non browser environment.\n *\n * @param resourceName The name of the resource to get.\n * @returns The file of the font resource.\n */\n getFontFile(resourceName: string): string {\n const resource = this._resourceLoader.getResource(resourceName);\n return resource ? resource.file || '' : resourceName;\n }\n\n /**\n * Return the font family to use for a given filename.\n * Each filename is guaranteed to have a unique font family. You should not rely\n * on the font family formatting (consider it as an \"opaque string\") - it's slugified\n * (no spaces, no dots, no non-alphanumeric characters) to avoid issues when using the\n * font family in various contexts.\n *\n * @param filename The filename of the font.\n * @returns The font family to be used for this font resource.\n */\n _getFontFamilyFromFilename(resource: ResourceData): string {\n // Replaces all non-alphanumeric characters with dashes to ensure no issues when\n // referring to this font family (see https://github.com/4ian/GDevelop/issues/1521).\n let baseSlugifiedName =\n 'gdjs_font_' + resource.file.toLowerCase().replace(/[^\\w]/gi, '-');\n\n // Ensure the generated font family is unique.\n const slugifiedName = baseSlugifiedName;\n let uniqueSuffix = 2;\n while (this._loadedFontFamilySet.has(baseSlugifiedName)) {\n baseSlugifiedName = baseSlugifiedName + '-' + uniqueSuffix;\n uniqueSuffix++;\n }\n return slugifiedName;\n }\n\n /**\n * Load the font at the given `src` location (relative to the project), giving\n * it the specified `fontFamily` name.\n *\n * This uses FontFace (if supported) or @font-face + FontFaceObserver\n * to load a font from an url and be notified when loading is done (or failed).\n *\n * @param fontFamily The font\n * @returns The font family to be used for this font resource.\n */\n private _loadFont(fontFamily: string, src: string): Promise<void> {\n const descriptors = {};\n const srcWithUrl = 'url(' + encodeURI(src) + ')';\n\n // @ts-ignore\n if (typeof FontFace !== 'undefined') {\n // Load the given font using CSS Font Loading API.\n return fetch(this._resourceLoader.getFullUrl(src), {\n credentials: this._resourceLoader.checkIfCredentialsRequired(src)\n ? // Any resource stored on the GDevelop Cloud buckets needs the \"credentials\" of the user,\n // i.e: its gdevelop.io cookie, to be passed.\n 'include'\n : // For other resources, use \"same-origin\" as done by default by fetch.\n 'same-origin',\n })\n .then((response) => {\n if (!response.ok) {\n const errorMessage =\n 'Unable to fetch ' +\n src +\n ' to be loaded as a font. HTTP status is: ' +\n response.status +\n '.';\n logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n return response.arrayBuffer();\n })\n .then((arrayBuffer) => {\n // @ts-ignore\n const fontFace = new FontFace(fontFamily, arrayBuffer, descriptors);\n\n // @ts-ignore\n document.fonts.add(fontFace);\n });\n } else {\n // TODO: this method of loading font should be removed as old and not allowing\n // to handle loading with credentials. All moderns and not-so-modern browsers\n // that we support also support FontFace API.\n\n // Add @font-face and use FontFaceObserver to be notified when the\n // font is ready.\n const newStyle = document.createElement('style');\n newStyle.appendChild(\n document.createTextNode(\n \"@font-face { font-family: '\" +\n fontFamily +\n \"'; src: \" +\n srcWithUrl +\n '; }'\n )\n );\n document.head.appendChild(newStyle);\n\n // @ts-ignore\n return new FontFaceObserver(fontFamily, descriptors).load();\n }\n }\n\n async processResource(resourceName: string): Promise<void> {\n // Do nothing because fonts are light enough to be parsed in background.\n }\n\n /**\n * Load the specified resources, so that fonts are loaded and can then be\n * used by using the font family returned by getFontFamily.\n * @param resourceName The name of the resource to load.\n */\n async loadResource(resourceName: string): Promise<void> {\n const resource = this._resourceLoader.getResource(resourceName);\n if (!resource) {\n logger.warn('Unable to find font for resource \"' + resourceName + '\".');\n return;\n }\n\n if (this._loadedFontFamily.get(resource)) {\n return;\n }\n const file = resource.file;\n if (!file) {\n return;\n }\n\n const fontFamily = this._getFontFamilyFromFilename(resource);\n // Cache the result to avoid collision with a similar slugified name for another filename.\n this._loadedFontFamily.set(resource, fontFamily);\n this._loadedFontFamilySet.add(fontFamily);\n try {\n await this._loadFont(fontFamily, file);\n } catch (error) {\n logger.error(\n 'Error loading font resource \"' +\n resource.name +\n '\" (file: ' +\n file +\n '): ' +\n (error.message || 'Unknown error')\n );\n }\n }\n\n /**\n * To be called when the game is disposed.\n * Clear caches of loaded font families.\n */\n dispose(): void {\n this._loadedFontFamily.clear();\n this._loadedFontFamilySet.clear();\n }\n }\n\n //Register the class to let the engine use it.\n export type FontManager = FontFaceObserverFontManager;\n export const FontManager = FontFaceObserverFontManager;\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,gBAEzB,EAAqC,CAAC,QAOrC,OAAkE,CASvE,YAAY,EAAqC,CANjD,uBAAoB,GAAI,GAAK,cAC7B,0BAAuB,GAAI,KAMzB,KAAK,gBAAkB,EAGzB,kBAAmC,CACjC,MAAO,GAYT,cAAc,EAA8B,CAC1C,MAAO,MAAK,kBAAkB,YAAY,IAAiB,QAc7D,YAAY,EAA8B,CACxC,KAAM,GAAW,KAAK,gBAAgB,YAAY,GAClD,MAAO,GAAW,EAAS,MAAQ,GAAK,EAa1C,2BAA2B,EAAgC,CAGzD,G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