gdcore-tools 2.0.0-beta6 → 2.0.0-beta7

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.
Files changed (138) hide show
  1. package/dist/Runtime/Cordova/config.xml +4 -0
  2. package/dist/Runtime/Cordova/package.json +12 -20
  3. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  4. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  5. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
  6. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
  7. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
  8. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  9. package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
  10. package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +1 -1
  12. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  13. package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
  14. package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
  15. package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
  16. package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
  17. package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
  18. package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
  19. package/dist/Runtime/Extensions/3D/JsExtension.js +419 -228
  20. package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
  21. package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
  22. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  23. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  24. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js +1 -1
  25. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  26. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  27. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  28. package/dist/Runtime/Extensions/BBText/JsExtension.js +45 -42
  29. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
  30. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  31. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +40 -49
  32. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
  33. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
  35. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
  37. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
  39. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
  41. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
  43. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +18 -21
  45. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js +1 -1
  46. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js.map +2 -2
  47. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +8 -2
  48. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
  49. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  50. package/dist/Runtime/Extensions/Lighting/JsExtension.js +50 -38
  51. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js +1 -1
  52. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  53. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +15 -0
  54. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
  55. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  56. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  57. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
  58. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  59. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
  60. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  61. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
  62. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  63. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +76 -24
  64. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
  65. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  66. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  67. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  68. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
  69. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  70. package/dist/Runtime/Extensions/Spine/JsExtension.js +45 -36
  71. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
  72. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/TextInput/JsExtension.js +52 -55
  74. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  75. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  76. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
  77. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  78. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js +1 -1
  79. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  80. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
  81. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  82. package/dist/Runtime/Extensions/TileMap/JsExtension.js +430 -261
  83. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
  84. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  85. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
  86. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  87. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
  88. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
  89. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
  90. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +1 -0
  91. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
  92. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +1 -1
  93. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  94. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
  95. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  96. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
  97. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  98. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
  99. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  100. package/dist/Runtime/Extensions/Video/JsExtension.js +35 -44
  101. package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
  102. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  103. package/dist/Runtime/ResourceLoader.js +1 -1
  104. package/dist/Runtime/ResourceLoader.js.map +2 -2
  105. package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
  106. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  107. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  108. package/dist/Runtime/events-tools/inputtools.js +1 -1
  109. package/dist/Runtime/events-tools/inputtools.js.map +2 -2
  110. package/dist/Runtime/events-tools/objecttools.js +1 -1
  111. package/dist/Runtime/events-tools/objecttools.js.map +2 -2
  112. package/dist/Runtime/gd.js +1 -1
  113. package/dist/Runtime/gd.js.map +2 -2
  114. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  115. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  116. package/dist/Runtime/inputmanager.js +1 -1
  117. package/dist/Runtime/inputmanager.js.map +2 -2
  118. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +1 -1
  119. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  120. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
  121. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  122. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  123. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js +1 -1
  125. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  126. package/dist/Runtime/runtimegame.js +1 -1
  127. package/dist/Runtime/runtimegame.js.map +1 -1
  128. package/dist/Runtime/runtimeobject.js +1 -1
  129. package/dist/Runtime/runtimeobject.js.map +2 -2
  130. package/dist/Runtime/spriteruntimeobject.js +1 -1
  131. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  132. package/dist/Runtime/types/project-data.d.ts +5 -0
  133. package/dist/lib/libGD.cjs +1 -1
  134. package/dist/lib/libGD.d.cts +5 -0
  135. package/dist/lib/libGD.wasm +0 -0
  136. package/dist/loaders.d.cts +2 -0
  137. package/gd.d.ts +74 -30
  138. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/TiledSpriteObject/tiledspriteruntimeobject.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n /** Initial properties for a Tiled Sprite object */\n export type TiledSpriteObjectDataType = {\n /** Default width of the object, if the instance has no custom width. */\n width: number;\n /** Default height of the object, if the instance has no custom height. */\n height: number;\n texture: string;\n };\n\n export type TiledSpriteObjectData = ObjectData & TiledSpriteObjectDataType;\n\n export type TiledSpriteNetworkSyncDataType = {\n wid: number;\n hei: number;\n xo: number;\n yo: number;\n op: number;\n color: string;\n };\n\n export type TiledSpriteNetworkSyncData = ObjectNetworkSyncData &\n TiledSpriteNetworkSyncDataType;\n\n /**\n * The TiledSpriteRuntimeObject displays a tiled texture.\n */\n export class TiledSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler {\n _xOffset: float = 0;\n _yOffset: float = 0;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.TiledSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param tiledSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n tiledSpriteObjectData: TiledSpriteObjectData\n ) {\n super(instanceContainer, tiledSpriteObjectData);\n this._renderer = new gdjs.TiledSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n tiledSpriteObjectData.texture\n );\n this._width = 0;\n this._height = 0;\n this.setWidth(tiledSpriteObjectData.width);\n this.setHeight(tiledSpriteObjectData.height);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(oldObjectData, newObjectData): boolean {\n if (oldObjectData.texture !== newObjectData.texture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n return true;\n }\n\n getNetworkSyncData(): TiledSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n xo: this.getXOffset(),\n yo: this.getYOffset(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TiledSpriteNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.xo !== undefined) {\n this.setXOffset(networkSyncData.xo);\n }\n if (networkSyncData.yo !== undefined) {\n this.setYOffset(networkSyncData.yo);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n /**\n * Set the X position of the Tiled Sprite object.\n * @param x The new X position.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the Y position of the Tiled Sprite object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Assign a new texture to the Tiled Sprite object.\n * @param textureName The name of the image texture resource.\n * @param instanceContainer The container in which the texture is used.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the Tiled Sprite object.\n * @param angle The new angle.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the Tiled Sprite object.\n * @returns The width of the Tiled Sprite object\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the Tiled Sprite object.\n * @returns The height of the Tiled Sprite object\n */\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Set the width of the Tiled Sprite object.\n * @param width The new width.\n */\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the Tiled Sprite object.\n * @param height The new height.\n */\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the size of the Tiled Sprite object.\n * @param width The new width.\n * @param height The new height.\n */\n setSize(width: float, height: float): void {\n this.setWidth(width);\n this.setHeight(height);\n }\n\n /**\n * Set the offset on the X-axis when displaying the image of the Tiled Sprite object.\n * @param xOffset The new offset on the X-axis.\n */\n setXOffset(xOffset: number): void {\n this._xOffset = xOffset;\n this._renderer.updateXOffset();\n }\n\n /**\n * Set the offset on the Y-axis when displaying the image of the Tiled Sprite object.\n * @param yOffset The new offset on the Y-axis.\n */\n setYOffset(yOffset: number): void {\n this._yOffset = yOffset;\n this._renderer.updateYOffset();\n }\n\n /**\n * Get the offset on the X-axis of the Tiled Sprite object.\n * @returns The offset on the X-axis\n */\n getXOffset(): number {\n return this._xOffset;\n }\n\n /**\n * Get the offset on the Y-axis of the Tiled Sprite object.\n * @returns The offset on the Y-axis\n */\n getYOffset(): number {\n return this._yOffset;\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the tiled sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the tiled sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'TiledSpriteObject::TiledSprite',\n gdjs.TiledSpriteRuntimeObject\n );\n}\n"],
5
- "mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CA2BS,eACG,GAAK,aACkC,CAgB/C,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnB3B,cAAkB,EAClB,cAAkB,EAClB,aAAiB,IAkBf,KAAK,UAAY,GAAI,GAAK,iCACxB,KACA,EACA,EAAsB,SAExB,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,SAAS,EAAsB,OACpC,KAAK,UAAU,EAAsB,QAGrC,KAAK,YAGP,qBAAqB,EAAe,EAAwB,CAC1D,MAAI,GAAc,UAAY,EAAc,SAC1C,KAAK,WAAW,EAAc,QAAS,KAAK,mBAE1C,EAAc,QAAU,EAAc,OACxC,KAAK,SAAS,EAAc,OAE1B,EAAc,SAAW,EAAc,QACzC,KAAK,UAAU,EAAc,QAExB,GAGT,oBAAiD,CAC/C,MAAO,IACF,MAAM,qBACT,IAAK,KAAK,WACV,IAAK,KAAK,YACV,GAAI,KAAK,aACT,GAAI,KAAK,aACT,GAAI,KAAK,aACT,MAAO,KAAK,YAIhB,0BACE,EACM,CACN,MAAM,0BAA0B,GAI5B,EAAgB,MAAQ,QAC1B,KAAK,SAAS,EAAgB,KAE5B,EAAgB,MAAQ,QAC1B,KAAK,UAAU,EAAgB,KAE7B,EAAgB,KAAO,QACzB,KAAK,WAAW,EAAgB,IAE9B,EA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CACjB,MAAO,MAAK,UAAU,WAUxB,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,aACvB,EAAS,KAAK,IAAI,KAAK,aAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAMzD,WAAmB,CACjB,MAAO,MAAK,OAAS,KAAK,UAAU,kBAMtC,WAAmB,CACjB,MAAO,MAAK,QAAU,KAAK,UAAU,mBAOvC,SAAS,EAAuB,CAC9B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GACjD,KAAK,UAAU,KAAK,UAAU,mBAAqB,GAOrD,UAAU,EAAuB,CAC/B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GAOnD,UAAU,EAAuB,CAC/B,KAAK,UAAU,KAAK,UAAU,mBAAqB,IAzThD,EAAM,2BA4Tb,EAAK,eACH,iCACA,EAAK,4BAzVC",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n /** Initial properties for a Tiled Sprite object */\n export type TiledSpriteObjectDataType = {\n /** Default width of the object, if the instance has no custom width. */\n width: number;\n /** Default height of the object, if the instance has no custom height. */\n height: number;\n texture: string;\n };\n\n export type TiledSpriteObjectData = ObjectData & TiledSpriteObjectDataType;\n\n export type TiledSpriteNetworkSyncDataType = {\n wid: number;\n hei: number;\n xo: number;\n yo: number;\n op: number;\n color: string;\n };\n\n export type TiledSpriteNetworkSyncData = ObjectNetworkSyncData &\n TiledSpriteNetworkSyncDataType;\n\n /**\n * The TiledSpriteRuntimeObject displays a tiled texture.\n */\n export class TiledSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler {\n _xOffset: float = 0;\n _yOffset: float = 0;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.TiledSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param tiledSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n tiledSpriteObjectData: TiledSpriteObjectData\n ) {\n super(instanceContainer, tiledSpriteObjectData);\n this._renderer = new gdjs.TiledSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n tiledSpriteObjectData.texture\n );\n this._width = 0;\n this._height = 0;\n this.setWidth(tiledSpriteObjectData.width);\n this.setHeight(tiledSpriteObjectData.height);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(oldObjectData, newObjectData): boolean {\n if (oldObjectData.texture !== newObjectData.texture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n return true;\n }\n\n getNetworkSyncData(): TiledSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n xo: this.getXOffset(),\n yo: this.getYOffset(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TiledSpriteNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.xo !== undefined) {\n this.setXOffset(networkSyncData.xo);\n }\n if (networkSyncData.yo !== undefined) {\n this.setYOffset(networkSyncData.yo);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n /**\n * Set the X position of the Tiled Sprite object.\n * @param x The new X position.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the Y position of the Tiled Sprite object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Assign a new texture to the Tiled Sprite object.\n * @param textureName The name of the image texture resource.\n * @param instanceContainer The container in which the texture is used.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the Tiled Sprite object.\n * @param angle The new angle.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the Tiled Sprite object.\n * @returns The width of the Tiled Sprite object\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the Tiled Sprite object.\n * @returns The height of the Tiled Sprite object\n */\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Set the width of the Tiled Sprite object.\n * @param width The new width.\n */\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the Tiled Sprite object.\n * @param height The new height.\n */\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the size of the Tiled Sprite object.\n * @param width The new width.\n * @param height The new height.\n */\n setSize(width: float, height: float): void {\n this.setWidth(width);\n this.setHeight(height);\n }\n\n /**\n * Set the offset on the X-axis when displaying the image of the Tiled Sprite object.\n * @param xOffset The new offset on the X-axis.\n */\n setXOffset(xOffset: number): void {\n this._xOffset = xOffset;\n this._renderer.updateXOffset();\n }\n\n /**\n * Set the offset on the Y-axis when displaying the image of the Tiled Sprite object.\n * @param yOffset The new offset on the Y-axis.\n */\n setYOffset(yOffset: number): void {\n this._yOffset = yOffset;\n this._renderer.updateYOffset();\n }\n\n /**\n * Get the offset on the X-axis of the Tiled Sprite object.\n * @returns The offset on the X-axis\n */\n getXOffset(): number {\n return this._xOffset;\n }\n\n /**\n * Get the offset on the Y-axis of the Tiled Sprite object.\n * @returns The offset on the Y-axis\n */\n getYOffset(): number {\n return this._yOffset;\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the tiled sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the tiled sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'TiledSpriteObject::TiledSprite',\n gdjs.TiledSpriteRuntimeObject\n );\n}\n"],
5
+ "mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CA2BS,eACG,GAAK,aACkC,CAgB/C,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnB3B,cAAkB,EAClB,cAAkB,EAClB,aAAiB,IAkBf,KAAK,UAAY,GAAI,GAAK,iCACxB,KACA,EACA,EAAsB,SAExB,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,SAAS,EAAsB,OACpC,KAAK,UAAU,EAAsB,QAGrC,KAAK,YAGP,qBAAqB,EAAe,EAAwB,CAC1D,MAAI,GAAc,UAAY,EAAc,SAC1C,KAAK,WAAW,EAAc,QAAS,KAAK,mBAE1C,EAAc,QAAU,EAAc,OACxC,KAAK,SAAS,EAAc,OAE1B,EAAc,SAAW,EAAc,QACzC,KAAK,UAAU,EAAc,QAExB,GAGT,oBAAiD,CAC/C,MAAO,IACF,MAAM,qBACT,IAAK,KAAK,WACV,IAAK,KAAK,YACV,GAAI,KAAK,aACT,GAAI,KAAK,aACT,GAAI,KAAK,aACT,MAAO,KAAK,YAIhB,0BACE,EACM,CACN,MAAM,0BAA0B,GAI5B,EAAgB,MAAQ,QAC1B,KAAK,SAAS,EAAgB,KAE5B,EAAgB,MAAQ,QAC1B,KAAK,UAAU,EAAgB,KAE7B,EAAgB,KAAO,QACzB,KAAK,WAAW,EAAgB,IAE9B,EAAgB,KAAO,QACzB,KAAK,W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SAAS,GAQ1B,UAAmB,CACjB,MAAO,MAAK,UAAU,WAUxB,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,aACvB,EAAS,KAAK,IAAI,KAAK,aAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAMzD,WAAmB,CACjB,MAAO,MAAK,OAAS,KAAK,UAAU,kBAMtC,WAAmB,CACjB,MAAO,MAAK,QAAU,KAAK,UAAU,mBAOvC,SAAS,EAAuB,CAC9B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GACjD,KAAK,UAAU,KAAK,UAAU,mBAAqB,GAOrD,UAAU,EAAuB,CAC/B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GAOnD,UAAU,EAAuB,CAC/B,KAAK,UAAU,KAAK,UAAU,mBAAqB,IA5ThD,EAAM,2BA+Tb,EAAK,eACH,iCACA,EAAK,4BA5VC",
6
6
  "names": []
7
7
  }
@@ -35,78 +35,65 @@ module.exports = {
35
35
  .setIcon('JsPlatform/Extensions/videoicon16.png');
36
36
 
37
37
  var videoObject = new gd.ObjectJsImplementation();
38
- videoObject.updateProperty = function (
39
- objectContent,
40
- propertyName,
41
- newValue
42
- ) {
38
+ videoObject.updateProperty = function (propertyName, newValue) {
43
39
  if (propertyName === 'Opacity') {
44
- objectContent.opacity = parseFloat(newValue);
40
+ this.content.opacity = parseFloat(newValue);
45
41
  return true;
46
42
  }
47
43
  if (propertyName === 'Looped') {
48
- objectContent.loop = newValue === '1';
44
+ this.content.loop = newValue === '1';
49
45
  return true;
50
46
  }
51
47
  if (propertyName === 'Volume') {
52
- objectContent.volume = parseFloat(newValue);
48
+ this.content.volume = parseFloat(newValue);
53
49
  return true;
54
50
  }
55
51
  if (propertyName === 'videoResource') {
56
- objectContent.videoResource = newValue;
52
+ this.content.videoResource = newValue;
57
53
  return true;
58
54
  }
59
55
 
60
56
  return false;
61
57
  };
62
- videoObject.getProperties = function (objectContent) {
58
+ videoObject.getProperties = function () {
63
59
  var objectProperties = new gd.MapStringPropertyDescriptor();
64
60
 
65
- objectProperties
66
- .getOrCreate('Opacity')
67
- .setValue(objectContent.opacity.toString())
68
- .setType('number')
69
- .setLabel(_('Video opacity (0-255)'))
70
- .setGroup(_('Appearance'));
71
61
  objectProperties
72
62
  .getOrCreate('Looped')
73
- .setValue(objectContent.loop ? 'true' : 'false')
63
+ .setValue(this.content.loop ? 'true' : 'false')
74
64
  .setType('boolean')
75
65
  .setLabel(_('Loop the video'))
76
66
  .setGroup(_('Playback settings'));
77
67
  objectProperties
78
68
  .getOrCreate('Volume')
79
- .setValue(objectContent.volume.toString())
69
+ .setValue(this.content.volume.toString())
80
70
  .setType('number')
81
71
  .setLabel(_('Video volume (0-100)'))
82
72
  .setGroup(_('Playback settings'));
83
73
  objectProperties
84
74
  .getOrCreate('videoResource')
85
- .setValue(objectContent.videoResource)
75
+ .setValue(this.content.videoResource)
86
76
  .setType('resource')
87
77
  .addExtraInfo('video')
88
78
  .setLabel(_('Video resource'));
89
79
 
90
80
  return objectProperties;
91
81
  };
92
- videoObject.setRawJSONContent(
93
- JSON.stringify({
94
- opacity: 255,
95
- loop: false,
96
- volume: 100,
97
- videoResource: '',
98
- })
99
- );
82
+ videoObject.content = {
83
+ opacity: 255,
84
+ loop: false,
85
+ volume: 100,
86
+ videoResource: '',
87
+ };
100
88
 
101
89
  videoObject.updateInitialInstanceProperty = function (
102
- objectContent,
103
90
  instance,
104
91
  propertyName,
105
92
  newValue
106
93
  ) {
107
94
  return false;
108
95
  };
109
- videoObject.getInitialInstanceProperties = function (content, instance) {
96
+ videoObject.getInitialInstanceProperties = function (instance) {
110
97
  var instanceProperties = new gd.MapStringPropertyDescriptor();
111
98
  return instanceProperties;
112
99
  };
@@ -589,10 +576,11 @@ module.exports = {
589
576
 
590
577
  _getVideoTexture() {
591
578
  // Get the video resource to use
592
- const videoResource = this._associatedObjectConfiguration
593
- .getProperties()
594
- .get('videoResource')
595
- .getValue();
579
+ const object = gd.castObject(
580
+ this._associatedObjectConfiguration,
581
+ gd.ObjectJsImplementation
582
+ );
583
+ const videoResource = object.content.videoResource;
596
584
 
597
585
  // This returns a VideoTexture with autoPlay set to false
598
586
  return this._pixiResourcesLoader.getPIXIVideoTexture(
@@ -606,10 +594,12 @@ module.exports = {
606
594
  */
607
595
  update() {
608
596
  // Check if the video resource has changed
609
- const videoResource = this._associatedObjectConfiguration
610
- .getProperties()
611
- .get('videoResource')
612
- .getValue();
597
+ const object = gd.castObject(
598
+ this._associatedObjectConfiguration,
599
+ gd.ObjectJsImplementation
600
+ );
601
+ const videoResource = object.content.videoResource;
602
+
613
603
  if (videoResource !== this._videoResource) {
614
604
  this._videoResource = videoResource;
615
605
  this._pixiObject.texture = this._getVideoTexture();
@@ -619,19 +609,13 @@ module.exports = {
619
609
 
620
610
  that._pixiObject.texture.on('error', function () {
621
611
  that._pixiObject.texture.off('error', this);
612
+ if (this._wasDestroyed) return;
622
613
 
623
614
  that._pixiObject.texture = that._pixiResourcesLoader.getInvalidPIXITexture();
624
615
  });
625
616
  }
626
617
  }
627
618
 
628
- // Update opacity
629
- const opacity = +this._associatedObjectConfiguration
630
- .getProperties()
631
- .get('Opacity')
632
- .getValue();
633
- this._pixiObject.alpha = opacity / 255;
634
-
635
619
  // Read position and angle from the instance
636
620
  this._pixiObject.position.x =
637
621
  this._instance.getX() + this._pixiObject.width / 2;
@@ -645,6 +629,13 @@ module.exports = {
645
629
  this._pixiObject.width = this.getCustomWidth();
646
630
  this._pixiObject.height = this.getCustomHeight();
647
631
  }
632
+
633
+ // Do not hide completely an object so it can still be manipulated
634
+ const alphaForDisplay = Math.max(
635
+ this._instance.getOpacity() / 255,
636
+ 0.5
637
+ );
638
+ this._pixiObject.alpha = alphaForDisplay;
648
639
  }
649
640
 
650
641
  /**
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){class n extends i.RuntimeObject{constructor(e,t){super(e,t);this._pausedAsScenePaused=!1;this._opacity=t.content.opacity,this._loop=t.content.loop,this._volume=t.content.volume,this._videoResource=t.content.videoResource,this._renderer=new i.VideoRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(e,t){return e.content.opacity!==t.content.opacity&&this.setOpacity(t.content.opacity),e.content.loop!==t.content.loop&&this.setLoop(t.content.loop),e.content.volume!==t.content.volume&&this.setVolume(t.content.volume),e.content.videoResource===t.content.videoResource}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,wid:this.getWidth(),hei:this.getHeight(),pla:this.isPlayed(),loop:this.isLooped(),ct:this.getCurrentTime(),ps:this.getPlaybackSpeed()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),this._opacity!==void 0&&this._opacity&&e.op&&this.setOpacity(e.op),this.getWidth()!==void 0&&this.getWidth()!==e.wid&&this.setWidth(e.wid),this.getHeight()!==void 0&&this.getHeight()!==e.hei&&this.setHeight(e.hei),e.pla!==void 0&&this.isPlayed()!==e.pla&&(e.pla?this.play():this.pause()),e.loop!==void 0&&this.isLooped()!==e.loop&&this.setLoop(e.loop),e.ct!==void 0&&Math.abs(this.getCurrentTime()-e.ct)>3&&this.setCurrentTime(e.ct),e.ps!==void 0&&this.getPlaybackSpeed()!==e.ps&&this.setPlaybackSpeed(e.ps)}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height))}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}update(e){this._renderer.ensureUpToDate()}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}setOpacity(e){this._opacity=e,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWidth(e){this._renderer.getWidth()!==e&&(this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this._renderer.getHeight()!==e&&(this._renderer.setHeight(e),this.invalidateHitboxes())}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}play(){this._renderer.play()}pause(){this._renderer.pause()}setLoop(e){this._renderer.setLoop(e)}mute(e){this._renderer.setMute(e)}isMuted(){return this._renderer.isMuted()}setVolume(e){this._volume=i.evtTools.common.clamp(i.evtTools.common.normalize(e,0,100),0,1)*100,this._renderer.updateVolume()}getVolume(){return i.evtTools.common.normalize(this._renderer.getVolume(),0,1)*100}isPlayed(){return this._renderer.isPlayed()}isPaused(){return!this._renderer.isPlayed()}isLooped(){return this._renderer.isLooped()}getDuration(){return this._renderer.getDuration()}isEnded(){return this._renderer.isEnded()}setCurrentTime(e){this._renderer.setCurrentTime(e)}getCurrentTime(){return this._renderer.getCurrentTime()}setPlaybackSpeed(e){this._playbackSpeed=i.evtTools.common.clamp(e,.5,2),this._renderer.setPlaybackSpeed(this._playbackSpeed)}getPlaybackSpeed(){return this._renderer.getPlaybackSpeed()}}i.VideoRuntimeObject=n,i.registerObject("Video::VideoObject",i.VideoRuntimeObject),i.registerRuntimeSceneUnloadedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o.isPlayed()&&o.pause()}}),i.registerRuntimeScenePausedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o.isPlayed()&&(o.pause(),o._pausedAsScenePaused=!0)}}),i.registerRuntimeSceneResumedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o._pausedAsScenePaused&&o.play()}})})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){class n extends i.RuntimeObject{constructor(e,t){super(e,t);this._pausedAsScenePaused=!1;this._opacity=t.content.opacity,this._loop=t.content.loop,this._volume=t.content.volume,this._videoResource=t.content.videoResource,this._renderer=new i.VideoRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(e,t){return e.content.opacity!==t.content.opacity&&this.setOpacity(t.content.opacity),e.content.loop!==t.content.loop&&this.setLoop(t.content.loop),e.content.volume!==t.content.volume&&this.setVolume(t.content.volume),e.content.videoResource===t.content.videoResource}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,wid:this.getWidth(),hei:this.getHeight(),pla:this.isPlayed(),loop:this.isLooped(),ct:this.getCurrentTime(),ps:this.getPlaybackSpeed()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),this._opacity!==void 0&&this._opacity&&e.op&&this.setOpacity(e.op),this.getWidth()!==void 0&&this.getWidth()!==e.wid&&this.setWidth(e.wid),this.getHeight()!==void 0&&this.getHeight()!==e.hei&&this.setHeight(e.hei),e.pla!==void 0&&this.isPlayed()!==e.pla&&(e.pla?this.play():this.pause()),e.loop!==void 0&&this.isLooped()!==e.loop&&this.setLoop(e.loop),e.ct!==void 0&&Math.abs(this.getCurrentTime()-e.ct)>3&&this.setCurrentTime(e.ct),e.ps!==void 0&&this.getPlaybackSpeed()!==e.ps&&this.setPlaybackSpeed(e.ps)}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),e.opacity!==void 0&&this.setOpacity(e.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}update(e){this._renderer.ensureUpToDate()}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}setOpacity(e){this._opacity=e,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWidth(e){this._renderer.getWidth()!==e&&(this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this._renderer.getHeight()!==e&&(this._renderer.setHeight(e),this.invalidateHitboxes())}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}play(){this._renderer.play()}pause(){this._renderer.pause()}setLoop(e){this._renderer.setLoop(e)}mute(e){this._renderer.setMute(e)}isMuted(){return this._renderer.isMuted()}setVolume(e){this._volume=i.evtTools.common.clamp(i.evtTools.common.normalize(e,0,100),0,1)*100,this._renderer.updateVolume()}getVolume(){return i.evtTools.common.normalize(this._renderer.getVolume(),0,1)*100}isPlayed(){return this._renderer.isPlayed()}isPaused(){return!this._renderer.isPlayed()}isLooped(){return this._renderer.isLooped()}getDuration(){return this._renderer.getDuration()}isEnded(){return this._renderer.isEnded()}setCurrentTime(e){this._renderer.setCurrentTime(e)}getCurrentTime(){return this._renderer.getCurrentTime()}setPlaybackSpeed(e){this._playbackSpeed=i.evtTools.common.clamp(e,.5,2),this._renderer.setPlaybackSpeed(this._playbackSpeed)}getPlaybackSpeed(){return this._renderer.getPlaybackSpeed()}}i.VideoRuntimeObject=n,i.registerObject("Video::VideoObject",i.VideoRuntimeObject),i.registerRuntimeSceneUnloadedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o.isPlayed()&&o.pause()}}),i.registerRuntimeScenePausedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o.isPlayed()&&(o.pause(),o._pausedAsScenePaused=!0)}}),i.registerRuntimeSceneResumedCallback(function(r){const e=r.getAdhocListOfAllInstances();for(let t=0;t<e.length;++t){const o=e[t];o instanceof i.VideoRuntimeObject&&o._pausedAsScenePaused&&o.play()}})})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=videoruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/Video/videoruntimeobject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /** The initial properties for {@link gdjs.VideoRuntimeObject} */\n export type VideoObjectDataType = {\n /** The base parameters of the video */\n content: {\n /** The opacity of the video */\n opacity: number;\n /** Does the video loops itself? */\n loop: boolean;\n /** The volume of the video */\n volume: number;\n /** Name of the resource corresponding to the video */\n videoResource: string;\n };\n };\n\n export type VideoObjectData = ObjectData & VideoObjectDataType;\n\n export type VideoNetworkSyncDataType = {\n op: float;\n wid: float;\n hei: float;\n // We don't sync volume, as it's probably a user setting?\n pla: boolean;\n loop: boolean;\n ct: float;\n ps: number;\n };\n\n export type VideoNetworkSyncData = ObjectNetworkSyncData &\n VideoNetworkSyncDataType;\n\n /**\n * An object displaying a video on screen.\n *\n * For the same video resource, only one video is being created in memory (\n * as a HTMLVideoElement). This means that two objects displaying the same\n * video will have the same state for this video (paused/playing, current time,\n * volume, etc...).\n */\n export class VideoRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.OpacityHandler {\n _opacity: float;\n _loop: boolean;\n _volume: float;\n _videoResource: string;\n\n // Use a boolean to track if the video was paused because we\n // navigated to another scene, and so should resume if we're back.\n _pausedAsScenePaused: boolean = false;\n _renderer: gdjs.VideoRuntimeObjectRenderer;\n _playbackSpeed: any;\n\n /**\n * @param instanceContainer The scene the object belongs to.\n * @param videoObjectData The data defining the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n videoObjectData: VideoObjectData\n ) {\n super(instanceContainer, videoObjectData);\n this._opacity = videoObjectData.content.opacity;\n this._loop = videoObjectData.content.loop;\n this._volume = videoObjectData.content.volume;\n this._videoResource = videoObjectData.content.videoResource;\n this._renderer = new gdjs.VideoRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: VideoObjectData,\n newObjectData: VideoObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.loop !== newObjectData.content.loop) {\n this.setLoop(newObjectData.content.loop);\n }\n if (oldObjectData.content.volume !== newObjectData.content.volume) {\n this.setVolume(newObjectData.content.volume);\n }\n if (\n oldObjectData.content.videoResource !==\n newObjectData.content.videoResource\n ) {\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): VideoNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n wid: this.getWidth(),\n hei: this.getHeight(),\n pla: this.isPlayed(),\n loop: this.isLooped(),\n ct: this.getCurrentTime(),\n ps: this.getPlaybackSpeed(),\n };\n }\n\n updateFromNetworkSyncData(syncData: VideoNetworkSyncData): void {\n super.updateFromNetworkSyncData(syncData);\n\n if (this._opacity !== undefined && this._opacity && syncData.op) {\n this.setOpacity(syncData.op);\n }\n if (this.getWidth() !== undefined && this.getWidth() !== syncData.wid) {\n this.setWidth(syncData.wid);\n }\n if (this.getHeight() !== undefined && this.getHeight() !== syncData.hei) {\n this.setHeight(syncData.hei);\n }\n if (syncData.pla !== undefined && this.isPlayed() !== syncData.pla) {\n syncData.pla ? this.play() : this.pause();\n }\n if (syncData.loop !== undefined && this.isLooped() !== syncData.loop) {\n this.setLoop(syncData.loop);\n }\n // We don't update the current time too regularly, only if it's off by a lot.\n if (\n syncData.ct !== undefined &&\n Math.abs(this.getCurrentTime() - syncData.ct) > 3 // More than 3 seconds off\n ) {\n this.setCurrentTime(syncData.ct);\n }\n if (\n syncData.ps !== undefined &&\n this.getPlaybackSpeed() !== syncData.ps\n ) {\n this.setPlaybackSpeed(syncData.ps);\n }\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The initial instance data\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.onDestroy();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Set object position on X axis.\n * @param x The new position X of the object.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set object position on Y axis.\n * @param y The new position Y of the object.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the angle of the object.\n * @param angle The new angle of the object.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n * @returns The current opacity\n */\n getOpacity(): number {\n return this._opacity;\n }\n\n /**\n * Set the width of the video.\n * @param width The new width in pixels.\n */\n setWidth(width: float): void {\n if (this._renderer.getWidth() === width) return;\n\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the video.\n * @param height The new height in pixels.\n */\n setHeight(height: float): void {\n if (this._renderer.getHeight() === height) return;\n\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Get the width of the video object.\n * @returns The current width of the object\n */\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n /**\n * Get the height of the video object.\n * @returns The current height of the object\n */\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n /**\n * Play the video.\n */\n play(): void {\n this._renderer.play();\n }\n\n /**\n * Pause the video.\n */\n pause(): void {\n this._renderer.pause();\n }\n\n /**\n * Set the state looped of the video.\n * @param enable true to loop the video\n */\n setLoop(enable: boolean): void {\n this._renderer.setLoop(enable);\n }\n\n /**\n * Set the state muted of the video.\n * @param enable The new state.\n */\n mute(enable: boolean) {\n this._renderer.setMute(enable);\n }\n\n /**\n * Return the state muted of video object.\n * @returns Is the video muted?\n */\n isMuted(): boolean {\n return this._renderer.isMuted();\n }\n\n /**\n * Set the volume of the video object.\n * @param volume The new volume, between 0 and 100.\n */\n setVolume(volume: number): void {\n this._volume =\n gdjs.evtTools.common.clamp(\n gdjs.evtTools.common.normalize(volume, 0, 100),\n 0,\n 1\n ) * 100;\n this._renderer.updateVolume();\n }\n\n /**\n * Get the volume of the video object.\n * @returns The current video's volume, between 0 and 100.\n */\n getVolume(): number {\n return (\n gdjs.evtTools.common.normalize(this._renderer.getVolume(), 0, 1) * 100\n );\n }\n\n /**\n * Check if the video is being played.\n * @returns Is the video being played?\n */\n isPlayed(): boolean {\n return this._renderer.isPlayed();\n }\n\n /**\n * Check if the video is paused.\n * @returns Is the video being paused?\n */\n isPaused(): boolean {\n return !this._renderer.isPlayed();\n }\n\n /**\n * Check if the video is looping.\n * @returns Is the video looping?\n */\n isLooped(): boolean {\n return this._renderer.isLooped();\n }\n\n /**\n * Return the total time of the video.\n * @returns The duration of the video\n */\n getDuration(): number {\n return this._renderer.getDuration();\n }\n\n /**\n * Check if the video has ended.\n * @returns Has the video ended?\n */\n isEnded(): boolean {\n return this._renderer.isEnded();\n }\n\n /**\n * Set the new time of the video object.\n * @param time The new time.\n */\n setCurrentTime(time: float): void {\n this._renderer.setCurrentTime(time);\n }\n\n /**\n * Get the current time of the video object.\n * @returns The current time of the video\n */\n getCurrentTime(): float {\n return this._renderer.getCurrentTime();\n }\n\n /**\n * Set the new playback speed of the video object.\n * @param playbackSpeed The new playback speed.\n */\n setPlaybackSpeed(playbackSpeed: number): void {\n this._playbackSpeed = gdjs.evtTools.common.clamp(playbackSpeed, 0.5, 2);\n this._renderer.setPlaybackSpeed(this._playbackSpeed);\n }\n\n /**\n * Get the playback speed of the video object.\n * @returns The current playback speed of the video.\n */\n getPlaybackSpeed(): number {\n return this._renderer.getPlaybackSpeed();\n }\n }\n gdjs.registerObject('Video::VideoObject', gdjs.VideoRuntimeObject);\n\n /**\n * When a scene is unloaded, pause any video being run.\n * TODO: Investigate how to dispose the video source?\n */\n gdjs.registerRuntimeSceneUnloadedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and pause them.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj.isPlayed()) {\n obj.pause();\n }\n }\n }\n });\n\n /**\n * When a scene is paused, pause any video being run.\n */\n gdjs.registerRuntimeScenePausedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and pause them.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj.isPlayed()) {\n obj.pause();\n obj._pausedAsScenePaused = true;\n }\n }\n }\n });\n\n // Flag it to be started again when scene is resumed.\n\n /**\n * When a scene is resumed, resume any video previously paused.\n */\n gdjs.registerRuntimeSceneResumedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and play them if they have been previously paused.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj._pausedAsScenePaused) {\n obj.play();\n }\n }\n }\n });\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAwCS,eACG,GAAK,aACkB,CAgB/B,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAZ3B,0BAAgC,GAa9B,KAAK,SAAW,EAAgB,QAAQ,QACxC,KAAK,MAAQ,EAAgB,QAAQ,KACrC,KAAK,QAAU,EAAgB,QAAQ,OACvC,KAAK,eAAiB,EAAgB,QAAQ,cAC9C,KAAK,UAAY,GAAI,GAAK,2BACxB,KACA,GAIF,KAAK,YAGP,mBAAoB,CAClB,MAAO,MAAK,UAAU,oBAGxB,qBACE,EACA,EACS,CAUT,MATI,GAAc,QAAQ,UAAY,EAAc,QAAQ,SAC1D,KAAK,WAAW,EAAc,QAAQ,SAEpC,EAAc,QAAQ,OAAS,EAAc,QAAQ,MACvD,KAAK,QAAQ,EAAc,QAAQ,MAEjC,EAAc,QAAQ,SAAW,EAAc,QAAQ,QACzD,KAAK,UAAU,EAAc,QAAQ,QAGrC,EAAc,QAAQ,gB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,GACtB,AAAI,YAAe,GAAK,oBAClB,EAAI,YACN,EAAI,WASZ,EAAK,mCAAmC,SAAU,EAAc,CAG9D,KAAM,GAAY,EAAa,6BAC/B,OAAS,GAAI,EAAG,EAAI,EAAU,OAAQ,EAAE,EAAG,CACzC,KAAM,GAAM,EAAU,GACtB,AAAI,YAAe,GAAK,oBAClB,EAAI,YACN,GAAI,QACJ,EAAI,qBAAuB,OAWnC,EAAK,oCAAoC,SAAU,EAAc,CAG/D,KAAM,GAAY,EAAa,6BAC/B,OAAS,GAAI,EAAG,EAAI,EAAU,OAAQ,EAAE,EAAG,CACzC,KAAM,GAAM,EAAU,GACtB,AAAI,YAAe,GAAK,oBAClB,EAAI,sBACN,EAAI,YApbJ",
4
+ "sourcesContent": ["namespace gdjs {\n /** The initial properties for {@link gdjs.VideoRuntimeObject} */\n export type VideoObjectDataType = {\n /** The base parameters of the video */\n content: {\n /** The opacity of the video */\n opacity: number;\n /** Does the video loops itself? */\n loop: boolean;\n /** The volume of the video */\n volume: number;\n /** Name of the resource corresponding to the video */\n videoResource: string;\n };\n };\n\n export type VideoObjectData = ObjectData & VideoObjectDataType;\n\n export type VideoNetworkSyncDataType = {\n op: float;\n wid: float;\n hei: float;\n // We don't sync volume, as it's probably a user setting?\n pla: boolean;\n loop: boolean;\n ct: float;\n ps: number;\n };\n\n export type VideoNetworkSyncData = ObjectNetworkSyncData &\n VideoNetworkSyncDataType;\n\n /**\n * An object displaying a video on screen.\n *\n * For the same video resource, only one video is being created in memory (\n * as a HTMLVideoElement). This means that two objects displaying the same\n * video will have the same state for this video (paused/playing, current time,\n * volume, etc...).\n */\n export class VideoRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.OpacityHandler {\n _opacity: float;\n _loop: boolean;\n _volume: float;\n _videoResource: string;\n\n // Use a boolean to track if the video was paused because we\n // navigated to another scene, and so should resume if we're back.\n _pausedAsScenePaused: boolean = false;\n _renderer: gdjs.VideoRuntimeObjectRenderer;\n _playbackSpeed: any;\n\n /**\n * @param instanceContainer The scene the object belongs to.\n * @param videoObjectData The data defining the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n videoObjectData: VideoObjectData\n ) {\n super(instanceContainer, videoObjectData);\n this._opacity = videoObjectData.content.opacity;\n this._loop = videoObjectData.content.loop;\n this._volume = videoObjectData.content.volume;\n this._videoResource = videoObjectData.content.videoResource;\n this._renderer = new gdjs.VideoRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: VideoObjectData,\n newObjectData: VideoObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.loop !== newObjectData.content.loop) {\n this.setLoop(newObjectData.content.loop);\n }\n if (oldObjectData.content.volume !== newObjectData.content.volume) {\n this.setVolume(newObjectData.content.volume);\n }\n if (\n oldObjectData.content.videoResource !==\n newObjectData.content.videoResource\n ) {\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): VideoNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n wid: this.getWidth(),\n hei: this.getHeight(),\n pla: this.isPlayed(),\n loop: this.isLooped(),\n ct: this.getCurrentTime(),\n ps: this.getPlaybackSpeed(),\n };\n }\n\n updateFromNetworkSyncData(syncData: VideoNetworkSyncData): void {\n super.updateFromNetworkSyncData(syncData);\n\n if (this._opacity !== undefined && this._opacity && syncData.op) {\n this.setOpacity(syncData.op);\n }\n if (this.getWidth() !== undefined && this.getWidth() !== syncData.wid) {\n this.setWidth(syncData.wid);\n }\n if (this.getHeight() !== undefined && this.getHeight() !== syncData.hei) {\n this.setHeight(syncData.hei);\n }\n if (syncData.pla !== undefined && this.isPlayed() !== syncData.pla) {\n syncData.pla ? this.play() : this.pause();\n }\n if (syncData.loop !== undefined && this.isLooped() !== syncData.loop) {\n this.setLoop(syncData.loop);\n }\n // We don't update the current time too regularly, only if it's off by a lot.\n if (\n syncData.ct !== undefined &&\n Math.abs(this.getCurrentTime() - syncData.ct) > 3 // More than 3 seconds off\n ) {\n this.setCurrentTime(syncData.ct);\n }\n if (\n syncData.ps !== undefined &&\n this.getPlaybackSpeed() !== syncData.ps\n ) {\n this.setPlaybackSpeed(syncData.ps);\n }\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The initial instance data\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.onDestroy();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Set object position on X axis.\n * @param x The new position X of the object.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set object position on Y axis.\n * @param y The new position Y of the object.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the angle of the object.\n * @param angle The new angle of the object.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n * @returns The current opacity\n */\n getOpacity(): number {\n return this._opacity;\n }\n\n /**\n * Set the width of the video.\n * @param width The new width in pixels.\n */\n setWidth(width: float): void {\n if (this._renderer.getWidth() === width) return;\n\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the video.\n * @param height The new height in pixels.\n */\n setHeight(height: float): void {\n if (this._renderer.getHeight() === height) return;\n\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Get the width of the video object.\n * @returns The current width of the object\n */\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n /**\n * Get the height of the video object.\n * @returns The current height of the object\n */\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n /**\n * Play the video.\n */\n play(): void {\n this._renderer.play();\n }\n\n /**\n * Pause the video.\n */\n pause(): void {\n this._renderer.pause();\n }\n\n /**\n * Set the state looped of the video.\n * @param enable true to loop the video\n */\n setLoop(enable: boolean): void {\n this._renderer.setLoop(enable);\n }\n\n /**\n * Set the state muted of the video.\n * @param enable The new state.\n */\n mute(enable: boolean) {\n this._renderer.setMute(enable);\n }\n\n /**\n * Return the state muted of video object.\n * @returns Is the video muted?\n */\n isMuted(): boolean {\n return this._renderer.isMuted();\n }\n\n /**\n * Set the volume of the video object.\n * @param volume The new volume, between 0 and 100.\n */\n setVolume(volume: number): void {\n this._volume =\n gdjs.evtTools.common.clamp(\n gdjs.evtTools.common.normalize(volume, 0, 100),\n 0,\n 1\n ) * 100;\n this._renderer.updateVolume();\n }\n\n /**\n * Get the volume of the video object.\n * @returns The current video's volume, between 0 and 100.\n */\n getVolume(): number {\n return (\n gdjs.evtTools.common.normalize(this._renderer.getVolume(), 0, 1) * 100\n );\n }\n\n /**\n * Check if the video is being played.\n * @returns Is the video being played?\n */\n isPlayed(): boolean {\n return this._renderer.isPlayed();\n }\n\n /**\n * Check if the video is paused.\n * @returns Is the video being paused?\n */\n isPaused(): boolean {\n return !this._renderer.isPlayed();\n }\n\n /**\n * Check if the video is looping.\n * @returns Is the video looping?\n */\n isLooped(): boolean {\n return this._renderer.isLooped();\n }\n\n /**\n * Return the total time of the video.\n * @returns The duration of the video\n */\n getDuration(): number {\n return this._renderer.getDuration();\n }\n\n /**\n * Check if the video has ended.\n * @returns Has the video ended?\n */\n isEnded(): boolean {\n return this._renderer.isEnded();\n }\n\n /**\n * Set the new time of the video object.\n * @param time The new time.\n */\n setCurrentTime(time: float): void {\n this._renderer.setCurrentTime(time);\n }\n\n /**\n * Get the current time of the video object.\n * @returns The current time of the video\n */\n getCurrentTime(): float {\n return this._renderer.getCurrentTime();\n }\n\n /**\n * Set the new playback speed of the video object.\n * @param playbackSpeed The new playback speed.\n */\n setPlaybackSpeed(playbackSpeed: number): void {\n this._playbackSpeed = gdjs.evtTools.common.clamp(playbackSpeed, 0.5, 2);\n this._renderer.setPlaybackSpeed(this._playbackSpeed);\n }\n\n /**\n * Get the playback speed of the video object.\n * @returns The current playback speed of the video.\n */\n getPlaybackSpeed(): number {\n return this._renderer.getPlaybackSpeed();\n }\n }\n gdjs.registerObject('Video::VideoObject', gdjs.VideoRuntimeObject);\n\n /**\n * When a scene is unloaded, pause any video being run.\n * TODO: Investigate how to dispose the video source?\n */\n gdjs.registerRuntimeSceneUnloadedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and pause them.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj.isPlayed()) {\n obj.pause();\n }\n }\n }\n });\n\n /**\n * When a scene is paused, pause any video being run.\n */\n gdjs.registerRuntimeScenePausedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and pause them.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj.isPlayed()) {\n obj.pause();\n obj._pausedAsScenePaused = true;\n }\n }\n }\n });\n\n // Flag it to be started again when scene is resumed.\n\n /**\n * When a scene is resumed, resume any video previously paused.\n */\n gdjs.registerRuntimeSceneResumedCallback(function (runtimeScene) {\n // Manually find all the gdjs.VideoRuntimeObject living on the scene,\n // and play them if they have been previously paused.\n const instances = runtimeScene.getAdhocListOfAllInstances();\n for (let i = 0; i < instances.length; ++i) {\n const obj = instances[i];\n if (obj instanceof gdjs.VideoRuntimeObject) {\n if (obj._pausedAsScenePaused) {\n obj.play();\n }\n }\n }\n });\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAwCS,eACG,GAAK,aACkB,CAgB/B,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAZ3B,0BAAgC,GAa9B,KAAK,SAAW,EAAgB,QAAQ,QACxC,KAAK,MAAQ,EAAgB,QAAQ,KACrC,KAAK,QAAU,EAAgB,QAAQ,OACvC,KAAK,eAAiB,EAAgB,QAAQ,cAC9C,KAAK,UAAY,GAAI,GAAK,2BACxB,KACA,GAIF,KAAK,YAGP,mBAAoB,CAClB,MAAO,MAAK,UAAU,oBAGxB,qBACE,EACA,EACS,CAUT,MATI,GAAc,QAAQ,UAAY,EAAc,QAAQ,SAC1D,KAAK,WAAW,EAAc,QAAQ,SAEpC,EAAc,QAAQ,OAAS,EAAc,QAAQ,MACvD,KAAK,QAAQ,EAAc,QAAQ,MAEjC,EAAc,QAAQ,SAAW,EAAc,QAAQ,QACzD,KAAK,UAAU,EAAc,QAAQ,QAGrC,EAAc,QAAQ,gBACtB,EAAc,QAAQ,cAO1B,oBAA2C,CACzC,MAAO,IACF,MAAM,qBACT,GAAI,KAAK,SACT,IAAK,KAAK,WACV,IAAK,KAAK,YACV,IAAK,KAAK,WACV,KAAM,KAAK,WACX,GAAI,KAAK,iBACT,GAAI,KAAK,oBAIb,0BAA0B,EAAsC,CAC9D,MAAM,0BAA0B,GAE5B,KAAK,WAAa,QAAa,KAAK,UAAY,EAAS,IAC3D,KAAK,WAAW,EAAS,IAEvB,KAAK,aAAe,QAAa,KAAK,aAAe,EAAS,KAChE,KAAK,SAAS,EAAS,KAErB,KAAK,cAAgB,QAAa,KAAK,cAAgB,EAAS,KAClE,KAAK,UAAU,EAAS,KAEtB,EAAS,MAAQ,QAAa,KAAK,aAAe,EAAS,KAC7D,GAAS,IAAM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EAAI,YAvbJ",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){const c=new i.Logger("ResourceLoader"),R=(t,e,s)=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;const n=t.indexOf("?")===-1?"?":"&";return t+n+e+"="+s},_=t=>t.startsWith("https://project-resources.gdevelop.io/")||t.startsWith("https://project-resources-dev.gdevelop.io/"),g=20,f=5,d=3;class v{constructor(e){this.isFinished=!1;this.sceneName=e,this.onProgressCallbacks=new Array,this.onFinishCallbacks=new Array}registerCallback(e,s){if(this.isFinished){e();return}this.onFinishCallbacks.push(e),s&&this.onProgressCallbacks.push(s)}onProgress(e,s){for(const n of this.onProgressCallbacks)n(e,s)}onFinish(){this.isFinished=!0;for(const e of this.onFinishCallbacks)e()}}class w{constructor(e,s,n,r){this._sceneToLoadQueue=new Array;this._spineAtlasManager=null;this._spineManager=null;this.currentLoadingSceneName="";this.currentSceneLoadingProgress=0;this._isLoadingInForeground=!0;this._runtimeGame=e,this._resources=new Map,this._globalResources=n,this._sceneResources=new Map,this._sceneNamesToLoad=new Set,this._sceneNamesToMakeReady=new Set,this.setResources(s,n,r),this._imageManager=new i.ImageManager(this),this._soundManager=new i.SoundManager(this),this._fontManager=new i.FontManager(this),this._jsonManager=new i.JsonManager(this),this._bitmapFontManager=new i.BitmapFontManager(this,this._imageManager),this._model3DManager=new i.Model3DManager(this),i.SpineAtlasManager&&i.SpineManager&&(this._spineAtlasManager=new i.SpineAtlasManager(this,this._imageManager),this._spineManager=new i.SpineManager(this,this._spineAtlasManager));const a=[this._imageManager,this._soundManager,this._fontManager,this._jsonManager,this._bitmapFontManager,this._model3DManager];this._spineAtlasManager&&a.push(this._spineAtlasManager),this._spineManager&&a.push(this._spineManager),this._resourceManagersMap=new Map;for(const o of a)for(const u of o.getResourceKinds())this._resourceManagersMap.set(u,o)}getRuntimeGame(){return this._runtimeGame}setResources(e,s,n){this._globalResources=s,this._sceneResources.clear(),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear();for(const r of n)this._sceneResources.set(r.name,r.usedResources.map(a=>a.name)),this._sceneNamesToLoad.add(r.name),this._sceneNamesToMakeReady.add(r.name);this._sceneToLoadQueue.length=0;for(let r=n.length-1;r>=0;r--){const a=n[r];this._sceneToLoadQueue.push(new v(a.name))}this._resources.clear();for(const r of e)this._resources.set(r.name,r)}async loadAllResources(e){let s=0;await h([...this._resources.values()],g,d,async n=>{await this._loadResource(n),await this._processResource(n),s++,e(s,this._resources.size)}),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear()}async loadGlobalAndFirstSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;const a=[...this._globalResources,...n.values()];await h(a,g,d,async o=>{const u=this._resources.get(o);if(!u){c.warn('Unable to find resource "'+o+'".');return}await this._loadResource(u),await this._processResource(u),r++,s(r,a.length)}),this._setSceneAssetsLoaded(e),this._setSceneAssetsReady(e)}async loadAllSceneInBackground(){for(;this._sceneToLoadQueue.length>0;){const e=this._sceneToLoadQueue[this._sceneToLoadQueue.length-1];e!==void 0&&(this.currentLoadingSceneName=e.sceneName,this.areSceneAssetsLoaded(e.sceneName)?this._sceneToLoadQueue.pop():(await this._doLoadSceneResources(e.sceneName,async(s,n)=>e.onProgress(s,n)),this._sceneToLoadQueue.splice(this._sceneToLoadQueue.findIndex(s=>s===e),1),e.onFinish()))}this.currentLoadingSceneName=""}async _doLoadSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;await h([...n.values()],this._isLoadingInForeground?g:f,d,async a=>{const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');return}await this._loadResource(o),r++,this.currentSceneLoadingProgress=r/this._resources.size,s&&await s(r,this._resources.size)}),this._setSceneAssetsLoaded(e)}async _loadResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.loadResource(e.name)}async loadAndProcessSceneResources(e,s){if(this.areSceneAssetsReady(e))return;await this.loadSceneResources(e,s);const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;for(const a of n){const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');continue}await this._processResource(o),r++,s&&await s(r,n.length)}this._setSceneAssetsReady(e)}async loadSceneResources(e,s){this._isLoadingInForeground=!0;const n=this._prioritizeScene(e);return new Promise((r,a)=>{if(!n){this._isLoadingInForeground=!1,r();return}n.registerCallback(()=>{this._isLoadingInForeground=!1,r()},s)})}_prioritizeScene(e){const s=this._sceneToLoadQueue.findIndex(r=>r.sceneName===e);if(s<0)return null;const n=this._sceneToLoadQueue[s];return this._sceneToLoadQueue.splice(s,1),this._sceneToLoadQueue.push(n),n}async _processResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.processResource(e.name)}getSceneLoadingProgress(e){return e===this.currentLoadingSceneName?this.currentSceneLoadingProgress:this.areSceneAssetsLoaded(e)?1:0}areSceneAssetsLoaded(e){return!this._sceneNamesToLoad.has(e)}areSceneAssetsReady(e){return!this._sceneNamesToMakeReady.has(e)}_setSceneAssetsLoaded(e){this._sceneNamesToLoad.delete(e)}_setSceneAssetsReady(e){this._sceneNamesToMakeReady.delete(e)}getResource(e){return this._resources.get(e)||null}getFullUrl(e){const{gdevelopResourceToken:s}=this._runtimeGame._options;return!s||!_(e)?e:R(e,"gd_resource_token",encodeURIComponent(s))}checkIfCredentialsRequired(e){return this._runtimeGame._options.gdevelopResourceToken?!1:!!_(e)}getSoundManager(){return this._soundManager}getImageManager(){return this._imageManager}getFontManager(){return this._fontManager}getBitmapFontManager(){return this._bitmapFontManager}getJsonManager(){return this._jsonManager}getModel3DManager(){return this._model3DManager}getSpineManager(){return this._spineManager}getSpineAtlasManager(){return this._spineAtlasManager}}i.ResourceLoader=w;const m=(t,e,s)=>{const n=[],r=[];let a=0,o=0;return new Promise((u,y)=>{const p=()=>{if(t.length===0){u({results:n,errors:r});return}for(;a<e&&o<t.length;){const M=t[o++];a++,s(M).then(l=>n.push(l)).catch(l=>r.push({item:M,error:l})).finally(()=>{a--,o===t.length&&a===0?u({results:n,errors:r}):p()})}};p()})},h=async(t,e,s,n)=>{const r=await m(t,e,n);r.errors.length!==0&&c.warn("Some assets couldn't be downloaded. Trying again now.");for(let a=1;a<s&&r.errors.length!==0;a++){const o=await m(t,e,n);r.results.push.apply(r.results,o.results),r.errors=o.errors}return r}})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){const c=new i.Logger("ResourceLoader"),R=(t,e,s)=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;const n=t.indexOf("?")===-1?"?":"&";return t+n+e+"="+s},_=t=>t.startsWith("https://project-resources.gdevelop.io/")||t.startsWith("https://project-resources-dev.gdevelop.io/"),g=20,f=5,d=3;class v{constructor(e){this.isFinished=!1;this.sceneName=e,this.onProgressCallbacks=new Array,this.onFinishCallbacks=new Array}registerCallback(e,s){if(this.isFinished){e();return}this.onFinishCallbacks.push(e),s&&this.onProgressCallbacks.push(s)}onProgress(e,s){for(const n of this.onProgressCallbacks)n(e,s)}onFinish(){this.isFinished=!0;for(const e of this.onFinishCallbacks)e()}}class w{constructor(e,s,n,r){this._sceneToLoadQueue=new Array;this._spineAtlasManager=null;this._spineManager=null;this.currentLoadingSceneName="";this.currentSceneLoadingProgress=0;this._isLoadingInForeground=!0;this._runtimeGame=e,this._resources=new Map,this._globalResources=n,this._sceneResources=new Map,this._sceneNamesToLoad=new Set,this._sceneNamesToMakeReady=new Set,this.setResources(s,n,r),this._imageManager=new i.ImageManager(this),this._soundManager=new i.SoundManager(this),this._fontManager=new i.FontManager(this),this._jsonManager=new i.JsonManager(this),this._bitmapFontManager=new i.BitmapFontManager(this,this._imageManager),this._model3DManager=new i.Model3DManager(this),i.SpineAtlasManager&&i.SpineManager&&(this._spineAtlasManager=new i.SpineAtlasManager(this,this._imageManager),this._spineManager=new i.SpineManager(this,this._spineAtlasManager));const a=[this._imageManager,this._soundManager,this._fontManager,this._jsonManager,this._bitmapFontManager,this._model3DManager];this._spineAtlasManager&&a.push(this._spineAtlasManager),this._spineManager&&a.push(this._spineManager),this._resourceManagersMap=new Map;for(const o of a)for(const u of o.getResourceKinds())this._resourceManagersMap.set(u,o)}getRuntimeGame(){return this._runtimeGame}setResources(e,s,n){this._globalResources=s,this._sceneResources.clear(),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear();for(const r of n)this._sceneResources.set(r.name,r.usedResources.map(a=>a.name)),this._sceneNamesToLoad.add(r.name),this._sceneNamesToMakeReady.add(r.name);this._sceneToLoadQueue.length=0;for(let r=n.length-1;r>=0;r--){const a=n[r];this._sceneToLoadQueue.push(new v(a.name))}this._resources.clear();for(const r of e)!r.file||this._resources.set(r.name,r)}async loadAllResources(e){let s=0;await h([...this._resources.values()],g,d,async n=>{await this._loadResource(n),await this._processResource(n),s++,e(s,this._resources.size)}),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear()}async loadGlobalAndFirstSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;const a=[...this._globalResources,...n.values()];await h(a,g,d,async o=>{const u=this._resources.get(o);if(!u){c.warn('Unable to find resource "'+o+'".');return}await this._loadResource(u),await this._processResource(u),r++,s(r,a.length)}),this._setSceneAssetsLoaded(e),this._setSceneAssetsReady(e)}async loadAllSceneInBackground(){for(;this._sceneToLoadQueue.length>0;){const e=this._sceneToLoadQueue[this._sceneToLoadQueue.length-1];e!==void 0&&(this.currentLoadingSceneName=e.sceneName,this.areSceneAssetsLoaded(e.sceneName)?this._sceneToLoadQueue.pop():(await this._doLoadSceneResources(e.sceneName,async(s,n)=>e.onProgress(s,n)),this._sceneToLoadQueue.splice(this._sceneToLoadQueue.findIndex(s=>s===e),1),e.onFinish()))}this.currentLoadingSceneName=""}async _doLoadSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;await h([...n.values()],this._isLoadingInForeground?g:f,d,async a=>{const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');return}await this._loadResource(o),r++,this.currentSceneLoadingProgress=r/this._resources.size,s&&await s(r,this._resources.size)}),this._setSceneAssetsLoaded(e)}async _loadResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.loadResource(e.name)}async loadAndProcessSceneResources(e,s){if(this.areSceneAssetsReady(e))return;await this.loadSceneResources(e,s);const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;for(const a of n){const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');continue}await this._processResource(o),r++,s&&await s(r,n.length)}this._setSceneAssetsReady(e)}async loadSceneResources(e,s){this._isLoadingInForeground=!0;const n=this._prioritizeScene(e);return new Promise((r,a)=>{if(!n){this._isLoadingInForeground=!1,r();return}n.registerCallback(()=>{this._isLoadingInForeground=!1,r()},s)})}_prioritizeScene(e){const s=this._sceneToLoadQueue.findIndex(r=>r.sceneName===e);if(s<0)return null;const n=this._sceneToLoadQueue[s];return this._sceneToLoadQueue.splice(s,1),this._sceneToLoadQueue.push(n),n}async _processResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.processResource(e.name)}getSceneLoadingProgress(e){return e===this.currentLoadingSceneName?this.currentSceneLoadingProgress:this.areSceneAssetsLoaded(e)?1:0}areSceneAssetsLoaded(e){return!this._sceneNamesToLoad.has(e)}areSceneAssetsReady(e){return!this._sceneNamesToMakeReady.has(e)}_setSceneAssetsLoaded(e){this._sceneNamesToLoad.delete(e)}_setSceneAssetsReady(e){this._sceneNamesToMakeReady.delete(e)}getResource(e){return this._resources.get(e)||null}getFullUrl(e){const{gdevelopResourceToken:s}=this._runtimeGame._options;return!s||!_(e)?e:R(e,"gd_resource_token",encodeURIComponent(s))}checkIfCredentialsRequired(e){return this._runtimeGame._options.gdevelopResourceToken?!1:!!_(e)}getSoundManager(){return this._soundManager}getImageManager(){return this._imageManager}getFontManager(){return this._fontManager}getBitmapFontManager(){return this._bitmapFontManager}getJsonManager(){return this._jsonManager}getModel3DManager(){return this._model3DManager}getSpineManager(){return this._spineManager}getSpineAtlasManager(){return this._spineAtlasManager}}i.ResourceLoader=w;const m=(t,e,s)=>{const n=[],r=[];let a=0,o=0;return new Promise((u,y)=>{const p=()=>{if(t.length===0){u({results:n,errors:r});return}for(;a<e&&o<t.length;){const M=t[o++];a++,s(M).then(l=>n.push(l)).catch(l=>r.push({item:M,error:l})).finally(()=>{a--,o===t.length&&a===0?u({results:n,errors:r}):p()})}};p()})},h=async(t,e,s,n)=>{const r=await m(t,e,n);r.errors.length!==0&&c.warn("Some assets couldn't be downloaded. Trying again now.");for(let a=1;a<s&&r.errors.length!==0;a++){const o=await m(t,e,n);r.results.push.apply(r.results,o.results),r.errors=o.errors}return r}})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=ResourceLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../GDevelop/GDJS/Runtime/ResourceLoader.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2023 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('ResourceLoader');\n\n const addSearchParameterToUrl = (\n url: string,\n urlEncodedParameterName: string,\n urlEncodedValue: string\n ) => {\n if (url.startsWith('data:') || url.startsWith('blob:')) {\n // blob/data protocol does not support search parameters, which are useless anyway.\n return url;\n }\n\n const separator = url.indexOf('?') === -1 ? '?' : '&';\n return url + separator + urlEncodedParameterName + '=' + urlEncodedValue;\n };\n\n const checkIfIsGDevelopCloudBucketUrl = (url: string): boolean => {\n return (\n url.startsWith('https://project-resources.gdevelop.io/') ||\n url.startsWith('https://project-resources-dev.gdevelop.io/')\n );\n };\n\n const maxForegroundConcurrency = 20;\n const maxBackgroundConcurrency = 5;\n const maxAttempt = 3;\n\n /**\n * A task of pre-loading resources used by a scene.\n *\n * A Promise can't be used instead of this class because a Promise will start\n * as soon as possible. It would flood the server with downloading requests\n * and make impossible to finely tune in which order scenes are actually\n * downloaded.\n */\n class SceneLoadingTask {\n sceneName: string;\n private onProgressCallbacks: Array<(count: number, total: number) => void>;\n private onFinishCallbacks: Array<() => void>;\n private isFinished = false;\n\n constructor(sceneName: string) {\n this.sceneName = sceneName;\n this.onProgressCallbacks = new Array<\n (count: number, total: number) => void\n >();\n this.onFinishCallbacks = new Array<() => void>();\n }\n\n registerCallback(\n onFinish: () => void,\n onProgress?: (count: number, total: number) => void\n ) {\n if (this.isFinished) {\n onFinish();\n return;\n }\n this.onFinishCallbacks.push(onFinish);\n if (onProgress) {\n this.onProgressCallbacks.push(onProgress);\n }\n }\n\n onProgress(count: number, total: number) {\n for (const onProgress of this.onProgressCallbacks) {\n onProgress(count, total);\n }\n }\n\n onFinish() {\n this.isFinished = true;\n for (const onFinish of this.onFinishCallbacks) {\n onFinish();\n }\n }\n }\n\n /**\n * Pre-load resources of any kind needed for a game or a scene.\n */\n export class ResourceLoader {\n _runtimeGame: RuntimeGame;\n /**\n * All the resource of a game by resource name.\n */\n private _resources: Map<string, ResourceData>;\n /**\n * Resources needed for any scene. Typically, they are resources from\n * global objects.\n */\n private _globalResources: Array<string>;\n /**\n * Resources by scene names.\n */\n private _sceneResources: Map<string, Array<string>>;\n /**\n * Keep track of which scene whose resources has already be pre-loaded.\n */\n private _sceneNamesToLoad: Set<string>;\n /**\n * Keep track of which scene whose resources has already be loaded.\n */\n private _sceneNamesToMakeReady: Set<string>;\n /**\n * A queue of scenes whose resources are still to be pre-loaded.\n */\n private _sceneToLoadQueue: Array<SceneLoadingTask> = new Array<\n SceneLoadingTask\n >();\n /**\n * The resource managers that actually download and remember downloaded\n * content.\n */\n _resourceManagersMap: Map<ResourceKind, ResourceManager>;\n private _imageManager: ImageManager;\n private _soundManager: SoundManager;\n private _fontManager: FontManager;\n private _jsonManager: JsonManager;\n private _model3DManager: Model3DManager;\n private _bitmapFontManager: BitmapFontManager;\n private _spineAtlasManager: SpineAtlasManager | null = null;\n private _spineManager: SpineManager | null = null;\n\n /**\n * Only used by events.\n */\n private currentLoadingSceneName: string = '';\n /**\n * Only used by events.\n */\n private currentSceneLoadingProgress: float = 0;\n /**\n * It's set to `true` during intermediary loading screen to use a greater\n * concurrency as the game is paused and doesn't need bandwidth (for video\n * or music streaming or online multiplayer).\n */\n private _isLoadingInForeground = true;\n\n /**\n * @param runtimeGame The game.\n * @param resourceDataArray The resources data of the game.\n * @param globalResources The resources needed for any layer.\n * @param layoutDataArray The resources used by each layer.\n */\n constructor(\n runtimeGame: RuntimeGame,\n resourceDataArray: ResourceData[],\n globalResources: Array<string>,\n layoutDataArray: Array<LayoutData>\n ) {\n this._runtimeGame = runtimeGame;\n this._resources = new Map<string, ResourceData>();\n this._globalResources = globalResources;\n\n // These 3 attributes are filled by `setResources`.\n this._sceneResources = new Map<string, Array<string>>();\n this._sceneNamesToLoad = new Set<string>();\n this._sceneNamesToMakeReady = new Set<string>();\n this.setResources(resourceDataArray, globalResources, layoutDataArray);\n\n this._imageManager = new gdjs.ImageManager(this);\n this._soundManager = new gdjs.SoundManager(this);\n this._fontManager = new gdjs.FontManager(this);\n this._jsonManager = new gdjs.JsonManager(this);\n this._bitmapFontManager = new gdjs.BitmapFontManager(\n this,\n this._imageManager\n );\n this._model3DManager = new gdjs.Model3DManager(this);\n\n // add spine related managers only if spine extension is used\n if (gdjs.SpineAtlasManager && gdjs.SpineManager) {\n this._spineAtlasManager = new gdjs.SpineAtlasManager(\n this,\n this._imageManager\n );\n this._spineManager = new gdjs.SpineManager(\n this,\n this._spineAtlasManager\n );\n }\n\n const resourceManagers: Array<ResourceManager> = [\n this._imageManager,\n this._soundManager,\n this._fontManager,\n this._jsonManager,\n this._bitmapFontManager,\n this._model3DManager,\n ];\n\n if (this._spineAtlasManager)\n resourceManagers.push(this._spineAtlasManager);\n if (this._spineManager) resourceManagers.push(this._spineManager);\n\n this._resourceManagersMap = new Map<ResourceKind, ResourceManager>();\n for (const resourceManager of resourceManagers) {\n for (const resourceKind of resourceManager.getResourceKinds()) {\n this._resourceManagersMap.set(resourceKind, resourceManager);\n }\n }\n }\n\n /**\n * @returns the runtime game instance.\n */\n getRuntimeGame(): RuntimeGame {\n return this._runtimeGame;\n }\n\n /**\n * Update the resources data of the game. Useful for hot-reloading, should\n * not be used otherwise.\n */\n setResources(\n resourceDataArray: ResourceData[],\n globalResources: Array<string>,\n layoutDataArray: Array<LayoutData>\n ): void {\n this._globalResources = globalResources;\n\n this._sceneResources.clear();\n this._sceneNamesToLoad.clear();\n this._sceneNamesToMakeReady.clear();\n for (const layoutData of layoutDataArray) {\n this._sceneResources.set(\n layoutData.name,\n layoutData.usedResources.map((resource) => resource.name)\n );\n this._sceneNamesToLoad.add(layoutData.name);\n this._sceneNamesToMakeReady.add(layoutData.name);\n }\n // TODO Clearing the queue doesn't abort the running task, but it should\n // not matter as resource loading is really fast in preview mode.\n this._sceneToLoadQueue.length = 0;\n for (let index = layoutDataArray.length - 1; index >= 0; index--) {\n const layoutData = layoutDataArray[index];\n this._sceneToLoadQueue.push(new SceneLoadingTask(layoutData.name));\n }\n\n this._resources.clear();\n for (const resourceData of resourceDataArray) {\n this._resources.set(resourceData.name, resourceData);\n }\n }\n\n async loadAllResources(\n onProgress: (loadingCount: integer, totalCount: integer) => void\n ): Promise<void> {\n let loadedCount = 0;\n await processAndRetryIfNeededWithPromisePool(\n [...this._resources.values()],\n maxForegroundConcurrency,\n maxAttempt,\n async (resource) => {\n await this._loadResource(resource);\n await this._processResource(resource);\n loadedCount++;\n onProgress(loadedCount, this._resources.size);\n }\n );\n this._sceneNamesToLoad.clear();\n this._sceneNamesToMakeReady.clear();\n }\n\n /**\n * Load the resources that are needed to launch the first scene.\n */\n async loadGlobalAndFirstSceneResources(\n firstSceneName: string,\n onProgress: (count: number, total: number) => void\n ): Promise<void> {\n const sceneResources = this._sceneResources.get(firstSceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + firstSceneName + '\".'\n );\n return;\n }\n let loadedCount = 0;\n const resources = [...this._globalResources, ...sceneResources.values()];\n await processAndRetryIfNeededWithPromisePool(\n resources,\n maxForegroundConcurrency,\n maxAttempt,\n async (resourceName) => {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n return;\n }\n await this._loadResource(resource);\n await this._processResource(resource);\n loadedCount++;\n onProgress(loadedCount, resources.length);\n }\n );\n this._setSceneAssetsLoaded(firstSceneName);\n this._setSceneAssetsReady(firstSceneName);\n }\n\n /**\n * Load each scene in order.\n *\n * This is done in background to try to avoid loading screens when changing\n * scenes.\n */\n async loadAllSceneInBackground(): Promise<void> {\n while (this._sceneToLoadQueue.length > 0) {\n const task = this._sceneToLoadQueue[this._sceneToLoadQueue.length - 1];\n if (task === undefined) {\n continue;\n }\n this.currentLoadingSceneName = task.sceneName;\n if (!this.areSceneAssetsLoaded(task.sceneName)) {\n await this._doLoadSceneResources(\n task.sceneName,\n async (count, total) => task.onProgress(count, total)\n );\n // A scene may have been moved last while awaiting resources to be\n // downloaded (see _prioritizeScene).\n this._sceneToLoadQueue.splice(\n this._sceneToLoadQueue.findIndex((element) => element === task),\n 1\n );\n task.onFinish();\n } else {\n this._sceneToLoadQueue.pop();\n }\n }\n this.currentLoadingSceneName = '';\n }\n\n private async _doLoadSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => Promise<void>\n ): Promise<void> {\n const sceneResources = this._sceneResources.get(sceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + sceneName + '\".'\n );\n return;\n }\n let loadedCount = 0;\n await processAndRetryIfNeededWithPromisePool(\n [...sceneResources.values()],\n this._isLoadingInForeground\n ? maxForegroundConcurrency\n : maxBackgroundConcurrency,\n maxAttempt,\n async (resourceName) => {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n return;\n }\n await this._loadResource(resource);\n loadedCount++;\n this.currentSceneLoadingProgress = loadedCount / this._resources.size;\n onProgress && (await onProgress(loadedCount, this._resources.size));\n }\n );\n this._setSceneAssetsLoaded(sceneName);\n }\n\n private async _loadResource(resource: ResourceData): Promise<void> {\n const resourceManager = this._resourceManagersMap.get(resource.kind);\n if (!resourceManager) {\n logger.warn(\n 'Unknown resource kind: \"' +\n resource.kind +\n '\" for: \"' +\n resource.name +\n '\".'\n );\n return;\n }\n await resourceManager.loadResource(resource.name);\n }\n\n /**\n * Load and process a scene that is needed right away.\n *\n * The renderer will show a loading screen while its done.\n */\n async loadAndProcessSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => Promise<void>\n ): Promise<void> {\n if (this.areSceneAssetsReady(sceneName)) {\n return;\n }\n await this.loadSceneResources(sceneName, onProgress);\n\n const sceneResources = this._sceneResources.get(sceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + sceneName + '\".'\n );\n return;\n }\n\n let parsedCount = 0;\n for (const resourceName of sceneResources) {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n continue;\n }\n await this._processResource(resource);\n parsedCount++;\n onProgress && (await onProgress(parsedCount, sceneResources.length));\n }\n this._setSceneAssetsReady(sceneName);\n }\n\n /**\n * Load a scene resources without parsing them.\n *\n * When another scene resources are loading in background, it waits for\n * all its resources to be loaded before loading resources of the given\n * scene.\n */\n async loadSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => void\n ): Promise<void> {\n this._isLoadingInForeground = true;\n const task = this._prioritizeScene(sceneName);\n return new Promise<void>((resolve, reject) => {\n if (!task) {\n this._isLoadingInForeground = false;\n resolve();\n return;\n }\n task.registerCallback(() => {\n this._isLoadingInForeground = false;\n resolve();\n }, onProgress);\n });\n }\n\n /**\n * Put a given scene at the end of the queue.\n *\n * When the scene that is currently loading in background is done,\n * this scene will be the next to be loaded.\n */\n private _prioritizeScene(sceneName: string): SceneLoadingTask | null {\n const taskIndex = this._sceneToLoadQueue.findIndex(\n (task) => task.sceneName === sceneName\n );\n if (taskIndex < 0) {\n // The scene is already loaded.\n return null;\n }\n const task = this._sceneToLoadQueue[taskIndex];\n this._sceneToLoadQueue.splice(taskIndex, 1);\n this._sceneToLoadQueue.push(task);\n return task;\n }\n\n private async _processResource(resource: ResourceData): Promise<void> {\n const resourceManager = this._resourceManagersMap.get(resource.kind);\n if (!resourceManager) {\n logger.warn(\n 'Unknown resource kind: \"' +\n resource.kind +\n '\" for: \"' +\n resource.name +\n '\".'\n );\n return;\n }\n await resourceManager.processResource(resource.name);\n }\n\n getSceneLoadingProgress(sceneName: string): float {\n return sceneName === this.currentLoadingSceneName\n ? this.currentSceneLoadingProgress\n : this.areSceneAssetsLoaded(sceneName)\n ? 1\n : 0;\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._sceneNamesToLoad.has(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._sceneNamesToMakeReady.has(sceneName);\n }\n\n private _setSceneAssetsLoaded(sceneName: string): void {\n this._sceneNamesToLoad.delete(sceneName);\n }\n\n private _setSceneAssetsReady(sceneName: string): void {\n this._sceneNamesToMakeReady.delete(sceneName);\n }\n\n getResource(resourceName: string): ResourceData | null {\n return this._resources.get(resourceName) || null;\n }\n\n // Helper methods used when resources are loaded from an URL.\n\n /**\n * Complete the given URL with any specific parameter required to access\n * the resource (this can be for example a token needed to access the resource).\n */\n getFullUrl(url: string) {\n const { gdevelopResourceToken } = this._runtimeGame._options;\n if (!gdevelopResourceToken) return url;\n\n if (!checkIfIsGDevelopCloudBucketUrl(url)) return url;\n\n return addSearchParameterToUrl(\n url,\n 'gd_resource_token',\n encodeURIComponent(gdevelopResourceToken)\n );\n }\n\n /**\n * Return true if the specified URL must be loaded with cookies (\"credentials\")\n * sent to grant access to them.\n */\n checkIfCredentialsRequired(url: string) {\n if (this._runtimeGame._options.gdevelopResourceToken) return false;\n\n // Any resource stored on the GDevelop Cloud buckets needs the \"credentials\" of the user,\n // i.e: its gdevelop.io cookie, to be passed.\n // Note that this is only useful during previews.\n if (checkIfIsGDevelopCloudBucketUrl(url)) return true;\n\n // For other resources, use the default way of loading resources (\"anonymous\" or \"same-site\").\n return false;\n }\n\n /**\n * Get the gdjs.SoundManager of the RuntimeGame.\n * @return The sound manager.\n */\n getSoundManager(): gdjs.HowlerSoundManager {\n return this._soundManager;\n }\n\n /**\n * Get the gdjs.ImageManager of the RuntimeGame.\n * @return The image manager.\n */\n getImageManager(): gdjs.PixiImageManager {\n return this._imageManager;\n }\n\n /**\n * Get the gdjs.FontManager of the RuntimeGame.\n * @return The font manager.\n */\n getFontManager(): gdjs.FontFaceObserverFontManager {\n return this._fontManager;\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._bitmapFontManager;\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._jsonManager;\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._model3DManager;\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._spineManager;\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._spineAtlasManager;\n }\n }\n\n type PromiseError<T> = { item: T; error: Error };\n\n type PromisePoolOutput<T, U> = {\n results: Array<U>;\n errors: Array<PromiseError<T>>;\n };\n\n const processWithPromisePool = <T, U>(\n items: Array<T>,\n maxConcurrency: number,\n asyncFunction: (item: T) => Promise<U>\n ): Promise<PromisePoolOutput<T, U>> => {\n const results: Array<U> = [];\n const errors: Array<PromiseError<T>> = [];\n let activePromises = 0;\n let index = 0;\n\n return new Promise((resolve, reject) => {\n const executeNext = () => {\n if (items.length === 0) {\n resolve({ results, errors });\n return;\n }\n while (activePromises < maxConcurrency && index < items.length) {\n const item = items[index++];\n activePromises++;\n\n asyncFunction(item)\n .then((result) => results.push(result))\n .catch((error) => errors.push({ item, error }))\n .finally(() => {\n activePromises--;\n if (index === items.length && activePromises === 0) {\n resolve({ results, errors });\n } else {\n executeNext();\n }\n });\n }\n };\n\n executeNext();\n });\n };\n\n const processAndRetryIfNeededWithPromisePool = async <T, U>(\n items: Array<T>,\n maxConcurrency: number,\n maxAttempt: number,\n asyncFunction: (item: T) => Promise<U>\n ): Promise<PromisePoolOutput<T, U>> => {\n const output = await processWithPromisePool<T, U>(\n items,\n maxConcurrency,\n asyncFunction\n );\n if (output.errors.length !== 0) {\n logger.warn(\"Some assets couldn't be downloaded. Trying again now.\");\n }\n for (\n let attempt = 1;\n attempt < maxAttempt && output.errors.length !== 0;\n attempt++\n ) {\n const retryOutput = await processWithPromisePool<T, U>(\n items,\n maxConcurrency,\n asyncFunction\n );\n output.results.push.apply(output.results, retryOutput.results);\n output.errors = retryOutput.errors;\n }\n return output;\n };\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAA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,IAC9B,MAAM,AAAC,GAAU,EAAO,KAAK,CAAE,OAAM,WACrC,QAAQ,IAAM,CACb,IACA,AAAI,IAAU,EAAM,QAAU,IAAmB,EAC/C,EAAQ,CAAE,UAAS,WAEnB,QAMV,OAIE,EAAyC,MAC7C,EACA,EACA,EACA,IACqC,CACrC,KAAM,GAAS,KAAM,GACnB,EACA,EACA,GAEF,AAAI,EAAO,OAAO,SAAW,GAC3B,EAAO,KAAK,yDAEd,OACM,GAAU,EACd,EAAU,GAAc,EAAO,OAAO,SAAW,EACjD,IACA,CACA,KAAM,GAAc,KAAM,GACxB,EACA,EACA,GAEF,EAAO,QAAQ,KAAK,MAAM,EAAO,QAAS,EAAY,SACtD,EAAO,OAAS,EAAY,OAE9B,MAAO,MAnrBD",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2023 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('ResourceLoader');\n\n const addSearchParameterToUrl = (\n url: string,\n urlEncodedParameterName: string,\n urlEncodedValue: string\n ) => {\n if (url.startsWith('data:') || url.startsWith('blob:')) {\n // blob/data protocol does not support search parameters, which are useless anyway.\n return url;\n }\n\n const separator = url.indexOf('?') === -1 ? '?' : '&';\n return url + separator + urlEncodedParameterName + '=' + urlEncodedValue;\n };\n\n const checkIfIsGDevelopCloudBucketUrl = (url: string): boolean => {\n return (\n url.startsWith('https://project-resources.gdevelop.io/') ||\n url.startsWith('https://project-resources-dev.gdevelop.io/')\n );\n };\n\n const maxForegroundConcurrency = 20;\n const maxBackgroundConcurrency = 5;\n const maxAttempt = 3;\n\n /**\n * A task of pre-loading resources used by a scene.\n *\n * A Promise can't be used instead of this class because a Promise will start\n * as soon as possible. It would flood the server with downloading requests\n * and make impossible to finely tune in which order scenes are actually\n * downloaded.\n */\n class SceneLoadingTask {\n sceneName: string;\n private onProgressCallbacks: Array<(count: number, total: number) => void>;\n private onFinishCallbacks: Array<() => void>;\n private isFinished = false;\n\n constructor(sceneName: string) {\n this.sceneName = sceneName;\n this.onProgressCallbacks = new Array<\n (count: number, total: number) => void\n >();\n this.onFinishCallbacks = new Array<() => void>();\n }\n\n registerCallback(\n onFinish: () => void,\n onProgress?: (count: number, total: number) => void\n ) {\n if (this.isFinished) {\n onFinish();\n return;\n }\n this.onFinishCallbacks.push(onFinish);\n if (onProgress) {\n this.onProgressCallbacks.push(onProgress);\n }\n }\n\n onProgress(count: number, total: number) {\n for (const onProgress of this.onProgressCallbacks) {\n onProgress(count, total);\n }\n }\n\n onFinish() {\n this.isFinished = true;\n for (const onFinish of this.onFinishCallbacks) {\n onFinish();\n }\n }\n }\n\n /**\n * Pre-load resources of any kind needed for a game or a scene.\n */\n export class ResourceLoader {\n _runtimeGame: RuntimeGame;\n /**\n * All the resource of a game by resource name.\n */\n private _resources: Map<string, ResourceData>;\n /**\n * Resources needed for any scene. Typically, they are resources from\n * global objects.\n */\n private _globalResources: Array<string>;\n /**\n * Resources by scene names.\n */\n private _sceneResources: Map<string, Array<string>>;\n /**\n * Keep track of which scene whose resources has already be pre-loaded.\n */\n private _sceneNamesToLoad: Set<string>;\n /**\n * Keep track of which scene whose resources has already be loaded.\n */\n private _sceneNamesToMakeReady: Set<string>;\n /**\n * A queue of scenes whose resources are still to be pre-loaded.\n */\n private _sceneToLoadQueue: Array<SceneLoadingTask> = new Array<\n SceneLoadingTask\n >();\n /**\n * The resource managers that actually download and remember downloaded\n * content.\n */\n _resourceManagersMap: Map<ResourceKind, ResourceManager>;\n private _imageManager: ImageManager;\n private _soundManager: SoundManager;\n private _fontManager: FontManager;\n private _jsonManager: JsonManager;\n private _model3DManager: Model3DManager;\n private _bitmapFontManager: BitmapFontManager;\n private _spineAtlasManager: SpineAtlasManager | null = null;\n private _spineManager: SpineManager | null = null;\n\n /**\n * Only used by events.\n */\n private currentLoadingSceneName: string = '';\n /**\n * Only used by events.\n */\n private currentSceneLoadingProgress: float = 0;\n /**\n * It's set to `true` during intermediary loading screen to use a greater\n * concurrency as the game is paused and doesn't need bandwidth (for video\n * or music streaming or online multiplayer).\n */\n private _isLoadingInForeground = true;\n\n /**\n * @param runtimeGame The game.\n * @param resourceDataArray The resources data of the game.\n * @param globalResources The resources needed for any layer.\n * @param layoutDataArray The resources used by each layer.\n */\n constructor(\n runtimeGame: RuntimeGame,\n resourceDataArray: ResourceData[],\n globalResources: Array<string>,\n layoutDataArray: Array<LayoutData>\n ) {\n this._runtimeGame = runtimeGame;\n this._resources = new Map<string, ResourceData>();\n this._globalResources = globalResources;\n\n // These 3 attributes are filled by `setResources`.\n this._sceneResources = new Map<string, Array<string>>();\n this._sceneNamesToLoad = new Set<string>();\n this._sceneNamesToMakeReady = new Set<string>();\n this.setResources(resourceDataArray, globalResources, layoutDataArray);\n\n this._imageManager = new gdjs.ImageManager(this);\n this._soundManager = new gdjs.SoundManager(this);\n this._fontManager = new gdjs.FontManager(this);\n this._jsonManager = new gdjs.JsonManager(this);\n this._bitmapFontManager = new gdjs.BitmapFontManager(\n this,\n this._imageManager\n );\n this._model3DManager = new gdjs.Model3DManager(this);\n\n // add spine related managers only if spine extension is used\n if (gdjs.SpineAtlasManager && gdjs.SpineManager) {\n this._spineAtlasManager = new gdjs.SpineAtlasManager(\n this,\n this._imageManager\n );\n this._spineManager = new gdjs.SpineManager(\n this,\n this._spineAtlasManager\n );\n }\n\n const resourceManagers: Array<ResourceManager> = [\n this._imageManager,\n this._soundManager,\n this._fontManager,\n this._jsonManager,\n this._bitmapFontManager,\n this._model3DManager,\n ];\n\n if (this._spineAtlasManager)\n resourceManagers.push(this._spineAtlasManager);\n if (this._spineManager) resourceManagers.push(this._spineManager);\n\n this._resourceManagersMap = new Map<ResourceKind, ResourceManager>();\n for (const resourceManager of resourceManagers) {\n for (const resourceKind of resourceManager.getResourceKinds()) {\n this._resourceManagersMap.set(resourceKind, resourceManager);\n }\n }\n }\n\n /**\n * @returns the runtime game instance.\n */\n getRuntimeGame(): RuntimeGame {\n return this._runtimeGame;\n }\n\n /**\n * Update the resources data of the game. Useful for hot-reloading, should\n * not be used otherwise.\n */\n setResources(\n resourceDataArray: ResourceData[],\n globalResources: Array<string>,\n layoutDataArray: Array<LayoutData>\n ): void {\n this._globalResources = globalResources;\n\n this._sceneResources.clear();\n this._sceneNamesToLoad.clear();\n this._sceneNamesToMakeReady.clear();\n for (const layoutData of layoutDataArray) {\n this._sceneResources.set(\n layoutData.name,\n layoutData.usedResources.map((resource) => resource.name)\n );\n this._sceneNamesToLoad.add(layoutData.name);\n this._sceneNamesToMakeReady.add(layoutData.name);\n }\n // TODO Clearing the queue doesn't abort the running task, but it should\n // not matter as resource loading is really fast in preview mode.\n this._sceneToLoadQueue.length = 0;\n for (let index = layoutDataArray.length - 1; index >= 0; index--) {\n const layoutData = layoutDataArray[index];\n this._sceneToLoadQueue.push(new SceneLoadingTask(layoutData.name));\n }\n\n this._resources.clear();\n for (const resourceData of resourceDataArray) {\n if (!resourceData.file) {\n // Empty string or missing `file` field: not a valid resource, let's entirely ignore it.\n // Otherwise, this can confuse some loaders that will consider an empty string different\n // than a file that happen not to fail to load.\n continue;\n }\n\n this._resources.set(resourceData.name, resourceData);\n }\n }\n\n async loadAllResources(\n onProgress: (loadingCount: integer, totalCount: integer) => void\n ): Promise<void> {\n let loadedCount = 0;\n await processAndRetryIfNeededWithPromisePool(\n [...this._resources.values()],\n maxForegroundConcurrency,\n maxAttempt,\n async (resource) => {\n await this._loadResource(resource);\n await this._processResource(resource);\n loadedCount++;\n onProgress(loadedCount, this._resources.size);\n }\n );\n this._sceneNamesToLoad.clear();\n this._sceneNamesToMakeReady.clear();\n }\n\n /**\n * Load the resources that are needed to launch the first scene.\n */\n async loadGlobalAndFirstSceneResources(\n firstSceneName: string,\n onProgress: (count: number, total: number) => void\n ): Promise<void> {\n const sceneResources = this._sceneResources.get(firstSceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + firstSceneName + '\".'\n );\n return;\n }\n let loadedCount = 0;\n const resources = [...this._globalResources, ...sceneResources.values()];\n await processAndRetryIfNeededWithPromisePool(\n resources,\n maxForegroundConcurrency,\n maxAttempt,\n async (resourceName) => {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n return;\n }\n await this._loadResource(resource);\n await this._processResource(resource);\n loadedCount++;\n onProgress(loadedCount, resources.length);\n }\n );\n this._setSceneAssetsLoaded(firstSceneName);\n this._setSceneAssetsReady(firstSceneName);\n }\n\n /**\n * Load each scene in order.\n *\n * This is done in background to try to avoid loading screens when changing\n * scenes.\n */\n async loadAllSceneInBackground(): Promise<void> {\n while (this._sceneToLoadQueue.length > 0) {\n const task = this._sceneToLoadQueue[this._sceneToLoadQueue.length - 1];\n if (task === undefined) {\n continue;\n }\n this.currentLoadingSceneName = task.sceneName;\n if (!this.areSceneAssetsLoaded(task.sceneName)) {\n await this._doLoadSceneResources(\n task.sceneName,\n async (count, total) => task.onProgress(count, total)\n );\n // A scene may have been moved last while awaiting resources to be\n // downloaded (see _prioritizeScene).\n this._sceneToLoadQueue.splice(\n this._sceneToLoadQueue.findIndex((element) => element === task),\n 1\n );\n task.onFinish();\n } else {\n this._sceneToLoadQueue.pop();\n }\n }\n this.currentLoadingSceneName = '';\n }\n\n private async _doLoadSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => Promise<void>\n ): Promise<void> {\n const sceneResources = this._sceneResources.get(sceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + sceneName + '\".'\n );\n return;\n }\n let loadedCount = 0;\n await processAndRetryIfNeededWithPromisePool(\n [...sceneResources.values()],\n this._isLoadingInForeground\n ? maxForegroundConcurrency\n : maxBackgroundConcurrency,\n maxAttempt,\n async (resourceName) => {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n return;\n }\n await this._loadResource(resource);\n loadedCount++;\n this.currentSceneLoadingProgress = loadedCount / this._resources.size;\n onProgress && (await onProgress(loadedCount, this._resources.size));\n }\n );\n this._setSceneAssetsLoaded(sceneName);\n }\n\n private async _loadResource(resource: ResourceData): Promise<void> {\n const resourceManager = this._resourceManagersMap.get(resource.kind);\n if (!resourceManager) {\n logger.warn(\n 'Unknown resource kind: \"' +\n resource.kind +\n '\" for: \"' +\n resource.name +\n '\".'\n );\n return;\n }\n await resourceManager.loadResource(resource.name);\n }\n\n /**\n * Load and process a scene that is needed right away.\n *\n * The renderer will show a loading screen while its done.\n */\n async loadAndProcessSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => Promise<void>\n ): Promise<void> {\n if (this.areSceneAssetsReady(sceneName)) {\n return;\n }\n await this.loadSceneResources(sceneName, onProgress);\n\n const sceneResources = this._sceneResources.get(sceneName);\n if (!sceneResources) {\n logger.warn(\n 'Can\\'t load resource for unknown scene: \"' + sceneName + '\".'\n );\n return;\n }\n\n let parsedCount = 0;\n for (const resourceName of sceneResources) {\n const resource = this._resources.get(resourceName);\n if (!resource) {\n logger.warn('Unable to find resource \"' + resourceName + '\".');\n continue;\n }\n await this._processResource(resource);\n parsedCount++;\n onProgress && (await onProgress(parsedCount, sceneResources.length));\n }\n this._setSceneAssetsReady(sceneName);\n }\n\n /**\n * Load a scene resources without parsing them.\n *\n * When another scene resources are loading in background, it waits for\n * all its resources to be loaded before loading resources of the given\n * scene.\n */\n async loadSceneResources(\n sceneName: string,\n onProgress?: (count: number, total: number) => void\n ): Promise<void> {\n this._isLoadingInForeground = true;\n const task = this._prioritizeScene(sceneName);\n return new Promise<void>((resolve, reject) => {\n if (!task) {\n this._isLoadingInForeground = false;\n resolve();\n return;\n }\n task.registerCallback(() => {\n this._isLoadingInForeground = false;\n resolve();\n }, onProgress);\n });\n }\n\n /**\n * Put a given scene at the end of the queue.\n *\n * When the scene that is currently loading in background is done,\n * this scene will be the next to be loaded.\n */\n private _prioritizeScene(sceneName: string): SceneLoadingTask | null {\n const taskIndex = this._sceneToLoadQueue.findIndex(\n (task) => task.sceneName === sceneName\n );\n if (taskIndex < 0) {\n // The scene is already loaded.\n return null;\n }\n const task = this._sceneToLoadQueue[taskIndex];\n this._sceneToLoadQueue.splice(taskIndex, 1);\n this._sceneToLoadQueue.push(task);\n return task;\n }\n\n private async _processResource(resource: ResourceData): Promise<void> {\n const resourceManager = this._resourceManagersMap.get(resource.kind);\n if (!resourceManager) {\n logger.warn(\n 'Unknown resource kind: \"' +\n resource.kind +\n '\" for: \"' +\n resource.name +\n '\".'\n );\n return;\n }\n await resourceManager.processResource(resource.name);\n }\n\n getSceneLoadingProgress(sceneName: string): float {\n return sceneName === this.currentLoadingSceneName\n ? this.currentSceneLoadingProgress\n : this.areSceneAssetsLoaded(sceneName)\n ? 1\n : 0;\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._sceneNamesToLoad.has(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._sceneNamesToMakeReady.has(sceneName);\n }\n\n private _setSceneAssetsLoaded(sceneName: string): void {\n this._sceneNamesToLoad.delete(sceneName);\n }\n\n private _setSceneAssetsReady(sceneName: string): void {\n this._sceneNamesToMakeReady.delete(sceneName);\n }\n\n getResource(resourceName: string): ResourceData | null {\n return this._resources.get(resourceName) || null;\n }\n\n // Helper methods used when resources are loaded from an URL.\n\n /**\n * Complete the given URL with any specific parameter required to access\n * the resource (this can be for example a token needed to access the resource).\n */\n getFullUrl(url: string) {\n const { gdevelopResourceToken } = this._runtimeGame._options;\n if (!gdevelopResourceToken) return url;\n\n if (!checkIfIsGDevelopCloudBucketUrl(url)) return url;\n\n return addSearchParameterToUrl(\n url,\n 'gd_resource_token',\n encodeURIComponent(gdevelopResourceToken)\n );\n }\n\n /**\n * Return true if the specified URL must be loaded with cookies (\"credentials\")\n * sent to grant access to them.\n */\n checkIfCredentialsRequired(url: string) {\n if (this._runtimeGame._options.gdevelopResourceToken) return false;\n\n // Any resource stored on the GDevelop Cloud buckets needs the \"credentials\" of the user,\n // i.e: its gdevelop.io cookie, to be passed.\n // Note that this is only useful during previews.\n if (checkIfIsGDevelopCloudBucketUrl(url)) return true;\n\n // For other resources, use the default way of loading resources (\"anonymous\" or \"same-site\").\n return false;\n }\n\n /**\n * Get the gdjs.SoundManager of the RuntimeGame.\n * @return The sound manager.\n */\n getSoundManager(): gdjs.HowlerSoundManager {\n return this._soundManager;\n }\n\n /**\n * Get the gdjs.ImageManager of the RuntimeGame.\n * @return The image manager.\n */\n getImageManager(): gdjs.PixiImageManager {\n return this._imageManager;\n }\n\n /**\n * Get the gdjs.FontManager of the RuntimeGame.\n * @return The font manager.\n */\n getFontManager(): gdjs.FontFaceObserverFontManager {\n return this._fontManager;\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._bitmapFontManager;\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._jsonManager;\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._model3DManager;\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._spineManager;\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._spineAtlasManager;\n }\n }\n\n type PromiseError<T> = { item: T; error: Error };\n\n type PromisePoolOutput<T, U> = {\n results: Array<U>;\n errors: Array<PromiseError<T>>;\n };\n\n const processWithPromisePool = <T, U>(\n items: Array<T>,\n maxConcurrency: number,\n asyncFunction: (item: T) => Promise<U>\n ): Promise<PromisePoolOutput<T, U>> => {\n const results: Array<U> = [];\n const errors: Array<PromiseError<T>> = [];\n let activePromises = 0;\n let index = 0;\n\n return new Promise((resolve, reject) => {\n const executeNext = () => {\n if (items.length === 0) {\n resolve({ results, errors });\n return;\n }\n while (activePromises < maxConcurrency && index < items.length) {\n const item = items[index++];\n activePromises++;\n\n asyncFunction(item)\n .then((result) => results.push(result))\n .catch((error) => errors.push({ item, error }))\n .finally(() => {\n activePromises--;\n if (index === items.length && activePromises === 0) {\n resolve({ results, errors });\n } else {\n executeNext();\n }\n });\n }\n };\n\n executeNext();\n });\n };\n\n const processAndRetryIfNeededWithPromisePool = async <T, U>(\n items: Array<T>,\n maxConcurrency: number,\n maxAttempt: number,\n asyncFunction: (item: T) => Promise<U>\n ): Promise<PromisePoolOutput<T, U>> => {\n const output = await processWithPromisePool<T, U>(\n items,\n maxConcurrency,\n asyncFunction\n );\n if (output.errors.length !== 0) {\n logger.warn(\"Some assets couldn't be downloaded. Trying again now.\");\n }\n for (\n let attempt = 1;\n attempt < maxAttempt && output.errors.length !== 0;\n attempt++\n ) {\n const retryOutput = await processWithPromisePool<T, U>(\n items,\n maxConcurrency,\n asyncFunction\n );\n output.results.push.apply(output.results, retryOutput.results);\n output.errors = retryOutput.errors;\n }\n return output;\n };\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,kBAEzB,EAA0B,CAC9B,EACA,EACA,IACG,CACH,GAAI,EAAI,WAAW,UAAY,EAAI,WAAW,SAE5C,MAAO,GAGT,KAAM,GAAY,EAAI,QAAQ,OAAS,GAAK,IAAM,IAClD,MAAO,GAAM,EAAY,EAA0B,IAAM,GAGrD,EAAkC,AAAC,GAErC,EAAI,WAAW,2CACf,EAAI,WAAW,8CAIb,EAA2B,GAC3B,EAA2B,EAC3B,EAAa,EAUnB,OAA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