@nice2dev/game-engine 1.3.14 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/accessibility/Accessibility.js +152 -165
- package/dist/cjs/ai/AI.js +292 -294
- package/dist/cjs/ai/BehaviorTree.js +1029 -1113
- package/dist/cjs/ai/StateMachine.js +694 -756
- package/dist/cjs/animation/Animation.js +232 -241
- package/dist/cjs/audio/AudioAdvanced.js +221 -236
- package/dist/cjs/audio/AudioBridge.js +441 -435
- package/dist/cjs/audio/AudioManager.js +242 -259
- package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
- package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
- package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
- package/dist/cjs/core/EventBus.js +51 -56
- package/dist/cjs/core/GameClock.js +62 -66
- package/dist/cjs/core/GameConfig.js +72 -79
- package/dist/cjs/core/GameLoop.js +80 -89
- package/dist/cjs/core/ServiceLocator.js +61 -65
- package/dist/cjs/core/Validation.js +72 -82
- package/dist/cjs/core/math.js +108 -112
- package/dist/cjs/devtools/DevTools.js +542 -563
- package/dist/cjs/devtools/DeveloperExperience.js +521 -559
- package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
- package/dist/cjs/dialogue/DialogueSystem.js +984 -986
- package/dist/cjs/docs/DocGenerator.js +339 -364
- package/dist/cjs/ecs/World.js +355 -371
- package/dist/cjs/editor/AchievementEditor.js +580 -636
- package/dist/cjs/editor/AdvancedEditor.js +184 -191
- package/dist/cjs/editor/AnimationRetargeting.js +696 -741
- package/dist/cjs/editor/AssetBrowser.js +1072 -1160
- package/dist/cjs/editor/AssetManager.js +187 -192
- package/dist/cjs/editor/ConsolePro.js +971 -1061
- package/dist/cjs/editor/CraftingEditor.js +680 -730
- package/dist/cjs/editor/DebugTools.js +187 -185
- package/dist/cjs/editor/DialogueSystem.js +844 -901
- package/dist/cjs/editor/LeaderboardSystem.js +429 -483
- package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
- package/dist/cjs/editor/PrefabSystem.js +772 -838
- package/dist/cjs/editor/ProfilerPanel.js +649 -700
- package/dist/cjs/editor/QuestEditor.js +792 -839
- package/dist/cjs/editor/ReplaySystem.js +585 -634
- package/dist/cjs/editor/SceneEditor.js +176 -200
- package/dist/cjs/editor/ScreenshotMode.js +621 -688
- package/dist/cjs/editor/ShaderGraph.js +1556 -1582
- package/dist/cjs/editor/TimelineEditor.js +715 -778
- package/dist/cjs/editor/UndoRedoPro.js +830 -904
- package/dist/cjs/editor/VRARMode.js +582 -645
- package/dist/cjs/engine/NiceGameEngine.js +141 -164
- package/dist/cjs/engine/SaveSystem.js +441 -495
- package/dist/cjs/enterprise/Enterprise.js +254 -261
- package/dist/cjs/export/BevyExporter.js +927 -967
- package/dist/cjs/export/CocosExporter.js +644 -673
- package/dist/cjs/export/Construct3Exporter.js +783 -794
- package/dist/cjs/export/DefoldExporter.js +1028 -1069
- package/dist/cjs/export/GDevelopExporter.js +674 -708
- package/dist/cjs/export/GameMakerExporter.js +791 -805
- package/dist/cjs/export/GodotExporter.js +1003 -1045
- package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
- package/dist/cjs/export/MonoGameExporter.js +1265 -1293
- package/dist/cjs/export/Pico8Exporter.js +766 -812
- package/dist/cjs/export/PlatformExporter.js +188 -206
- package/dist/cjs/export/RPGMakerExporter.js +860 -879
- package/dist/cjs/export/RobloxExporter.js +883 -919
- package/dist/cjs/export/Solar2DExporter.js +1218 -1256
- package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
- package/dist/cjs/export/Tic80Exporter.js +1210 -1267
- package/dist/cjs/export/UnityExporter.js +1116 -1131
- package/dist/cjs/export/UnrealExporter.js +889 -919
- package/dist/cjs/export/WebExporter.js +931 -970
- package/dist/cjs/export/index.js +42 -65
- package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
- package/dist/cjs/godot-integration/GodotImport.js +929 -1027
- package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
- package/dist/cjs/i18n/I18n.js +860 -900
- package/dist/cjs/i18n/useTranslation.js +84 -89
- package/dist/cjs/import/AsepriteImporter.js +658 -716
- package/dist/cjs/import/DragonBonesImporter.js +437 -461
- package/dist/cjs/import/GameMakerImporter.js +511 -521
- package/dist/cjs/import/GodotSceneImporter.js +788 -822
- package/dist/cjs/import/LDtkImporter.js +436 -454
- package/dist/cjs/import/Live2DImporter.js +497 -518
- package/dist/cjs/import/NdgFormat.js +424 -457
- package/dist/cjs/import/OgmoImporter.js +466 -493
- package/dist/cjs/import/RPGMakerImporter.js +451 -477
- package/dist/cjs/import/SceneImporter.js +378 -423
- package/dist/cjs/import/SpineImporter.js +511 -546
- package/dist/cjs/import/SpriterImporter.js +590 -613
- package/dist/cjs/import/TiledMapImporter.js +811 -846
- package/dist/cjs/import/UnitySceneImporter.js +687 -703
- package/dist/cjs/import/index.js +206 -251
- package/dist/cjs/index.js +275 -278
- package/dist/cjs/input/GamepadNavigation.js +185 -205
- package/dist/cjs/input/InputManager.js +397 -421
- package/dist/cjs/input/useGamepads.js +70 -81
- package/dist/cjs/integration/IconSprite.js +129 -256
- package/dist/cjs/inventory/InventorySystem.js +920 -995
- package/dist/cjs/kids/KidMode.js +997 -1022
- package/dist/cjs/kids/KidTools.js +570 -594
- package/dist/cjs/monetization/Monetization.js +170 -177
- package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
- package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
- package/dist/cjs/native-engine/AnimationSystem.js +731 -806
- package/dist/cjs/native-engine/AssetPipeline.js +454 -515
- package/dist/cjs/native-engine/AudioEngine.js +763 -804
- package/dist/cjs/native-engine/InputSystem.js +1075 -1145
- package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
- package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
- package/dist/cjs/native-engine/RenderingEngine.js +302 -350
- package/dist/cjs/native-engine/SceneGraph.js +769 -808
- package/dist/cjs/network/MultiplayerTransport.js +97 -132
- package/dist/cjs/network/Networking.js +549 -564
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
- package/dist/cjs/pathfinding/Pathfinding.js +245 -263
- package/dist/cjs/performance/AssetStreaming.js +561 -635
- package/dist/cjs/performance/BenchmarkSuite.js +283 -311
- package/dist/cjs/performance/DeltaCompression.js +467 -526
- package/dist/cjs/performance/DeterministicPhysics.js +450 -498
- package/dist/cjs/performance/ECSOptimization.js +644 -695
- package/dist/cjs/performance/GameSaveSystem.js +509 -556
- package/dist/cjs/performance/HotReload.js +447 -500
- package/dist/cjs/performance/InputRecording.js +511 -561
- package/dist/cjs/performance/InterestManagement.js +453 -500
- package/dist/cjs/performance/LocalizationRuntime.js +376 -423
- package/dist/cjs/performance/MemoryManagement.js +410 -470
- package/dist/cjs/performance/ModSupport.js +445 -496
- package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
- package/dist/cjs/performance/NetworkPrediction.js +424 -482
- package/dist/cjs/performance/ObjectPooling.js +569 -617
- package/dist/cjs/performance/Performance.js +174 -190
- package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
- package/dist/cjs/performance/WebGPURenderer.js +656 -683
- package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
- package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
- package/dist/cjs/plugins/PluginSDK.js +432 -466
- package/dist/cjs/plugins/PluginTestKit.js +307 -330
- package/dist/cjs/procedural/Procedural.js +243 -254
- package/dist/cjs/procedural/WorldBuilding.js +297 -314
- package/dist/cjs/quest/QuestSystem.js +975 -932
- package/dist/cjs/release/MobileExport.js +157 -163
- package/dist/cjs/release/Release.js +225 -238
- package/dist/cjs/rendering/Camera2D.js +121 -124
- package/dist/cjs/rendering/Renderer2D.js +321 -335
- package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
- package/dist/cjs/runtime3d/Runtime3D.js +359 -378
- package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
- package/dist/cjs/scene/SceneManager.js +177 -193
- package/dist/cjs/scripting/GraphToAST.js +574 -547
- package/dist/cjs/scripting/LanguageExporter.js +254 -279
- package/dist/cjs/scripting/NodeGraph.js +546 -570
- package/dist/cjs/scripting/ScriptAST.js +31 -39
- package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
- package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
- package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
- package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
- package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
- package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
- package/dist/cjs/social/Social.js +72 -80
- package/dist/cjs/systems/LightingSystem.js +844 -931
- package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
- package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
- package/dist/cjs/systems/TerrainSystem.js +985 -1098
- package/dist/cjs/templates/ActionTemplates.js +296 -309
- package/dist/cjs/templates/FightingTemplate.js +417 -463
- package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
- package/dist/cjs/templates/PartyTemplates.js +190 -202
- package/dist/cjs/templates/PuzzleTemplates.js +245 -261
- package/dist/cjs/templates/RPGTemplates.js +160 -178
- package/dist/cjs/templates/SportsTemplates.js +237 -250
- package/dist/cjs/templates/StrategyTemplates.js +143 -153
- package/dist/cjs/templates/SurvivalTemplate.js +336 -380
- package/dist/cjs/templates/WaveDefense.js +499 -526
- package/dist/cjs/tilemap/Tilemap.js +207 -214
- package/dist/cjs/tutorials/TutorialBranching.js +396 -417
- package/dist/cjs/tutorials/TutorialEngine.js +888 -931
- package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
- package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
- package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
- package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
- package/dist/cjs/ui/GameUI.js +295 -312
- package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
- package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
- package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
- package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
- package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
- package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
- package/dist/cjs/xr/ARVR.js +167 -175
- package/dist/esm/accessibility/Accessibility.js +160 -164
- package/dist/esm/ai/AI.js +310 -293
- package/dist/esm/ai/BehaviorTree.js +1057 -1112
- package/dist/esm/ai/StateMachine.js +709 -755
- package/dist/esm/animation/Animation.js +237 -240
- package/dist/esm/audio/AudioAdvanced.js +239 -235
- package/dist/esm/audio/AudioBridge.js +448 -434
- package/dist/esm/audio/AudioManager.js +243 -258
- package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
- package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
- package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
- package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
- package/dist/esm/core/EventBus.js +52 -55
- package/dist/esm/core/GameClock.js +63 -65
- package/dist/esm/core/GameConfig.js +77 -78
- package/dist/esm/core/GameLoop.js +81 -88
- package/dist/esm/core/ServiceLocator.js +63 -64
- package/dist/esm/core/Validation.js +82 -81
- package/dist/esm/core/math.js +109 -111
- package/dist/esm/devtools/DevTools.js +546 -562
- package/dist/esm/devtools/DeveloperExperience.js +535 -558
- package/dist/esm/devtools/GameplayAnalytics.js +647 -645
- package/dist/esm/dialogue/DialogueSystem.js +998 -985
- package/dist/esm/docs/DocGenerator.js +342 -363
- package/dist/esm/ecs/World.js +358 -370
- package/dist/esm/editor/AchievementEditor.js +584 -635
- package/dist/esm/editor/AdvancedEditor.js +191 -190
- package/dist/esm/editor/AnimationRetargeting.js +700 -740
- package/dist/esm/editor/AssetBrowser.js +1078 -1159
- package/dist/esm/editor/AssetManager.js +188 -191
- package/dist/esm/editor/ConsolePro.js +977 -1060
- package/dist/esm/editor/CraftingEditor.js +684 -729
- package/dist/esm/editor/DebugTools.js +194 -184
- package/dist/esm/editor/DialogueSystem.js +849 -900
- package/dist/esm/editor/LeaderboardSystem.js +433 -482
- package/dist/esm/editor/NiceGameEditor.js +1908 -1200
- package/dist/esm/editor/PrefabSystem.js +777 -837
- package/dist/esm/editor/ProfilerPanel.js +654 -699
- package/dist/esm/editor/QuestEditor.js +795 -838
- package/dist/esm/editor/ReplaySystem.js +591 -633
- package/dist/esm/editor/SceneEditor.js +189 -199
- package/dist/esm/editor/ScreenshotMode.js +628 -687
- package/dist/esm/editor/ShaderGraph.js +1565 -1581
- package/dist/esm/editor/TimelineEditor.js +733 -777
- package/dist/esm/editor/UndoRedoPro.js +835 -903
- package/dist/esm/editor/VRARMode.js +586 -644
- package/dist/esm/engine/NiceGameEngine.js +142 -163
- package/dist/esm/engine/SaveSystem.js +447 -494
- package/dist/esm/enterprise/Enterprise.js +265 -260
- package/dist/esm/export/BevyExporter.js +929 -966
- package/dist/esm/export/CocosExporter.js +646 -672
- package/dist/esm/export/Construct3Exporter.js +785 -793
- package/dist/esm/export/DefoldExporter.js +1030 -1068
- package/dist/esm/export/GDevelopExporter.js +676 -707
- package/dist/esm/export/GameMakerExporter.js +793 -804
- package/dist/esm/export/GodotExporter.js +1004 -1044
- package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
- package/dist/esm/export/MonoGameExporter.js +1267 -1292
- package/dist/esm/export/Pico8Exporter.js +768 -811
- package/dist/esm/export/PlatformExporter.js +193 -205
- package/dist/esm/export/RPGMakerExporter.js +862 -878
- package/dist/esm/export/RobloxExporter.js +885 -918
- package/dist/esm/export/Solar2DExporter.js +1220 -1255
- package/dist/esm/export/ThreeJSExporter.js +1007 -1072
- package/dist/esm/export/Tic80Exporter.js +1212 -1266
- package/dist/esm/export/UnityExporter.js +1117 -1130
- package/dist/esm/export/UnrealExporter.js +891 -918
- package/dist/esm/export/WebExporter.js +933 -969
- package/dist/esm/export/index.js +86 -71
- package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
- package/dist/esm/godot-integration/GodotImport.js +935 -1026
- package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
- package/dist/esm/i18n/I18n.js +871 -899
- package/dist/esm/i18n/useTranslation.js +88 -88
- package/dist/esm/import/AsepriteImporter.js +637 -715
- package/dist/esm/import/DragonBonesImporter.js +417 -460
- package/dist/esm/import/GameMakerImporter.js +491 -520
- package/dist/esm/import/GodotSceneImporter.js +767 -821
- package/dist/esm/import/LDtkImporter.js +415 -453
- package/dist/esm/import/Live2DImporter.js +477 -517
- package/dist/esm/import/NdgFormat.js +410 -456
- package/dist/esm/import/OgmoImporter.js +446 -492
- package/dist/esm/import/RPGMakerImporter.js +431 -476
- package/dist/esm/import/SceneImporter.js +385 -422
- package/dist/esm/import/SpineImporter.js +491 -545
- package/dist/esm/import/SpriterImporter.js +570 -612
- package/dist/esm/import/TiledMapImporter.js +790 -845
- package/dist/esm/import/UnitySceneImporter.js +666 -702
- package/dist/esm/import/index.js +247 -258
- package/dist/esm/index.js +1332 -188
- package/dist/esm/input/GamepadNavigation.js +187 -204
- package/dist/esm/input/InputManager.js +401 -420
- package/dist/esm/input/useGamepads.js +72 -80
- package/dist/esm/integration/IconSprite.js +143 -255
- package/dist/esm/inventory/InventorySystem.js +925 -994
- package/dist/esm/kids/KidMode.js +1003 -1021
- package/dist/esm/kids/KidTools.js +573 -593
- package/dist/esm/monetization/Monetization.js +180 -176
- package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
- package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
- package/dist/esm/native-engine/AnimationSystem.js +735 -805
- package/dist/esm/native-engine/AssetPipeline.js +456 -514
- package/dist/esm/native-engine/AudioEngine.js +765 -803
- package/dist/esm/native-engine/InputSystem.js +1079 -1144
- package/dist/esm/native-engine/NetworkingSystem.js +740 -792
- package/dist/esm/native-engine/PhysicsEngine.js +585 -606
- package/dist/esm/native-engine/RenderingEngine.js +304 -349
- package/dist/esm/native-engine/SceneGraph.js +773 -807
- package/dist/esm/network/MultiplayerTransport.js +99 -131
- package/dist/esm/network/Networking.js +556 -563
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
- package/dist/esm/pathfinding/Pathfinding.js +249 -262
- package/dist/esm/performance/AssetStreaming.js +567 -634
- package/dist/esm/performance/BenchmarkSuite.js +285 -310
- package/dist/esm/performance/DeltaCompression.js +478 -525
- package/dist/esm/performance/DeterministicPhysics.js +479 -497
- package/dist/esm/performance/ECSOptimization.js +653 -694
- package/dist/esm/performance/GameSaveSystem.js +515 -555
- package/dist/esm/performance/HotReload.js +454 -499
- package/dist/esm/performance/InputRecording.js +520 -560
- package/dist/esm/performance/InterestManagement.js +460 -499
- package/dist/esm/performance/LocalizationRuntime.js +382 -422
- package/dist/esm/performance/MemoryManagement.js +415 -469
- package/dist/esm/performance/ModSupport.js +455 -495
- package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
- package/dist/esm/performance/NetworkPrediction.js +436 -481
- package/dist/esm/performance/ObjectPooling.js +582 -616
- package/dist/esm/performance/Performance.js +182 -189
- package/dist/esm/performance/PerformanceAdvanced.js +621 -636
- package/dist/esm/performance/WebGPURenderer.js +660 -682
- package/dist/esm/physics/PhysicsAdvanced.js +359 -378
- package/dist/esm/physics/PhysicsEngine2D.js +393 -426
- package/dist/esm/plugins/PluginSDK.js +435 -465
- package/dist/esm/plugins/PluginTestKit.js +315 -329
- package/dist/esm/procedural/Procedural.js +248 -253
- package/dist/esm/procedural/WorldBuilding.js +316 -313
- package/dist/esm/quest/QuestSystem.js +982 -931
- package/dist/esm/release/MobileExport.js +163 -162
- package/dist/esm/release/Release.js +234 -237
- package/dist/esm/rendering/Camera2D.js +122 -123
- package/dist/esm/rendering/Renderer2D.js +323 -334
- package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
- package/dist/esm/runtime3d/Runtime3D.js +368 -377
- package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
- package/dist/esm/scene/SceneManager.js +178 -192
- package/dist/esm/scripting/GraphToAST.js +576 -546
- package/dist/esm/scripting/LanguageExporter.js +263 -278
- package/dist/esm/scripting/NodeGraph.js +550 -569
- package/dist/esm/scripting/ScriptAST.js +45 -38
- package/dist/esm/scripting/VisualScripting2.js +1025 -1064
- package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
- package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
- package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
- package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
- package/dist/esm/scripting/exporters/RustExporter.js +460 -511
- package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
- package/dist/esm/social/Social.js +77 -79
- package/dist/esm/systems/LightingSystem.js +855 -930
- package/dist/esm/systems/ParticleSystem2.js +1453 -1450
- package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
- package/dist/esm/systems/TerrainSystem.js +996 -1097
- package/dist/esm/templates/ActionTemplates.js +307 -308
- package/dist/esm/templates/FightingTemplate.js +439 -462
- package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
- package/dist/esm/templates/PartyTemplates.js +206 -201
- package/dist/esm/templates/PuzzleTemplates.js +260 -260
- package/dist/esm/templates/RPGTemplates.js +172 -177
- package/dist/esm/templates/SportsTemplates.js +251 -249
- package/dist/esm/templates/StrategyTemplates.js +158 -152
- package/dist/esm/templates/SurvivalTemplate.js +367 -379
- package/dist/esm/templates/WaveDefense.js +501 -525
- package/dist/esm/tilemap/Tilemap.js +209 -213
- package/dist/esm/tutorials/TutorialBranching.js +399 -416
- package/dist/esm/tutorials/TutorialEngine.js +893 -930
- package/dist/esm/tutorials/TutorialOverlay.js +603 -639
- package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
- package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
- package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
- package/dist/esm/ui/GameUI.js +296 -311
- package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
- package/dist/esm/unity-integration/UnityImport.js +1071 -1175
- package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
- package/dist/esm/unreal-integration/UnrealImport.js +395 -411
- package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
- package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
- package/dist/esm/xr/ARVR.js +181 -174
- package/package.json +7 -12
|
@@ -1,638 +1,614 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/* ────────────────────────────────────────────────────────────────
|
|
6
|
-
Kid Tools — LEGENDARY L7
|
|
7
|
-
|
|
8
|
-
• Guided Wizard ("Co chcesz zrobić?")
|
|
9
|
-
• Drag & Drop block editor (no typing required)
|
|
10
|
-
• Kid-friendly project creation flow
|
|
11
|
-
──────────────────────────────────────────────────────────────── */
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const EventBus = require("../core/EventBus.js");
|
|
12
4
|
class GuidedWizard {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.steps.set(step.id, step);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/** Set display locale. */
|
|
27
|
-
setLocale(locale) {
|
|
28
|
-
this.locale = locale;
|
|
5
|
+
constructor(locale = "en") {
|
|
6
|
+
this.events = new EventBus.EventBus();
|
|
7
|
+
this.steps = /* @__PURE__ */ new Map();
|
|
8
|
+
this.choicePath = [];
|
|
9
|
+
this.locale = "en";
|
|
10
|
+
this.locale = locale;
|
|
11
|
+
this.startStepId = "start";
|
|
12
|
+
this.currentStepId = this.startStepId;
|
|
13
|
+
for (const step of WIZARD_STEPS) {
|
|
14
|
+
this.steps.set(step.id, step);
|
|
29
15
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
if (c.maxAge !== undefined && playerAge > c.maxAge) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
});
|
|
16
|
+
}
|
|
17
|
+
/** Set display locale. */
|
|
18
|
+
setLocale(locale) {
|
|
19
|
+
this.locale = locale;
|
|
20
|
+
}
|
|
21
|
+
/** Get the current step. */
|
|
22
|
+
getCurrentStep() {
|
|
23
|
+
return this.steps.get(this.currentStepId);
|
|
24
|
+
}
|
|
25
|
+
/** Get choices for the current step, filtered by age. */
|
|
26
|
+
getChoices(playerAge) {
|
|
27
|
+
const step = this.getCurrentStep();
|
|
28
|
+
if (!step) {
|
|
29
|
+
return [];
|
|
51
30
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return null;
|
|
31
|
+
return step.choices.filter((c) => {
|
|
32
|
+
if (playerAge !== void 0) {
|
|
33
|
+
if (c.minAge !== void 0 && playerAge < c.minAge) {
|
|
34
|
+
return false;
|
|
57
35
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return null;
|
|
36
|
+
if (c.maxAge !== void 0 && playerAge > c.maxAge) {
|
|
37
|
+
return false;
|
|
61
38
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
break;
|
|
72
|
-
case 'template':
|
|
73
|
-
return {
|
|
74
|
-
choicePath: [...this.choicePath],
|
|
75
|
-
finalAction: 'template',
|
|
76
|
-
templateId: choice.templateId,
|
|
77
|
-
};
|
|
78
|
-
case 'tutorial':
|
|
79
|
-
return {
|
|
80
|
-
choicePath: [...this.choicePath],
|
|
81
|
-
finalAction: 'tutorial',
|
|
82
|
-
tutorialId: choice.tutorialId,
|
|
83
|
-
};
|
|
84
|
-
case 'open-project':
|
|
85
|
-
return {
|
|
86
|
-
choicePath: [...this.choicePath],
|
|
87
|
-
finalAction: 'open-project',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return null;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Select a choice. Returns a WizardResult if the wizard is complete, null otherwise. */
|
|
44
|
+
select(choiceId) {
|
|
45
|
+
const step = this.getCurrentStep();
|
|
46
|
+
if (!step) {
|
|
47
|
+
return null;
|
|
91
48
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
49
|
+
const choice = step.choices.find((c) => c.id === choiceId);
|
|
50
|
+
if (!choice) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
this.choicePath.push(choiceId);
|
|
54
|
+
this.events.emit("wizard:choice", { stepId: this.currentStepId, choiceId, choice });
|
|
55
|
+
switch (choice.action) {
|
|
56
|
+
case "wizard-step":
|
|
57
|
+
if (choice.nextStepId) {
|
|
58
|
+
this.currentStepId = choice.nextStepId;
|
|
59
|
+
this.events.emit("wizard:step", { stepId: this.currentStepId });
|
|
60
|
+
return null;
|
|
104
61
|
}
|
|
62
|
+
break;
|
|
63
|
+
case "template":
|
|
64
|
+
return {
|
|
65
|
+
choicePath: [...this.choicePath],
|
|
66
|
+
finalAction: "template",
|
|
67
|
+
templateId: choice.templateId
|
|
68
|
+
};
|
|
69
|
+
case "tutorial":
|
|
70
|
+
return {
|
|
71
|
+
choicePath: [...this.choicePath],
|
|
72
|
+
finalAction: "tutorial",
|
|
73
|
+
tutorialId: choice.tutorialId
|
|
74
|
+
};
|
|
75
|
+
case "open-project":
|
|
76
|
+
return {
|
|
77
|
+
choicePath: [...this.choicePath],
|
|
78
|
+
finalAction: "open-project"
|
|
79
|
+
};
|
|
105
80
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
/** Go back to the previous step. */
|
|
84
|
+
back() {
|
|
85
|
+
if (this.choicePath.length === 0) {
|
|
86
|
+
return;
|
|
110
87
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
88
|
+
this.choicePath.pop();
|
|
89
|
+
this.currentStepId = this.startStepId;
|
|
90
|
+
const saved = [...this.choicePath];
|
|
91
|
+
this.choicePath = [];
|
|
92
|
+
for (const cId of saved) {
|
|
93
|
+
this.select(cId);
|
|
114
94
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
95
|
+
}
|
|
96
|
+
/** Reset wizard to initial state. */
|
|
97
|
+
reset() {
|
|
98
|
+
this.currentStepId = this.startStepId;
|
|
99
|
+
this.choicePath = [];
|
|
100
|
+
}
|
|
101
|
+
/** Register a custom wizard step. */
|
|
102
|
+
registerStep(step) {
|
|
103
|
+
this.steps.set(step.id, step);
|
|
104
|
+
}
|
|
105
|
+
/** Get the localized question for the current step. */
|
|
106
|
+
getQuestion() {
|
|
107
|
+
const step = this.getCurrentStep();
|
|
108
|
+
if (!step) {
|
|
109
|
+
return "";
|
|
122
110
|
}
|
|
111
|
+
return step.question[this.locale] ?? step.question["en"] ?? "";
|
|
112
|
+
}
|
|
123
113
|
}
|
|
124
|
-
/* ── Built-in Wizard Steps ────────────────────────────────────── */
|
|
125
114
|
const WIZARD_STEPS = [
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
choices: [
|
|
134
|
-
{
|
|
135
|
-
id: 'make-game',
|
|
136
|
-
icon: 'gamepad',
|
|
137
|
-
label: { en: 'Make a game!', pl: 'Zrobić grę!', de: 'Ein Spiel machen!' },
|
|
138
|
-
description: {
|
|
139
|
-
en: 'Create your own video game',
|
|
140
|
-
pl: 'Stwórz własną grę wideo',
|
|
141
|
-
de: 'Erstelle dein eigenes Videospiel',
|
|
142
|
-
},
|
|
143
|
-
action: 'wizard-step',
|
|
144
|
-
nextStepId: 'game-type',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: 'learn',
|
|
148
|
-
icon: 'book',
|
|
149
|
-
label: { en: 'Learn something', pl: 'Nauczyć się czegoś', de: 'Etwas lernen' },
|
|
150
|
-
description: {
|
|
151
|
-
en: 'Follow a tutorial step by step',
|
|
152
|
-
pl: 'Podążaj za tutorialem krok po kroku',
|
|
153
|
-
de: 'Folge einem Tutorial Schritt für Schritt',
|
|
154
|
-
},
|
|
155
|
-
action: 'wizard-step',
|
|
156
|
-
nextStepId: 'learn-what',
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
id: 'open-existing',
|
|
160
|
-
icon: 'folder',
|
|
161
|
-
label: { en: 'Open my project', pl: 'Otworzyć mój projekt', de: 'Mein Projekt öffnen' },
|
|
162
|
-
description: {
|
|
163
|
-
en: 'Continue working on a saved project',
|
|
164
|
-
pl: 'Kontynuuj pracę nad zapisanym projektem',
|
|
165
|
-
de: 'An einem gespeicherten Projekt weiterarbeiten',
|
|
166
|
-
},
|
|
167
|
-
action: 'open-project',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
115
|
+
{
|
|
116
|
+
id: "start",
|
|
117
|
+
question: {
|
|
118
|
+
en: "What would you like to do?",
|
|
119
|
+
pl: "Co chcesz zrobić?",
|
|
120
|
+
de: "Was möchtest du machen?"
|
|
170
121
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
122
|
+
choices: [
|
|
123
|
+
{
|
|
124
|
+
id: "make-game",
|
|
125
|
+
icon: "gamepad",
|
|
126
|
+
label: { en: "Make a game!", pl: "Zrobić grę!", de: "Ein Spiel machen!" },
|
|
127
|
+
description: {
|
|
128
|
+
en: "Create your own video game",
|
|
129
|
+
pl: "Stwórz własną grę wideo",
|
|
130
|
+
de: "Erstelle dein eigenes Videospiel"
|
|
177
131
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
action: 'template',
|
|
214
|
-
templateId: 'rpg',
|
|
215
|
-
minAge: 10,
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: 'tower-defense',
|
|
219
|
-
icon: 'building',
|
|
220
|
-
label: { en: 'Tower Defense', pl: 'Tower Defense', de: 'Tower Defense' },
|
|
221
|
-
description: {
|
|
222
|
-
en: 'Build towers, stop enemies!',
|
|
223
|
-
pl: 'Buduj wieże, powstrzymuj wrogów!',
|
|
224
|
-
de: 'Baue Türme, stoppe Feinde!',
|
|
225
|
-
},
|
|
226
|
-
action: 'template',
|
|
227
|
-
templateId: 'tower-defense',
|
|
228
|
-
minAge: 10,
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
id: 'puzzle',
|
|
232
|
-
icon: 'puzzle',
|
|
233
|
-
label: { en: 'Puzzle Game', pl: 'Gra logiczna', de: 'Puzzlespiel' },
|
|
234
|
-
description: {
|
|
235
|
-
en: 'Match colors and solve puzzles!',
|
|
236
|
-
pl: 'Dopasuj kolory i rozwiązuj zagadki!',
|
|
237
|
-
de: 'Kombiniere Farben und löse Rätsel!',
|
|
238
|
-
},
|
|
239
|
-
action: 'template',
|
|
240
|
-
templateId: 'puzzle',
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
id: 'empty',
|
|
244
|
-
icon: 'file',
|
|
245
|
-
label: { en: 'Empty Project', pl: 'Pusty projekt', de: 'Leeres Projekt' },
|
|
246
|
-
description: {
|
|
247
|
-
en: 'Start from scratch!',
|
|
248
|
-
pl: 'Zacznij od zera!',
|
|
249
|
-
de: 'Von Grund auf beginnen!',
|
|
250
|
-
},
|
|
251
|
-
action: 'template',
|
|
252
|
-
templateId: 'empty-project',
|
|
253
|
-
},
|
|
254
|
-
],
|
|
132
|
+
action: "wizard-step",
|
|
133
|
+
nextStepId: "game-type"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "learn",
|
|
137
|
+
icon: "book",
|
|
138
|
+
label: { en: "Learn something", pl: "Nauczyć się czegoś", de: "Etwas lernen" },
|
|
139
|
+
description: {
|
|
140
|
+
en: "Follow a tutorial step by step",
|
|
141
|
+
pl: "Podążaj za tutorialem krok po kroku",
|
|
142
|
+
de: "Folge einem Tutorial Schritt für Schritt"
|
|
143
|
+
},
|
|
144
|
+
action: "wizard-step",
|
|
145
|
+
nextStepId: "learn-what"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "open-existing",
|
|
149
|
+
icon: "folder",
|
|
150
|
+
label: { en: "Open my project", pl: "Otworzyć mój projekt", de: "Mein Projekt öffnen" },
|
|
151
|
+
description: {
|
|
152
|
+
en: "Continue working on a saved project",
|
|
153
|
+
pl: "Kontynuuj pracę nad zapisanym projektem",
|
|
154
|
+
de: "An einem gespeicherten Projekt weiterarbeiten"
|
|
155
|
+
},
|
|
156
|
+
action: "open-project"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "game-type",
|
|
162
|
+
question: {
|
|
163
|
+
en: "What kind of game?",
|
|
164
|
+
pl: "Jaki rodzaj gry?",
|
|
165
|
+
de: "Was für ein Spiel?"
|
|
255
166
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
167
|
+
showBack: true,
|
|
168
|
+
choices: [
|
|
169
|
+
{
|
|
170
|
+
id: "platformer",
|
|
171
|
+
icon: "user",
|
|
172
|
+
label: { en: "Platformer", pl: "Platformówka", de: "Plattformer" },
|
|
173
|
+
description: {
|
|
174
|
+
en: "Jump and run like Mario!",
|
|
175
|
+
pl: "Skacz i biegnij jak Mario!",
|
|
176
|
+
de: "Springe und laufe wie Mario!"
|
|
177
|
+
},
|
|
178
|
+
action: "template",
|
|
179
|
+
templateId: "platformer"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "space-shooter",
|
|
183
|
+
icon: "rocket",
|
|
184
|
+
label: { en: "Space Shooter", pl: "Kosmiczny strzelec", de: "Weltraum-Shooter" },
|
|
185
|
+
description: {
|
|
186
|
+
en: "Shoot aliens in space!",
|
|
187
|
+
pl: "Strzelaj do kosmitów!",
|
|
188
|
+
de: "Schieße Aliens im Weltraum!"
|
|
262
189
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
id: 'learn-platformer',
|
|
327
|
-
icon: 'user',
|
|
328
|
-
label: {
|
|
329
|
-
en: 'Build a Platformer',
|
|
330
|
-
pl: 'Zbuduj platformówkę',
|
|
331
|
-
de: 'Baue einen Plattformer',
|
|
332
|
-
},
|
|
333
|
-
description: {
|
|
334
|
-
en: 'Full game from start to finish',
|
|
335
|
-
pl: 'Cała gra od A do Z',
|
|
336
|
-
de: 'Ein ganzes Spiel von A bis Z',
|
|
337
|
-
},
|
|
338
|
-
action: 'tutorial',
|
|
339
|
-
tutorialId: 'build-a-platformer',
|
|
340
|
-
minAge: 10,
|
|
341
|
-
},
|
|
342
|
-
],
|
|
190
|
+
action: "template",
|
|
191
|
+
templateId: "space-shooter"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: "rpg",
|
|
195
|
+
icon: "target",
|
|
196
|
+
label: { en: "RPG Adventure", pl: "Przygoda RPG", de: "RPG-Abenteuer" },
|
|
197
|
+
description: {
|
|
198
|
+
en: "Heroes, quests and magic!",
|
|
199
|
+
pl: "Bohaterowie, questy i magia!",
|
|
200
|
+
de: "Helden, Quests und Magie!"
|
|
201
|
+
},
|
|
202
|
+
action: "template",
|
|
203
|
+
templateId: "rpg",
|
|
204
|
+
minAge: 10
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: "tower-defense",
|
|
208
|
+
icon: "building",
|
|
209
|
+
label: { en: "Tower Defense", pl: "Tower Defense", de: "Tower Defense" },
|
|
210
|
+
description: {
|
|
211
|
+
en: "Build towers, stop enemies!",
|
|
212
|
+
pl: "Buduj wieże, powstrzymuj wrogów!",
|
|
213
|
+
de: "Baue Türme, stoppe Feinde!"
|
|
214
|
+
},
|
|
215
|
+
action: "template",
|
|
216
|
+
templateId: "tower-defense",
|
|
217
|
+
minAge: 10
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "puzzle",
|
|
221
|
+
icon: "puzzle",
|
|
222
|
+
label: { en: "Puzzle Game", pl: "Gra logiczna", de: "Puzzlespiel" },
|
|
223
|
+
description: {
|
|
224
|
+
en: "Match colors and solve puzzles!",
|
|
225
|
+
pl: "Dopasuj kolory i rozwiązuj zagadki!",
|
|
226
|
+
de: "Kombiniere Farben und löse Rätsel!"
|
|
227
|
+
},
|
|
228
|
+
action: "template",
|
|
229
|
+
templateId: "puzzle"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "empty",
|
|
233
|
+
icon: "file",
|
|
234
|
+
label: { en: "Empty Project", pl: "Pusty projekt", de: "Leeres Projekt" },
|
|
235
|
+
description: {
|
|
236
|
+
en: "Start from scratch!",
|
|
237
|
+
pl: "Zacznij od zera!",
|
|
238
|
+
de: "Von Grund auf beginnen!"
|
|
239
|
+
},
|
|
240
|
+
action: "template",
|
|
241
|
+
templateId: "empty-project"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "learn-what",
|
|
247
|
+
question: {
|
|
248
|
+
en: "What would you like to learn?",
|
|
249
|
+
pl: "Czego chcesz się nauczyć?",
|
|
250
|
+
de: "Was möchtest du lernen?"
|
|
343
251
|
},
|
|
252
|
+
showBack: true,
|
|
253
|
+
choices: [
|
|
254
|
+
{
|
|
255
|
+
id: "learn-basics",
|
|
256
|
+
icon: "star",
|
|
257
|
+
label: { en: "The Basics", pl: "Podstawy", de: "Die Grundlagen" },
|
|
258
|
+
description: {
|
|
259
|
+
en: "My very first game",
|
|
260
|
+
pl: "Moja pierwsza gra",
|
|
261
|
+
de: "Mein allererstes Spiel"
|
|
262
|
+
},
|
|
263
|
+
action: "tutorial",
|
|
264
|
+
tutorialId: "first-game"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "learn-controls",
|
|
268
|
+
icon: "gamepad",
|
|
269
|
+
label: { en: "Controls & Movement", pl: "Sterowanie i ruch", de: "Steuerung & Bewegung" },
|
|
270
|
+
description: {
|
|
271
|
+
en: "Keyboard, mouse, gamepad",
|
|
272
|
+
pl: "Klawiatura, myszka, gamepad",
|
|
273
|
+
de: "Tastatur, Maus, Gamepad"
|
|
274
|
+
},
|
|
275
|
+
action: "tutorial",
|
|
276
|
+
tutorialId: "input-and-movement"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: "learn-physics",
|
|
280
|
+
icon: "zap",
|
|
281
|
+
label: { en: "Collisions & Physics", pl: "Kolizje i fizyka", de: "Kollisionen & Physik" },
|
|
282
|
+
description: {
|
|
283
|
+
en: "Bounce, crash, explode!",
|
|
284
|
+
pl: "Odbijaj, zderzaj, eksploduj!",
|
|
285
|
+
de: "Prallen, krachen, explodieren!"
|
|
286
|
+
},
|
|
287
|
+
action: "tutorial",
|
|
288
|
+
tutorialId: "collisions-and-physics"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "learn-animations",
|
|
292
|
+
icon: "video",
|
|
293
|
+
label: { en: "Animations", pl: "Animacje", de: "Animationen" },
|
|
294
|
+
description: {
|
|
295
|
+
en: "Make things move smoothly",
|
|
296
|
+
pl: "Ruszaj rzeczami płynnie",
|
|
297
|
+
de: "Dinge fließend bewegen"
|
|
298
|
+
},
|
|
299
|
+
action: "tutorial",
|
|
300
|
+
tutorialId: "animations"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
id: "learn-multiplayer",
|
|
304
|
+
icon: "users",
|
|
305
|
+
label: { en: "Play with friends", pl: "Graj ze znajomymi", de: "Mit Freunden spielen" },
|
|
306
|
+
description: {
|
|
307
|
+
en: "Local multiplayer on one screen",
|
|
308
|
+
pl: "Lokalny multiplayer na jednym ekranie",
|
|
309
|
+
de: "Lokaler Mehrspieler auf einem Bildschirm"
|
|
310
|
+
},
|
|
311
|
+
action: "tutorial",
|
|
312
|
+
tutorialId: "local-multiplayer-coop"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "learn-platformer",
|
|
316
|
+
icon: "user",
|
|
317
|
+
label: {
|
|
318
|
+
en: "Build a Platformer",
|
|
319
|
+
pl: "Zbuduj platformówkę",
|
|
320
|
+
de: "Baue einen Plattformer"
|
|
321
|
+
},
|
|
322
|
+
description: {
|
|
323
|
+
en: "Full game from start to finish",
|
|
324
|
+
pl: "Cała gra od A do Z",
|
|
325
|
+
de: "Ein ganzes Spiel von A bis Z"
|
|
326
|
+
},
|
|
327
|
+
action: "tutorial",
|
|
328
|
+
tutorialId: "build-a-platformer",
|
|
329
|
+
minAge: 10
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
}
|
|
344
333
|
];
|
|
345
334
|
class BlockEditor {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
335
|
+
constructor() {
|
|
336
|
+
this.events = new EventBus.EventBus();
|
|
337
|
+
this.state = {
|
|
338
|
+
blocks: /* @__PURE__ */ new Map(),
|
|
339
|
+
dragging: null,
|
|
340
|
+
snapPreview: null,
|
|
341
|
+
selected: null
|
|
342
|
+
};
|
|
343
|
+
this.nextBlockId = 1;
|
|
344
|
+
this.snapDistance = 30;
|
|
345
|
+
}
|
|
346
|
+
/** Add a new block to the canvas at position (x, y). */
|
|
347
|
+
addBlock(blockType, x, y, values) {
|
|
348
|
+
const id = `block_${this.nextBlockId++}`;
|
|
349
|
+
const block = {
|
|
350
|
+
id,
|
|
351
|
+
blockType,
|
|
352
|
+
values: values ?? {},
|
|
353
|
+
x,
|
|
354
|
+
y
|
|
355
|
+
};
|
|
356
|
+
this.state.blocks.set(id, block);
|
|
357
|
+
this.events.emit("block:added", block);
|
|
358
|
+
return id;
|
|
359
|
+
}
|
|
360
|
+
/** Remove a block (and unsnap from neighbors). */
|
|
361
|
+
removeBlock(id) {
|
|
362
|
+
const block = this.state.blocks.get(id);
|
|
363
|
+
if (!block) {
|
|
364
|
+
return;
|
|
370
365
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
if (
|
|
375
|
-
|
|
366
|
+
if (block.parentBlockId) {
|
|
367
|
+
const parent = this.state.blocks.get(block.parentBlockId);
|
|
368
|
+
if (parent) {
|
|
369
|
+
if (parent.nextBlockId === id) {
|
|
370
|
+
parent.nextBlockId = void 0;
|
|
376
371
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const parent = this.state.blocks.get(block.parentBlockId);
|
|
380
|
-
if (parent) {
|
|
381
|
-
if (parent.nextBlockId === id) {
|
|
382
|
-
parent.nextBlockId = undefined;
|
|
383
|
-
}
|
|
384
|
-
if (parent.innerBlockId === id) {
|
|
385
|
-
parent.innerBlockId = undefined;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
372
|
+
if (parent.innerBlockId === id) {
|
|
373
|
+
parent.innerBlockId = void 0;
|
|
388
374
|
}
|
|
389
|
-
|
|
390
|
-
if (block.nextBlockId) {
|
|
391
|
-
const next = this.state.blocks.get(block.nextBlockId);
|
|
392
|
-
if (next) {
|
|
393
|
-
next.parentBlockId = undefined;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
if (block.innerBlockId) {
|
|
397
|
-
const inner = this.state.blocks.get(block.innerBlockId);
|
|
398
|
-
if (inner) {
|
|
399
|
-
inner.parentBlockId = undefined;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
this.state.blocks.delete(id);
|
|
403
|
-
if (this.state.selected === id) {
|
|
404
|
-
this.state.selected = null;
|
|
405
|
-
}
|
|
406
|
-
this.events.emit('block:removed', { id });
|
|
375
|
+
}
|
|
407
376
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const block = this.state.blocks.get(id);
|
|
414
|
-
// Detach from parent
|
|
415
|
-
if (block.parentBlockId) {
|
|
416
|
-
const parent = this.state.blocks.get(block.parentBlockId);
|
|
417
|
-
if (parent) {
|
|
418
|
-
if (parent.nextBlockId === id) {
|
|
419
|
-
parent.nextBlockId = undefined;
|
|
420
|
-
}
|
|
421
|
-
if (parent.innerBlockId === id) {
|
|
422
|
-
parent.innerBlockId = undefined;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
block.parentBlockId = undefined;
|
|
426
|
-
}
|
|
427
|
-
this.state.dragging = id;
|
|
428
|
-
this.events.emit('block:drag-start', { id });
|
|
377
|
+
if (block.nextBlockId) {
|
|
378
|
+
const next = this.state.blocks.get(block.nextBlockId);
|
|
379
|
+
if (next) {
|
|
380
|
+
next.parentBlockId = void 0;
|
|
381
|
+
}
|
|
429
382
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const block = this.state.blocks.get(this.state.dragging);
|
|
436
|
-
if (!block) {
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
block.x = x;
|
|
440
|
-
block.y = y;
|
|
441
|
-
// Check for snap points
|
|
442
|
-
this.state.snapPreview = this.findSnapTarget(block);
|
|
443
|
-
this.events.emit('block:drag-move', {
|
|
444
|
-
id: block.id,
|
|
445
|
-
x,
|
|
446
|
-
y,
|
|
447
|
-
snapPreview: this.state.snapPreview,
|
|
448
|
-
});
|
|
383
|
+
if (block.innerBlockId) {
|
|
384
|
+
const inner = this.state.blocks.get(block.innerBlockId);
|
|
385
|
+
if (inner) {
|
|
386
|
+
inner.parentBlockId = void 0;
|
|
387
|
+
}
|
|
449
388
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
389
|
+
this.state.blocks.delete(id);
|
|
390
|
+
if (this.state.selected === id) {
|
|
391
|
+
this.state.selected = null;
|
|
392
|
+
}
|
|
393
|
+
this.events.emit("block:removed", { id });
|
|
394
|
+
}
|
|
395
|
+
/** Start dragging a block. */
|
|
396
|
+
startDrag(id) {
|
|
397
|
+
if (!this.state.blocks.has(id)) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const block = this.state.blocks.get(id);
|
|
401
|
+
if (block.parentBlockId) {
|
|
402
|
+
const parent = this.state.blocks.get(block.parentBlockId);
|
|
403
|
+
if (parent) {
|
|
404
|
+
if (parent.nextBlockId === id) {
|
|
405
|
+
parent.nextBlockId = void 0;
|
|
459
406
|
}
|
|
460
|
-
if (
|
|
461
|
-
|
|
407
|
+
if (parent.innerBlockId === id) {
|
|
408
|
+
parent.innerBlockId = void 0;
|
|
462
409
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
this.events.emit('block:drag-end', { id: block.id });
|
|
410
|
+
}
|
|
411
|
+
block.parentBlockId = void 0;
|
|
466
412
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
413
|
+
this.state.dragging = id;
|
|
414
|
+
this.events.emit("block:drag-start", { id });
|
|
415
|
+
}
|
|
416
|
+
/** Move the dragged block. */
|
|
417
|
+
moveDrag(x, y) {
|
|
418
|
+
if (!this.state.dragging) {
|
|
419
|
+
return;
|
|
471
420
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
if (!block) {
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
block.values[key] = value;
|
|
479
|
-
this.events.emit('block:value-changed', { id, key, value });
|
|
421
|
+
const block = this.state.blocks.get(this.state.dragging);
|
|
422
|
+
if (!block) {
|
|
423
|
+
return;
|
|
480
424
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
425
|
+
block.x = x;
|
|
426
|
+
block.y = y;
|
|
427
|
+
this.state.snapPreview = this.findSnapTarget(block);
|
|
428
|
+
this.events.emit("block:drag-move", {
|
|
429
|
+
id: block.id,
|
|
430
|
+
x,
|
|
431
|
+
y,
|
|
432
|
+
snapPreview: this.state.snapPreview
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
/** End dragging — snap if near a target. */
|
|
436
|
+
endDrag() {
|
|
437
|
+
if (!this.state.dragging) {
|
|
438
|
+
return;
|
|
484
439
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
while (current) {
|
|
490
|
-
chain.push(current);
|
|
491
|
-
current = current.nextBlockId ? this.state.blocks.get(current.nextBlockId) : undefined;
|
|
492
|
-
}
|
|
493
|
-
return chain;
|
|
440
|
+
const block = this.state.blocks.get(this.state.dragging);
|
|
441
|
+
if (!block) {
|
|
442
|
+
this.state.dragging = null;
|
|
443
|
+
return;
|
|
494
444
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return roots;
|
|
445
|
+
if (this.state.snapPreview) {
|
|
446
|
+
this.snapBlock(
|
|
447
|
+
block.id,
|
|
448
|
+
this.state.snapPreview.targetBlockId,
|
|
449
|
+
this.state.snapPreview.position
|
|
450
|
+
);
|
|
504
451
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return lines.join('\n');
|
|
452
|
+
this.state.dragging = null;
|
|
453
|
+
this.state.snapPreview = null;
|
|
454
|
+
this.events.emit("block:drag-end", { id: block.id });
|
|
455
|
+
}
|
|
456
|
+
/** Select a block for value editing. */
|
|
457
|
+
selectBlock(id) {
|
|
458
|
+
this.state.selected = id;
|
|
459
|
+
this.events.emit("block:selected", { id });
|
|
460
|
+
}
|
|
461
|
+
/** Update a block's value. */
|
|
462
|
+
setBlockValue(id, key, value) {
|
|
463
|
+
const block = this.state.blocks.get(id);
|
|
464
|
+
if (!block) {
|
|
465
|
+
return;
|
|
522
466
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
467
|
+
block.values[key] = value;
|
|
468
|
+
this.events.emit("block:value-changed", { id, key, value });
|
|
469
|
+
}
|
|
470
|
+
/** Get all blocks. */
|
|
471
|
+
getAllBlocks() {
|
|
472
|
+
return Array.from(this.state.blocks.values());
|
|
473
|
+
}
|
|
474
|
+
/** Get the block chain starting from a root block. */
|
|
475
|
+
getChain(startId) {
|
|
476
|
+
const chain = [];
|
|
477
|
+
let current = this.state.blocks.get(startId);
|
|
478
|
+
while (current) {
|
|
479
|
+
chain.push(current);
|
|
480
|
+
current = current.nextBlockId ? this.state.blocks.get(current.nextBlockId) : void 0;
|
|
530
481
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const belowY = block.y - (other.y + BLOCK_HEIGHT);
|
|
541
|
-
if (belowX < this.snapDistance &&
|
|
542
|
-
belowY >= -this.snapDistance &&
|
|
543
|
-
belowY <= this.snapDistance &&
|
|
544
|
-
!other.nextBlockId) {
|
|
545
|
-
return { targetBlockId: id, position: 'below' };
|
|
546
|
-
}
|
|
547
|
-
// Snap inside (for loop/condition blocks)
|
|
548
|
-
const insideX = Math.abs(block.x - (other.x + 20));
|
|
549
|
-
const insideY = block.y - (other.y + BLOCK_HEIGHT - 10);
|
|
550
|
-
if (insideX < this.snapDistance &&
|
|
551
|
-
insideY >= -this.snapDistance &&
|
|
552
|
-
insideY <= this.snapDistance &&
|
|
553
|
-
!other.innerBlockId) {
|
|
554
|
-
return { targetBlockId: id, position: 'inside' };
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
return null;
|
|
482
|
+
return chain;
|
|
483
|
+
}
|
|
484
|
+
/** Get all root blocks (blocks with no parent). */
|
|
485
|
+
getRootBlocks() {
|
|
486
|
+
const roots = [];
|
|
487
|
+
for (const block of this.state.blocks.values()) {
|
|
488
|
+
if (!block.parentBlockId) {
|
|
489
|
+
roots.push(block);
|
|
490
|
+
}
|
|
558
491
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
492
|
+
return roots;
|
|
493
|
+
}
|
|
494
|
+
/** Convert the block program to a simple code representation. */
|
|
495
|
+
toCode(startId, indent = 0) {
|
|
496
|
+
const lines = [];
|
|
497
|
+
const pad = " ".repeat(indent);
|
|
498
|
+
const chain = this.getChain(startId);
|
|
499
|
+
for (const block of chain) {
|
|
500
|
+
const vals = Object.entries(block.values).map(([k, v]) => `${k}=${typeof v === "string" ? `"${v}"` : v}`).join(", ");
|
|
501
|
+
lines.push(`${pad}${block.blockType}(${vals})`);
|
|
502
|
+
if (block.innerBlockId) {
|
|
503
|
+
lines.push(`${pad}{`);
|
|
504
|
+
lines.push(this.toCode(block.innerBlockId, indent + 1));
|
|
505
|
+
lines.push(`${pad}}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return lines.join("\n");
|
|
509
|
+
}
|
|
510
|
+
/** Clear all blocks. */
|
|
511
|
+
clear() {
|
|
512
|
+
this.state.blocks.clear();
|
|
513
|
+
this.state.dragging = null;
|
|
514
|
+
this.state.snapPreview = null;
|
|
515
|
+
this.state.selected = null;
|
|
516
|
+
this.events.emit("block:cleared", {});
|
|
517
|
+
}
|
|
518
|
+
/* ── Internals ──────────────────────────────────────────────── */
|
|
519
|
+
findSnapTarget(block) {
|
|
520
|
+
const BLOCK_HEIGHT = 40;
|
|
521
|
+
for (const [id, other] of this.state.blocks) {
|
|
522
|
+
if (id === block.id) {
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
const belowX = Math.abs(block.x - other.x);
|
|
526
|
+
const belowY = block.y - (other.y + BLOCK_HEIGHT);
|
|
527
|
+
if (belowX < this.snapDistance && belowY >= -this.snapDistance && belowY <= this.snapDistance && !other.nextBlockId) {
|
|
528
|
+
return { targetBlockId: id, position: "below" };
|
|
529
|
+
}
|
|
530
|
+
const insideX = Math.abs(block.x - (other.x + 20));
|
|
531
|
+
const insideY = block.y - (other.y + BLOCK_HEIGHT - 10);
|
|
532
|
+
if (insideX < this.snapDistance && insideY >= -this.snapDistance && insideY <= this.snapDistance && !other.innerBlockId) {
|
|
533
|
+
return { targetBlockId: id, position: "inside" };
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
snapBlock(blockId, targetId, position) {
|
|
539
|
+
const block = this.state.blocks.get(blockId);
|
|
540
|
+
const target = this.state.blocks.get(targetId);
|
|
541
|
+
if (!block || !target) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
const BLOCK_HEIGHT = 40;
|
|
545
|
+
if (position === "below") {
|
|
546
|
+
target.nextBlockId = blockId;
|
|
547
|
+
block.parentBlockId = targetId;
|
|
548
|
+
block.x = target.x;
|
|
549
|
+
block.y = target.y + BLOCK_HEIGHT;
|
|
550
|
+
} else {
|
|
551
|
+
target.innerBlockId = blockId;
|
|
552
|
+
block.parentBlockId = targetId;
|
|
553
|
+
block.x = target.x + 20;
|
|
554
|
+
block.y = target.y + BLOCK_HEIGHT - 10;
|
|
579
555
|
}
|
|
556
|
+
this.events.emit("block:snapped", { blockId, targetId, position });
|
|
557
|
+
}
|
|
580
558
|
}
|
|
581
|
-
/* ── Built-in Block Palettes ──────────────────────────────────── */
|
|
582
559
|
const KID_BLOCK_PALETTES = [
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
560
|
+
{
|
|
561
|
+
category: "motion",
|
|
562
|
+
icon: "move",
|
|
563
|
+
label: { en: "Motion", pl: "Ruch", de: "Bewegung" },
|
|
564
|
+
blocks: [
|
|
565
|
+
"move_right",
|
|
566
|
+
"move_left",
|
|
567
|
+
"move_up",
|
|
568
|
+
"move_down",
|
|
569
|
+
"jump",
|
|
570
|
+
"set_speed",
|
|
571
|
+
"turn_left",
|
|
572
|
+
"turn_right"
|
|
573
|
+
]
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
category: "looks",
|
|
577
|
+
icon: "palette",
|
|
578
|
+
label: { en: "Looks", pl: "Wygląd", de: "Aussehen" },
|
|
579
|
+
blocks: ["set_color", "set_size", "show", "hide", "set_sprite", "say"]
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
category: "events",
|
|
583
|
+
icon: "zap",
|
|
584
|
+
label: { en: "Events", pl: "Zdarzenia", de: "Ereignisse" },
|
|
585
|
+
blocks: ["on_start", "on_click", "on_key_press", "on_collision", "on_timer"]
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
category: "control",
|
|
589
|
+
icon: "refresh",
|
|
590
|
+
label: { en: "Control", pl: "Sterowanie", de: "Steuerung" },
|
|
591
|
+
blocks: ["repeat", "forever", "if_then", "if_then_else", "wait"]
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
category: "sensing",
|
|
595
|
+
icon: "eye",
|
|
596
|
+
label: { en: "Sensing", pl: "Wykrywanie", de: "Erkennung" },
|
|
597
|
+
blocks: ["touching", "key_pressed", "mouse_x", "mouse_y", "distance_to"]
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
category: "operators",
|
|
601
|
+
icon: "plus",
|
|
602
|
+
label: { en: "Math", pl: "Matematyka", de: "Mathematik" },
|
|
603
|
+
blocks: ["add", "subtract", "multiply", "random", "greater_than", "less_than"]
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
category: "variables",
|
|
607
|
+
icon: "box",
|
|
608
|
+
label: { en: "Variables", pl: "Zmienne", de: "Variablen" },
|
|
609
|
+
blocks: ["set_variable", "change_variable", "show_variable"]
|
|
610
|
+
}
|
|
634
611
|
];
|
|
635
|
-
|
|
636
612
|
exports.BlockEditor = BlockEditor;
|
|
637
613
|
exports.GuidedWizard = GuidedWizard;
|
|
638
614
|
exports.KID_BLOCK_PALETTES = KID_BLOCK_PALETTES;
|