gdcore-tools 2.0.0-beta2 → 2.0.0-beta4
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/AsyncTasksManager.js +2 -2
- package/dist/Runtime/AsyncTasksManager.js.map +2 -2
- package/dist/Runtime/Cordova/config.xml +23 -1
- package/dist/Runtime/Cordova/www/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Cordova/www/index.html +1 -1
- package/dist/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject2D.js +2 -0
- package/dist/Runtime/CustomRuntimeObject2D.js.map +7 -0
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
- package/dist/Runtime/Electron/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Electron/package.json +3 -0
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
- package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js +1 -1
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BloomEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BloomEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +7 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +7 -0
- package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
- package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
- package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExposureEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/ExposureEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
- package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +56 -24
- package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
- package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
- 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 +11 -10
- package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
- package/dist/Runtime/Extensions/AnchorBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/BBText/JsExtension.js +20 -11
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/JsExtension.js +2 -8
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/CMakeLists.txt +35 -0
- package/dist/Runtime/Extensions/CMakeUtils.txt +81 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/DialogueTree/bondage.js/version.txt +5 -0
- package/dist/Runtime/Extensions/DraggableBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js +1 -1
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
- package/dist/Runtime/Extensions/FileSystem/JsExtension.js +22 -0
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js +1 -1
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/A_firebasejs/NOTICE.txt +6 -0
- package/dist/Runtime/Extensions/Inventory/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +13 -4
- package/dist/Runtime/Extensions/Leaderboards/JsExtension.js +42 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/LinkedObjects/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js +1 -1
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +1130 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js +10 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js.map +1 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +509 -0
- package/dist/Runtime/Extensions/P2P/A_peer.js +8 -2
- package/dist/Runtime/Extensions/P2P/A_peer.js.map +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js.map +2 -2
- package/dist/Runtime/Extensions/P2P/JsExtension.js +27 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +47 -4
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PhysicsBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/JsExtension.js +6 -3
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js +4 -4
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Shopify/CMakeLists.txt +26 -0
- package/dist/Runtime/Extensions/Spine/CMakeLists.txt +20 -0
- package/dist/Runtime/Extensions/Spine/JsExtension.js +11 -2
- 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/pixi-spine/Spine-Runtimes-License-Agreement.txt +11 -0
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js +5 -3
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SystemInfo/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextEntryObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextInput/JsExtension.js +3 -10
- 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 +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/JsExtension.js +834 -23
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.d.ts +2 -0
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts +12 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +119 -5
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts +25 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +16 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +2 -0
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +7 -0
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Video/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
- package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
- package/dist/Runtime/SpriteAnimator.js +2 -0
- package/dist/Runtime/SpriteAnimator.js.map +7 -0
- package/dist/Runtime/debugger-client/hot-reloader.js +1 -1
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/events-tools/objecttools.js +1 -1
- package/dist/Runtime/events-tools/objecttools.js.map +2 -2
- package/dist/Runtime/events-tools/runtimescenetools.js +1 -1
- package/dist/Runtime/events-tools/runtimescenetools.js.map +2 -2
- package/dist/Runtime/force.js +1 -1
- package/dist/Runtime/force.js.map +2 -2
- package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +1 -1
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +2 -0
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +7 -0
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js +1 -1
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
- 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/spriteruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/polygon.js +1 -1
- package/dist/Runtime/polygon.js.map +2 -2
- package/dist/Runtime/runtimebehavior.js +1 -1
- package/dist/Runtime/runtimebehavior.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 +1 -1
- package/dist/Runtime/runtimescene.js.map +2 -2
- package/dist/Runtime/scenestack.js +1 -1
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js +1 -1
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/timer.js +1 -1
- package/dist/Runtime/timer.js.map +2 -2
- package/dist/Runtime/types/project-data.d.ts +115 -0
- package/dist/Runtime/variable.js +1 -1
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js +1 -1
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +2 -1
- package/dist/lib/libGD.wasm +0 -0
- package/dist/loaders.cjs +2 -1
- package/gd.d.ts +217 -223
- package/package.json +15 -7
- package/src/index.js +2 -0
- package/src/open_project.js +1 -1
- package/types/index.d.ts +2 -2
- package/types/open_project.d.ts +5 -5
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js.map +0 -7
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js +0 -2
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/polygon.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 type CollisionTestResult = {\n collision: boolean;\n move_axis: FloatPoint;\n };\n\n export type RaycastTestResult = {\n collision: boolean;\n closeX: float;\n closeY: float;\n closeSqDist: float;\n farX: float;\n farY: float;\n farSqDist: float;\n };\n\n /** Build a new object to store collision test results. */\n const makeNewCollisionTestResult = (): CollisionTestResult => {\n return { collision: false, move_axis: [0, 0] };\n };\n\n /** Build a new object to store raycast test results. */\n const makeNewRaycastTestResult = (): RaycastTestResult => {\n return {\n collision: false,\n closeX: 0,\n closeY: 0,\n closeSqDist: 0,\n farX: 0,\n farY: 0,\n farSqDist: 0,\n };\n };\n\n /**\n * Arrays and data structure that are (re)used by Polygon.collisionTest to\n * avoid any allocation.\n */\n const collisionTestStatics: {\n minMaxA: FloatPoint;\n minMaxB: FloatPoint;\n edge: FloatPoint;\n axis: FloatPoint;\n move_axis: FloatPoint;\n result: CollisionTestResult;\n } = {\n minMaxA: [0, 0],\n minMaxB: [0, 0],\n edge: [0, 0],\n axis: [0, 0],\n move_axis: [0, 0],\n result: makeNewCollisionTestResult(),\n };\n\n /**\n * Arrays and data structure that are (re)used by Polygon.raycastTest to\n * avoid any allocation.\n */\n const raycastTestStatics: {\n p: FloatPoint;\n q: FloatPoint;\n r: FloatPoint;\n s: FloatPoint;\n deltaQP: FloatPoint;\n axis: FloatPoint;\n result: RaycastTestResult;\n } = {\n p: [0, 0],\n q: [0, 0],\n r: [0, 0],\n s: [0, 0],\n deltaQP: [0, 0],\n axis: [0, 0],\n result: makeNewRaycastTestResult(),\n };\n\n /**\n * Polygon represents a polygon which can be used to create collisions masks for RuntimeObject.\n */\n export class Polygon {\n /**\n * The vertices of the polygon\n */\n vertices: Array<FloatPoint> = [];\n\n /**\n * The edges of the polygon. This property is only valid after calling\n * computeEdges, and remains valid until vertices are modified.\n */\n edges: Array<FloatPoint> = [];\n\n /**\n * The center of the polygon. This property is only valid after calling\n * computeCenter, and remains valid until vertices are modified.\n */\n center: FloatPoint = [0, 0];\n\n move(x: float, y: float): void {\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n this.vertices[i][0] += x;\n this.vertices[i][1] += y;\n }\n }\n\n rotate(angle: float): void {\n let t: float = 0;\n\n //We want a clockwise rotation\n const cosa = Math.cos(-angle);\n const sina = Math.sin(-angle);\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n t = this.vertices[i][0];\n this.vertices[i][0] = t * cosa + this.vertices[i][1] * sina;\n this.vertices[i][1] = -t * sina + this.vertices[i][1] * cosa;\n }\n }\n\n computeEdges(): void {\n //Ensure edge array has the right size (and avoid recreating an edge array).\n while (this.edges.length < this.vertices.length) {\n this.edges.push([0, 0]);\n }\n if (this.edges.length != this.vertices.length) {\n this.edges.length = this.vertices.length;\n }\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n const v1 = this.vertices[i];\n const v2 = i + 1 >= len ? this.vertices[0] : this.vertices[i + 1];\n this.edges[i][0] = v2[0] - v1[0];\n this.edges[i][1] = v2[1] - v1[1];\n }\n }\n\n isConvex(): boolean {\n this.computeEdges();\n const edgesLen = this.edges.length;\n if (edgesLen < 3) {\n return false;\n }\n const zProductIsPositive =\n this.edges[0][0] * this.edges[0 + 1][1] -\n this.edges[0][1] * this.edges[0 + 1][0] >\n 0;\n for (let i = 1; i < edgesLen - 1; ++i) {\n const zCrossProduct =\n this.edges[i][0] * this.edges[i + 1][1] -\n this.edges[i][1] * this.edges[i + 1][0];\n if (zCrossProduct > 0 !== zProductIsPositive) {\n return false;\n }\n }\n const lastZCrossProduct =\n this.edges[edgesLen - 1][0] * this.edges[0][1] -\n this.edges[edgesLen - 1][1] * this.edges[0][0];\n if (lastZCrossProduct > 0 !== zProductIsPositive) {\n return false;\n }\n return true;\n }\n\n computeCenter(): FloatPoint {\n this.center[0] = 0;\n this.center[1] = 0;\n const len = this.vertices.length;\n for (let i = 0; i < len; ++i) {\n this.center[0] += this.vertices[i][0];\n this.center[1] += this.vertices[i][1];\n }\n this.center[0] /= len;\n this.center[1] /= len;\n return this.center;\n }\n\n static createRectangle(width: float, height: float): gdjs.Polygon {\n const rect = new gdjs.Polygon();\n rect.vertices.push([-width / 2.0, -height / 2.0]);\n rect.vertices.push([+width / 2.0, -height / 2.0]);\n rect.vertices.push([+width / 2.0, +height / 2.0]);\n rect.vertices.push([-width / 2.0, +height / 2.0]);\n return rect;\n }\n\n /**\n * Do a collision test between two polygons.\n * Please note that polygons must *convexes*!\n *\n * You can read the result but do not keep a reference to it as it's a static object\n * reused between function calls. If you need to keep the results, use `copyCollisionTestResult`.\n *\n * Uses <a href=\"http://en.wikipedia.org/wiki/Hyperplane_separation_theorem\">Separating Axis Theorem </a>.<br>\n * Based on <a href=\"http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection\">this</a>\n * and <a href=\"http://stackoverflow.com/questions/5742329/problem-with-collision-response-sat\">this</a> article.\n *\n * @return A collision result. `collision` property is equal to true if polygons are overlapping. Do NOT keep a reference to this.\n * @param p1 The first polygon\n * @param p2 The second polygon\n * @param ignoreTouchingEdges If true, then edges that are touching each other, without the polygons actually overlapping, won't be considered in collision.\n */\n static collisionTest(\n p1: gdjs.Polygon,\n p2: gdjs.Polygon,\n ignoreTouchingEdges: boolean\n ): CollisionTestResult {\n //Algorithm core :\n p1.computeEdges();\n p2.computeEdges();\n let edge = collisionTestStatics.edge;\n const move_axis = collisionTestStatics.move_axis;\n const result = collisionTestStatics.result;\n let minDist = Number.MAX_VALUE;\n edge[0] = 0;\n edge[1] = 0;\n edge[0] = 0;\n edge[1] = 0;\n result.collision = false;\n result.move_axis[0] = 0;\n result.move_axis[1] = 0;\n\n //Iterate over all the edges composing the polygons\n for (\n let i = 0, len1 = p1.vertices.length, len2 = p2.vertices.length;\n i < len1 + len2;\n i++\n ) {\n if (i < len1) {\n // or <=\n edge = p1.edges[i];\n } else {\n edge = p2.edges[i - len1];\n }\n const axis = collisionTestStatics.axis;\n\n //Get the axis to which polygons will be projected\n axis[0] = -edge[1];\n axis[1] = edge[0];\n Polygon.normalise(axis);\n const minMaxA = collisionTestStatics.minMaxA;\n const minMaxB = collisionTestStatics.minMaxB;\n Polygon.project(\n axis,\n p1,\n //Do projection on the axis.\n minMaxA\n );\n Polygon.project(axis, p2, minMaxB);\n\n //If the projections on the axis do not overlap, then their is no collision\n const dist = Polygon.distance(\n minMaxA[0],\n minMaxA[1],\n minMaxB[0],\n minMaxB[1]\n );\n if (dist > 0 || (dist === 0 && ignoreTouchingEdges)) {\n result.collision = false;\n result.move_axis[0] = 0;\n result.move_axis[1] = 0;\n return result;\n }\n const absDist = Math.abs(dist);\n if (absDist < minDist) {\n minDist = absDist;\n move_axis[0] = axis[0];\n move_axis[1] = axis[1];\n }\n }\n result.collision = true;\n\n //Ensure move axis is correctly oriented.\n const p1Center = p1.computeCenter();\n const p2Center = p2.computeCenter();\n const d: FloatPoint = [\n p1Center[0] - p2Center[0],\n p1Center[1] - p2Center[1],\n ];\n if (Polygon.dotProduct(d, move_axis) < 0) {\n move_axis[0] = -move_axis[0];\n move_axis[1] = -move_axis[1];\n }\n\n //Add the magnitude to the move axis.\n result.move_axis[0] = move_axis[0] * minDist;\n result.move_axis[1] = move_axis[1] * minDist;\n return result;\n }\n\n /**\n * Do a raycast test.\n * Please note that the polygon must be **convex**!\n *\n * You can read the result but do not keep a reference to it as it's a static object\n * reused between function calls. If you need to keep the results, use `copyRaycastTestResult`.\n *\n * For some theory, check <a href=\"https://www.codeproject.com/Tips/862988/Find-the-Intersection-Point-of-Two-Line-Segments\">Find the Intersection Point of Two Line Segments</a>.\n *\n * @param poly The polygon to test\n * @param startX The raycast start point X\n * @param startY The raycast start point Y\n * @param endX The raycast end point X\n * @param endY The raycast end point Y\n * @return A raycast result with the contact points and distances. Do NOT keep a reference to this.\n */\n static raycastTest(\n poly: gdjs.Polygon,\n startX: float,\n startY: float,\n endX: float,\n endY: float\n ): RaycastTestResult {\n const result = raycastTestStatics.result;\n result.collision = false;\n if (poly.vertices.length < 2) {\n return result;\n }\n poly.computeEdges();\n const p = raycastTestStatics.p;\n const q = raycastTestStatics.q;\n const r = raycastTestStatics.r;\n const s = raycastTestStatics.s;\n let minSqDist = Number.MAX_VALUE;\n\n // Ray segment: p + t*r, with p = start and r = end - start\n p[0] = startX;\n p[1] = startY;\n r[0] = endX - startX;\n r[1] = endY - startY;\n for (let i = 0; i < poly.edges.length; i++) {\n // Edge segment: q + u*s\n q[0] = poly.vertices[i][0];\n q[1] = poly.vertices[i][1];\n s[0] = poly.edges[i][0];\n s[1] = poly.edges[i][1];\n const deltaQP = raycastTestStatics.deltaQP;\n deltaQP[0] = q[0] - p[0];\n deltaQP[1] = q[1] - p[1];\n const crossRS = Polygon.crossProduct(r, s);\n const t = Polygon.crossProduct(deltaQP, s) / crossRS;\n const u = Polygon.crossProduct(deltaQP, r) / crossRS;\n\n // Collinear\n // One point intersection\n if (\n Math.abs(crossRS) <= 0.0001 &&\n Math.abs(Polygon.crossProduct(deltaQP, r)) <= 0.0001\n ) {\n // Project the ray and the edge to work on floats, keeping linearity through t\n const axis = raycastTestStatics.axis;\n axis[0] = r[0];\n axis[1] = r[1];\n Polygon.normalise(axis);\n const rayA = 0;\n const rayB = Polygon.dotProduct(axis, r);\n const edgeA = Polygon.dotProduct(axis, deltaQP);\n const edgeB = Polygon.dotProduct(axis, [\n deltaQP[0] + s[0],\n deltaQP[1] + s[1],\n ]);\n\n // Get overlapping range\n const minOverlap = Math.max(\n Math.min(rayA, rayB),\n Math.min(edgeA, edgeB)\n );\n const maxOverlap = Math.min(\n Math.max(rayA, rayB),\n Math.max(edgeA, edgeB)\n );\n if (minOverlap > maxOverlap) {\n return result;\n }\n result.collision = true;\n\n // Zero distance ray\n if (rayB === 0) {\n result.closeX = startX;\n result.closeY = startY;\n result.closeSqDist = 0;\n result.farX = startX;\n result.farY = startY;\n result.farSqDist = 0;\n }\n const t1 = minOverlap / Math.abs(rayB);\n const t2 = maxOverlap / Math.abs(rayB);\n result.closeX = startX + t1 * r[0];\n result.closeY = startY + t1 * r[1];\n result.closeSqDist = t1 * t1 * (r[0] * r[0] + r[1] * r[1]);\n result.farX = startX + t2 * r[0];\n result.farY = startY + t2 * r[1];\n result.farSqDist = t2 * t2 * (r[0] * r[0] + r[1] * r[1]);\n return result;\n } else {\n if (crossRS !== 0 && 0 <= t && t <= 1 && 0 <= u && u <= 1) {\n const x = p[0] + t * r[0];\n const y = p[1] + t * r[1];\n const sqDist =\n (x - startX) * (x - startX) + (y - startY) * (y - startY);\n if (sqDist < minSqDist) {\n if (!result.collision) {\n result.farX = x;\n result.farY = y;\n result.farSqDist = sqDist;\n }\n minSqDist = sqDist;\n result.closeX = x;\n result.closeY = y;\n result.closeSqDist = sqDist;\n result.collision = true;\n } else {\n result.farX = x;\n result.farY = y;\n result.farSqDist = sqDist;\n }\n }\n }\n }\n return result;\n }\n\n //Tools functions :\n static normalise(v: FloatPoint): void {\n const len = Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n if (len != 0) {\n v[0] /= len;\n v[1] /= len;\n }\n }\n\n static dotProduct(a: FloatPoint, b: FloatPoint): float {\n const dp = a[0] * b[0] + a[1] * b[1];\n return dp;\n }\n\n static crossProduct(a: FloatPoint, b: FloatPoint): float {\n const cp = a[0] * b[1] - a[1] * b[0];\n return cp;\n }\n\n static project(\n axis: FloatPoint,\n p: gdjs.Polygon,\n result: FloatPoint\n ): void {\n let dp = Polygon.dotProduct(axis, p.vertices[0]);\n result[0] = dp;\n result[1] = dp;\n for (let i = 1, len = p.vertices.length; i < len; ++i) {\n dp = Polygon.dotProduct(axis, p.vertices[i]);\n if (dp < result[0]) {\n result[0] = dp;\n } else {\n if (dp > result[1]) {\n result[1] = dp;\n }\n }\n }\n }\n\n static distance(minA: float, maxA: float, minB: float, maxB: float): float {\n if (minA < minB) {\n return minB - maxA;\n } else {\n return minA - maxB;\n }\n }\n\n /**\n * Check if a point is inside a polygon.\n *\n * Uses <a href=\"https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html\">PNPOLY</a> by W. Randolph Franklin.\n *\n * @param poly The polygon to test\n * @param x The point x coordinate\n * @param y The point y coordinate\n * @return true if the point is inside the polygon\n */\n static isPointInside(poly: gdjs.Polygon, x: float, y: float): boolean {\n let inside = false;\n for (\n let i = 0, j = poly.vertices.length - 1;\n i < poly.vertices.length;\n j = i++\n ) {\n let vi = poly.vertices[i];\n let vj = poly.vertices[j];\n if (\n vi[1] > y != vj[1] > y &&\n x < ((vj[0] - vi[0]) * (y - vi[1])) / (vj[1] - vi[1]) + vi[0]\n ) {\n inside = !inside;\n }\n }\n return inside;\n }\n\n /**\n * Copy a `CollisionTestResult` into another one.\n * Use `gdjs.Polygon.makeNewCollisionTestResult()` to build a new\n * destination before copying the existing source inside it.\n */\n static copyCollisionTestResult(\n source: CollisionTestResult,\n dest: CollisionTestResult\n ) {\n dest.collision = source.collision;\n dest.move_axis[0] = source.move_axis[0];\n dest.move_axis[1] = source.move_axis[1];\n }\n\n static makeNewCollisionTestResult = makeNewCollisionTestResult;\n\n /**\n * Copy a `RaycastTestResult` into another one.\n * Use `gdjs.Polygon.makeNewRaycastTestResult()` to build a new\n * destination before copying the existing source inside it.\n */\n static copyRaycastTestResult(\n source: RaycastTestResult,\n dest: RaycastTestResult\n ) {\n dest.collision = source.collision;\n dest.closeX = source.closeX;\n dest.closeY = source.closeY;\n dest.closeSqDist = source.closeSqDist;\n dest.farX = source.farX;\n dest.farY = source.farY;\n dest.farSqDist = source.farSqDist;\n }\n\n static makeNewRaycastTestResult = makeNewRaycastTestResult;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,
|
|
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 type CollisionTestResult = {\n collision: boolean;\n move_axis: FloatPoint;\n };\n\n export type RaycastTestResult = {\n collision: boolean;\n closeX: float;\n closeY: float;\n closeSqDist: float;\n farX: float;\n farY: float;\n farSqDist: float;\n edgeX: float;\n edgeY: float;\n };\n\n /** Build a new object to store collision test results. */\n const makeNewCollisionTestResult = (): CollisionTestResult => {\n return { collision: false, move_axis: [0, 0] };\n };\n\n /** Build a new object to store raycast test results. */\n const makeNewRaycastTestResult = (): RaycastTestResult => {\n return {\n collision: false,\n closeX: 0,\n closeY: 0,\n closeSqDist: 0,\n farX: 0,\n farY: 0,\n farSqDist: 0,\n edgeX: 0,\n edgeY: 0,\n };\n };\n\n /**\n * Arrays and data structure that are (re)used by Polygon.collisionTest to\n * avoid any allocation.\n */\n const collisionTestStatics: {\n minMaxA: FloatPoint;\n minMaxB: FloatPoint;\n edge: FloatPoint;\n axis: FloatPoint;\n move_axis: FloatPoint;\n result: CollisionTestResult;\n } = {\n minMaxA: [0, 0],\n minMaxB: [0, 0],\n edge: [0, 0],\n axis: [0, 0],\n move_axis: [0, 0],\n result: makeNewCollisionTestResult(),\n };\n\n /**\n * Arrays and data structure that are (re)used by Polygon.raycastTest to\n * avoid any allocation.\n */\n const raycastTestStatics: {\n p: FloatPoint;\n q: FloatPoint;\n r: FloatPoint;\n s: FloatPoint;\n deltaQP: FloatPoint;\n axis: FloatPoint;\n result: RaycastTestResult;\n } = {\n p: [0, 0],\n q: [0, 0],\n r: [0, 0],\n s: [0, 0],\n deltaQP: [0, 0],\n axis: [0, 0],\n result: makeNewRaycastTestResult(),\n };\n\n /**\n * Polygon represents a polygon which can be used to create collisions masks for RuntimeObject.\n */\n export class Polygon {\n /**\n * The vertices of the polygon\n */\n vertices: Array<FloatPoint> = [];\n\n /**\n * The edges of the polygon. This property is only valid after calling\n * computeEdges, and remains valid until vertices are modified.\n */\n edges: Array<FloatPoint> = [];\n\n /**\n * The center of the polygon. This property is only valid after calling\n * computeCenter, and remains valid until vertices are modified.\n */\n center: FloatPoint = [0, 0];\n\n move(x: float, y: float): void {\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n this.vertices[i][0] += x;\n this.vertices[i][1] += y;\n }\n }\n\n rotate(angle: float): void {\n let t: float = 0;\n\n //We want a clockwise rotation\n const cosa = Math.cos(-angle);\n const sina = Math.sin(-angle);\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n t = this.vertices[i][0];\n this.vertices[i][0] = t * cosa + this.vertices[i][1] * sina;\n this.vertices[i][1] = -t * sina + this.vertices[i][1] * cosa;\n }\n }\n\n computeEdges(): void {\n //Ensure edge array has the right size (and avoid recreating an edge array).\n while (this.edges.length < this.vertices.length) {\n this.edges.push([0, 0]);\n }\n if (this.edges.length != this.vertices.length) {\n this.edges.length = this.vertices.length;\n }\n for (let i = 0, len = this.vertices.length; i < len; ++i) {\n const v1 = this.vertices[i];\n const v2 = i + 1 >= len ? this.vertices[0] : this.vertices[i + 1];\n this.edges[i][0] = v2[0] - v1[0];\n this.edges[i][1] = v2[1] - v1[1];\n }\n }\n\n isConvex(): boolean {\n this.computeEdges();\n const edgesLen = this.edges.length;\n if (edgesLen < 3) {\n return false;\n }\n const zProductIsPositive =\n this.edges[0][0] * this.edges[0 + 1][1] -\n this.edges[0][1] * this.edges[0 + 1][0] >\n 0;\n for (let i = 1; i < edgesLen - 1; ++i) {\n const zCrossProduct =\n this.edges[i][0] * this.edges[i + 1][1] -\n this.edges[i][1] * this.edges[i + 1][0];\n if (zCrossProduct > 0 !== zProductIsPositive) {\n return false;\n }\n }\n const lastZCrossProduct =\n this.edges[edgesLen - 1][0] * this.edges[0][1] -\n this.edges[edgesLen - 1][1] * this.edges[0][0];\n if (lastZCrossProduct > 0 !== zProductIsPositive) {\n return false;\n }\n return true;\n }\n\n computeCenter(): FloatPoint {\n this.center[0] = 0;\n this.center[1] = 0;\n const len = this.vertices.length;\n for (let i = 0; i < len; ++i) {\n this.center[0] += this.vertices[i][0];\n this.center[1] += this.vertices[i][1];\n }\n this.center[0] /= len;\n this.center[1] /= len;\n return this.center;\n }\n\n static createRectangle(width: float, height: float): gdjs.Polygon {\n const rect = new gdjs.Polygon();\n rect.vertices.push([-width / 2.0, -height / 2.0]);\n rect.vertices.push([+width / 2.0, -height / 2.0]);\n rect.vertices.push([+width / 2.0, +height / 2.0]);\n rect.vertices.push([-width / 2.0, +height / 2.0]);\n return rect;\n }\n\n /**\n * Do a collision test between two polygons.\n * Please note that polygons must *convexes*!\n *\n * You can read the result but do not keep a reference to it as it's a static object\n * reused between function calls. If you need to keep the results, use `copyCollisionTestResult`.\n *\n * Uses <a href=\"http://en.wikipedia.org/wiki/Hyperplane_separation_theorem\">Separating Axis Theorem </a>.<br>\n * Based on <a href=\"http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection\">this</a>\n * and <a href=\"http://stackoverflow.com/questions/5742329/problem-with-collision-response-sat\">this</a> article.\n *\n * @return A collision result. `collision` property is equal to true if polygons are overlapping. Do NOT keep a reference to this.\n * @param p1 The first polygon\n * @param p2 The second polygon\n * @param ignoreTouchingEdges If true, then edges that are touching each other, without the polygons actually overlapping, won't be considered in collision.\n */\n static collisionTest(\n p1: gdjs.Polygon,\n p2: gdjs.Polygon,\n ignoreTouchingEdges: boolean\n ): CollisionTestResult {\n //Algorithm core :\n p1.computeEdges();\n p2.computeEdges();\n let edge = collisionTestStatics.edge;\n const move_axis = collisionTestStatics.move_axis;\n const result = collisionTestStatics.result;\n let minDist = Number.MAX_VALUE;\n edge[0] = 0;\n edge[1] = 0;\n edge[0] = 0;\n edge[1] = 0;\n result.collision = false;\n result.move_axis[0] = 0;\n result.move_axis[1] = 0;\n\n //Iterate over all the edges composing the polygons\n for (\n let i = 0, len1 = p1.vertices.length, len2 = p2.vertices.length;\n i < len1 + len2;\n i++\n ) {\n if (i < len1) {\n // or <=\n edge = p1.edges[i];\n } else {\n edge = p2.edges[i - len1];\n }\n const axis = collisionTestStatics.axis;\n\n //Get the axis to which polygons will be projected\n axis[0] = -edge[1];\n axis[1] = edge[0];\n Polygon.normalise(axis);\n const minMaxA = collisionTestStatics.minMaxA;\n const minMaxB = collisionTestStatics.minMaxB;\n Polygon.project(\n axis,\n p1,\n //Do projection on the axis.\n minMaxA\n );\n Polygon.project(axis, p2, minMaxB);\n\n //If the projections on the axis do not overlap, then their is no collision\n const dist = Polygon.distance(\n minMaxA[0],\n minMaxA[1],\n minMaxB[0],\n minMaxB[1]\n );\n if (dist > 0 || (dist === 0 && ignoreTouchingEdges)) {\n result.collision = false;\n result.move_axis[0] = 0;\n result.move_axis[1] = 0;\n return result;\n }\n const absDist = Math.abs(dist);\n if (absDist < minDist) {\n minDist = absDist;\n move_axis[0] = axis[0];\n move_axis[1] = axis[1];\n }\n }\n result.collision = true;\n\n //Ensure move axis is correctly oriented.\n const p1Center = p1.computeCenter();\n const p2Center = p2.computeCenter();\n const d: FloatPoint = [\n p1Center[0] - p2Center[0],\n p1Center[1] - p2Center[1],\n ];\n if (Polygon.dotProduct(d, move_axis) < 0) {\n move_axis[0] = -move_axis[0];\n move_axis[1] = -move_axis[1];\n }\n\n //Add the magnitude to the move axis.\n result.move_axis[0] = move_axis[0] * minDist;\n result.move_axis[1] = move_axis[1] * minDist;\n return result;\n }\n\n /**\n * Do a raycast test.\n * Please note that the polygon must be **convex**!\n *\n * You can read the result but do not keep a reference to it as it's a static object\n * reused between function calls. If you need to keep the results, use `copyRaycastTestResult`.\n *\n * For some theory, check <a href=\"https://www.codeproject.com/Tips/862988/Find-the-Intersection-Point-of-Two-Line-Segments\">Find the Intersection Point of Two Line Segments</a>.\n *\n * @param poly The polygon to test\n * @param startX The raycast start point X\n * @param startY The raycast start point Y\n * @param endX The raycast end point X\n * @param endY The raycast end point Y\n * @return A raycast result with the contact points and distances. Do NOT keep a reference to this.\n */\n static raycastTest(\n poly: gdjs.Polygon,\n startX: float,\n startY: float,\n endX: float,\n endY: float\n ): RaycastTestResult {\n const result = raycastTestStatics.result;\n result.collision = false;\n if (poly.vertices.length < 2) {\n return result;\n }\n poly.computeEdges();\n const p = raycastTestStatics.p;\n const q = raycastTestStatics.q;\n const r = raycastTestStatics.r;\n const s = raycastTestStatics.s;\n let minSqDist = Number.MAX_VALUE;\n\n // Ray segment: p + t*r, with p = start and r = end - start\n p[0] = startX;\n p[1] = startY;\n r[0] = endX - startX;\n r[1] = endY - startY;\n for (let i = 0; i < poly.edges.length; i++) {\n // Edge segment: q + u*s\n q[0] = poly.vertices[i][0];\n q[1] = poly.vertices[i][1];\n s[0] = poly.edges[i][0];\n s[1] = poly.edges[i][1];\n const deltaQP = raycastTestStatics.deltaQP;\n deltaQP[0] = q[0] - p[0];\n deltaQP[1] = q[1] - p[1];\n const crossRS = Polygon.crossProduct(r, s);\n const t = Polygon.crossProduct(deltaQP, s) / crossRS;\n const u = Polygon.crossProduct(deltaQP, r) / crossRS;\n\n // Collinear\n // One point intersection\n if (\n Math.abs(crossRS) <= 0.0001 &&\n Math.abs(Polygon.crossProduct(deltaQP, r)) <= 0.0001\n ) {\n // Project the ray and the edge to work on floats, keeping linearity through t\n const axis = raycastTestStatics.axis;\n axis[0] = r[0];\n axis[1] = r[1];\n Polygon.normalise(axis);\n const rayA = 0;\n const rayB = Polygon.dotProduct(axis, r);\n const edgeA = Polygon.dotProduct(axis, deltaQP);\n const edgeB = Polygon.dotProduct(axis, [\n deltaQP[0] + s[0],\n deltaQP[1] + s[1],\n ]);\n\n // Get overlapping range\n const minOverlap = Math.max(\n Math.min(rayA, rayB),\n Math.min(edgeA, edgeB)\n );\n const maxOverlap = Math.min(\n Math.max(rayA, rayB),\n Math.max(edgeA, edgeB)\n );\n if (minOverlap > maxOverlap) {\n return result;\n }\n result.collision = true;\n\n // Zero distance ray\n if (rayB === 0) {\n result.closeX = startX;\n result.closeY = startY;\n result.closeSqDist = 0;\n result.farX = startX;\n result.farY = startY;\n result.farSqDist = 0;\n result.edgeX = s[0];\n result.edgeY = s[1];\n return result;\n }\n const t1 = minOverlap / Math.abs(rayB);\n const t2 = maxOverlap / Math.abs(rayB);\n result.closeX = startX + t1 * r[0];\n result.closeY = startY + t1 * r[1];\n result.closeSqDist = t1 * t1 * (r[0] * r[0] + r[1] * r[1]);\n result.farX = startX + t2 * r[0];\n result.farY = startY + t2 * r[1];\n result.farSqDist = t2 * t2 * (r[0] * r[0] + r[1] * r[1]);\n result.edgeX = s[0];\n result.edgeY = s[1];\n return result;\n } else {\n if (crossRS !== 0 && 0 <= t && t <= 1 && 0 <= u && u <= 1) {\n const x = p[0] + t * r[0];\n const y = p[1] + t * r[1];\n const sqDist =\n (x - startX) * (x - startX) + (y - startY) * (y - startY);\n if (sqDist < minSqDist) {\n if (!result.collision) {\n result.farX = x;\n result.farY = y;\n result.farSqDist = sqDist;\n }\n minSqDist = sqDist;\n result.closeX = x;\n result.closeY = y;\n result.closeSqDist = sqDist;\n result.edgeX = s[0];\n result.edgeY = s[1];\n result.collision = true;\n } else {\n result.farX = x;\n result.farY = y;\n result.farSqDist = sqDist;\n }\n }\n }\n }\n return result;\n }\n\n //Tools functions :\n static normalise(v: FloatPoint): void {\n const len = Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n if (len != 0) {\n v[0] /= len;\n v[1] /= len;\n }\n }\n\n static dotProduct(a: FloatPoint, b: FloatPoint): float {\n const dp = a[0] * b[0] + a[1] * b[1];\n return dp;\n }\n\n static crossProduct(a: FloatPoint, b: FloatPoint): float {\n const cp = a[0] * b[1] - a[1] * b[0];\n return cp;\n }\n\n static project(\n axis: FloatPoint,\n p: gdjs.Polygon,\n result: FloatPoint\n ): void {\n let dp = Polygon.dotProduct(axis, p.vertices[0]);\n result[0] = dp;\n result[1] = dp;\n for (let i = 1, len = p.vertices.length; i < len; ++i) {\n dp = Polygon.dotProduct(axis, p.vertices[i]);\n if (dp < result[0]) {\n result[0] = dp;\n } else {\n if (dp > result[1]) {\n result[1] = dp;\n }\n }\n }\n }\n\n static distance(minA: float, maxA: float, minB: float, maxB: float): float {\n if (minA < minB) {\n return minB - maxA;\n } else {\n return minA - maxB;\n }\n }\n\n /**\n * Check if a point is inside a polygon.\n *\n * Uses <a href=\"https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html\">PNPOLY</a> by W. Randolph Franklin.\n *\n * @param poly The polygon to test\n * @param x The point x coordinate\n * @param y The point y coordinate\n * @return true if the point is inside the polygon\n */\n static isPointInside(poly: gdjs.Polygon, x: float, y: float): boolean {\n let inside = false;\n for (\n let i = 0, j = poly.vertices.length - 1;\n i < poly.vertices.length;\n j = i++\n ) {\n let vi = poly.vertices[i];\n let vj = poly.vertices[j];\n if (\n vi[1] > y != vj[1] > y &&\n x < ((vj[0] - vi[0]) * (y - vi[1])) / (vj[1] - vi[1]) + vi[0]\n ) {\n inside = !inside;\n }\n }\n return inside;\n }\n\n /**\n * Copy a `CollisionTestResult` into another one.\n * Use `gdjs.Polygon.makeNewCollisionTestResult()` to build a new\n * destination before copying the existing source inside it.\n */\n static copyCollisionTestResult(\n source: CollisionTestResult,\n dest: CollisionTestResult\n ) {\n dest.collision = source.collision;\n dest.move_axis[0] = source.move_axis[0];\n dest.move_axis[1] = source.move_axis[1];\n }\n\n static makeNewCollisionTestResult = makeNewCollisionTestResult;\n\n /**\n * Copy a `RaycastTestResult` into another one.\n * Use `gdjs.Polygon.makeNewRaycastTestResult()` to build a new\n * destination before copying the existing source inside it.\n */\n static copyRaycastTestResult(\n source: RaycastTestResult,\n dest: RaycastTestResult\n ) {\n dest.collision = source.collision;\n dest.closeX = source.closeX;\n dest.closeY = source.closeY;\n dest.closeSqDist = source.closeSqDist;\n dest.farX = source.farX;\n dest.farY = source.farY;\n dest.farSqDist = source.farSqDist;\n dest.edgeX = source.edgeX;\n dest.edgeY = source.edgeY;\n }\n\n static makeNewRaycastTestResult = makeNewRaycastTestResult;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAmBE,KAAM,GAA6B,IAC1B,EAAE,UAAW,GAAO,UAAW,C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c,EAAO,YAC1B,EAAK,KAAO,EAAO,KACnB,EAAK,KAAO,EAAO,KACnB,EAAK,UAAY,EAAO,UACxB,EAAK,MAAQ,EAAO,MACpB,EAAK,MAAQ,EAAO,QAvcjB,QAobE,AApbF,EAobE,2BAA6B,EAsB7B,AA1cF,EA0cE,yBAA2B,EA1c7B,EAAM,YAnFL",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(i){class
|
|
1
|
+
var gdjs;(function(i){class n{constructor(e){this.minX=0;this.minY=0;this.maxX=0;this.maxY=0;this.behavior=e,this.updateAABBFromOwner()}updateAABBFromOwner(){this.minX=this.behavior.owner.getAABB().min[0],this.minY=this.behavior.owner.getAABB().min[1],this.maxX=this.behavior.owner.getAABB().max[0],this.maxY=this.behavior.owner.getAABB().max[1]}}i.BehaviorRBushAABB=n;class o{constructor(e,t,r){this.owner=r;this._activated=!0;this._syncOverNetwork=!0;this.name=t.name||"",this.type=t.type||"",this._nameId=i.RuntimeObject.getNameIdentifier(this.name)}updateFromBehaviorData(e,t){return!1}getNetworkSyncData(){return{act:this._activated,props:{}}}updateFromNetworkSyncData(e){e.act!==this._activated&&this.activate(e.act)}getName(){return this.name}getNameId(){return this._nameId}stepPreEvents(e){if(this._activated){const t=e.getScene().getProfiler();t&&t.begin(this.name),this.doStepPreEvents(e),t&&t.end(this.name)}}stepPostEvents(e){if(this._activated){const t=e.getScene().getProfiler();t&&t.begin(this.name),this.doStepPostEvents(e),t&&t.end(this.name)}}activate(e){e===void 0&&(e=!0),!this._activated&&e?(this._activated=!0,this.onActivate()):this._activated&&!e&&(this._activated=!1,this.onDeActivate())}onCreated(){}activated(){return this._activated}onActivate(){}onDeActivate(){}doStepPreEvents(e){}doStepPostEvents(e){}onDestroy(){}onObjectHotReloaded(){}usesLifecycleFunction(){return!0}enableSynchronization(e){this._syncOverNetwork=e}isSyncedOverNetwork(){return this._syncOverNetwork}}i.RuntimeBehavior=o,i.registerBehavior("",i.RuntimeBehavior)})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=runtimebehavior.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/runtimebehavior.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 /**\n * Allow to store a behavior in a RBush (spatial data structure).\n * Because this duplicates the AABB, this ensures the RBush AABB\n * stays the same even if the underlying object is moved\n * (in which case the behavior is responsible for removing/adding\n * back/updating this BehaviorRBushAABB).\n */\n export class BehaviorRBushAABB<T extends RuntimeBehavior> {\n minX: float = 0;\n minY: float = 0;\n maxX: float = 0;\n maxY: float = 0;\n behavior: T;\n\n constructor(behavior: T) {\n this.behavior = behavior;\n this.updateAABBFromOwner();\n }\n\n updateAABBFromOwner() {\n this.minX = this.behavior.owner.getAABB().min[0];\n this.minY = this.behavior.owner.getAABB().min[1];\n this.maxX = this.behavior.owner.getAABB().max[0];\n this.maxY = this.behavior.owner.getAABB().max[1];\n }\n }\n\n /**\n * RuntimeBehavior represents a behavior being used by a RuntimeObject.\n */\n export class RuntimeBehavior {\n name: string;\n type: string;\n _nameId: integer;\n _activated: boolean = true;\n\n /**\n * @param instanceContainer The container owning the object of the behavior\n * @param behaviorData The properties used to setup the behavior\n * @param owner The object owning the behavior\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData: BehaviorData,\n public owner: gdjs.RuntimeObject\n ) {\n this.name = behaviorData.name || '';\n this.type = behaviorData.type || '';\n this._nameId = gdjs.RuntimeObject.getNameIdentifier(this.name);\n }\n\n /**\n * Called when the behavior must be updated using the specified behaviorData. This is the\n * case during hot-reload, and is only called if the behavior was modified.\n *\n * @see gdjs.RuntimeBehavior#onObjectHotReloaded\n *\n * @param oldBehaviorData The previous data for the behavior.\n * @param newBehaviorData The new data for the behavior.\n * @returns true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).\n */\n updateFromBehaviorData(\n oldBehaviorData: BehaviorData,\n newBehaviorData: BehaviorData\n ): boolean {\n // If not redefined, mark by default the hot-reload as failed.\n return false;\n }\n\n /**\n * Get the name of the behavior.\n * @return The behavior's name.\n */\n getName(): string {\n return this.name;\n }\n\n /**\n * Get the name identifier of the behavior.\n * @return The behavior's name identifier.\n */\n getNameId(): integer {\n return this._nameId;\n }\n\n /**\n * Called at each frame before events. Call doStepPreEvents.<br>\n * Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.\n * @param instanceContainer The instanceContainer owning the object\n */\n stepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._activated) {\n const profiler = instanceContainer.getScene().getProfiler();\n if (profiler) {\n profiler.begin(this.name);\n }\n this.doStepPreEvents(instanceContainer);\n if (profiler) {\n profiler.end(this.name);\n }\n }\n }\n\n /**\n * Called at each frame after events. Call doStepPostEvents.<br>\n * Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.\n * @param instanceContainer The instanceContainer owning the object\n */\n stepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._activated) {\n const profiler = instanceContainer.getScene().getProfiler();\n if (profiler) {\n profiler.begin(this.name);\n }\n this.doStepPostEvents(instanceContainer);\n if (profiler) {\n profiler.end(this.name);\n }\n }\n }\n\n /**\n * De/Activate the behavior\n * @param enable true to enable the behavior, false to disable it\n */\n activate(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n if (!this._activated && enable) {\n this._activated = true;\n this.onActivate();\n } else {\n if (this._activated && !enable) {\n this._activated = false;\n this.onDeActivate();\n }\n }\n }\n\n /**\n * Reimplement this to do extra work when the behavior is created (i.e: an\n * object using it was created), after the object is fully initialized (so\n * you can use `this.owner` without risk).\n */\n onCreated(): void {}\n\n /**\n * Return true if the behavior is activated\n */\n activated(): boolean {\n return this._activated;\n }\n\n /**\n * Reimplement this method to do extra work when the behavior is activated (after\n * it has been deactivated, see `onDeActivate`).\n */\n onActivate(): void {}\n\n /**\n * Reimplement this method to do extra work when the behavior is deactivated.\n */\n onDeActivate(): void {}\n\n /**\n * This method is called each tick before events are done.\n * @param instanceContainer The instanceContainer owning the object\n */\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {}\n\n /**\n * This method is called each tick after events are done.\n * @param instanceContainer The instanceContainer owning the object\n */\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {}\n\n /**\n * This method is called when the owner of the behavior\n * is being removed from the scene and is about to be destroyed/reused later\n * or when the behavior is removed from an object (can happen in case of\n * hot-reloading only. Otherwise, behaviors are just de-activated,\n * not removed. See `onDeActivate`).\n */\n onDestroy(): void {}\n\n /**\n * This method is called when the owner of the behavior\n * was hot reloaded, so its position, angle, size can have been changed outside\n * of events.\n */\n onObjectHotReloaded(): void {}\n\n /**\n * Should return `false` if the behavior does not need any lifecycle function to\n * be called.\n * Default, hidden, \"capability\" behaviors set it to `false`.\n * This avoids useless calls to empty lifecycle functions, which would waste CPU\n * time (and have a sizeable impact for example when lots of static instances\n * are living in the scene).\n * @returns\n */\n usesLifecycleFunction(): boolean {\n return true;\n }\n }\n gdjs.registerBehavior('', gdjs.RuntimeBehavior);\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAQS,OAAmD,CAOxD,YAAY,EAAa,CANzB,UAAc,EACd,UAAc,EACd,UAAc,EACd,UAAc,EAIZ,KAAK,SAAW,EAChB,KAAK,sBAGP,qBAAsB,CACpB,KAAK,KAAO,KAAK,SAAS,MAAM,UAAU,IAAI,GAC9C,KAAK,KAAO,KAAK,SAAS,MAAM,UAAU,IAAI,GAC9C,KAAK,KAAO,KAAK,SAAS,MAAM,UAAU,IAAI,GAC9C,KAAK,KAAO,KAAK,SAAS,MAAM,UAAU,IAAI,IAhB3C,EAAM,oBAuBN,OAAsB,
|
|
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 /**\n * Allow to store a behavior in a RBush (spatial data structure).\n * Because this duplicates the AABB, this ensures the RBush AABB\n * stays the same even if the underlying object is moved\n * (in which case the behavior is responsible for removing/adding\n * back/updating this BehaviorRBushAABB).\n */\n export class BehaviorRBushAABB<T extends RuntimeBehavior> {\n minX: float = 0;\n minY: float = 0;\n maxX: float = 0;\n maxY: float = 0;\n behavior: T;\n\n constructor(behavior: T) {\n this.behavior = behavior;\n this.updateAABBFromOwner();\n }\n\n updateAABBFromOwner() {\n this.minX = this.behavior.owner.getAABB().min[0];\n this.minY = this.behavior.owner.getAABB().min[1];\n this.maxX = this.behavior.owner.getAABB().max[0];\n this.maxY = this.behavior.owner.getAABB().max[1];\n }\n }\n\n /**\n * RuntimeBehavior represents a behavior being used by a RuntimeObject.\n */\n export class RuntimeBehavior {\n name: string;\n type: string;\n _nameId: integer;\n _activated: boolean = true;\n\n // When synchronised over the network, a behavior is always owned by the player owning the object,\n // and always synced. If set to false, the behavior properties will not be synced to others.\n _syncOverNetwork: boolean = true;\n\n /**\n * @param instanceContainer The container owning the object of the behavior\n * @param behaviorData The properties used to setup the behavior\n * @param owner The object owning the behavior\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData: BehaviorData,\n public owner: gdjs.RuntimeObject\n ) {\n this.name = behaviorData.name || '';\n this.type = behaviorData.type || '';\n this._nameId = gdjs.RuntimeObject.getNameIdentifier(this.name);\n }\n\n /**\n * Called when the behavior must be updated using the specified behaviorData. This is the\n * case during hot-reload, and is only called if the behavior was modified.\n *\n * @see gdjs.RuntimeBehavior#onObjectHotReloaded\n *\n * @param oldBehaviorData The previous data for the behavior.\n * @param newBehaviorData The new data for the behavior.\n * @returns true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).\n */\n updateFromBehaviorData(\n oldBehaviorData: BehaviorData,\n newBehaviorData: BehaviorData\n ): boolean {\n // If not redefined, mark by default the hot-reload as failed.\n return false;\n }\n\n getNetworkSyncData(): BehaviorNetworkSyncData {\n // To be redefined by behaviors that need to synchronize properties\n // while calling super() to get the common properties.\n return {\n act: this._activated,\n props: {},\n };\n }\n\n /**\n * Update the behavior properties using the provided data.\n * @param networkSyncData The new properties of the behavior.\n */\n updateFromNetworkSyncData(networkSyncData: BehaviorNetworkSyncData): void {\n // Must be redefined by behaviors that need to synchronize properties\n // while calling super() to get the common properties.\n if (networkSyncData.act !== this._activated) {\n this.activate(networkSyncData.act);\n }\n }\n\n /**\n * Get the name of the behavior.\n * @return The behavior's name.\n */\n getName(): string {\n return this.name;\n }\n\n /**\n * Get the name identifier of the behavior.\n * @return The behavior's name identifier.\n */\n getNameId(): integer {\n return this._nameId;\n }\n\n /**\n * Called at each frame before events. Call doStepPreEvents.<br>\n * Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.\n * @param instanceContainer The instanceContainer owning the object\n */\n stepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._activated) {\n const profiler = instanceContainer.getScene().getProfiler();\n if (profiler) {\n profiler.begin(this.name);\n }\n this.doStepPreEvents(instanceContainer);\n if (profiler) {\n profiler.end(this.name);\n }\n }\n }\n\n /**\n * Called at each frame after events. Call doStepPostEvents.<br>\n * Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.\n * @param instanceContainer The instanceContainer owning the object\n */\n stepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._activated) {\n const profiler = instanceContainer.getScene().getProfiler();\n if (profiler) {\n profiler.begin(this.name);\n }\n this.doStepPostEvents(instanceContainer);\n if (profiler) {\n profiler.end(this.name);\n }\n }\n }\n\n /**\n * De/Activate the behavior\n * @param enable true to enable the behavior, false to disable it\n */\n activate(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n if (!this._activated && enable) {\n this._activated = true;\n this.onActivate();\n } else {\n if (this._activated && !enable) {\n this._activated = false;\n this.onDeActivate();\n }\n }\n }\n\n /**\n * Reimplement this to do extra work when the behavior is created (i.e: an\n * object using it was created), after the object is fully initialized (so\n * you can use `this.owner` without risk).\n */\n onCreated(): void {}\n\n /**\n * Return true if the behavior is activated\n */\n activated(): boolean {\n return this._activated;\n }\n\n /**\n * Reimplement this method to do extra work when the behavior is activated (after\n * it has been deactivated, see `onDeActivate`).\n */\n onActivate(): void {}\n\n /**\n * Reimplement this method to do extra work when the behavior is deactivated.\n */\n onDeActivate(): void {}\n\n /**\n * This method is called each tick before events are done.\n * @param instanceContainer The instanceContainer owning the object\n */\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {}\n\n /**\n * This method is called each tick after events are done.\n * @param instanceContainer The instanceContainer owning the object\n */\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer): void {}\n\n /**\n * This method is called when the owner of the behavior\n * is being removed from the scene and is about to be destroyed/reused later\n * or when the behavior is removed from an object (can happen in case of\n * hot-reloading only. Otherwise, behaviors are just de-activated,\n * not removed. See `onDeActivate`).\n */\n onDestroy(): void {}\n\n /**\n * This method is called when the owner of the behavior\n * was hot reloaded, so its position, angle, size can have been changed outside\n * of events.\n */\n onObjectHotReloaded(): void {}\n\n /**\n * Should return `false` if the behavior does not need any lifecycle function to\n * be called.\n * Default, hidden, \"capability\" behaviors set it to `false`.\n * This avoids useless calls to empty lifecycle functions, which would waste CPU\n * time (and have a sizeable impact for example when lots of static instances\n * are living in the scene).\n * @returns\n */\n usesLifecycleFunction(): boolean {\n return true;\n }\n\n enableSynchronization(enable: boolean) {\n this._syncOverNetwork = enable;\n }\n\n isSyncedOverNetwork(): boolean {\n return this._syncOverNetwork;\n }\n }\n gdjs.registerBehavior('', gdjs.RuntimeBehavior);\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAQS,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,gBAUX,WAAkB,EAKlB,WAAqB,CACnB,MAAO,MAAK,WAOd,YAAmB,EAKnB,cAAqB,EAMrB,gBAAgB,EAAwD,EAMxE,iBAAiB,EAAwD,EASzE,WAAkB,EAOlB,qBAA4B,EAW5B,uBAAiC,CAC/B,MAAO,GAGT,sBAAsB,EAAiB,CACrC,KAAK,iBAAmB,EAG1B,qBAA+B,CAC7B,MAAO,MAAK,kBA9MT,EAAM,kBAiNb,EAAK,iBAAiB,GAAI,EAAK,mBAhPvB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(n){const d=new n.Logger("Game manager"),h=l=>new Promise(e=>setTimeout(e,l)),u=l=>l.usedResources.map(e=>e.name);class c{constructor(e,s){this._notifyScenesForGameResolutionResize=!1;this._paused=!1;this._hasJustResumed=!1;this._sessionMetricsInitialized=!1;this._disableMetrics=!1;this._options=s||{},this._variables=new n.VariablesContainer(e.variables),this._data=e,this._resourcesLoader=new n.ResourceLoader(this,e.resources.resources,u(e),e.layouts),this._effectsManager=new n.EffectsManager,this._maxFPS=this._data.properties.maxFPS,this._minFPS=this._data.properties.minFPS,this._gameResolutionWidth=this._data.properties.windowWidth,this._gameResolutionHeight=this._data.properties.windowHeight,this._originalWidth=this._gameResolutionWidth,this._originalHeight=this._gameResolutionHeight,this._resizeMode=this._data.properties.sizeOnStartupMode,this._adaptGameResolutionAtRuntime=this._data.properties.adaptGameResolutionAtRuntime,this._scaleMode=e.properties.scaleMode||"linear",this._pixelsRounding=this._data.properties.pixelsRounding,this._antialiasingMode=this._data.properties.antialiasingMode,this._isAntialisingEnabledOnMobile=this._data.properties.antialisingEnabledOnMobile,this._renderer=new n.RuntimeGameRenderer(this,this._options.forceFullscreen||!1),this._watermark=new n.watermark.RuntimeWatermark(this,e.properties.authorUsernames,this._data.properties.watermark),this._sceneStack=new n.SceneStack(this),this._inputManager=new n.InputManager,this._injectExternalLayout=this._options.injectExternalLayout||"",this._debuggerClient=n.DebuggerClient?new n.DebuggerClient(this):null,this._isPreview=this._options.isPreview||!1,this._sessionId=null,this._playerId=null,this._embeddedResourcesMappings=new Map;for(const t of this._data.resources.resources)if(t.metadata)try{const i=JSON.parse(t.metadata);i?.embeddedResourcesMapping&&this._embeddedResourcesMappings.set(t.name,i.embeddedResourcesMapping)}catch{d.error("Some metadata of resources can not be successfully parsed.")}if(this._eventsBasedObjectDatas=new Map,this._data.eventsFunctionsExtensions)for(const t of this._data.eventsFunctionsExtensions)for(const i of t.eventsBasedObjects)this._eventsBasedObjectDatas.set(t.name+"::"+i.name,i);this.isUsingGDevelopDevelopmentEnvironment()&&d.info("This game will run on the development version of GDevelop APIs.")}setProjectData(e){this._data=e,this._resourcesLoader.setResources(e.resources.resources,u(e),e.layouts)}getAdditionalOptions(){return this._options}getRenderer(){return this._renderer}getVariables(){return this._variables}getSoundManager(){return this._resourcesLoader.getSoundManager()}getImageManager(){return this._resourcesLoader.getImageManager()}getFontManager(){return this._resourcesLoader.getFontManager()}getBitmapFontManager(){return this._resourcesLoader.getBitmapFontManager()}getJsonManager(){return this._resourcesLoader.getJsonManager()}getModel3DManager(){return this._resourcesLoader.getModel3DManager()}getSpineManager(){return this._resourcesLoader.getSpineManager()}getSpineAtlasManager(){return this._resourcesLoader.getSpineAtlasManager()}getInputManager(){return this._inputManager}getEffectsManager(){return this._effectsManager}getGameData(){return this._data}getEventsBasedObjectData(e){const s=this._eventsBasedObjectDatas.get(e);return s||(d.error('The game has no events-based object of the type "'+e+'"'),null)}getSceneData(e){let s=null;for(let t=0,i=this._data.layouts.length;t<i;++t){const r=this._data.layouts[t];if(e===void 0||r.name===e){s=r;break}}return s===null&&d.error('The game has no scene called "'+e+'"'),s}hasScene(e){let s=!1;for(let t=0,i=this._data.layouts.length;t<i;++t){const r=this._data.layouts[t];if(e===void 0||r.name==e){s=!0;break}}return s}getExternalLayoutData(e){let s=null;for(let t=0,i=this._data.externalLayouts.length;t<i;++t){const r=this._data.externalLayouts[t];if(r.name===e){s=r;break}}return s}getInitialObjectsData(){return this._data.objects||[]}getOriginalWidth(){return this._originalWidth}getOriginalHeight(){return this._originalHeight}getGameResolutionWidth(){return this._gameResolutionWidth}getGameResolutionHeight(){return this._gameResolutionHeight}setGameResolutionSize(e,s){if(this._gameResolutionWidth=e,this._gameResolutionHeight=s,this._adaptGameResolutionAtRuntime&&n.RuntimeGameRenderer&&n.RuntimeGameRenderer.getWindowInnerWidth&&n.RuntimeGameRenderer.getWindowInnerHeight){const t=n.RuntimeGameRenderer.getWindowInnerWidth(),i=n.RuntimeGameRenderer.getWindowInnerHeight();this._resizeMode==="adaptWidth"?this._gameResolutionWidth=this._gameResolutionHeight*t/i:this._resizeMode==="adaptHeight"&&(this._gameResolutionHeight=this._gameResolutionWidth*i/t)}this._renderer.updateRendererSize(),this._notifyScenesForGameResolutionResize=!0}setGameResolutionResizeMode(e){this._resizeMode=e,this._forceGameResolutionUpdate()}getGameResolutionResizeMode(){return this._resizeMode}setAdaptGameResolutionAtRuntime(e){this._adaptGameResolutionAtRuntime=e,this._forceGameResolutionUpdate()}getAdaptGameResolutionAtRuntime(){return this._adaptGameResolutionAtRuntime}getMinimalFramerate(){return this._minFPS}getScaleMode(){return this._scaleMode}getPixelsRounding(){return this._pixelsRounding}getAntialiasingMode(){return this._antialiasingMode}isAntialisingEnabledOnMobile(){return this._isAntialisingEnabledOnMobile}pause(e){this._paused!==e&&(this._paused=e,this._debuggerClient&&(this._paused?this._debuggerClient.sendGamePaused():this._debuggerClient.sendGameResumed()))}hasJustResumed(){return this._hasJustResumed}prioritizeLoadingOfScene(e){this._resourcesLoader.loadSceneResources(e)}getSceneLoadingProgress(e){return this._resourcesLoader.getSceneLoadingProgress(e)}areSceneAssetsLoaded(e){return this._resourcesLoader.areSceneAssetsLoaded(e)}areSceneAssetsReady(e){return this._resourcesLoader.areSceneAssetsReady(e)}loadAllAssets(e,s){this.loadFirstAssetsAndStartBackgroundLoading(this._getFirstSceneName(),s).then(e)}async loadFirstAssetsAndStartBackgroundLoading(e,s){try{const t=this._data.properties.loadingScreen.backgroundImageResourceName;t&&await this._resourcesLoader.getImageManager().loadResource(t),await Promise.all([this._loadAssetsWithLoadingScreen(!0,async i=>{await this._resourcesLoader.loadGlobalAndFirstSceneResources(e,i),this._resourcesLoader.loadAllSceneInBackground()},s),n.getAllAsynchronouslyLoadingLibraryPromise()])}catch(t){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(t),t}}async loadSceneAssets(e,s){await this._loadAssetsWithLoadingScreen(!1,async t=>{await this._resourcesLoader.loadAndProcessSceneResources(e,t)},s)}async _loadAssetsWithLoadingScreen(e,s,t){this.pause(!0);const i=new n.LoadingScreenRenderer(this.getRenderer(),this._resourcesLoader.getImageManager(),this._data.properties.loadingScreen,this._data.properties.watermark.showWatermark,e);await s(async(a,o)=>{const g=Math.floor(100*a/o);i.setPercent(g),t&&t(g),i.renderIfNeeded()&&await h(1)}),await i.unload(),this.pause(!1)}_getFirstSceneName(){const e=this._data.firstLayout;return this.hasScene(e)?e:this.getSceneData().name}startGameLoop(){try{if(!this.hasScene()){d.error("The game has no scene.");return}this._forceGameResolutionUpdate(),this._sceneStack.push(this._getFirstSceneName(),this._injectExternalLayout),this._watermark.displayAtStartup(),this._setupGameVisibilityEvents();let e=0;this._hasJustResumed=!1,this._renderer.startGameLoop(s=>{try{if(this._paused||(e+=s,this._maxFPS>0&&1e3/e>this._maxFPS+7))return!0;const t=e;return e=0,this._notifyScenesForGameResolutionResize&&(this._sceneStack.onGameResolutionResized(),this._notifyScenesForGameResolutionResize=!1),this._sceneStack.step(t)?(this.getInputManager().onFrameEnded(),this._hasJustResumed=!1,!0):!1}catch(t){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(t),t}}),setTimeout(()=>{this._setupSessionMetrics()},1e4)}catch(e){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(e),e}}enableMetrics(e){this._disableMetrics=!e,e&&this._setupSessionMetrics()}_setupGameVisibilityEvents(){typeof navigator!="undefined"&&typeof document!="undefined"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(this._hasJustResumed=!0)}),window.addEventListener("resume",()=>{this._hasJustResumed=!0},!1))}_setupSessionMetrics(){if(this._sessionMetricsInitialized||this._disableMetrics||this.isPreview()||typeof fetch=="undefined"||!this._data.properties.projectUuid)return;const e="https://api.gdevelop-app.com/analytics";this._playerId=this._makePlayerUuid();let s=0,t=0,i=Date.now();fetch(e+"/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,game:{name:this._data.properties.name||"",packageName:this._data.properties.packageName||"",version:this._data.properties.version||"",location:window.location.href},platform:{isCordova:!!window.cordova,devicePlatform:typeof device!="undefined"&&device.platform||"",navigatorPlatform:typeof navigator!="undefined"?navigator.platform:"",hasTouch:typeof navigator!="undefined"?!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2:!1}})}).then(a=>{if(!a.ok)throw console.error("Error while creating the session",a),new Error("Error while creating the session");return a}).then(a=>a.text()).then(a=>{this._sessionId=a}).catch(()=>{});const r=()=>{if(!this._sessionId)return;const a=Date.now();if(t+=a-i,i=a,t<5*1e3)return;const o=Math.floor(t/1e3)*1e3;s+=o,t-=o,navigator.sendBeacon(e+"/session-hit",JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,sessionId:this._sessionId,duration:Math.floor(s/1e3)}))};if(typeof navigator!="undefined"&&typeof document!="undefined"){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?i=Date.now():r()}),window.addEventListener("pagehide",r,!1),window.addEventListener("pause",r,!1),window.addEventListener("resume",()=>{i=Date.now()},!1);const a=typeof safari=="object"&&safari.pushNotification,o=/electron/i.test(navigator.userAgent);(a||o)&&window.addEventListener("beforeunload",()=>{r()})}this._sessionMetricsInitialized=!0,this._sessionId=this._sessionId}_makePlayerUuid(){try{const e="GDJS-internal-player-uuid",s=localStorage.getItem(e);if(s)return s;const t=n.makeUuid();return localStorage.setItem(e,t),t}catch{return n.makeUuid()}}getSessionId(){return this._sessionId}getPlayerId(){return this._playerId}onWindowInnerSizeChanged(){this._forceGameResolutionUpdate()}_forceGameResolutionUpdate(){this.setGameResolutionSize(this._gameResolutionWidth,this._gameResolutionHeight)}startCurrentSceneProfiler(e){const s=this._sceneStack.getCurrentScene();return s?(s.startProfiler(e),!0):!1}stopCurrentSceneProfiler(){const e=this._sceneStack.getCurrentScene();!e||e.stopProfiler()}wasFirstSceneLoaded(){return this._sceneStack.wasFirstSceneLoaded()}getSceneStack(){return this._sceneStack}isPreview(){return this._isPreview}isUsingGDevelopDevelopmentEnvironment(){return this._options.environment==="dev"}getExtensionProperty(e,s){for(let t of this._data.properties.extensionProperties)if(t.extension===e&&t.property===s)return t.value;return null}resolveEmbeddedResource(e,s){const t=this._embeddedResourcesMappings.get(e);return t&&t[s]?t[s]:s}getEmbeddedResourcesNames(e){return this._embeddedResourcesMappings.has(e)?Object.keys(this._embeddedResourcesMappings.get(e)):[]}}n.RuntimeGame=c})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(i){const g=new i.Logger("Game manager"),h=u=>new Promise(e=>setTimeout(e,u)),c=u=>u.usedResources.map(e=>e.name);let l=null;const p=()=>{if(l)return l;l=[];try{new CompressionStream("gzip"),l.push("cs:gzip")}catch{}try{new CompressionStream("deflate"),l.push("cs:deflate")}catch{}return l};class m{constructor(e,t){this._sceneAndExtensionsData=[];this._notifyScenesForGameResolutionResize=!1;this._paused=!1;this._hasJustResumed=!1;this._sessionMetricsInitialized=!1;this._disableMetrics=!1;this.getPlatformInfo=()=>({isCordova:!!window.cordova,devicePlatform:typeof device!="undefined"&&device.platform||"",navigatorPlatform:typeof navigator!="undefined"?navigator.platform:"",hasTouch:typeof navigator!="undefined"?!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2:!1,supportedCompressionMethods:p()});this._options=t||{},this._variables=new i.VariablesContainer(e.variables),this._variablesByExtensionName=new Map;for(const s of e.eventsFunctionsExtensions)s.globalVariables.length>0&&this._variablesByExtensionName.set(s.name,new i.VariablesContainer(s.globalVariables));this._data=e,this._updateSceneAndExtensionsData(),this._resourcesLoader=new i.ResourceLoader(this,e.resources.resources,c(e),e.layouts),this._effectsManager=new i.EffectsManager,this._maxFPS=this._data.properties.maxFPS,this._minFPS=this._data.properties.minFPS,this._gameResolutionWidth=this._data.properties.windowWidth,this._gameResolutionHeight=this._data.properties.windowHeight,this._originalWidth=this._gameResolutionWidth,this._originalHeight=this._gameResolutionHeight,this._resizeMode=this._data.properties.sizeOnStartupMode,this._adaptGameResolutionAtRuntime=this._data.properties.adaptGameResolutionAtRuntime,this._scaleMode=e.properties.scaleMode||"linear",this._pixelsRounding=this._data.properties.pixelsRounding,this._antialiasingMode=this._data.properties.antialiasingMode,this._isAntialisingEnabledOnMobile=this._data.properties.antialisingEnabledOnMobile,this._renderer=new i.RuntimeGameRenderer(this,this._options.forceFullscreen||!1),this._watermark=new i.watermark.RuntimeWatermark(this,e.properties.authorUsernames,this._data.properties.watermark),this._sceneStack=new i.SceneStack(this),this._inputManager=new i.InputManager,this._injectExternalLayout=this._options.injectExternalLayout||"",this._debuggerClient=i.DebuggerClient?new i.DebuggerClient(this):null,this._isPreview=this._options.isPreview||!1,this._sessionId=null,this._playerId=null,this._embeddedResourcesMappings=new Map;for(const s of this._data.resources.resources)if(s.metadata)try{const n=JSON.parse(s.metadata);n?.embeddedResourcesMapping&&this._embeddedResourcesMappings.set(s.name,n.embeddedResourcesMapping)}catch{g.error("Some metadata of resources can not be successfully parsed.")}if(this._eventsBasedObjectDatas=new Map,this._data.eventsFunctionsExtensions)for(const s of this._data.eventsFunctionsExtensions)for(const n of s.eventsBasedObjects)this._eventsBasedObjectDatas.set(s.name+"::"+n.name,n);this.isUsingGDevelopDevelopmentEnvironment()&&g.info("This game will run on the development version of GDevelop APIs.")}setProjectData(e){this._data=e,this._updateSceneAndExtensionsData(),this._resourcesLoader.setResources(e.resources.resources,c(e),e.layouts)}_updateSceneAndExtensionsData(){const e=this._data.eventsFunctionsExtensions.filter(t=>t.sceneVariables.length>0);this._sceneAndExtensionsData=this._data.layouts.map(t=>({sceneData:t,usedExtensionsWithVariablesData:e}))}getAdditionalOptions(){return this._options}getRenderer(){return this._renderer}getVariables(){return this._variables}getVariablesForExtension(e){return this._variablesByExtensionName.get(e)||null}getSoundManager(){return this._resourcesLoader.getSoundManager()}getImageManager(){return this._resourcesLoader.getImageManager()}getFontManager(){return this._resourcesLoader.getFontManager()}getBitmapFontManager(){return this._resourcesLoader.getBitmapFontManager()}getJsonManager(){return this._resourcesLoader.getJsonManager()}getModel3DManager(){return this._resourcesLoader.getModel3DManager()}getSpineManager(){return this._resourcesLoader.getSpineManager()}getSpineAtlasManager(){return this._resourcesLoader.getSpineAtlasManager()}getInputManager(){return this._inputManager}getEffectsManager(){return this._effectsManager}getGameData(){return this._data}getEventsBasedObjectData(e){const t=this._eventsBasedObjectDatas.get(e);return t||(g.error('The game has no events-based object of the type "'+e+'"'),null)}getSceneAndExtensionsData(e){for(let t=0,s=this._sceneAndExtensionsData.length;t<s;++t){const n=this._sceneAndExtensionsData[t];if(e===void 0||n.sceneData.name===e)return n}return g.error('The game has no scene called "'+e+'"'),null}hasScene(e){for(let t=0,s=this._data.layouts.length;t<s;++t){const n=this._data.layouts[t];if(e===void 0||n.name==e)return!0}return!1}getExternalLayoutData(e){let t=null;for(let s=0,n=this._data.externalLayouts.length;s<n;++s){const r=this._data.externalLayouts[s];if(r.name===e){t=r;break}}return t}getInitialObjectsData(){return this._data.objects||[]}getOriginalWidth(){return this._originalWidth}getOriginalHeight(){return this._originalHeight}getGameResolutionWidth(){return this._gameResolutionWidth}getGameResolutionHeight(){return this._gameResolutionHeight}setGameResolutionSize(e,t){if(this._gameResolutionWidth=e,this._gameResolutionHeight=t,this._adaptGameResolutionAtRuntime&&i.RuntimeGameRenderer&&i.RuntimeGameRenderer.getWindowInnerWidth&&i.RuntimeGameRenderer.getWindowInnerHeight){const s=i.RuntimeGameRenderer.getWindowInnerWidth(),n=i.RuntimeGameRenderer.getWindowInnerHeight();this._resizeMode==="adaptWidth"?this._gameResolutionWidth=this._gameResolutionHeight*s/n:this._resizeMode==="adaptHeight"&&(this._gameResolutionHeight=this._gameResolutionWidth*n/s)}this._renderer.updateRendererSize(),this._notifyScenesForGameResolutionResize=!0}setGameResolutionResizeMode(e){this._resizeMode=e,this._forceGameResolutionUpdate()}getGameResolutionResizeMode(){return this._resizeMode}setAdaptGameResolutionAtRuntime(e){this._adaptGameResolutionAtRuntime=e,this._forceGameResolutionUpdate()}getAdaptGameResolutionAtRuntime(){return this._adaptGameResolutionAtRuntime}getMinimalFramerate(){return this._minFPS}getScaleMode(){return this._scaleMode}getPixelsRounding(){return this._pixelsRounding}getAntialiasingMode(){return this._antialiasingMode}isAntialisingEnabledOnMobile(){return this._isAntialisingEnabledOnMobile}pause(e){this._paused!==e&&(this._paused=e,this._debuggerClient&&(this._paused?this._debuggerClient.sendGamePaused():this._debuggerClient.sendGameResumed()))}hasJustResumed(){return this._hasJustResumed}prioritizeLoadingOfScene(e){this._resourcesLoader.loadSceneResources(e)}getSceneLoadingProgress(e){return this._resourcesLoader.getSceneLoadingProgress(e)}areSceneAssetsLoaded(e){return this._resourcesLoader.areSceneAssetsLoaded(e)}areSceneAssetsReady(e){return this._resourcesLoader.areSceneAssetsReady(e)}loadAllAssets(e,t){this.loadFirstAssetsAndStartBackgroundLoading(this._getFirstSceneName(),t).then(e)}async loadFirstAssetsAndStartBackgroundLoading(e,t){try{const s=this._data.properties.loadingScreen.backgroundImageResourceName;s&&await this._resourcesLoader.getImageManager().loadResource(s),await Promise.all([this._loadAssetsWithLoadingScreen(!0,async n=>{await this._resourcesLoader.loadGlobalAndFirstSceneResources(e,n),this._resourcesLoader.loadAllSceneInBackground()},t),i.getAllAsynchronouslyLoadingLibraryPromise()])}catch(s){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(s),s}}async loadSceneAssets(e,t){await this._loadAssetsWithLoadingScreen(!1,async s=>{await this._resourcesLoader.loadAndProcessSceneResources(e,s)},t)}async _loadAssetsWithLoadingScreen(e,t,s){this.pause(!0);const n=new i.LoadingScreenRenderer(this.getRenderer(),this._resourcesLoader.getImageManager(),this._data.properties.loadingScreen,this._data.properties.watermark.showWatermark,e);await t(async(o,a)=>{const d=Math.floor(100*o/a);n.setPercent(d),s&&s(d),n.renderIfNeeded()&&await h(1)}),await n.unload(),this.pause(!1)}_getFirstSceneName(){const e=this._data.firstLayout;return this.hasScene(e)?e:this.getSceneAndExtensionsData().sceneData.name}startGameLoop(){try{if(!this.hasScene()){g.error("The game has no scene.");return}this._forceGameResolutionUpdate(),this._sceneStack.push(this._getFirstSceneName(),this._injectExternalLayout),this._watermark.displayAtStartup(),this._setupGameVisibilityEvents();let e=0;this._hasJustResumed=!1,this._renderer.startGameLoop(t=>{try{if(this._paused||(e+=t,this._maxFPS>0&&1e3/e>this._maxFPS+7))return!0;const s=e;return e=0,this._notifyScenesForGameResolutionResize&&(this._sceneStack.onGameResolutionResized(),this._notifyScenesForGameResolutionResize=!1),this._sceneStack.step(s)?(this.getInputManager().onFrameEnded(),this._hasJustResumed=!1,!0):!1}catch(s){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(s),s}}),setTimeout(()=>{this._setupSessionMetrics()},1e4)}catch(e){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(e),e}}enableMetrics(e){this._disableMetrics=!e,e&&this._setupSessionMetrics()}_setupGameVisibilityEvents(){typeof navigator!="undefined"&&typeof document!="undefined"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(this._hasJustResumed=!0)}),window.addEventListener("resume",()=>{this._hasJustResumed=!0},!1))}_setupSessionMetrics(){if(this._sessionMetricsInitialized||this._disableMetrics||this.isPreview()||typeof fetch=="undefined"||!this._data.properties.projectUuid)return;const e="https://api.gdevelop-app.com/analytics";this._playerId=this._makePlayerUuid();let t=0,s=0,n=Date.now();const r=this.getPlatformInfo();fetch(e+"/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,game:{name:this._data.properties.name||"",packageName:this._data.properties.packageName||"",version:this._data.properties.version||"",location:window.location.href},platform:{isCordova:r.isCordova,devicePlatform:r.devicePlatform,navigatorPlatform:r.navigatorPlatform,hasTouch:r.hasTouch}})}).then(a=>{if(!a.ok)throw console.error("Error while creating the session",a),new Error("Error while creating the session");return a}).then(a=>a.text()).then(a=>{this._sessionId=a}).catch(()=>{});const o=()=>{if(!this._sessionId)return;const a=Date.now();if(s+=a-n,n=a,s<5*1e3)return;const d=Math.floor(s/1e3)*1e3;t+=d,s-=d,navigator.sendBeacon(e+"/session-hit",JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,sessionId:this._sessionId,duration:Math.floor(t/1e3)}))};if(typeof navigator!="undefined"&&typeof document!="undefined"){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?n=Date.now():o()}),window.addEventListener("pagehide",o,!1),window.addEventListener("pause",o,!1),window.addEventListener("resume",()=>{n=Date.now()},!1);const a=typeof safari=="object"&&safari.pushNotification,d=/electron/i.test(navigator.userAgent);(a||d)&&window.addEventListener("beforeunload",()=>{o()})}this._sessionMetricsInitialized=!0,this._sessionId=this._sessionId}_makePlayerUuid(){try{const e="GDJS-internal-player-uuid",t=localStorage.getItem(e);if(t)return t;const s=i.makeUuid();return localStorage.setItem(e,s),s}catch{return i.makeUuid()}}getSessionId(){return this._sessionId}getPlayerId(){return this._playerId}onWindowInnerSizeChanged(){this._forceGameResolutionUpdate()}_forceGameResolutionUpdate(){this.setGameResolutionSize(this._gameResolutionWidth,this._gameResolutionHeight)}startCurrentSceneProfiler(e){const t=this._sceneStack.getCurrentScene();return t?(t.startProfiler(e),!0):!1}stopCurrentSceneProfiler(){const e=this._sceneStack.getCurrentScene();!e||e.stopProfiler()}wasFirstSceneLoaded(){return this._sceneStack.wasFirstSceneLoaded()}getSceneStack(){return this._sceneStack}isPreview(){return this._isPreview}isUsingGDevelopDevelopmentEnvironment(){return this._options.environment==="dev"}getExtensionProperty(e,t){for(let s of this._data.properties.extensionProperties)if(s.extension===e&&s.property===t)return s.value;return null}resolveEmbeddedResource(e,t){const s=this._embeddedResourcesMappings.get(e);return s&&s[t]?s[t]:t}getEmbeddedResourcesNames(e){return this._embeddedResourcesMappings.has(e)?Object.keys(this._embeddedResourcesMappings.get(e)):[]}getNetworkSyncData(e){const t={var:this._variables.getNetworkSyncData(e),ss:this._sceneStack.getNetworkSyncData(e)||void 0},s={};return this._variablesByExtensionName.forEach((n,r)=>{const o=n.getNetworkSyncData(e);o.length&&(s[r]=o)}),t.extVar=s,(!t.var||t.var.length===0)&&!t.ss&&(!t.extVar||Object.keys(t.extVar).length===0)?null:t}updateFromNetworkSyncData(e){if(e.var&&this._variables.updateFromNetworkSyncData(e.var),e.ss&&this._sceneStack.updateFromNetworkSyncData(e.ss),e.extVar)for(const t in e.extVar){if(!e.extVar.hasOwnProperty(t))continue;const s=e.extVar[t],n=this.getVariablesForExtension(t);n&&n.updateFromNetworkSyncData(s)}}}i.RuntimeGame=m})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=runtimegame.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/runtimegame.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 const logger = new gdjs.Logger('Game manager');\n\n const sleep = (ms: float) =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n /** Identify a script file, with its content hash (useful for hot-reloading). */\n export type RuntimeGameOptionsScriptFile = {\n /** The path for this script file. */\n path: string;\n /** The hash of the script file content. */\n hash: number;\n };\n\n const getGlobalResourceNames = (projectData: ProjectData): Array<string> =>\n projectData.usedResources.map((resource) => resource.name);\n\n /** Options given to the game at startup. */\n export type RuntimeGameOptions = {\n /** if true, force fullscreen. */\n forceFullscreen?: boolean;\n /** if true, game is run as a preview launched from an editor. */\n isPreview?: boolean;\n /** The name of the external layout to create in the scene at position 0;0. */\n injectExternalLayout?: string;\n /** Script files, used for hot-reloading. */\n scriptFiles?: Array<RuntimeGameOptionsScriptFile>;\n /** if true, export is a partial preview without events. */\n projectDataOnlyExport?: boolean;\n /** The address of the debugger server, to reach out using WebSocket. */\n websocketDebuggerServerAddress?: string;\n /** The port of the debugger server, to reach out using WebSocket. */\n websocketDebuggerServerPort?: string;\n\n /**\n * The path to require `@electron/remote` module.\n * This is only useful in a preview, where this can't be required from\n * `@electron/remote` directly as previews don't have any node_modules.\n * On the contrary, a game packaged with Electron as a standalone app\n * has its node_modules.\n * This can be removed once there are no more dependencies on\n * `@electron/remote` in the game engine and extensions.\n */\n electronRemoteRequirePath?: string;\n\n /**\n * the token to use by the game engine when requiring any resource stored on\n * GDevelop Cloud buckets. Note that this is only useful during previews.\n */\n gdevelopResourceToken?: string;\n\n /**\n * Check if, in some exceptional cases, we allow authentication\n * to be done through a iframe.\n * This is usually discouraged as the user can't verify that the authentication\n * window is a genuine one. It's only to be used in trusted contexts.\n */\n allowAuthenticationUsingIframeForPreview?: boolean;\n\n /**\n * If set, the game should use the specified environment for making calls\n * to GDevelop APIs (\"dev\" = development APIs).\n */\n environment?: 'dev';\n };\n\n /**\n * Represents a game being played.\n */\n export class RuntimeGame {\n _resourcesLoader: gdjs.ResourceLoader;\n _variables: VariablesContainer;\n _data: ProjectData;\n _eventsBasedObjectDatas: Map<String, EventsBasedObjectData>;\n _effectsManager: EffectsManager;\n _maxFPS: integer;\n _minFPS: integer;\n _gameResolutionWidth: integer;\n _gameResolutionHeight: integer;\n _originalWidth: float;\n _originalHeight: float;\n _resizeMode: 'adaptWidth' | 'adaptHeight' | string;\n _adaptGameResolutionAtRuntime: boolean;\n _scaleMode: 'linear' | 'nearest';\n _pixelsRounding: boolean;\n _antialiasingMode: 'none' | 'MSAA';\n _isAntialisingEnabledOnMobile: boolean;\n /**\n * Game loop management (see startGameLoop method)\n */\n _renderer: RuntimeGameRenderer;\n _sessionId: string | null;\n _playerId: string | null;\n _watermark: watermark.RuntimeWatermark;\n\n _sceneStack: SceneStack;\n /**\n * When set to true, the scenes are notified that game resolution size changed.\n */\n _notifyScenesForGameResolutionResize: boolean = false;\n\n /**\n * When paused, the game won't step and will be freezed. Useful for debugging.\n */\n _paused: boolean = false;\n\n /**\n * True during the first frame the game is back from being hidden.\n * This has nothing to do with `_paused`.\n */\n _hasJustResumed: boolean = false;\n\n //Inputs :\n _inputManager: InputManager;\n\n /**\n * Allow to specify an external layout to insert in the first scene.\n */\n _injectExternalLayout: any;\n _options: RuntimeGameOptions;\n\n /**\n * The mappings for embedded resources\n */\n _embeddedResourcesMappings: Map<string, Record<string, string>>;\n\n /**\n * Optional client to connect to a debugger server.\n */\n _debuggerClient: gdjs.AbstractDebuggerClient | null;\n _sessionMetricsInitialized: boolean = false;\n _disableMetrics: boolean = false;\n _isPreview: boolean;\n\n /**\n * @param data The object (usually stored in data.json) containing the full project data\n * @param\n */\n constructor(data: ProjectData, options?: RuntimeGameOptions) {\n this._options = options || {};\n this._variables = new gdjs.VariablesContainer(data.variables);\n this._data = data;\n\n this._resourcesLoader = new gdjs.ResourceLoader(\n this,\n data.resources.resources,\n getGlobalResourceNames(data),\n data.layouts\n );\n\n this._effectsManager = new gdjs.EffectsManager();\n this._maxFPS = this._data.properties.maxFPS;\n this._minFPS = this._data.properties.minFPS;\n this._gameResolutionWidth = this._data.properties.windowWidth;\n this._gameResolutionHeight = this._data.properties.windowHeight;\n this._originalWidth = this._gameResolutionWidth;\n this._originalHeight = this._gameResolutionHeight;\n this._resizeMode = this._data.properties.sizeOnStartupMode;\n this._adaptGameResolutionAtRuntime = this._data.properties.adaptGameResolutionAtRuntime;\n this._scaleMode = data.properties.scaleMode || 'linear';\n this._pixelsRounding = this._data.properties.pixelsRounding;\n this._antialiasingMode = this._data.properties.antialiasingMode;\n this._isAntialisingEnabledOnMobile = this._data.properties.antialisingEnabledOnMobile;\n this._renderer = new gdjs.RuntimeGameRenderer(\n this,\n this._options.forceFullscreen || false\n );\n this._watermark = new gdjs.watermark.RuntimeWatermark(\n this,\n data.properties.authorUsernames,\n this._data.properties.watermark\n );\n this._sceneStack = new gdjs.SceneStack(this);\n this._inputManager = new gdjs.InputManager();\n this._injectExternalLayout = this._options.injectExternalLayout || '';\n this._debuggerClient = gdjs.DebuggerClient\n ? new gdjs.DebuggerClient(this)\n : null;\n this._isPreview = this._options.isPreview || false;\n this._sessionId = null;\n this._playerId = null;\n\n this._embeddedResourcesMappings = new Map();\n for (const resource of this._data.resources.resources) {\n if (resource.metadata) {\n try {\n const metadata = JSON.parse(resource.metadata);\n if (metadata?.embeddedResourcesMapping) {\n this._embeddedResourcesMappings.set(\n resource.name,\n metadata.embeddedResourcesMapping\n );\n }\n } catch {\n logger.error(\n 'Some metadata of resources can not be successfully parsed.'\n );\n }\n }\n }\n\n this._eventsBasedObjectDatas = new Map<String, EventsBasedObjectData>();\n if (this._data.eventsFunctionsExtensions) {\n for (const extension of this._data.eventsFunctionsExtensions) {\n for (const eventsBasedObject of extension.eventsBasedObjects) {\n this._eventsBasedObjectDatas.set(\n extension.name + '::' + eventsBasedObject.name,\n eventsBasedObject\n );\n }\n }\n }\n\n if (this.isUsingGDevelopDevelopmentEnvironment()) {\n logger.info(\n 'This game will run on the development version of GDevelop APIs.'\n );\n }\n }\n\n /**\n * Update the project data. Useful for hot-reloading, should not be used otherwise.\n *\n * @param projectData The object (usually stored in data.json) containing the full project data\n */\n setProjectData(projectData: ProjectData): void {\n this._data = projectData;\n this._resourcesLoader.setResources(\n projectData.resources.resources,\n getGlobalResourceNames(projectData),\n projectData.layouts\n );\n }\n\n /**\n * Return the additional options passed to the RuntimeGame when created.\n * @returns The additional options, if any.\n */\n getAdditionalOptions(): RuntimeGameOptions | null {\n return this._options;\n }\n\n getRenderer(): gdjs.RuntimeGameRenderer {\n return this._renderer;\n }\n\n /**\n * Get the variables of the RuntimeGame.\n * @return The global variables\n */\n getVariables(): gdjs.VariablesContainer {\n return this._variables;\n }\n\n /**\n * Get the gdjs.SoundManager of the RuntimeGame.\n * @return The sound manager.\n */\n getSoundManager(): gdjs.HowlerSoundManager {\n return this._resourcesLoader.getSoundManager();\n }\n\n /**\n * Get the gdjs.ImageManager of the RuntimeGame.\n * @return The image manager.\n */\n getImageManager(): gdjs.PixiImageManager {\n return this._resourcesLoader.getImageManager();\n }\n\n /**\n * Get the gdjs.FontManager of the RuntimeGame.\n * @return The font manager.\n */\n getFontManager(): gdjs.FontFaceObserverFontManager {\n return this._resourcesLoader.getFontManager();\n }\n\n /**\n * Get the gdjs.BitmapFontManager of the RuntimeGame.\n * @return The bitmap font manager.\n */\n getBitmapFontManager(): gdjs.BitmapFontManager {\n return this._resourcesLoader.getBitmapFontManager();\n }\n\n /**\n * Get the JSON manager of the game, used to load JSON from game\n * resources.\n * @return The json manager for the game\n */\n getJsonManager(): gdjs.JsonManager {\n return this._resourcesLoader.getJsonManager();\n }\n\n /**\n * Get the 3D model manager of the game, used to load 3D model from game\n * resources.\n * @return The 3D model manager for the game\n */\n getModel3DManager(): gdjs.Model3DManager {\n return this._resourcesLoader.getModel3DManager();\n }\n\n /**\n * Get the Spine manager of the game, used to load and construct spine skeletons from game\n * resources.\n * @return The Spine manager for the game\n */\n getSpineManager(): gdjs.SpineManager | null {\n return this._resourcesLoader.getSpineManager();\n }\n\n /**\n * Get the Spine Atlas manager of the game, used to load atlases from game\n * resources.\n * @return The Spine Atlas manager for the game\n */\n getSpineAtlasManager(): gdjs.SpineAtlasManager | null {\n return this._resourcesLoader.getSpineAtlasManager();\n }\n\n /**\n * Get the input manager of the game, storing mouse, keyboard\n * and touches states.\n * @return The input manager owned by the game\n */\n getInputManager(): gdjs.InputManager {\n return this._inputManager;\n }\n\n /**\n * Get the effects manager of the game, which allows to manage\n * effects on runtime objects or runtime layers.\n * @return The effects manager for the game\n */\n getEffectsManager(): gdjs.EffectsManager {\n return this._effectsManager;\n }\n\n /**\n * Get the object containing the game data\n * @return The object associated to the game.\n */\n getGameData(): ProjectData {\n return this._data;\n }\n\n getEventsBasedObjectData(type: string): EventsBasedObjectData | null {\n const eventsBasedObjectData = this._eventsBasedObjectDatas.get(type);\n if (!eventsBasedObjectData) {\n logger.error(\n 'The game has no events-based object of the type \"' + type + '\"'\n );\n return null;\n }\n return eventsBasedObjectData;\n }\n\n /**\n * Get the data associated to a scene.\n *\n * @param sceneName The name of the scene. If not defined, the first scene will be returned.\n * @return The data associated to the scene.\n */\n getSceneData(sceneName?: string): LayoutData | null {\n let scene: LayoutData | null = null;\n for (let i = 0, len = this._data.layouts.length; i < len; ++i) {\n const sceneData = this._data.layouts[i];\n if (sceneName === undefined || sceneData.name === sceneName) {\n scene = sceneData;\n break;\n }\n }\n if (scene === null) {\n logger.error('The game has no scene called \"' + sceneName + '\"');\n }\n return scene;\n }\n\n /**\n * Check if a scene exists\n *\n * @param sceneName The name of the scene to search.\n * @return true if the scene exists. If sceneName is undefined, true if the game has a scene.\n */\n hasScene(sceneName?: string): boolean {\n let isTrue = false;\n for (let i = 0, len = this._data.layouts.length; i < len; ++i) {\n const sceneData = this._data.layouts[i];\n if (sceneName === undefined || sceneData.name == sceneName) {\n isTrue = true;\n break;\n }\n }\n return isTrue;\n }\n\n /**\n * Get the data associated to an external layout.\n *\n * @param name The name of the external layout.\n * @return The data associated to the external layout or null if not found.\n */\n getExternalLayoutData(name: string): ExternalLayoutData | null {\n let externalLayout: ExternalLayoutData | null = null;\n for (let i = 0, len = this._data.externalLayouts.length; i < len; ++i) {\n const layoutData = this._data.externalLayouts[i];\n if (layoutData.name === name) {\n externalLayout = layoutData;\n break;\n }\n }\n return externalLayout;\n }\n\n /**\n * Get the data representing all the global objects of the game.\n * @return The data associated to the global objects.\n */\n getInitialObjectsData(): ObjectData[] {\n return this._data.objects || [];\n }\n\n /**\n * Get the original width of the game, as set on the startup of the game.\n *\n * This is guaranteed to never change, even if the size of the game is changed afterwards.\n */\n getOriginalWidth(): float {\n return this._originalWidth;\n }\n\n /**\n * Get the original height of the game, as set on the startup of the game.\n *\n * This is guaranteed to never change, even if the size of the game is changed afterwards.\n */\n getOriginalHeight(): float {\n return this._originalHeight;\n }\n\n /**\n * Get the game resolution (the size at which the game is played and rendered) width.\n * @returns The game resolution width, in pixels.\n */\n getGameResolutionWidth(): float {\n return this._gameResolutionWidth;\n }\n\n /**\n * Get the game resolution (the size at which the game is played and rendered) height.\n * @returns The game resolution height, in pixels.\n */\n getGameResolutionHeight(): float {\n return this._gameResolutionHeight;\n }\n\n /**\n * Change the game resolution.\n *\n * @param width The new width\n * @param height The new height\n */\n setGameResolutionSize(width: float, height: float): void {\n this._gameResolutionWidth = width;\n this._gameResolutionHeight = height;\n if (this._adaptGameResolutionAtRuntime) {\n if (\n gdjs.RuntimeGameRenderer &&\n gdjs.RuntimeGameRenderer.getWindowInnerWidth &&\n gdjs.RuntimeGameRenderer.getWindowInnerHeight\n ) {\n const windowInnerWidth = gdjs.RuntimeGameRenderer.getWindowInnerWidth();\n const windowInnerHeight = gdjs.RuntimeGameRenderer.getWindowInnerHeight();\n\n // Enlarge either the width or the eight to fill the inner window space.\n if (this._resizeMode === 'adaptWidth') {\n this._gameResolutionWidth =\n (this._gameResolutionHeight * windowInnerWidth) /\n windowInnerHeight;\n } else {\n if (this._resizeMode === 'adaptHeight') {\n this._gameResolutionHeight =\n (this._gameResolutionWidth * windowInnerHeight) /\n windowInnerWidth;\n }\n }\n }\n } else {\n }\n\n // Don't alter the game resolution. The renderer\n // will maybe adapt the size of the canvas or whatever is used to render the\n // game in the window, but this does not change the \"game resolution\".\n\n // Notify the renderer that game resolution changed (so that the renderer size\n // can be updated, and maybe other things like the canvas size), and let the\n // scenes know too.\n this._renderer.updateRendererSize();\n this._notifyScenesForGameResolutionResize = true;\n }\n\n /**\n * Set if the width or the height of the game resolution\n * should be changed to fit the game window - or if the game\n * resolution should not be updated automatically.\n *\n * @param resizeMode Either \"\" (don't change game resolution), \"adaptWidth\" or \"adaptHeight\".\n */\n setGameResolutionResizeMode(resizeMode: string): void {\n this._resizeMode = resizeMode;\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Returns if the width or the height of the game resolution\n * should be changed to fit the game window - or if the game\n * resolution should not be updated automatically (empty string).\n *\n * @returns Either \"\" (don't change game resolution), \"adaptWidth\" or \"adaptHeight\".\n */\n getGameResolutionResizeMode(): string {\n return this._resizeMode;\n }\n\n /**\n * Set if the game resolution should be automatically adapted\n * when the game window or screen size change. This will only\n * be the case if the game resolution resize mode is\n * configured to adapt the width or the height of the game.\n * @param enable true to change the game resolution according to the window/screen size.\n */\n setAdaptGameResolutionAtRuntime(enable: boolean): void {\n this._adaptGameResolutionAtRuntime = enable;\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Returns if the game resolution should be automatically adapted\n * when the game window or screen size change. This will only\n * be the case if the game resolution resize mode is\n * configured to adapt the width or the height of the game.\n * @returns true if the game resolution is automatically changed according to the window/screen size.\n */\n getAdaptGameResolutionAtRuntime(): boolean {\n return this._adaptGameResolutionAtRuntime;\n }\n\n /**\n * Return the minimal fps that must be guaranteed by the game\n * (otherwise, game is slowed down).\n */\n getMinimalFramerate(): integer {\n return this._minFPS;\n }\n\n /**\n * Return the scale mode of the game (\"linear\" or \"nearest\").\n */\n getScaleMode(): 'linear' | 'nearest' {\n return this._scaleMode;\n }\n\n /**\n * Return if the game is rounding pixels when rendering.\n */\n getPixelsRounding(): boolean {\n return this._pixelsRounding;\n }\n\n /**\n * Return the antialiasing mode used by the game (\"none\" or \"MSAA\").\n */\n getAntialiasingMode(): 'none' | 'MSAA' {\n return this._antialiasingMode;\n }\n\n /**\n * Return true if antialising is enabled on mobiles.\n */\n isAntialisingEnabledOnMobile(): boolean {\n return this._isAntialisingEnabledOnMobile;\n }\n\n /**\n * Set or unset the game as paused.\n * When paused, the game won't step and will be freezed. Useful for debugging.\n * @param enable true to pause the game, false to unpause\n */\n pause(enable: boolean) {\n if (this._paused === enable) return;\n\n this._paused = enable;\n if (this._debuggerClient) {\n if (this._paused) this._debuggerClient.sendGamePaused();\n else this._debuggerClient.sendGameResumed();\n }\n }\n\n /**\n * @returns true during the first frame the game is back from being hidden.\n * This has nothing to do with `_paused`.\n */\n hasJustResumed() {\n return this._hasJustResumed;\n }\n\n /**\n * Preload a scene assets as soon as possible in background.\n */\n prioritizeLoadingOfScene(sceneName: string) {\n // Don't await the scene assets to be loaded.\n this._resourcesLoader.loadSceneResources(sceneName);\n }\n\n /**\n * @return The progress of assets loading in background for a scene\n * (between 0 and 1).\n */\n getSceneLoadingProgress(sceneName: string): number {\n return this._resourcesLoader.getSceneLoadingProgress(sceneName);\n }\n\n /**\n * @returns true when all the resources of the given scene are loaded\n * (but maybe not parsed).\n */\n areSceneAssetsLoaded(sceneName: string): boolean {\n return this._resourcesLoader.areSceneAssetsLoaded(sceneName);\n }\n\n /**\n * @returns true when all the resources of the given scene are loaded and\n * parsed.\n */\n areSceneAssetsReady(sceneName: string): boolean {\n return this._resourcesLoader.areSceneAssetsReady(sceneName);\n }\n\n /**\n * Load all assets needed to display the 1st scene, displaying progress in\n * renderer.\n */\n loadAllAssets(\n callback: () => void,\n progressCallback?: (progress: float) => void\n ) {\n this.loadFirstAssetsAndStartBackgroundLoading(\n this._getFirstSceneName(),\n progressCallback\n ).then(callback);\n }\n\n /**\n * Load all assets needed to display the 1st scene, displaying progress in\n * renderer.\n *\n * When a game is hot-reload, this method can be called with the current\n * scene.\n */\n async loadFirstAssetsAndStartBackgroundLoading(\n firstSceneName: string,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n try {\n // Download the loading screen background image first to be able to\n // display the loading screen as soon as possible.\n const backgroundImageResourceName = this._data.properties.loadingScreen\n .backgroundImageResourceName;\n if (backgroundImageResourceName) {\n await this._resourcesLoader\n .getImageManager()\n .loadResource(backgroundImageResourceName);\n }\n await Promise.all([\n this._loadAssetsWithLoadingScreen(\n /* isFirstScene = */ true,\n async (onProgress) => {\n // TODO Is a setting needed?\n if (false) {\n await this._resourcesLoader.loadAllResources(onProgress);\n } else {\n await this._resourcesLoader.loadGlobalAndFirstSceneResources(\n firstSceneName,\n onProgress\n );\n // Don't await as it must not block the first scene from starting.\n this._resourcesLoader.loadAllSceneInBackground();\n }\n },\n progressCallback\n ),\n // TODO This is probably not necessary in case of hot reload.\n gdjs.getAllAsynchronouslyLoadingLibraryPromise(),\n ]);\n } catch (e) {\n if (this._debuggerClient) this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n }\n\n /**\n * Load all assets for a given scene, displaying progress in renderer.\n */\n async loadSceneAssets(\n sceneName: string,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n await this._loadAssetsWithLoadingScreen(\n /* isFirstLayout = */ false,\n async (onProgress) => {\n await this._resourcesLoader.loadAndProcessSceneResources(\n sceneName,\n onProgress\n );\n },\n progressCallback\n );\n }\n\n /**\n * Load assets, displaying progress in renderer.\n */\n private async _loadAssetsWithLoadingScreen(\n isFirstScene: boolean,\n loadAssets: (\n onProgress: (count: integer, total: integer) => Promise<void>\n ) => Promise<void>,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n this.pause(true);\n const loadingScreen = new gdjs.LoadingScreenRenderer(\n this.getRenderer(),\n this._resourcesLoader.getImageManager(),\n this._data.properties.loadingScreen,\n this._data.properties.watermark.showWatermark,\n isFirstScene\n );\n\n const onProgress = async (count: integer, total: integer) => {\n const percent = Math.floor((100 * count) / total);\n loadingScreen.setPercent(percent);\n if (progressCallback) {\n progressCallback(percent);\n }\n const hasRendered = loadingScreen.renderIfNeeded();\n if (hasRendered) {\n // Give a chance to draw calls from the renderer to be handled.\n await sleep(1);\n }\n };\n await loadAssets(onProgress);\n\n await loadingScreen.unload();\n this.pause(false);\n }\n\n private _getFirstSceneName(): string {\n const firstSceneName = this._data.firstLayout;\n return this.hasScene(firstSceneName)\n ? firstSceneName\n : // @ts-ignore - no risk of null object.\n this.getSceneData().name;\n }\n\n /**\n * Start the game loop, to be called once assets are loaded.\n */\n startGameLoop() {\n try {\n if (!this.hasScene()) {\n logger.error('The game has no scene.');\n return;\n }\n this._forceGameResolutionUpdate();\n\n // Load the first scene\n this._sceneStack.push(\n this._getFirstSceneName(),\n this._injectExternalLayout\n );\n this._watermark.displayAtStartup();\n\n //Uncomment to profile the first x frames of the game.\n // var x = 500;\n // var startTime = Date.now();\n // console.profile(\"Stepping for \" + x + \" frames\")\n // for(var i = 0; i < x; ++i) {\n // this._sceneStack.step(16);\n // }\n // console.profileEnd();\n // var time = Date.now() - startTime;\n // logger.log(\"Took\", time, \"ms\");\n // return;\n\n this._setupGameVisibilityEvents();\n\n // The standard game loop\n let accumulatedElapsedTime = 0;\n this._hasJustResumed = false;\n this._renderer.startGameLoop((lastCallElapsedTime) => {\n try {\n if (this._paused) {\n return true;\n }\n\n // Skip the frame if we rendering frames too fast\n accumulatedElapsedTime += lastCallElapsedTime;\n if (\n this._maxFPS > 0 &&\n 1000.0 / accumulatedElapsedTime > this._maxFPS + 7\n ) {\n // Only skip frame if the framerate is 7 frames above the maximum framerate.\n // Most browser/engines will try to run at slightly more than 60 frames per second.\n // If game is set to have a maximum FPS to 60, then one out of two frames will be dropped.\n // Hence, we use a 7 frames margin to ensure that we're not skipping frames too much.\n return true;\n }\n const elapsedTime = accumulatedElapsedTime;\n accumulatedElapsedTime = 0;\n\n // Manage resize events.\n if (this._notifyScenesForGameResolutionResize) {\n this._sceneStack.onGameResolutionResized();\n this._notifyScenesForGameResolutionResize = false;\n }\n\n // Render and step the scene.\n if (this._sceneStack.step(elapsedTime)) {\n this.getInputManager().onFrameEnded();\n this._hasJustResumed = false;\n return true;\n }\n return false;\n } catch (e) {\n if (this._debuggerClient)\n this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n });\n setTimeout(() => {\n this._setupSessionMetrics();\n }, 10000);\n } catch (e) {\n if (this._debuggerClient) this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n }\n\n /**\n * Set if the session should be registered.\n */\n enableMetrics(enable: boolean): void {\n this._disableMetrics = !enable;\n if (enable) {\n this._setupSessionMetrics();\n }\n }\n\n _setupGameVisibilityEvents() {\n if (typeof navigator !== 'undefined' && typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n this._hasJustResumed = true;\n }\n });\n window.addEventListener(\n 'resume',\n () => {\n this._hasJustResumed = true;\n },\n false\n );\n }\n }\n\n /**\n * Register a new session for the game, and set up listeners to follow the session\n * time.\n */\n _setupSessionMetrics() {\n if (this._sessionMetricsInitialized) {\n return;\n }\n if (this._disableMetrics) {\n return;\n }\n if (this.isPreview()) {\n return;\n }\n if (typeof fetch === 'undefined') {\n return;\n }\n if (!this._data.properties.projectUuid) {\n return;\n }\n const baseUrl = 'https://api.gdevelop-app.com/analytics';\n this._playerId = this._makePlayerUuid();\n /**\n * The duration that is already sent to the service\n * (in milliseconds).\n **/\n let sentDuration = 0;\n /**\n * The duration that is not yet sent to the service to avoid flooding\n * (in milliseconds).\n **/\n let notYetSentDuration = 0;\n /**\n * The last time when duration has been counted\n * either in sendedDuration or notYetSentDuration.\n **/\n let lastSessionResumeTime = Date.now();\n fetch(baseUrl + '/session', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n // It's important to ensure that the data sent here does not contain\n // any personal information from the player or that would allow to\n // precisely identify someone.\n body: JSON.stringify({\n gameId: this._data.properties.projectUuid,\n playerId: this._playerId,\n game: {\n name: this._data.properties.name || '',\n packageName: this._data.properties.packageName || '',\n version: this._data.properties.version || '',\n location: window.location.href,\n },\n platform: {\n // @ts-ignore\n isCordova: !!window.cordova,\n devicePlatform:\n // @ts-ignore\n typeof device !== 'undefined' ? device.platform || '' : '',\n navigatorPlatform:\n typeof navigator !== 'undefined' ? navigator.platform : '',\n hasTouch:\n typeof navigator !== 'undefined'\n ? !!navigator.maxTouchPoints && navigator.maxTouchPoints > 2\n : false,\n },\n }),\n })\n .then((response) => {\n // Ensure the session is correctly created to avoid sending hits that will fail.\n if (!response.ok) {\n console.error('Error while creating the session', response);\n throw new Error('Error while creating the session');\n }\n return response;\n })\n .then((response) => response.text())\n .then((returnedSessionId) => {\n this._sessionId = returnedSessionId;\n })\n .catch(() => {});\n\n /* Ignore any error */\n const sendSessionHit = () => {\n if (!this._sessionId) {\n return;\n }\n\n const now = Date.now();\n notYetSentDuration += now - lastSessionResumeTime;\n lastSessionResumeTime = now;\n\n // Group repeated calls to sendSessionHit - which could\n // happen because of multiple event listeners being fired.\n if (notYetSentDuration < 5 * 1000) {\n return;\n }\n // The backend use seconds for duration.\n // The milliseconds will stay in notYetSentDuration.\n const toBeSentDuration = Math.floor(notYetSentDuration / 1000) * 1000;\n sentDuration += toBeSentDuration;\n notYetSentDuration -= toBeSentDuration;\n\n navigator.sendBeacon(\n baseUrl + '/session-hit',\n JSON.stringify({\n gameId: this._data.properties.projectUuid,\n playerId: this._playerId,\n sessionId: this._sessionId,\n duration: Math.floor(sentDuration / 1000),\n })\n );\n };\n if (typeof navigator !== 'undefined' && typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n // Skip the duration the game was hidden.\n lastSessionResumeTime = Date.now();\n } else {\n sendSessionHit();\n }\n });\n window.addEventListener('pagehide', sendSessionHit, false);\n // Cordova events\n window.addEventListener('pause', sendSessionHit, false);\n window.addEventListener(\n 'resume',\n () => {\n // Skip the duration the game was hidden.\n lastSessionResumeTime = Date.now();\n },\n false\n );\n\n // Detect Safari to work around Safari-specific bugs:\n // - https://bugs.webkit.org/show_bug.cgi?id=151610\n // - https://bugs.webkit.org/show_bug.cgi?id=151234\n // @ts-ignore\n const isSafari = typeof safari === 'object' && safari.pushNotification;\n const isElectron = /electron/i.test(navigator.userAgent);\n if (isSafari || isElectron) {\n window.addEventListener('beforeunload', () => {\n sendSessionHit();\n });\n }\n }\n this._sessionMetricsInitialized = true;\n this._sessionId = this._sessionId;\n }\n\n /**\n * Generate an anonymous unique identifier to differentiate\n * the player from others in the game metrics.\n */\n _makePlayerUuid(): string {\n try {\n const key = 'GDJS-internal-player-uuid';\n const existingPlayerUuid = localStorage.getItem(key);\n if (existingPlayerUuid) {\n return existingPlayerUuid;\n }\n const newPlayerUuid = gdjs.makeUuid();\n localStorage.setItem(key, newPlayerUuid);\n return newPlayerUuid;\n } catch (err) {\n return gdjs.makeUuid();\n }\n }\n\n getSessionId(): string | null {\n return this._sessionId;\n }\n\n getPlayerId(): string | null {\n return this._playerId;\n }\n\n /**\n * Called by the game renderer when the window containing the game\n * has changed size (this can result from a resize of the window,\n * but also other factors like a device orientation change on mobile).\n */\n onWindowInnerSizeChanged() {\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Enlarge/reduce the width (or the height) of the game to fill the inner window.\n */\n _forceGameResolutionUpdate() {\n this.setGameResolutionSize(\n this._gameResolutionWidth,\n this._gameResolutionHeight\n );\n }\n\n /**\n * Start a profiler for the currently running scene.\n * @param onProfilerStopped Function to be called when the profiler is stopped. Will be passed the profiler as argument.\n */\n startCurrentSceneProfiler(\n onProfilerStopped: (oldProfiler: Profiler) => void\n ) {\n const currentScene = this._sceneStack.getCurrentScene();\n if (!currentScene) {\n return false;\n }\n currentScene.startProfiler(onProfilerStopped);\n return true;\n }\n\n /**\n * Stop the profiler for the currently running scene.\n */\n stopCurrentSceneProfiler() {\n const currentScene = this._sceneStack.getCurrentScene();\n if (!currentScene) {\n return;\n }\n currentScene.stopProfiler();\n }\n\n /**\n * Return true if a scene was loaded, false otherwise (i.e: game not yet started).\n */\n wasFirstSceneLoaded(): boolean {\n return this._sceneStack.wasFirstSceneLoaded();\n }\n\n /**\n * Return the stack of {@link gdjs.RuntimeScene} being played.\n */\n getSceneStack(): gdjs.SceneStack {\n return this._sceneStack;\n }\n\n /**\n * Check if the game is running as a preview, launched from an editor.\n * @returns true if the current game is a preview.\n */\n isPreview(): boolean {\n return this._isPreview;\n }\n\n /**\n * Check if the game should call GDevelop development APIs or not.\n *\n * Unless you are contributing to GDevelop, avoid using this.\n */\n isUsingGDevelopDevelopmentEnvironment(): boolean {\n return this._options.environment === 'dev';\n }\n\n /**\n * Gets an extension property from the project data.\n * @param extensionName The extension name.\n * @param propertyName The property name.\n * @return The property value.\n */\n getExtensionProperty(\n extensionName: string,\n propertyName: string\n ): string | null {\n for (let property of this._data.properties.extensionProperties) {\n if (\n property.extension === extensionName &&\n property.property === propertyName\n ) {\n return property.value;\n }\n }\n return null;\n }\n\n /**\n * Resolves the name of an embedded resource.\n * @param mainResourceName The name of the resource containing the embedded resource.\n * @param embeddedResourceName The name of the embedded resource.\n * @return The resource name.\n */\n resolveEmbeddedResource(\n mainResourceName: string,\n embeddedResourceName: string\n ): string {\n const mapping = this._embeddedResourcesMappings.get(mainResourceName);\n return mapping && mapping[embeddedResourceName]\n ? mapping[embeddedResourceName]\n : embeddedResourceName;\n }\n\n /**\n * Returns the array of resources that are embedded to passed one.\n * @param resourceName The name of resource to find embedded resources of.\n * @returns The array of related resources names.\n */\n getEmbeddedResourcesNames(resourceName: string): string[] {\n return this._embeddedResourcesMappings.has(resourceName)\n ? Object.keys(this._embeddedResourcesMappings.get(resourceName)!)\n : [];\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,gBAEzB,EAAQ,AAAC,GACb,GAAI,SAAQ,AAAC,GAAY,WAAW,EAAS,IAUzC,EAAyB,AAAC,GAC9B,EAAY,cAAc,IAAI,AAAC,GAAa,EAAS,
|
|
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 const logger = new gdjs.Logger('Game manager');\n\n const sleep = (ms: float) =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n /** Identify a script file, with its content hash (useful for hot-reloading). */\n export type RuntimeGameOptionsScriptFile = {\n /** The path for this script file. */\n path: string;\n /** The hash of the script file content. */\n hash: number;\n };\n\n const getGlobalResourceNames = (projectData: ProjectData): Array<string> =>\n projectData.usedResources.map((resource) => resource.name);\n\n let supportedCompressionMethods: ('cs:gzip' | 'cs:deflate')[] | null = null;\n const getSupportedCompressionMethods = (): ('cs:gzip' | 'cs:deflate')[] => {\n if (!!supportedCompressionMethods) {\n return supportedCompressionMethods;\n }\n supportedCompressionMethods = [];\n\n try {\n // @ts-ignore - We are checking if the CompressionStream is available.\n new CompressionStream('gzip');\n supportedCompressionMethods.push('cs:gzip');\n } catch (e) {}\n try {\n // @ts-ignore - We are checking if the CompressionStream is available.\n new CompressionStream('deflate');\n supportedCompressionMethods.push('cs:deflate');\n } catch (e) {}\n\n return supportedCompressionMethods;\n };\n\n /** Options given to the game at startup. */\n export type RuntimeGameOptions = {\n /** if true, force fullscreen. */\n forceFullscreen?: boolean;\n /** if true, game is run as a preview launched from an editor. */\n isPreview?: boolean;\n /** The name of the external layout to create in the scene at position 0;0. */\n injectExternalLayout?: string;\n /** Script files, used for hot-reloading. */\n scriptFiles?: Array<RuntimeGameOptionsScriptFile>;\n /** if true, export is a partial preview without events. */\n projectDataOnlyExport?: boolean;\n /** if true, preview is launched from GDevelop native mobile app. */\n nativeMobileApp?: boolean;\n /** The address of the debugger server, to reach out using WebSocket. */\n websocketDebuggerServerAddress?: string;\n /** The port of the debugger server, to reach out using WebSocket. */\n websocketDebuggerServerPort?: string;\n\n /**\n * The path to require `@electron/remote` module.\n * This is only useful in a preview, where this can't be required from\n * `@electron/remote` directly as previews don't have any node_modules.\n * On the contrary, a game packaged with Electron as a standalone app\n * has its node_modules.\n * This can be removed once there are no more dependencies on\n * `@electron/remote` in the game engine and extensions.\n */\n electronRemoteRequirePath?: string;\n\n /**\n * the token to use by the game engine when requiring any resource stored on\n * GDevelop Cloud buckets. Note that this is only useful during previews.\n */\n gdevelopResourceToken?: string;\n\n /**\n * Check if, in some exceptional cases, we allow authentication\n * to be done through a iframe.\n * This is usually discouraged as the user can't verify that the authentication\n * window is a genuine one. It's only to be used in trusted contexts.\n */\n allowAuthenticationUsingIframeForPreview?: boolean;\n\n /**\n * If set, this data is used to authenticate automatically when launching the game.\n * This is only useful during previews.\n */\n playerUsername?: string;\n playerId?: string;\n playerToken?: string;\n\n /**\n * If set, the game should use the specified environment for making calls\n * to GDevelop APIs (\"dev\" = development APIs).\n */\n environment?: 'dev';\n };\n\n /**\n * Represents a game being played.\n */\n export class RuntimeGame {\n _resourcesLoader: gdjs.ResourceLoader;\n _variables: VariablesContainer;\n _variablesByExtensionName: Map<string, gdjs.VariablesContainer>;\n _data: ProjectData;\n _sceneAndExtensionsData: Array<SceneAndExtensionsData> = [];\n _eventsBasedObjectDatas: Map<String, EventsBasedObjectData>;\n _effectsManager: EffectsManager;\n _maxFPS: integer;\n _minFPS: integer;\n _gameResolutionWidth: integer;\n _gameResolutionHeight: integer;\n _originalWidth: float;\n _originalHeight: float;\n _resizeMode: 'adaptWidth' | 'adaptHeight' | string;\n _adaptGameResolutionAtRuntime: boolean;\n _scaleMode: 'linear' | 'nearest';\n _pixelsRounding: boolean;\n _antialiasingMode: 'none' | 'MSAA';\n _isAntialisingEnabledOnMobile: boolean;\n /**\n * Game loop management (see startGameLoop method)\n */\n _renderer: RuntimeGameRenderer;\n _sessionId: string | null;\n _playerId: string | null;\n _watermark: watermark.RuntimeWatermark;\n\n _sceneStack: SceneStack;\n /**\n * When set to true, the scenes are notified that game resolution size changed.\n */\n _notifyScenesForGameResolutionResize: boolean = false;\n\n /**\n * When paused, the game won't step and will be freezed. Useful for debugging.\n */\n _paused: boolean = false;\n\n /**\n * True during the first frame the game is back from being hidden.\n * This has nothing to do with `_paused`.\n */\n _hasJustResumed: boolean = false;\n\n //Inputs :\n _inputManager: InputManager;\n\n /**\n * Allow to specify an external layout to insert in the first scene.\n */\n _injectExternalLayout: any;\n _options: RuntimeGameOptions;\n\n /**\n * The mappings for embedded resources\n */\n _embeddedResourcesMappings: Map<string, Record<string, string>>;\n\n /**\n * Optional client to connect to a debugger server.\n */\n _debuggerClient: gdjs.AbstractDebuggerClient | null;\n _sessionMetricsInitialized: boolean = false;\n _disableMetrics: boolean = false;\n _isPreview: boolean;\n\n /**\n * @param data The object (usually stored in data.json) containing the full project data\n * @param\n */\n constructor(data: ProjectData, options?: RuntimeGameOptions) {\n this._options = options || {};\n this._variables = new gdjs.VariablesContainer(data.variables);\n this._variablesByExtensionName = new Map<\n string,\n gdjs.VariablesContainer\n >();\n for (const extensionData of data.eventsFunctionsExtensions) {\n if (extensionData.globalVariables.length > 0) {\n this._variablesByExtensionName.set(\n extensionData.name,\n new gdjs.VariablesContainer(extensionData.globalVariables)\n );\n }\n }\n this._data = data;\n this._updateSceneAndExtensionsData();\n\n this._resourcesLoader = new gdjs.ResourceLoader(\n this,\n data.resources.resources,\n getGlobalResourceNames(data),\n data.layouts\n );\n\n this._effectsManager = new gdjs.EffectsManager();\n this._maxFPS = this._data.properties.maxFPS;\n this._minFPS = this._data.properties.minFPS;\n this._gameResolutionWidth = this._data.properties.windowWidth;\n this._gameResolutionHeight = this._data.properties.windowHeight;\n this._originalWidth = this._gameResolutionWidth;\n this._originalHeight = this._gameResolutionHeight;\n this._resizeMode = this._data.properties.sizeOnStartupMode;\n this._adaptGameResolutionAtRuntime = this._data.properties.adaptGameResolutionAtRuntime;\n this._scaleMode = data.properties.scaleMode || 'linear';\n this._pixelsRounding = this._data.properties.pixelsRounding;\n this._antialiasingMode = this._data.properties.antialiasingMode;\n this._isAntialisingEnabledOnMobile = this._data.properties.antialisingEnabledOnMobile;\n this._renderer = new gdjs.RuntimeGameRenderer(\n this,\n this._options.forceFullscreen || false\n );\n this._watermark = new gdjs.watermark.RuntimeWatermark(\n this,\n data.properties.authorUsernames,\n this._data.properties.watermark\n );\n this._sceneStack = new gdjs.SceneStack(this);\n this._inputManager = new gdjs.InputManager();\n this._injectExternalLayout = this._options.injectExternalLayout || '';\n this._debuggerClient = gdjs.DebuggerClient\n ? new gdjs.DebuggerClient(this)\n : null;\n this._isPreview = this._options.isPreview || false;\n this._sessionId = null;\n this._playerId = null;\n\n this._embeddedResourcesMappings = new Map();\n for (const resource of this._data.resources.resources) {\n if (resource.metadata) {\n try {\n const metadata = JSON.parse(resource.metadata);\n if (metadata?.embeddedResourcesMapping) {\n this._embeddedResourcesMappings.set(\n resource.name,\n metadata.embeddedResourcesMapping\n );\n }\n } catch {\n logger.error(\n 'Some metadata of resources can not be successfully parsed.'\n );\n }\n }\n }\n\n this._eventsBasedObjectDatas = new Map<String, EventsBasedObjectData>();\n if (this._data.eventsFunctionsExtensions) {\n for (const extension of this._data.eventsFunctionsExtensions) {\n for (const eventsBasedObject of extension.eventsBasedObjects) {\n this._eventsBasedObjectDatas.set(\n extension.name + '::' + eventsBasedObject.name,\n eventsBasedObject\n );\n }\n }\n }\n\n if (this.isUsingGDevelopDevelopmentEnvironment()) {\n logger.info(\n 'This game will run on the development version of GDevelop APIs.'\n );\n }\n }\n\n /**\n * Update the project data. Useful for hot-reloading, should not be used otherwise.\n *\n * @param projectData The object (usually stored in data.json) containing the full project data\n */\n setProjectData(projectData: ProjectData): void {\n this._data = projectData;\n this._updateSceneAndExtensionsData();\n this._resourcesLoader.setResources(\n projectData.resources.resources,\n getGlobalResourceNames(projectData),\n projectData.layouts\n );\n }\n\n private _updateSceneAndExtensionsData(): void {\n const usedExtensionsWithVariablesData = this._data.eventsFunctionsExtensions.filter(\n (extensionData) => extensionData.sceneVariables.length > 0\n );\n this._sceneAndExtensionsData = this._data.layouts.map((sceneData) => ({\n sceneData,\n usedExtensionsWithVariablesData,\n }));\n }\n\n /**\n * Return the additional options passed to the RuntimeGame when created.\n * @returns The additional options, if any.\n */\n getAdditionalOptions(): RuntimeGameOptions {\n return this._options;\n }\n\n getRenderer(): gdjs.RuntimeGameRenderer {\n return this._renderer;\n }\n\n /**\n * Get the variables of the RuntimeGame.\n * @return The global variables\n */\n getVariables(): gdjs.VariablesContainer {\n return this._variables;\n }\n\n /**\n * Get the extension's global variables.\n * @param extensionName The extension name.\n * @returns The extension's global variables.\n */\n getVariablesForExtension(extensionName: string) {\n return this._variablesByExtensionName.get(extensionName) || null;\n }\n\n /**\n * Get the gdjs.SoundManager of the RuntimeGame.\n * @return The sound manager.\n */\n getSoundManager(): gdjs.HowlerSoundManager {\n return this._resourcesLoader.getSoundManager();\n }\n\n /**\n * Get the gdjs.ImageManager of the RuntimeGame.\n * @return The image manager.\n */\n getImageManager(): gdjs.PixiImageManager {\n return this._resourcesLoader.getImageManager();\n }\n\n /**\n * Get the gdjs.FontManager of the RuntimeGame.\n * @return The font manager.\n */\n getFontManager(): gdjs.FontFaceObserverFontManager {\n return this._resourcesLoader.getFontManager();\n }\n\n /**\n * Get the gdjs.BitmapFontManager of the RuntimeGame.\n * @return The bitmap font manager.\n */\n getBitmapFontManager(): gdjs.BitmapFontManager {\n return this._resourcesLoader.getBitmapFontManager();\n }\n\n /**\n * Get the JSON manager of the game, used to load JSON from game\n * resources.\n * @return The json manager for the game\n */\n getJsonManager(): gdjs.JsonManager {\n return this._resourcesLoader.getJsonManager();\n }\n\n /**\n * Get the 3D model manager of the game, used to load 3D model from game\n * resources.\n * @return The 3D model manager for the game\n */\n getModel3DManager(): gdjs.Model3DManager {\n return this._resourcesLoader.getModel3DManager();\n }\n\n /**\n * Get the Spine manager of the game, used to load and construct spine skeletons from game\n * resources.\n * @return The Spine manager for the game\n */\n getSpineManager(): gdjs.SpineManager | null {\n return this._resourcesLoader.getSpineManager();\n }\n\n /**\n * Get the Spine Atlas manager of the game, used to load atlases from game\n * resources.\n * @return The Spine Atlas manager for the game\n */\n getSpineAtlasManager(): gdjs.SpineAtlasManager | null {\n return this._resourcesLoader.getSpineAtlasManager();\n }\n\n /**\n * Get the input manager of the game, storing mouse, keyboard\n * and touches states.\n * @return The input manager owned by the game\n */\n getInputManager(): gdjs.InputManager {\n return this._inputManager;\n }\n\n /**\n * Get the effects manager of the game, which allows to manage\n * effects on runtime objects or runtime layers.\n * @return The effects manager for the game\n */\n getEffectsManager(): gdjs.EffectsManager {\n return this._effectsManager;\n }\n\n /**\n * Get the object containing the game data\n * @return The object associated to the game.\n */\n getGameData(): ProjectData {\n return this._data;\n }\n\n getEventsBasedObjectData(type: string): EventsBasedObjectData | null {\n const eventsBasedObjectData = this._eventsBasedObjectDatas.get(type);\n if (!eventsBasedObjectData) {\n logger.error(\n 'The game has no events-based object of the type \"' + type + '\"'\n );\n return null;\n }\n return eventsBasedObjectData;\n }\n\n /**\n * Get the data associated to a scene.\n *\n * @param sceneName The name of the scene. If not defined, the first scene will be returned.\n * @return The data associated to the scene.\n */\n getSceneAndExtensionsData(\n sceneName?: string\n ): SceneAndExtensionsData | null {\n for (let i = 0, len = this._sceneAndExtensionsData.length; i < len; ++i) {\n const sceneAndExtensionsData = this._sceneAndExtensionsData[i];\n if (\n sceneName === undefined ||\n sceneAndExtensionsData.sceneData.name === sceneName\n ) {\n return sceneAndExtensionsData;\n }\n }\n logger.error('The game has no scene called \"' + sceneName + '\"');\n return null;\n }\n\n /**\n * Check if a scene exists\n *\n * @param sceneName The name of the scene to search.\n * @return true if the scene exists. If sceneName is undefined, true if the game has a scene.\n */\n hasScene(sceneName?: string): boolean {\n for (let i = 0, len = this._data.layouts.length; i < len; ++i) {\n const sceneData = this._data.layouts[i];\n if (sceneName === undefined || sceneData.name == sceneName) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Get the data associated to an external layout.\n *\n * @param name The name of the external layout.\n * @return The data associated to the external layout or null if not found.\n */\n getExternalLayoutData(name: string): ExternalLayoutData | null {\n let externalLayout: ExternalLayoutData | null = null;\n for (let i = 0, len = this._data.externalLayouts.length; i < len; ++i) {\n const layoutData = this._data.externalLayouts[i];\n if (layoutData.name === name) {\n externalLayout = layoutData;\n break;\n }\n }\n return externalLayout;\n }\n\n /**\n * Get the data representing all the global objects of the game.\n * @return The data associated to the global objects.\n */\n getInitialObjectsData(): ObjectData[] {\n return this._data.objects || [];\n }\n\n /**\n * Get the original width of the game, as set on the startup of the game.\n *\n * This is guaranteed to never change, even if the size of the game is changed afterwards.\n */\n getOriginalWidth(): float {\n return this._originalWidth;\n }\n\n /**\n * Get the original height of the game, as set on the startup of the game.\n *\n * This is guaranteed to never change, even if the size of the game is changed afterwards.\n */\n getOriginalHeight(): float {\n return this._originalHeight;\n }\n\n /**\n * Get the game resolution (the size at which the game is played and rendered) width.\n * @returns The game resolution width, in pixels.\n */\n getGameResolutionWidth(): float {\n return this._gameResolutionWidth;\n }\n\n /**\n * Get the game resolution (the size at which the game is played and rendered) height.\n * @returns The game resolution height, in pixels.\n */\n getGameResolutionHeight(): float {\n return this._gameResolutionHeight;\n }\n\n /**\n * Change the game resolution.\n *\n * @param width The new width\n * @param height The new height\n */\n setGameResolutionSize(width: float, height: float): void {\n this._gameResolutionWidth = width;\n this._gameResolutionHeight = height;\n if (this._adaptGameResolutionAtRuntime) {\n if (\n gdjs.RuntimeGameRenderer &&\n gdjs.RuntimeGameRenderer.getWindowInnerWidth &&\n gdjs.RuntimeGameRenderer.getWindowInnerHeight\n ) {\n const windowInnerWidth = gdjs.RuntimeGameRenderer.getWindowInnerWidth();\n const windowInnerHeight = gdjs.RuntimeGameRenderer.getWindowInnerHeight();\n\n // Enlarge either the width or the eight to fill the inner window space.\n if (this._resizeMode === 'adaptWidth') {\n this._gameResolutionWidth =\n (this._gameResolutionHeight * windowInnerWidth) /\n windowInnerHeight;\n } else {\n if (this._resizeMode === 'adaptHeight') {\n this._gameResolutionHeight =\n (this._gameResolutionWidth * windowInnerHeight) /\n windowInnerWidth;\n }\n }\n }\n } else {\n }\n\n // Don't alter the game resolution. The renderer\n // will maybe adapt the size of the canvas or whatever is used to render the\n // game in the window, but this does not change the \"game resolution\".\n\n // Notify the renderer that game resolution changed (so that the renderer size\n // can be updated, and maybe other things like the canvas size), and let the\n // scenes know too.\n this._renderer.updateRendererSize();\n this._notifyScenesForGameResolutionResize = true;\n }\n\n /**\n * Set if the width or the height of the game resolution\n * should be changed to fit the game window - or if the game\n * resolution should not be updated automatically.\n *\n * @param resizeMode Either \"\" (don't change game resolution), \"adaptWidth\" or \"adaptHeight\".\n */\n setGameResolutionResizeMode(resizeMode: string): void {\n this._resizeMode = resizeMode;\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Returns if the width or the height of the game resolution\n * should be changed to fit the game window - or if the game\n * resolution should not be updated automatically (empty string).\n *\n * @returns Either \"\" (don't change game resolution), \"adaptWidth\" or \"adaptHeight\".\n */\n getGameResolutionResizeMode(): string {\n return this._resizeMode;\n }\n\n /**\n * Set if the game resolution should be automatically adapted\n * when the game window or screen size change. This will only\n * be the case if the game resolution resize mode is\n * configured to adapt the width or the height of the game.\n * @param enable true to change the game resolution according to the window/screen size.\n */\n setAdaptGameResolutionAtRuntime(enable: boolean): void {\n this._adaptGameResolutionAtRuntime = enable;\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Returns if the game resolution should be automatically adapted\n * when the game window or screen size change. This will only\n * be the case if the game resolution resize mode is\n * configured to adapt the width or the height of the game.\n * @returns true if the game resolution is automatically changed according to the window/screen size.\n */\n getAdaptGameResolutionAtRuntime(): boolean {\n return this._adaptGameResolutionAtRuntime;\n }\n\n /**\n * Return the minimal fps that must be guaranteed by the game\n * (otherwise, game is slowed down).\n */\n getMinimalFramerate(): integer {\n return this._minFPS;\n }\n\n /**\n * Return the scale mode of the game (\"linear\" or \"nearest\").\n */\n getScaleMode(): 'linear' | 'nearest' {\n return this._scaleMode;\n }\n\n /**\n * Return if the game is rounding pixels when rendering.\n */\n getPixelsRounding(): boolean {\n return this._pixelsRounding;\n }\n\n /**\n * Return the antialiasing mode used by the game (\"none\" or \"MSAA\").\n */\n getAntialiasingMode(): 'none' | 'MSAA' {\n return this._antialiasingMode;\n }\n\n /**\n * Return true if antialising is enabled on mobiles.\n */\n isAntialisingEnabledOnMobile(): boolean {\n return this._isAntialisingEnabledOnMobile;\n }\n\n /**\n * Set or unset the game as paused.\n * When paused, the game won't step and will be freezed. Useful for debugging.\n * @param enable true to pause the game, false to unpause\n */\n pause(enable: boolean) {\n if (this._paused === enable) return;\n\n this._paused = enable;\n if (this._debuggerClient) {\n if (this._paused) this._debuggerClient.sendGamePaused();\n else this._debuggerClient.sendGameResumed();\n }\n }\n\n /**\n * @returns true during the first frame the game is back from being hidden.\n * This has nothing to do with `_paused`.\n */\n hasJustResumed() {\n return this._hasJustResumed;\n }\n\n /**\n * Preload a scene assets as soon as possible in background.\n */\n prioritizeLoadingOfScene(sceneName: string) {\n // Don't await the scene assets to be loaded.\n this._resourcesLoader.loadSceneResources(sceneName);\n }\n\n /**\n * @return The progress of assets loading in background for a scene\n * (between 0 and 1).\n */\n getSceneLoadingProgress(sceneName: string): number {\n return this._resourcesLoader.getSceneLoadingProgress(sceneName);\n }\n\n /**\n * @returns true when all the resources of the given scene are loaded\n * (but maybe not parsed).\n */\n areSceneAssetsLoaded(sceneName: string): boolean {\n return this._resourcesLoader.areSceneAssetsLoaded(sceneName);\n }\n\n /**\n * @returns true when all the resources of the given scene are loaded and\n * parsed.\n */\n areSceneAssetsReady(sceneName: string): boolean {\n return this._resourcesLoader.areSceneAssetsReady(sceneName);\n }\n\n /**\n * Load all assets needed to display the 1st scene, displaying progress in\n * renderer.\n */\n loadAllAssets(\n callback: () => void,\n progressCallback?: (progress: float) => void\n ) {\n this.loadFirstAssetsAndStartBackgroundLoading(\n this._getFirstSceneName(),\n progressCallback\n ).then(callback);\n }\n\n /**\n * Load all assets needed to display the 1st scene, displaying progress in\n * renderer.\n *\n * When a game is hot-reload, this method can be called with the current\n * scene.\n */\n async loadFirstAssetsAndStartBackgroundLoading(\n firstSceneName: string,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n try {\n // Download the loading screen background image first to be able to\n // display the loading screen as soon as possible.\n const backgroundImageResourceName = this._data.properties.loadingScreen\n .backgroundImageResourceName;\n if (backgroundImageResourceName) {\n await this._resourcesLoader\n .getImageManager()\n .loadResource(backgroundImageResourceName);\n }\n await Promise.all([\n this._loadAssetsWithLoadingScreen(\n /* isFirstScene = */ true,\n async (onProgress) => {\n // TODO Is a setting needed?\n if (false) {\n await this._resourcesLoader.loadAllResources(onProgress);\n } else {\n await this._resourcesLoader.loadGlobalAndFirstSceneResources(\n firstSceneName,\n onProgress\n );\n // Don't await as it must not block the first scene from starting.\n this._resourcesLoader.loadAllSceneInBackground();\n }\n },\n progressCallback\n ),\n // TODO This is probably not necessary in case of hot reload.\n gdjs.getAllAsynchronouslyLoadingLibraryPromise(),\n ]);\n } catch (e) {\n if (this._debuggerClient) this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n }\n\n /**\n * Load all assets for a given scene, displaying progress in renderer.\n */\n async loadSceneAssets(\n sceneName: string,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n await this._loadAssetsWithLoadingScreen(\n /* isFirstLayout = */ false,\n async (onProgress) => {\n await this._resourcesLoader.loadAndProcessSceneResources(\n sceneName,\n onProgress\n );\n },\n progressCallback\n );\n }\n\n /**\n * Load assets, displaying progress in renderer.\n */\n private async _loadAssetsWithLoadingScreen(\n isFirstScene: boolean,\n loadAssets: (\n onProgress: (count: integer, total: integer) => Promise<void>\n ) => Promise<void>,\n progressCallback?: (progress: float) => void\n ): Promise<void> {\n this.pause(true);\n const loadingScreen = new gdjs.LoadingScreenRenderer(\n this.getRenderer(),\n this._resourcesLoader.getImageManager(),\n this._data.properties.loadingScreen,\n this._data.properties.watermark.showWatermark,\n isFirstScene\n );\n\n const onProgress = async (count: integer, total: integer) => {\n const percent = Math.floor((100 * count) / total);\n loadingScreen.setPercent(percent);\n if (progressCallback) {\n progressCallback(percent);\n }\n const hasRendered = loadingScreen.renderIfNeeded();\n if (hasRendered) {\n // Give a chance to draw calls from the renderer to be handled.\n await sleep(1);\n }\n };\n await loadAssets(onProgress);\n\n await loadingScreen.unload();\n this.pause(false);\n }\n\n private _getFirstSceneName(): string {\n const firstSceneName = this._data.firstLayout;\n return this.hasScene(firstSceneName)\n ? firstSceneName\n : // There is always at least a scene\n this.getSceneAndExtensionsData()!.sceneData.name;\n }\n\n /**\n * Start the game loop, to be called once assets are loaded.\n */\n startGameLoop() {\n try {\n if (!this.hasScene()) {\n logger.error('The game has no scene.');\n return;\n }\n this._forceGameResolutionUpdate();\n\n // Load the first scene\n this._sceneStack.push(\n this._getFirstSceneName(),\n this._injectExternalLayout\n );\n this._watermark.displayAtStartup();\n\n //Uncomment to profile the first x frames of the game.\n // var x = 500;\n // var startTime = Date.now();\n // console.profile(\"Stepping for \" + x + \" frames\")\n // for(var i = 0; i < x; ++i) {\n // this._sceneStack.step(16);\n // }\n // console.profileEnd();\n // var time = Date.now() - startTime;\n // logger.log(\"Took\", time, \"ms\");\n // return;\n\n this._setupGameVisibilityEvents();\n\n // The standard game loop\n let accumulatedElapsedTime = 0;\n this._hasJustResumed = false;\n this._renderer.startGameLoop((lastCallElapsedTime) => {\n try {\n if (this._paused) {\n return true;\n }\n\n // Skip the frame if we rendering frames too fast\n accumulatedElapsedTime += lastCallElapsedTime;\n if (\n this._maxFPS > 0 &&\n 1000.0 / accumulatedElapsedTime > this._maxFPS + 7\n ) {\n // Only skip frame if the framerate is 7 frames above the maximum framerate.\n // Most browser/engines will try to run at slightly more than 60 frames per second.\n // If game is set to have a maximum FPS to 60, then one out of two frames will be dropped.\n // Hence, we use a 7 frames margin to ensure that we're not skipping frames too much.\n return true;\n }\n const elapsedTime = accumulatedElapsedTime;\n accumulatedElapsedTime = 0;\n\n // Manage resize events.\n if (this._notifyScenesForGameResolutionResize) {\n this._sceneStack.onGameResolutionResized();\n this._notifyScenesForGameResolutionResize = false;\n }\n\n // Render and step the scene.\n if (this._sceneStack.step(elapsedTime)) {\n this.getInputManager().onFrameEnded();\n this._hasJustResumed = false;\n return true;\n }\n return false;\n } catch (e) {\n if (this._debuggerClient)\n this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n });\n setTimeout(() => {\n this._setupSessionMetrics();\n }, 10000);\n } catch (e) {\n if (this._debuggerClient) this._debuggerClient.onUncaughtException(e);\n\n throw e;\n }\n }\n\n /**\n * Set if the session should be registered.\n */\n enableMetrics(enable: boolean): void {\n this._disableMetrics = !enable;\n if (enable) {\n this._setupSessionMetrics();\n }\n }\n\n /**\n * Helper function to get information about the platform running the game.\n */\n getPlatformInfo = () => {\n return {\n // @ts-ignore\n isCordova: !!window.cordova,\n devicePlatform:\n // @ts-ignore\n typeof device !== 'undefined' ? device.platform || '' : '',\n navigatorPlatform:\n typeof navigator !== 'undefined' ? navigator.platform : '',\n hasTouch:\n typeof navigator !== 'undefined'\n ? !!navigator.maxTouchPoints && navigator.maxTouchPoints > 2\n : false,\n supportedCompressionMethods: getSupportedCompressionMethods(),\n };\n };\n\n _setupGameVisibilityEvents() {\n if (typeof navigator !== 'undefined' && typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n this._hasJustResumed = true;\n }\n });\n window.addEventListener(\n 'resume',\n () => {\n this._hasJustResumed = true;\n },\n false\n );\n }\n }\n\n /**\n * Register a new session for the game, and set up listeners to follow the session\n * time.\n */\n _setupSessionMetrics() {\n if (this._sessionMetricsInitialized) {\n return;\n }\n if (this._disableMetrics) {\n return;\n }\n if (this.isPreview()) {\n return;\n }\n if (typeof fetch === 'undefined') {\n return;\n }\n if (!this._data.properties.projectUuid) {\n return;\n }\n const baseUrl = 'https://api.gdevelop-app.com/analytics';\n this._playerId = this._makePlayerUuid();\n /**\n * The duration that is already sent to the service\n * (in milliseconds).\n **/\n let sentDuration = 0;\n /**\n * The duration that is not yet sent to the service to avoid flooding\n * (in milliseconds).\n **/\n let notYetSentDuration = 0;\n /**\n * The last time when duration has been counted\n * either in sendedDuration or notYetSentDuration.\n **/\n let lastSessionResumeTime = Date.now();\n const platform = this.getPlatformInfo();\n fetch(baseUrl + '/session', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n // It's important to ensure that the data sent here does not contain\n // any personal information from the player or that would allow to\n // precisely identify someone.\n body: JSON.stringify({\n gameId: this._data.properties.projectUuid,\n playerId: this._playerId,\n game: {\n name: this._data.properties.name || '',\n packageName: this._data.properties.packageName || '',\n version: this._data.properties.version || '',\n location: window.location.href,\n },\n platform: {\n isCordova: platform.isCordova,\n devicePlatform: platform.devicePlatform,\n navigatorPlatform: platform.navigatorPlatform,\n hasTouch: platform.hasTouch,\n },\n }),\n })\n .then((response) => {\n // Ensure the session is correctly created to avoid sending hits that will fail.\n if (!response.ok) {\n console.error('Error while creating the session', response);\n throw new Error('Error while creating the session');\n }\n return response;\n })\n .then((response) => response.text())\n .then((returnedSessionId) => {\n this._sessionId = returnedSessionId;\n })\n .catch(() => {});\n\n /* Ignore any error */\n const sendSessionHit = () => {\n if (!this._sessionId) {\n return;\n }\n\n const now = Date.now();\n notYetSentDuration += now - lastSessionResumeTime;\n lastSessionResumeTime = now;\n\n // Group repeated calls to sendSessionHit - which could\n // happen because of multiple event listeners being fired.\n if (notYetSentDuration < 5 * 1000) {\n return;\n }\n // The backend use seconds for duration.\n // The milliseconds will stay in notYetSentDuration.\n const toBeSentDuration = Math.floor(notYetSentDuration / 1000) * 1000;\n sentDuration += toBeSentDuration;\n notYetSentDuration -= toBeSentDuration;\n\n navigator.sendBeacon(\n baseUrl + '/session-hit',\n JSON.stringify({\n gameId: this._data.properties.projectUuid,\n playerId: this._playerId,\n sessionId: this._sessionId,\n duration: Math.floor(sentDuration / 1000),\n })\n );\n };\n if (typeof navigator !== 'undefined' && typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n // Skip the duration the game was hidden.\n lastSessionResumeTime = Date.now();\n } else {\n sendSessionHit();\n }\n });\n window.addEventListener('pagehide', sendSessionHit, false);\n // Cordova events\n window.addEventListener('pause', sendSessionHit, false);\n window.addEventListener(\n 'resume',\n () => {\n // Skip the duration the game was hidden.\n lastSessionResumeTime = Date.now();\n },\n false\n );\n\n // Detect Safari to work around Safari-specific bugs:\n // - https://bugs.webkit.org/show_bug.cgi?id=151610\n // - https://bugs.webkit.org/show_bug.cgi?id=151234\n // @ts-ignore\n const isSafari = typeof safari === 'object' && safari.pushNotification;\n const isElectron = /electron/i.test(navigator.userAgent);\n if (isSafari || isElectron) {\n window.addEventListener('beforeunload', () => {\n sendSessionHit();\n });\n }\n }\n this._sessionMetricsInitialized = true;\n this._sessionId = this._sessionId;\n }\n\n /**\n * Generate an anonymous unique identifier to differentiate\n * the player from others in the game metrics.\n */\n _makePlayerUuid(): string {\n try {\n const key = 'GDJS-internal-player-uuid';\n const existingPlayerUuid = localStorage.getItem(key);\n if (existingPlayerUuid) {\n return existingPlayerUuid;\n }\n const newPlayerUuid = gdjs.makeUuid();\n localStorage.setItem(key, newPlayerUuid);\n return newPlayerUuid;\n } catch (err) {\n return gdjs.makeUuid();\n }\n }\n\n getSessionId(): string | null {\n return this._sessionId;\n }\n\n getPlayerId(): string | null {\n return this._playerId;\n }\n\n /**\n * Called by the game renderer when the window containing the game\n * has changed size (this can result from a resize of the window,\n * but also other factors like a device orientation change on mobile).\n */\n onWindowInnerSizeChanged() {\n this._forceGameResolutionUpdate();\n }\n\n /**\n * Enlarge/reduce the width (or the height) of the game to fill the inner window.\n */\n _forceGameResolutionUpdate() {\n this.setGameResolutionSize(\n this._gameResolutionWidth,\n this._gameResolutionHeight\n );\n }\n\n /**\n * Start a profiler for the currently running scene.\n * @param onProfilerStopped Function to be called when the profiler is stopped. Will be passed the profiler as argument.\n */\n startCurrentSceneProfiler(\n onProfilerStopped: (oldProfiler: Profiler) => void\n ) {\n const currentScene = this._sceneStack.getCurrentScene();\n if (!currentScene) {\n return false;\n }\n currentScene.startProfiler(onProfilerStopped);\n return true;\n }\n\n /**\n * Stop the profiler for the currently running scene.\n */\n stopCurrentSceneProfiler() {\n const currentScene = this._sceneStack.getCurrentScene();\n if (!currentScene) {\n return;\n }\n currentScene.stopProfiler();\n }\n\n /**\n * Return true if a scene was loaded, false otherwise (i.e: game not yet started).\n */\n wasFirstSceneLoaded(): boolean {\n return this._sceneStack.wasFirstSceneLoaded();\n }\n\n /**\n * Return the stack of {@link gdjs.RuntimeScene} being played.\n */\n getSceneStack(): gdjs.SceneStack {\n return this._sceneStack;\n }\n\n /**\n * Check if the game is running as a preview, launched from an editor.\n * @returns true if the current game is a preview.\n */\n isPreview(): boolean {\n return this._isPreview;\n }\n\n /**\n * Check if the game should call GDevelop development APIs or not.\n *\n * Unless you are contributing to GDevelop, avoid using this.\n */\n isUsingGDevelopDevelopmentEnvironment(): boolean {\n return this._options.environment === 'dev';\n }\n\n /**\n * Gets an extension property from the project data.\n * @param extensionName The extension name.\n * @param propertyName The property name.\n * @return The property value.\n */\n getExtensionProperty(\n extensionName: string,\n propertyName: string\n ): string | null {\n for (let property of this._data.properties.extensionProperties) {\n if (\n property.extension === extensionName &&\n property.property === propertyName\n ) {\n return property.value;\n }\n }\n return null;\n }\n\n /**\n * Resolves the name of an embedded resource.\n * @param mainResourceName The name of the resource containing the embedded resource.\n * @param embeddedResourceName The name of the embedded resource.\n * @return The resource name.\n */\n resolveEmbeddedResource(\n mainResourceName: string,\n embeddedResourceName: string\n ): string {\n const mapping = this._embeddedResourcesMappings.get(mainResourceName);\n return mapping && mapping[embeddedResourceName]\n ? mapping[embeddedResourceName]\n : embeddedResourceName;\n }\n\n /**\n * Returns the array of resources that are embedded to passed one.\n * @param resourceName The name of resource to find embedded resources of.\n * @returns The array of related resources names.\n */\n getEmbeddedResourcesNames(resourceName: string): string[] {\n return this._embeddedResourcesMappings.has(resourceName)\n ? Object.keys(this._embeddedResourcesMappings.get(resourceName)!)\n : [];\n }\n\n getNetworkSyncData(\n syncOptions: GetNetworkSyncDataOptions\n ): GameNetworkSyncData | null {\n const syncData: GameNetworkSyncData = {\n var: this._variables.getNetworkSyncData(syncOptions),\n ss: this._sceneStack.getNetworkSyncData(syncOptions) || undefined,\n };\n\n const extensionsVariablesSyncData = {};\n this._variablesByExtensionName.forEach((variables, extensionName) => {\n const extensionVariablesSyncData = variables.getNetworkSyncData(\n syncOptions\n );\n // If there is no variables to sync, don't include the extension in the sync data.\n if (extensionVariablesSyncData.length) {\n extensionsVariablesSyncData[\n extensionName\n ] = extensionVariablesSyncData;\n }\n });\n syncData.extVar = extensionsVariablesSyncData;\n\n if (\n (!syncData.var || syncData.var.length === 0) &&\n !syncData.ss &&\n (!syncData.extVar || Object.keys(syncData.extVar).length === 0)\n ) {\n // Nothing to sync.\n return null;\n }\n\n return syncData;\n }\n\n updateFromNetworkSyncData(syncData: GameNetworkSyncData) {\n if (syncData.var) {\n this._variables.updateFromNetworkSyncData(syncData.var);\n }\n if (syncData.ss) {\n this._sceneStack.updateFromNetworkSyncData(syncData.ss);\n }\n if (syncData.extVar) {\n for (const extensionName in syncData.extVar) {\n if (!syncData.extVar.hasOwnProperty(extensionName)) {\n continue;\n }\n const extensionVariablesData = syncData.extVar[extensionName];\n const extensionVariables = this.getVariablesForExtension(\n extensionName\n );\n if (extensionVariables) {\n extensionVariables.updateFromNetworkSyncData(\n extensionVariablesData\n );\n }\n }\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,gBAEzB,EAAQ,AAAC,GACb,GAAI,SAAQ,AAAC,GAAY,WAAW,EAAS,IAUzC,EAAyB,AAAC,GAC9B,EAAY,cAAc,IAAI,AAAC,GAAa,EAAS,MAEvD,GAAI,GAAmE,KACvE,KAAM,GAAiC,IAAoC,CACzE,GAAM,EACJ,MAAO,GAET,EAA8B,GAE9B,GAAI,CAEF,GAAI,mBAAkB,QACtB,EAA4B,KAAK,gBACjC,EACF,GAAI,CAEF,GAAI,mBAAkB,WACtB,EAA4B,KAAK,mBACjC,EAEF,MAAO,IAiEF,OAAkB,CAuEvB,YAAY,EAAmB,EAA8B,CAlE7D,6BAAyD,GA2BzD,0CAAgD,GAKhD,aAA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