@nice2dev/game-engine 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai/BehaviorTree.js +1215 -0
- package/dist/cjs/ai/BehaviorTree.js.map +1 -0
- package/dist/cjs/ai/StateMachine.js +783 -0
- package/dist/cjs/ai/StateMachine.js.map +1 -0
- package/dist/cjs/editor/ShaderGraph.js +1616 -0
- package/dist/cjs/editor/ShaderGraph.js.map +1 -0
- package/dist/cjs/editor/TimelineEditor.js +819 -0
- package/dist/cjs/editor/TimelineEditor.js.map +1 -0
- package/dist/cjs/export/GodotExporter.js +1102 -0
- package/dist/cjs/export/GodotExporter.js.map +1 -0
- package/dist/cjs/export/PlatformExporter.js +236 -0
- package/dist/cjs/export/PlatformExporter.js.map +1 -0
- package/dist/cjs/export/ThreeJSExporter.js +1116 -0
- package/dist/cjs/export/ThreeJSExporter.js.map +1 -0
- package/dist/cjs/export/UnityExporter.js +1193 -0
- package/dist/cjs/export/UnityExporter.js.map +1 -0
- package/dist/cjs/export/WebExporter.js +1036 -0
- package/dist/cjs/export/WebExporter.js.map +1 -0
- package/dist/cjs/export/index.js +58 -0
- package/dist/cjs/export/index.js.map +1 -0
- package/dist/cjs/import/AsepriteImporter.js +761 -0
- package/dist/cjs/import/AsepriteImporter.js.map +1 -0
- package/dist/cjs/import/DragonBonesImporter.js +499 -0
- package/dist/cjs/import/DragonBonesImporter.js.map +1 -0
- package/dist/cjs/import/GameMakerImporter.js +559 -0
- package/dist/cjs/import/GameMakerImporter.js.map +1 -0
- package/dist/cjs/import/GodotSceneImporter.js +824 -0
- package/dist/cjs/import/GodotSceneImporter.js.map +1 -0
- package/dist/cjs/import/LDtkImporter.js +481 -0
- package/dist/cjs/import/LDtkImporter.js.map +1 -0
- package/dist/cjs/import/Live2DImporter.js +553 -0
- package/dist/cjs/import/Live2DImporter.js.map +1 -0
- package/dist/cjs/import/NdgFormat.js +499 -0
- package/dist/cjs/import/NdgFormat.js.map +1 -0
- package/dist/cjs/import/OgmoImporter.js +529 -0
- package/dist/cjs/import/OgmoImporter.js.map +1 -0
- package/dist/cjs/import/RPGMakerImporter.js +520 -0
- package/dist/cjs/import/RPGMakerImporter.js.map +1 -0
- package/dist/cjs/import/SceneImporter.js +449 -0
- package/dist/cjs/import/SceneImporter.js.map +1 -0
- package/dist/cjs/import/SpineImporter.js +583 -0
- package/dist/cjs/import/SpineImporter.js.map +1 -0
- package/dist/cjs/import/SpriterImporter.js +652 -0
- package/dist/cjs/import/SpriterImporter.js.map +1 -0
- package/dist/cjs/import/TiledMapImporter.js +859 -0
- package/dist/cjs/import/TiledMapImporter.js.map +1 -0
- package/dist/cjs/import/UnitySceneImporter.js +732 -0
- package/dist/cjs/import/UnitySceneImporter.js.map +1 -0
- package/dist/cjs/import/index.js +305 -0
- package/dist/cjs/import/index.js.map +1 -0
- package/dist/cjs/index.js +201 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/scripting/GraphToAST.js +567 -0
- package/dist/cjs/scripting/GraphToAST.js.map +1 -0
- package/dist/cjs/scripting/LanguageExporter.js +321 -0
- package/dist/cjs/scripting/LanguageExporter.js.map +1 -0
- package/dist/cjs/scripting/ScriptAST.js +67 -0
- package/dist/cjs/scripting/ScriptAST.js.map +1 -0
- package/dist/cjs/scripting/VisualScripting2.js +1140 -0
- package/dist/cjs/scripting/VisualScripting2.js.map +1 -0
- package/dist/cjs/scripting/exporters/CSharpExporter.js +503 -0
- package/dist/cjs/scripting/exporters/CSharpExporter.js.map +1 -0
- package/dist/cjs/scripting/exporters/GDScriptExporter.js +452 -0
- package/dist/cjs/scripting/exporters/GDScriptExporter.js.map +1 -0
- package/dist/cjs/scripting/exporters/LuaExporter.js +457 -0
- package/dist/cjs/scripting/exporters/LuaExporter.js.map +1 -0
- package/dist/cjs/scripting/exporters/PythonExporter.js +565 -0
- package/dist/cjs/scripting/exporters/PythonExporter.js.map +1 -0
- package/dist/cjs/scripting/exporters/RustExporter.js +525 -0
- package/dist/cjs/scripting/exporters/RustExporter.js.map +1 -0
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js +570 -0
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js.map +1 -0
- package/dist/cjs/systems/ParticleSystem2.js +1478 -0
- package/dist/cjs/systems/ParticleSystem2.js.map +1 -0
- package/dist/esm/ai/BehaviorTree.js +1186 -0
- package/dist/esm/ai/BehaviorTree.js.map +1 -0
- package/dist/esm/ai/StateMachine.js +767 -0
- package/dist/esm/ai/StateMachine.js.map +1 -0
- package/dist/esm/editor/ShaderGraph.js +1606 -0
- package/dist/esm/editor/ShaderGraph.js.map +1 -0
- package/dist/esm/editor/TimelineEditor.js +800 -0
- package/dist/esm/editor/TimelineEditor.js.map +1 -0
- package/dist/esm/export/GodotExporter.js +1100 -0
- package/dist/esm/export/GodotExporter.js.map +1 -0
- package/dist/esm/export/PlatformExporter.js +230 -0
- package/dist/esm/export/PlatformExporter.js.map +1 -0
- package/dist/esm/export/ThreeJSExporter.js +1114 -0
- package/dist/esm/export/ThreeJSExporter.js.map +1 -0
- package/dist/esm/export/UnityExporter.js +1191 -0
- package/dist/esm/export/UnityExporter.js.map +1 -0
- package/dist/esm/export/WebExporter.js +1033 -0
- package/dist/esm/export/WebExporter.js.map +1 -0
- package/dist/esm/export/index.js +44 -0
- package/dist/esm/export/index.js.map +1 -0
- package/dist/esm/import/AsepriteImporter.js +759 -0
- package/dist/esm/import/AsepriteImporter.js.map +1 -0
- package/dist/esm/import/DragonBonesImporter.js +496 -0
- package/dist/esm/import/DragonBonesImporter.js.map +1 -0
- package/dist/esm/import/GameMakerImporter.js +556 -0
- package/dist/esm/import/GameMakerImporter.js.map +1 -0
- package/dist/esm/import/GodotSceneImporter.js +822 -0
- package/dist/esm/import/GodotSceneImporter.js.map +1 -0
- package/dist/esm/import/LDtkImporter.js +479 -0
- package/dist/esm/import/LDtkImporter.js.map +1 -0
- package/dist/esm/import/Live2DImporter.js +550 -0
- package/dist/esm/import/Live2DImporter.js.map +1 -0
- package/dist/esm/import/NdgFormat.js +490 -0
- package/dist/esm/import/NdgFormat.js.map +1 -0
- package/dist/esm/import/OgmoImporter.js +526 -0
- package/dist/esm/import/OgmoImporter.js.map +1 -0
- package/dist/esm/import/RPGMakerImporter.js +517 -0
- package/dist/esm/import/RPGMakerImporter.js.map +1 -0
- package/dist/esm/import/SceneImporter.js +441 -0
- package/dist/esm/import/SceneImporter.js.map +1 -0
- package/dist/esm/import/SpineImporter.js +580 -0
- package/dist/esm/import/SpineImporter.js.map +1 -0
- package/dist/esm/import/SpriterImporter.js +649 -0
- package/dist/esm/import/SpriterImporter.js.map +1 -0
- package/dist/esm/import/TiledMapImporter.js +857 -0
- package/dist/esm/import/TiledMapImporter.js.map +1 -0
- package/dist/esm/import/UnitySceneImporter.js +730 -0
- package/dist/esm/import/UnitySceneImporter.js.map +1 -0
- package/dist/esm/import/index.js +279 -0
- package/dist/esm/import/index.js.map +1 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/scripting/GraphToAST.js +564 -0
- package/dist/esm/scripting/GraphToAST.js.map +1 -0
- package/dist/esm/scripting/LanguageExporter.js +311 -0
- package/dist/esm/scripting/LanguageExporter.js.map +1 -0
- package/dist/esm/scripting/ScriptAST.js +52 -0
- package/dist/esm/scripting/ScriptAST.js.map +1 -0
- package/dist/esm/scripting/VisualScripting2.js +1130 -0
- package/dist/esm/scripting/VisualScripting2.js.map +1 -0
- package/dist/esm/scripting/exporters/CSharpExporter.js +501 -0
- package/dist/esm/scripting/exporters/CSharpExporter.js.map +1 -0
- package/dist/esm/scripting/exporters/GDScriptExporter.js +450 -0
- package/dist/esm/scripting/exporters/GDScriptExporter.js.map +1 -0
- package/dist/esm/scripting/exporters/LuaExporter.js +455 -0
- package/dist/esm/scripting/exporters/LuaExporter.js.map +1 -0
- package/dist/esm/scripting/exporters/PythonExporter.js +563 -0
- package/dist/esm/scripting/exporters/PythonExporter.js.map +1 -0
- package/dist/esm/scripting/exporters/RustExporter.js +523 -0
- package/dist/esm/scripting/exporters/RustExporter.js.map +1 -0
- package/dist/esm/scripting/exporters/TypeScriptExporter.js +568 -0
- package/dist/esm/scripting/exporters/TypeScriptExporter.js.map +1 -0
- package/dist/esm/systems/ParticleSystem2.js +1471 -0
- package/dist/esm/systems/ParticleSystem2.js.map +1 -0
- package/dist/types/ai/BehaviorTree.d.ts +375 -0
- package/dist/types/ai/StateMachine.d.ts +296 -0
- package/dist/types/editor/ShaderGraph.d.ts +207 -0
- package/dist/types/editor/TimelineEditor.d.ts +393 -0
- package/dist/types/export/GodotExporter.d.ts +56 -0
- package/dist/types/export/PlatformExporter.d.ts +201 -0
- package/dist/types/export/ThreeJSExporter.d.ts +40 -0
- package/dist/types/export/UnityExporter.d.ts +69 -0
- package/dist/types/export/WebExporter.d.ts +58 -0
- package/dist/types/export/index.d.ts +19 -0
- package/dist/types/import/AsepriteImporter.d.ts +46 -0
- package/dist/types/import/DragonBonesImporter.d.ts +331 -0
- package/dist/types/import/GameMakerImporter.d.ts +375 -0
- package/dist/types/import/GodotSceneImporter.d.ts +34 -0
- package/dist/types/import/LDtkImporter.d.ts +177 -0
- package/dist/types/import/Live2DImporter.d.ts +237 -0
- package/dist/types/import/NdgFormat.d.ts +387 -0
- package/dist/types/import/OgmoImporter.d.ts +237 -0
- package/dist/types/import/RPGMakerImporter.d.ts +186 -0
- package/dist/types/import/SceneImporter.d.ts +276 -0
- package/dist/types/import/SpineImporter.d.ts +372 -0
- package/dist/types/import/SpriterImporter.d.ts +230 -0
- package/dist/types/import/TiledMapImporter.d.ts +57 -0
- package/dist/types/import/UnitySceneImporter.d.ts +87 -0
- package/dist/types/import/index.d.ts +59 -0
- package/dist/types/index.d.ts +29 -17
- package/dist/types/scripting/GraphToAST.d.ts +55 -0
- package/dist/types/scripting/LanguageExporter.d.ts +136 -0
- package/dist/types/scripting/ScriptAST.d.ts +312 -0
- package/dist/types/scripting/VisualScripting2.d.ts +353 -0
- package/dist/types/scripting/exporters/CSharpExporter.d.ts +44 -0
- package/dist/types/scripting/exporters/GDScriptExporter.d.ts +46 -0
- package/dist/types/scripting/exporters/LuaExporter.d.ts +46 -0
- package/dist/types/scripting/exporters/PythonExporter.d.ts +49 -0
- package/dist/types/scripting/exporters/RustExporter.d.ts +46 -0
- package/dist/types/scripting/exporters/TypeScriptExporter.d.ts +48 -0
- package/dist/types/scripting/exporters/index.d.ts +8 -0
- package/dist/types/scripting/index.d.ts +11 -0
- package/dist/types/systems/ParticleSystem2.d.ts +646 -0
- package/package.json +3 -3
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var PlatformExporter = require('./PlatformExporter.js');
|
|
4
|
+
var GDScriptExporter = require('../scripting/exporters/GDScriptExporter.js');
|
|
5
|
+
var GraphToAST = require('../scripting/GraphToAST.js');
|
|
6
|
+
|
|
7
|
+
/* ────────────────────────────────────────────────────────────────
|
|
8
|
+
Godot Project Exporter
|
|
9
|
+
|
|
10
|
+
Exports Nice2Dev projects to Godot 4.x format.
|
|
11
|
+
Generates .tscn scenes, .tres resources, and .gd scripts.
|
|
12
|
+
──────────────────────────────────────────────────────────────── */
|
|
13
|
+
/* ── Godot Exporter Class ─────────────────────────────────────── */
|
|
14
|
+
class GodotExporter extends PlatformExporter.PlatformExporter {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.platformId = 'godot';
|
|
18
|
+
this.platformInfo = {
|
|
19
|
+
id: 'godot',
|
|
20
|
+
name: 'Godot Engine',
|
|
21
|
+
description: 'Free and open source game engine',
|
|
22
|
+
website: 'https://godotengine.org',
|
|
23
|
+
features: [
|
|
24
|
+
'2d-rendering',
|
|
25
|
+
'3d-rendering',
|
|
26
|
+
'physics-2d',
|
|
27
|
+
'physics-3d',
|
|
28
|
+
'audio',
|
|
29
|
+
'networking',
|
|
30
|
+
'ui-system',
|
|
31
|
+
'visual-scripting',
|
|
32
|
+
'tilemaps',
|
|
33
|
+
'particles',
|
|
34
|
+
'animation',
|
|
35
|
+
],
|
|
36
|
+
supportedAssets: [
|
|
37
|
+
'sprite',
|
|
38
|
+
'tileset',
|
|
39
|
+
'audio',
|
|
40
|
+
'font',
|
|
41
|
+
'script',
|
|
42
|
+
'scene',
|
|
43
|
+
'prefab',
|
|
44
|
+
'material',
|
|
45
|
+
'shader',
|
|
46
|
+
'animation',
|
|
47
|
+
'tilemap',
|
|
48
|
+
'particleSystem',
|
|
49
|
+
],
|
|
50
|
+
exportFormats: ['.tscn', '.tres', '.gd', '.godot'],
|
|
51
|
+
};
|
|
52
|
+
this.gdscriptExporter = new GDScriptExporter.GDScriptExporter();
|
|
53
|
+
this.graphToAST = new GraphToAST.GraphToAST();
|
|
54
|
+
this.resourceIdCounter = 1;
|
|
55
|
+
this.uidCounter = 1;
|
|
56
|
+
}
|
|
57
|
+
async doExport(project, options) {
|
|
58
|
+
const godot = options.platformOptions;
|
|
59
|
+
const projectName = options.projectName || project.name;
|
|
60
|
+
// 1. Generate project.godot
|
|
61
|
+
this.exportProjectFile(project, projectName, godot);
|
|
62
|
+
// 2. Export scripts
|
|
63
|
+
await this.exportScripts(project, options, godot);
|
|
64
|
+
// 3. Export scenes (.tscn)
|
|
65
|
+
await this.exportScenes(project, options);
|
|
66
|
+
// 4. Export prefabs as packed scenes
|
|
67
|
+
await this.exportPrefabs(project, options);
|
|
68
|
+
// 5. Export resources (.tres)
|
|
69
|
+
await this.exportResources(project, options);
|
|
70
|
+
// 6. Export tilemaps and tilesets
|
|
71
|
+
await this.exportTilesets(project, options);
|
|
72
|
+
// 7. Generate autoload singletons
|
|
73
|
+
if ((godot === null || godot === void 0 ? void 0 : godot.includeAutoloads) !== false) {
|
|
74
|
+
this.exportAutoloads(project, projectName);
|
|
75
|
+
}
|
|
76
|
+
// 8. Export default_env.tres
|
|
77
|
+
this.exportEnvironment(project);
|
|
78
|
+
// 9. Generate import files for assets
|
|
79
|
+
this.exportAssetImports(project);
|
|
80
|
+
}
|
|
81
|
+
/* ── Project File ───────────────────────────────────────────── */
|
|
82
|
+
exportProjectFile(project, projectName, godot) {
|
|
83
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84
|
+
const version = (godot === null || godot === void 0 ? void 0 : godot.godotVersion) || '4.2';
|
|
85
|
+
const renderer = (godot === null || godot === void 0 ? void 0 : godot.renderer) || 'forward_plus';
|
|
86
|
+
const content = `; Engine configuration file.
|
|
87
|
+
; It's best edited using the editor UI and not directly,
|
|
88
|
+
; since the parameters that go here are not all obvious.
|
|
89
|
+
;
|
|
90
|
+
; Format:
|
|
91
|
+
; [section] ; section goes between []
|
|
92
|
+
; param=value ; assign values to parameters
|
|
93
|
+
|
|
94
|
+
config_version=5
|
|
95
|
+
|
|
96
|
+
[application]
|
|
97
|
+
|
|
98
|
+
config/name="${project.name}"
|
|
99
|
+
config/description="${project.description || ''}"
|
|
100
|
+
config/version="${project.version}"
|
|
101
|
+
run/main_scene="res://scenes/${this.sanitizeName(((_a = project.scenes[0]) === null || _a === void 0 ? void 0 : _a.name) || 'main')}.tscn"
|
|
102
|
+
config/features=PackedStringArray("${version}", "Forward Plus")
|
|
103
|
+
config/icon="res://icon.svg"
|
|
104
|
+
|
|
105
|
+
[autoload]
|
|
106
|
+
|
|
107
|
+
GameManager="*res://scripts/autoload/GameManager.gd"
|
|
108
|
+
AudioManager="*res://scripts/autoload/AudioManager.gd"
|
|
109
|
+
EventBus="*res://scripts/autoload/EventBus.gd"
|
|
110
|
+
|
|
111
|
+
[display]
|
|
112
|
+
|
|
113
|
+
window/size/viewport_width=${project.settings.resolution.width}
|
|
114
|
+
window/size/viewport_height=${project.settings.resolution.height}
|
|
115
|
+
window/stretch/mode="canvas_items"
|
|
116
|
+
window/stretch/aspect="keep"
|
|
117
|
+
|
|
118
|
+
[input]
|
|
119
|
+
|
|
120
|
+
move_left={
|
|
121
|
+
"deadzone": 0.5,
|
|
122
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)]
|
|
123
|
+
}
|
|
124
|
+
move_right={
|
|
125
|
+
"deadzone": 0.5,
|
|
126
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)]
|
|
127
|
+
}
|
|
128
|
+
move_up={
|
|
129
|
+
"deadzone": 0.5,
|
|
130
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)]
|
|
131
|
+
}
|
|
132
|
+
move_down={
|
|
133
|
+
"deadzone": 0.5,
|
|
134
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)]
|
|
135
|
+
}
|
|
136
|
+
jump={
|
|
137
|
+
"deadzone": 0.5,
|
|
138
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)]
|
|
139
|
+
}
|
|
140
|
+
action={
|
|
141
|
+
"deadzone": 0.5,
|
|
142
|
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)]
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[layer_names]
|
|
146
|
+
|
|
147
|
+
2d_physics/layer_1="player"
|
|
148
|
+
2d_physics/layer_2="enemies"
|
|
149
|
+
2d_physics/layer_3="world"
|
|
150
|
+
2d_physics/layer_4="projectiles"
|
|
151
|
+
2d_physics/layer_5="pickups"
|
|
152
|
+
|
|
153
|
+
[physics]
|
|
154
|
+
|
|
155
|
+
2d/default_gravity=${(_c = (_b = project.settings.physics) === null || _b === void 0 ? void 0 : _b.gravity.y) !== null && _c !== void 0 ? _c : 980}
|
|
156
|
+
2d/default_gravity_vector=Vector2(${(_e = (_d = project.settings.physics) === null || _d === void 0 ? void 0 : _d.gravity.x) !== null && _e !== void 0 ? _e : 0}, 1)
|
|
157
|
+
|
|
158
|
+
[rendering]
|
|
159
|
+
|
|
160
|
+
renderer/rendering_method="${renderer}"
|
|
161
|
+
textures/canvas_textures/default_texture_filter=${((_f = project.settings.rendering) === null || _f === void 0 ? void 0 : _f.pixelArt) ? 0 : 1}
|
|
162
|
+
environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.settings.backgroundColor)})
|
|
163
|
+
`;
|
|
164
|
+
this.addTextFile('project.godot', content);
|
|
165
|
+
}
|
|
166
|
+
/* ── Scripts ────────────────────────────────────────────────── */
|
|
167
|
+
async exportScripts(project, options, godot) {
|
|
168
|
+
for (const script of project.scripts) {
|
|
169
|
+
try {
|
|
170
|
+
const ast = this.graphToAST.convert(script);
|
|
171
|
+
const result = this.gdscriptExporter.export(ast, {
|
|
172
|
+
includeDebugComments: options.debug,
|
|
173
|
+
});
|
|
174
|
+
for (const file of result.files) {
|
|
175
|
+
const path = `scripts/${file.path}`;
|
|
176
|
+
this.addTextFile(path, file.content);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
this.addWarning('SCRIPT_EXPORT_ERROR', `Failed to export script "${script.name}": ${error}`, 'Check visual script for errors');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/* ── Scenes ─────────────────────────────────────────────────── */
|
|
185
|
+
async exportScenes(project, options) {
|
|
186
|
+
for (const scene of project.scenes) {
|
|
187
|
+
const tscn = this.createSceneTSCN(scene, project);
|
|
188
|
+
const path = `scenes/${this.sanitizeName(scene.name)}.tscn`;
|
|
189
|
+
this.addTextFile(path, tscn);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
createSceneTSCN(scene, project) {
|
|
193
|
+
var _a;
|
|
194
|
+
const resources = [];
|
|
195
|
+
const nodes = [];
|
|
196
|
+
// Root node
|
|
197
|
+
const rootNode = {
|
|
198
|
+
name: scene.name,
|
|
199
|
+
type: 'Node2D',
|
|
200
|
+
properties: {},
|
|
201
|
+
children: [],
|
|
202
|
+
};
|
|
203
|
+
// Process entities
|
|
204
|
+
for (const entity of scene.entities) {
|
|
205
|
+
const node = this.createGodotNode(entity, project, resources);
|
|
206
|
+
rootNode.children.push(node);
|
|
207
|
+
}
|
|
208
|
+
// Process tilemaps
|
|
209
|
+
for (const tilemap of (_a = scene.tilemaps) !== null && _a !== void 0 ? _a : []) {
|
|
210
|
+
const tilemapNode = this.createTilemapNode(tilemap, project, resources);
|
|
211
|
+
rootNode.children.push(tilemapNode);
|
|
212
|
+
}
|
|
213
|
+
nodes.push(rootNode);
|
|
214
|
+
return this.serializeTSCN(resources, nodes, scene.name);
|
|
215
|
+
}
|
|
216
|
+
createGodotNode(entity, project, resources) {
|
|
217
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
218
|
+
// Determine node type based on components
|
|
219
|
+
let nodeType = 'Node2D';
|
|
220
|
+
const properties = {};
|
|
221
|
+
// Check for specific node types
|
|
222
|
+
entity.components.some((c) => c.type === 'sprite');
|
|
223
|
+
const hasRigidbody = entity.components.some((c) => c.type === 'rigidbody-2d');
|
|
224
|
+
const hasCharacterBody = entity.components.some((c) => c.type === 'character-body-2d');
|
|
225
|
+
const hasArea = entity.components.some((c) => c.type === 'area-2d');
|
|
226
|
+
const isUI = entity.components.some((c) => c.type.startsWith('ui-'));
|
|
227
|
+
if (hasCharacterBody) {
|
|
228
|
+
nodeType = 'CharacterBody2D';
|
|
229
|
+
}
|
|
230
|
+
else if (hasRigidbody) {
|
|
231
|
+
nodeType = 'RigidBody2D';
|
|
232
|
+
}
|
|
233
|
+
else if (hasArea) {
|
|
234
|
+
nodeType = 'Area2D';
|
|
235
|
+
}
|
|
236
|
+
else if (isUI) {
|
|
237
|
+
nodeType = 'Control';
|
|
238
|
+
}
|
|
239
|
+
// Set transform
|
|
240
|
+
properties.position = `Vector2(${(_b = (_a = entity.position) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0}, ${(_d = (_c = entity.position) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0})`;
|
|
241
|
+
properties.rotation = (_e = entity.rotation) !== null && _e !== void 0 ? _e : 0;
|
|
242
|
+
properties.scale = `Vector2(${(_g = (_f = entity.scale) === null || _f === void 0 ? void 0 : _f.x) !== null && _g !== void 0 ? _g : 1}, ${(_j = (_h = entity.scale) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 1})`;
|
|
243
|
+
const node = {
|
|
244
|
+
name: entity.name,
|
|
245
|
+
type: nodeType,
|
|
246
|
+
properties,
|
|
247
|
+
children: [],
|
|
248
|
+
};
|
|
249
|
+
// Add child nodes for components
|
|
250
|
+
for (const component of entity.components) {
|
|
251
|
+
const childNode = this.createComponentNode(component, entity, project, resources);
|
|
252
|
+
if (childNode) {
|
|
253
|
+
node.children.push(childNode);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Add script if present
|
|
257
|
+
if (entity.scriptId) {
|
|
258
|
+
const script = project.scripts.find((s) => s.id === entity.scriptId);
|
|
259
|
+
if (script) {
|
|
260
|
+
properties.script = `ExtResource("${this.addScriptResource(script, resources)}")`;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Process children entities
|
|
264
|
+
if (entity.children) {
|
|
265
|
+
for (const child of entity.children) {
|
|
266
|
+
const childNode = this.createGodotNode(child, project, resources);
|
|
267
|
+
node.children.push(childNode);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Handle prefab instances
|
|
271
|
+
if (entity.prefabId) {
|
|
272
|
+
const prefab = project.prefabs.find((p) => p.id === entity.prefabId);
|
|
273
|
+
if (prefab) {
|
|
274
|
+
return {
|
|
275
|
+
name: entity.name,
|
|
276
|
+
type: 'Node2D',
|
|
277
|
+
instance: `res://prefabs/${this.sanitizeName(prefab.name)}.tscn`,
|
|
278
|
+
properties: {
|
|
279
|
+
position: `Vector2(${(_l = (_k = entity.position) === null || _k === void 0 ? void 0 : _k.x) !== null && _l !== void 0 ? _l : 0}, ${(_o = (_m = entity.position) === null || _m === void 0 ? void 0 : _m.y) !== null && _o !== void 0 ? _o : 0})`,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return node;
|
|
285
|
+
}
|
|
286
|
+
createComponentNode(component, entity, project, resources) {
|
|
287
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
288
|
+
const props = (_a = component.properties) !== null && _a !== void 0 ? _a : {};
|
|
289
|
+
switch (component.type) {
|
|
290
|
+
case 'sprite': {
|
|
291
|
+
const spriteId = props.spriteId;
|
|
292
|
+
const sprite = project.assets.find((a) => a.id === spriteId);
|
|
293
|
+
const textureResId = sprite ? this.addTextureResource(sprite, resources) : null;
|
|
294
|
+
return {
|
|
295
|
+
name: 'Sprite2D',
|
|
296
|
+
type: 'Sprite2D',
|
|
297
|
+
properties: {
|
|
298
|
+
texture: textureResId ? `ExtResource("${textureResId}")` : 'null',
|
|
299
|
+
flip_h: props.flipX || false,
|
|
300
|
+
flip_v: props.flipY || false,
|
|
301
|
+
modulate: props.color
|
|
302
|
+
? `Color(${this.hexToGodotColor(props.color)})`
|
|
303
|
+
: undefined,
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
case 'animated-sprite': {
|
|
308
|
+
return {
|
|
309
|
+
name: 'AnimatedSprite2D',
|
|
310
|
+
type: 'AnimatedSprite2D',
|
|
311
|
+
properties: {
|
|
312
|
+
autoplay: props.autoplay,
|
|
313
|
+
frame: (_b = props.frame) !== null && _b !== void 0 ? _b : 0,
|
|
314
|
+
speed_scale: (_c = props.speedScale) !== null && _c !== void 0 ? _c : 1,
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
case 'box-collider-2d': {
|
|
319
|
+
const shapeId = this.nextResourceId();
|
|
320
|
+
resources.push({
|
|
321
|
+
type: 'RectangleShape2D',
|
|
322
|
+
id: shapeId,
|
|
323
|
+
properties: {
|
|
324
|
+
size: `Vector2(${(_d = props.width) !== null && _d !== void 0 ? _d : 32}, ${(_e = props.height) !== null && _e !== void 0 ? _e : 32})`,
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
return {
|
|
328
|
+
name: 'CollisionShape2D',
|
|
329
|
+
type: 'CollisionShape2D',
|
|
330
|
+
properties: {
|
|
331
|
+
shape: `SubResource("${shapeId}")`,
|
|
332
|
+
position: `Vector2(${(_f = props.offsetX) !== null && _f !== void 0 ? _f : 0}, ${(_g = props.offsetY) !== null && _g !== void 0 ? _g : 0})`,
|
|
333
|
+
disabled: props.disabled || false,
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
case 'circle-collider-2d': {
|
|
338
|
+
const shapeId = this.nextResourceId();
|
|
339
|
+
resources.push({
|
|
340
|
+
type: 'CircleShape2D',
|
|
341
|
+
id: shapeId,
|
|
342
|
+
properties: {
|
|
343
|
+
radius: (_h = props.radius) !== null && _h !== void 0 ? _h : 16,
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
return {
|
|
347
|
+
name: 'CollisionShape2D',
|
|
348
|
+
type: 'CollisionShape2D',
|
|
349
|
+
properties: {
|
|
350
|
+
shape: `SubResource("${shapeId}")`,
|
|
351
|
+
position: `Vector2(${(_j = props.offsetX) !== null && _j !== void 0 ? _j : 0}, ${(_k = props.offsetY) !== null && _k !== void 0 ? _k : 0})`,
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
case 'capsule-collider-2d': {
|
|
356
|
+
const shapeId = this.nextResourceId();
|
|
357
|
+
resources.push({
|
|
358
|
+
type: 'CapsuleShape2D',
|
|
359
|
+
id: shapeId,
|
|
360
|
+
properties: {
|
|
361
|
+
radius: (_l = props.radius) !== null && _l !== void 0 ? _l : 16,
|
|
362
|
+
height: (_m = props.height) !== null && _m !== void 0 ? _m : 64,
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
return {
|
|
366
|
+
name: 'CollisionShape2D',
|
|
367
|
+
type: 'CollisionShape2D',
|
|
368
|
+
properties: {
|
|
369
|
+
shape: `SubResource("${shapeId}")`,
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
case 'audio-source': {
|
|
374
|
+
const clipId = props.clipId;
|
|
375
|
+
const clip = project.assets.find((a) => a.id === clipId);
|
|
376
|
+
const audioResId = clip ? this.addAudioResource(clip, resources) : null;
|
|
377
|
+
return {
|
|
378
|
+
name: 'AudioStreamPlayer2D',
|
|
379
|
+
type: props.is3D ? 'AudioStreamPlayer3D' : 'AudioStreamPlayer2D',
|
|
380
|
+
properties: {
|
|
381
|
+
stream: audioResId ? `ExtResource("${audioResId}")` : 'null',
|
|
382
|
+
autoplay: props.playOnAwake || false,
|
|
383
|
+
volume_db: props.volume !== undefined ? this.linearToDb(props.volume) : 0,
|
|
384
|
+
pitch_scale: (_o = props.pitch) !== null && _o !== void 0 ? _o : 1,
|
|
385
|
+
max_distance: (_p = props.maxDistance) !== null && _p !== void 0 ? _p : 2000,
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
case 'particle-system': {
|
|
390
|
+
return {
|
|
391
|
+
name: 'GPUParticles2D',
|
|
392
|
+
type: 'GPUParticles2D',
|
|
393
|
+
properties: {
|
|
394
|
+
emitting: props.playOnAwake !== false,
|
|
395
|
+
amount: (_q = props.maxParticles) !== null && _q !== void 0 ? _q : 100,
|
|
396
|
+
lifetime: (_r = props.duration) !== null && _r !== void 0 ? _r : 1,
|
|
397
|
+
one_shot: !props.looping,
|
|
398
|
+
preprocess: props.prewarm ? ((_s = props.duration) !== null && _s !== void 0 ? _s : 1) : 0,
|
|
399
|
+
speed_scale: (_t = props.speedScale) !== null && _t !== void 0 ? _t : 1,
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
case 'camera': {
|
|
404
|
+
return {
|
|
405
|
+
name: 'Camera2D',
|
|
406
|
+
type: 'Camera2D',
|
|
407
|
+
properties: {
|
|
408
|
+
current: props.isMain || false,
|
|
409
|
+
zoom: `Vector2(${(_u = props.zoom) !== null && _u !== void 0 ? _u : 1}, ${(_v = props.zoom) !== null && _v !== void 0 ? _v : 1})`,
|
|
410
|
+
position_smoothing_enabled: props.smoothing || false,
|
|
411
|
+
position_smoothing_speed: (_w = props.smoothingSpeed) !== null && _w !== void 0 ? _w : 5,
|
|
412
|
+
drag_horizontal_enabled: props.dragEnabled || false,
|
|
413
|
+
drag_vertical_enabled: props.dragEnabled || false,
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
case 'ui-text': {
|
|
418
|
+
return {
|
|
419
|
+
name: 'Label',
|
|
420
|
+
type: 'Label',
|
|
421
|
+
properties: {
|
|
422
|
+
text: (_x = props.text) !== null && _x !== void 0 ? _x : '',
|
|
423
|
+
horizontal_alignment: this.getHorizontalAlignment(props.alignment),
|
|
424
|
+
vertical_alignment: this.getVerticalAlignment(props.alignment),
|
|
425
|
+
},
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
case 'ui-button': {
|
|
429
|
+
return {
|
|
430
|
+
name: 'Button',
|
|
431
|
+
type: 'Button',
|
|
432
|
+
properties: {
|
|
433
|
+
text: (_y = props.text) !== null && _y !== void 0 ? _y : 'Button',
|
|
434
|
+
disabled: props.disabled || false,
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
case 'ui-image': {
|
|
439
|
+
const spriteId = props.spriteId;
|
|
440
|
+
const sprite = project.assets.find((a) => a.id === spriteId);
|
|
441
|
+
const textureResId = sprite ? this.addTextureResource(sprite, resources) : null;
|
|
442
|
+
return {
|
|
443
|
+
name: 'TextureRect',
|
|
444
|
+
type: 'TextureRect',
|
|
445
|
+
properties: {
|
|
446
|
+
texture: textureResId ? `ExtResource("${textureResId}")` : 'null',
|
|
447
|
+
expand_mode: 1, // ExpandMode.IGNORE_SIZE
|
|
448
|
+
stretch_mode: 5, // StretchMode.KEEP_ASPECT_CENTERED
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
case 'raycast': {
|
|
453
|
+
return {
|
|
454
|
+
name: 'RayCast2D',
|
|
455
|
+
type: 'RayCast2D',
|
|
456
|
+
properties: {
|
|
457
|
+
enabled: true,
|
|
458
|
+
target_position: `Vector2(${(_0 = (_z = props.direction) === null || _z === void 0 ? void 0 : _z.x) !== null && _0 !== void 0 ? _0 : 0}, ${(_2 = (_1 = props.direction) === null || _1 === void 0 ? void 0 : _1.y) !== null && _2 !== void 0 ? _2 : 50})`,
|
|
459
|
+
collision_mask: (_3 = props.collisionMask) !== null && _3 !== void 0 ? _3 : 1,
|
|
460
|
+
},
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
case 'light-2d': {
|
|
464
|
+
return {
|
|
465
|
+
name: 'PointLight2D',
|
|
466
|
+
type: 'PointLight2D',
|
|
467
|
+
properties: {
|
|
468
|
+
enabled: props.enabled !== false,
|
|
469
|
+
color: props.color
|
|
470
|
+
? `Color(${this.hexToGodotColor(props.color)})`
|
|
471
|
+
: 'Color(1, 1, 1, 1)',
|
|
472
|
+
energy: (_4 = props.intensity) !== null && _4 !== void 0 ? _4 : 1,
|
|
473
|
+
texture_scale: (_5 = props.range) !== null && _5 !== void 0 ? _5 : 1,
|
|
474
|
+
},
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
default:
|
|
478
|
+
// Skip unknown components
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
/* ── Tilemaps ───────────────────────────────────────────────── */
|
|
483
|
+
createTilemapNode(tilemap, project, resources) {
|
|
484
|
+
const tilesetAsset = project.assets.find((a) => a.id === tilemap.tilesetId);
|
|
485
|
+
const tilesetResId = tilesetAsset
|
|
486
|
+
? this.addTileSetResource(tilesetAsset, tilemap, resources)
|
|
487
|
+
: null;
|
|
488
|
+
return {
|
|
489
|
+
name: tilemap.name,
|
|
490
|
+
type: 'TileMap',
|
|
491
|
+
properties: {
|
|
492
|
+
tile_set: tilesetResId ? `ExtResource("${tilesetResId}")` : 'null',
|
|
493
|
+
cell_quadrant_size: tilemap.tileSize,
|
|
494
|
+
},
|
|
495
|
+
children: tilemap.layers.map((layer, index) => ({
|
|
496
|
+
name: layer.name,
|
|
497
|
+
type: 'TileMapLayer',
|
|
498
|
+
properties: {
|
|
499
|
+
visible: layer.visible,
|
|
500
|
+
modulate: `Color(1, 1, 1, ${layer.opacity})`,
|
|
501
|
+
z_index: index,
|
|
502
|
+
},
|
|
503
|
+
})),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
/* ── Prefabs ────────────────────────────────────────────────── */
|
|
507
|
+
async exportPrefabs(project, options) {
|
|
508
|
+
for (const prefab of project.prefabs) {
|
|
509
|
+
const tscn = this.createPrefabTSCN(prefab, project);
|
|
510
|
+
const path = `prefabs/${this.sanitizeName(prefab.name)}.tscn`;
|
|
511
|
+
this.addTextFile(path, tscn);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
createPrefabTSCN(prefab, project) {
|
|
515
|
+
const resources = [];
|
|
516
|
+
const rootNode = this.createGodotNode(prefab.entity, project, resources);
|
|
517
|
+
rootNode.name = prefab.name;
|
|
518
|
+
return this.serializeTSCN(resources, [rootNode], prefab.name);
|
|
519
|
+
}
|
|
520
|
+
/* ── Resources ──────────────────────────────────────────────── */
|
|
521
|
+
async exportResources(project, options) {
|
|
522
|
+
// Export materials as ShaderMaterial resources
|
|
523
|
+
const materials = project.assets.filter((a) => a.type === 'material');
|
|
524
|
+
for (const material of materials) {
|
|
525
|
+
const tres = this.createMaterialTRES(material);
|
|
526
|
+
const path = `resources/materials/${this.sanitizeName(material.name)}.tres`;
|
|
527
|
+
this.addTextFile(path, tres);
|
|
528
|
+
}
|
|
529
|
+
// Export animations as AnimationLibrary
|
|
530
|
+
const animations = project.assets.filter((a) => a.type === 'animation');
|
|
531
|
+
if (animations.length > 0) {
|
|
532
|
+
const animLib = this.createAnimationLibrary(animations);
|
|
533
|
+
this.addTextFile('resources/animations/animation_library.tres', animLib);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
createMaterialTRES(material) {
|
|
537
|
+
var _a, _b;
|
|
538
|
+
const color = (_b = (_a = material.metadata) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : '#ffffff';
|
|
539
|
+
return `[gd_resource type="ShaderMaterial" format=3]
|
|
540
|
+
|
|
541
|
+
[resource]
|
|
542
|
+
shader = null
|
|
543
|
+
shader_parameter/color = Color(${this.hexToGodotColor(color)})
|
|
544
|
+
`;
|
|
545
|
+
}
|
|
546
|
+
createAnimationLibrary(animations) {
|
|
547
|
+
var _a, _b, _c;
|
|
548
|
+
let content = `[gd_resource type="AnimationLibrary" format=3]
|
|
549
|
+
|
|
550
|
+
`;
|
|
551
|
+
for (const anim of animations) {
|
|
552
|
+
const frameRate = (_b = (_a = anim.metadata) === null || _a === void 0 ? void 0 : _a.frameRate) !== null && _b !== void 0 ? _b : 12;
|
|
553
|
+
content += `[sub_resource type="Animation" id="${this.nextResourceId()}"]
|
|
554
|
+
resource_name = "${anim.name}"
|
|
555
|
+
length = ${((_c = anim.metadata) === null || _c === void 0 ? void 0 : _c.length) || 1.0}
|
|
556
|
+
step = ${1 / frameRate}
|
|
557
|
+
|
|
558
|
+
`;
|
|
559
|
+
}
|
|
560
|
+
content += `[resource]
|
|
561
|
+
_data = {
|
|
562
|
+
`;
|
|
563
|
+
for (const anim of animations) {
|
|
564
|
+
content += `"${anim.name}": SubResource("${this.resourceIdCounter - animations.length + animations.indexOf(anim)}"),
|
|
565
|
+
`;
|
|
566
|
+
}
|
|
567
|
+
content += `}`;
|
|
568
|
+
return content;
|
|
569
|
+
}
|
|
570
|
+
/* ── Tilesets ───────────────────────────────────────────────── */
|
|
571
|
+
async exportTilesets(project, options) {
|
|
572
|
+
const tilesets = project.assets.filter((a) => a.type === 'tileset');
|
|
573
|
+
for (const tileset of tilesets) {
|
|
574
|
+
const tres = this.createTileSetTRES(tileset);
|
|
575
|
+
const path = `resources/tilesets/${this.sanitizeName(tileset.name)}.tres`;
|
|
576
|
+
this.addTextFile(path, tres);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
createTileSetTRES(tileset) {
|
|
580
|
+
var _a, _b, _c, _d;
|
|
581
|
+
const tileSize = (_b = (_a = tileset.metadata) === null || _a === void 0 ? void 0 : _a.tileSize) !== null && _b !== void 0 ? _b : 16;
|
|
582
|
+
(_d = (_c = tileset.metadata) === null || _c === void 0 ? void 0 : _c.columns) !== null && _d !== void 0 ? _d : 8;
|
|
583
|
+
return `[gd_resource type="TileSet" load_steps=2 format=3 uid="uid://${this.nextUID()}"]
|
|
584
|
+
|
|
585
|
+
[ext_resource type="Texture2D" path="res://assets/tilesets/${tileset.name}" id="1"]
|
|
586
|
+
|
|
587
|
+
[resource]
|
|
588
|
+
tile_shape = 0
|
|
589
|
+
tile_size = Vector2i(${tileSize}, ${tileSize})
|
|
590
|
+
sources/0/texture = ExtResource("1")
|
|
591
|
+
sources/0/texture_region_size = Vector2i(${tileSize}, ${tileSize})
|
|
592
|
+
`;
|
|
593
|
+
}
|
|
594
|
+
/* ── Autoloads ──────────────────────────────────────────────── */
|
|
595
|
+
exportAutoloads(project, projectName) {
|
|
596
|
+
// GameManager autoload
|
|
597
|
+
const gameManager = `extends Node
|
|
598
|
+
class_name GameManager
|
|
599
|
+
|
|
600
|
+
## Game Manager singleton for Nice2Dev exported project.
|
|
601
|
+
## Handles global game state and entity registry.
|
|
602
|
+
|
|
603
|
+
signal game_started
|
|
604
|
+
signal game_paused
|
|
605
|
+
signal game_resumed
|
|
606
|
+
signal game_over
|
|
607
|
+
|
|
608
|
+
var entities: Dictionary = {}
|
|
609
|
+
var is_paused: bool = false
|
|
610
|
+
var score: int = 0
|
|
611
|
+
var level: int = 1
|
|
612
|
+
|
|
613
|
+
func _ready() -> void:
|
|
614
|
+
process_mode = Node.PROCESS_MODE_ALWAYS
|
|
615
|
+
|
|
616
|
+
func register_entity(id: String, entity: Node) -> void:
|
|
617
|
+
entities[id] = entity
|
|
618
|
+
|
|
619
|
+
func unregister_entity(id: String) -> void:
|
|
620
|
+
entities.erase(id)
|
|
621
|
+
|
|
622
|
+
func get_entity(id: String) -> Node:
|
|
623
|
+
return entities.get(id)
|
|
624
|
+
|
|
625
|
+
func pause_game() -> void:
|
|
626
|
+
if not is_paused:
|
|
627
|
+
is_paused = true
|
|
628
|
+
get_tree().paused = true
|
|
629
|
+
game_paused.emit()
|
|
630
|
+
|
|
631
|
+
func resume_game() -> void:
|
|
632
|
+
if is_paused:
|
|
633
|
+
is_paused = false
|
|
634
|
+
get_tree().paused = false
|
|
635
|
+
game_resumed.emit()
|
|
636
|
+
|
|
637
|
+
func toggle_pause() -> void:
|
|
638
|
+
if is_paused:
|
|
639
|
+
resume_game()
|
|
640
|
+
else:
|
|
641
|
+
pause_game()
|
|
642
|
+
|
|
643
|
+
func start_game() -> void:
|
|
644
|
+
score = 0
|
|
645
|
+
level = 1
|
|
646
|
+
is_paused = false
|
|
647
|
+
get_tree().paused = false
|
|
648
|
+
game_started.emit()
|
|
649
|
+
|
|
650
|
+
func end_game() -> void:
|
|
651
|
+
game_over.emit()
|
|
652
|
+
|
|
653
|
+
func add_score(amount: int) -> void:
|
|
654
|
+
score += amount
|
|
655
|
+
|
|
656
|
+
func next_level() -> void:
|
|
657
|
+
level += 1
|
|
658
|
+
`;
|
|
659
|
+
this.addTextFile('scripts/autoload/GameManager.gd', gameManager);
|
|
660
|
+
// AudioManager autoload
|
|
661
|
+
const audioManager = `extends Node
|
|
662
|
+
class_name AudioManager
|
|
663
|
+
|
|
664
|
+
## Audio Manager singleton for Nice2Dev exported project.
|
|
665
|
+
## Handles music and sound effect playback.
|
|
666
|
+
|
|
667
|
+
var music_player: AudioStreamPlayer
|
|
668
|
+
var sfx_players: Array[AudioStreamPlayer] = []
|
|
669
|
+
var music_volume: float = 1.0
|
|
670
|
+
var sfx_volume: float = 1.0
|
|
671
|
+
var master_volume: float = 1.0
|
|
672
|
+
|
|
673
|
+
const MAX_SFX_PLAYERS = 8
|
|
674
|
+
|
|
675
|
+
func _ready() -> void:
|
|
676
|
+
music_player = AudioStreamPlayer.new()
|
|
677
|
+
music_player.bus = "Music"
|
|
678
|
+
add_child(music_player)
|
|
679
|
+
|
|
680
|
+
for i in MAX_SFX_PLAYERS:
|
|
681
|
+
var player = AudioStreamPlayer.new()
|
|
682
|
+
player.bus = "SFX"
|
|
683
|
+
add_child(player)
|
|
684
|
+
sfx_players.append(player)
|
|
685
|
+
|
|
686
|
+
func play_music(stream: AudioStream, fade_in: float = 0.5) -> void:
|
|
687
|
+
if music_player.playing:
|
|
688
|
+
var tween = create_tween()
|
|
689
|
+
tween.tween_property(music_player, "volume_db", -80.0, fade_in)
|
|
690
|
+
await tween.finished
|
|
691
|
+
|
|
692
|
+
music_player.stream = stream
|
|
693
|
+
music_player.volume_db = linear_to_db(music_volume * master_volume)
|
|
694
|
+
music_player.play()
|
|
695
|
+
|
|
696
|
+
func stop_music(fade_out: float = 0.5) -> void:
|
|
697
|
+
if music_player.playing:
|
|
698
|
+
var tween = create_tween()
|
|
699
|
+
tween.tween_property(music_player, "volume_db", -80.0, fade_out)
|
|
700
|
+
await tween.finished
|
|
701
|
+
music_player.stop()
|
|
702
|
+
|
|
703
|
+
func play_sfx(stream: AudioStream, volume: float = 1.0, pitch: float = 1.0) -> void:
|
|
704
|
+
var player = _get_available_sfx_player()
|
|
705
|
+
if player:
|
|
706
|
+
player.stream = stream
|
|
707
|
+
player.volume_db = linear_to_db(volume * sfx_volume * master_volume)
|
|
708
|
+
player.pitch_scale = pitch
|
|
709
|
+
player.play()
|
|
710
|
+
|
|
711
|
+
func _get_available_sfx_player() -> AudioStreamPlayer:
|
|
712
|
+
for player in sfx_players:
|
|
713
|
+
if not player.playing:
|
|
714
|
+
return player
|
|
715
|
+
return sfx_players[0] # Fallback to first
|
|
716
|
+
|
|
717
|
+
func set_master_volume(volume: float) -> void:
|
|
718
|
+
master_volume = clamp(volume, 0.0, 1.0)
|
|
719
|
+
_update_volumes()
|
|
720
|
+
|
|
721
|
+
func set_music_volume(volume: float) -> void:
|
|
722
|
+
music_volume = clamp(volume, 0.0, 1.0)
|
|
723
|
+
_update_volumes()
|
|
724
|
+
|
|
725
|
+
func set_sfx_volume(volume: float) -> void:
|
|
726
|
+
sfx_volume = clamp(volume, 0.0, 1.0)
|
|
727
|
+
|
|
728
|
+
func _update_volumes() -> void:
|
|
729
|
+
music_player.volume_db = linear_to_db(music_volume * master_volume)
|
|
730
|
+
`;
|
|
731
|
+
this.addTextFile('scripts/autoload/AudioManager.gd', audioManager);
|
|
732
|
+
// EventBus autoload
|
|
733
|
+
const eventBus = `extends Node
|
|
734
|
+
class_name EventBus
|
|
735
|
+
|
|
736
|
+
## Event Bus singleton for Nice2Dev exported project.
|
|
737
|
+
## Provides global event communication between nodes.
|
|
738
|
+
|
|
739
|
+
# Gameplay events
|
|
740
|
+
signal player_spawned(player: Node)
|
|
741
|
+
signal player_died(player: Node)
|
|
742
|
+
signal enemy_spawned(enemy: Node)
|
|
743
|
+
signal enemy_died(enemy: Node)
|
|
744
|
+
signal item_collected(item: Node, collector: Node)
|
|
745
|
+
signal damage_dealt(target: Node, amount: float, source: Node)
|
|
746
|
+
|
|
747
|
+
# UI events
|
|
748
|
+
signal ui_button_pressed(button_id: String)
|
|
749
|
+
signal dialog_started(dialog_id: String)
|
|
750
|
+
signal dialog_ended(dialog_id: String)
|
|
751
|
+
|
|
752
|
+
# Level events
|
|
753
|
+
signal level_started(level_id: String)
|
|
754
|
+
signal level_completed(level_id: String)
|
|
755
|
+
signal checkpoint_reached(checkpoint_id: String)
|
|
756
|
+
|
|
757
|
+
# Custom events dictionary for dynamic events
|
|
758
|
+
var _custom_handlers: Dictionary = {}
|
|
759
|
+
|
|
760
|
+
func emit_custom(event_name: String, data: Variant = null) -> void:
|
|
761
|
+
if _custom_handlers.has(event_name):
|
|
762
|
+
for handler in _custom_handlers[event_name]:
|
|
763
|
+
if is_instance_valid(handler.object):
|
|
764
|
+
handler.object.call(handler.method, data)
|
|
765
|
+
|
|
766
|
+
func subscribe(event_name: String, object: Object, method: String) -> void:
|
|
767
|
+
if not _custom_handlers.has(event_name):
|
|
768
|
+
_custom_handlers[event_name] = []
|
|
769
|
+
_custom_handlers[event_name].append({"object": object, "method": method})
|
|
770
|
+
|
|
771
|
+
func unsubscribe(event_name: String, object: Object, method: String) -> void:
|
|
772
|
+
if _custom_handlers.has(event_name):
|
|
773
|
+
_custom_handlers[event_name] = _custom_handlers[event_name].filter(
|
|
774
|
+
func(h): return h.object != object or h.method != method
|
|
775
|
+
)
|
|
776
|
+
`;
|
|
777
|
+
this.addTextFile('scripts/autoload/EventBus.gd', eventBus);
|
|
778
|
+
}
|
|
779
|
+
/* ── Environment ────────────────────────────────────────────── */
|
|
780
|
+
exportEnvironment(project) {
|
|
781
|
+
const bgColor = this.hexToGodotColor(project.settings.backgroundColor);
|
|
782
|
+
const env = `[gd_resource type="Environment" format=3]
|
|
783
|
+
|
|
784
|
+
[resource]
|
|
785
|
+
background_mode = 1
|
|
786
|
+
background_color = Color(${bgColor})
|
|
787
|
+
`;
|
|
788
|
+
this.addTextFile('resources/default_env.tres', env);
|
|
789
|
+
}
|
|
790
|
+
/* ── Asset Imports ──────────────────────────────────────────── */
|
|
791
|
+
exportAssetImports(project) {
|
|
792
|
+
for (const asset of project.assets) {
|
|
793
|
+
const importFile = this.createImportFile(asset);
|
|
794
|
+
if (importFile) {
|
|
795
|
+
const assetPath = this.getAssetPath(asset);
|
|
796
|
+
this.addTextFile(`${assetPath}.import`, importFile);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
createImportFile(asset) {
|
|
801
|
+
switch (asset.type) {
|
|
802
|
+
case 'sprite':
|
|
803
|
+
return `[remap]
|
|
804
|
+
|
|
805
|
+
importer="texture"
|
|
806
|
+
type="CompressedTexture2D"
|
|
807
|
+
uid="uid://${this.nextUID()}"
|
|
808
|
+
path="res://.godot/imported/${asset.name}.ctex"
|
|
809
|
+
|
|
810
|
+
[deps]
|
|
811
|
+
|
|
812
|
+
source_file="res://assets/sprites/${asset.name}"
|
|
813
|
+
dest_files=["res://.godot/imported/${asset.name}.ctex"]
|
|
814
|
+
|
|
815
|
+
[params]
|
|
816
|
+
|
|
817
|
+
compress/mode=0
|
|
818
|
+
compress/high_quality=false
|
|
819
|
+
compress/lossy_quality=0.7
|
|
820
|
+
compress/hdr_compression=1
|
|
821
|
+
compress/normal_map=0
|
|
822
|
+
compress/channel_pack=0
|
|
823
|
+
mipmaps/generate=false
|
|
824
|
+
mipmaps/limit=-1
|
|
825
|
+
roughness/mode=0
|
|
826
|
+
roughness/src_normal=""
|
|
827
|
+
process/fix_alpha_border=true
|
|
828
|
+
process/premult_alpha=false
|
|
829
|
+
process/normal_map_invert_y=false
|
|
830
|
+
process/hdr_as_srgb=false
|
|
831
|
+
process/hdr_clamp_exposure=false
|
|
832
|
+
process/size_limit=0
|
|
833
|
+
detect_3d/compress_to=1
|
|
834
|
+
`;
|
|
835
|
+
case 'audio':
|
|
836
|
+
return `[remap]
|
|
837
|
+
|
|
838
|
+
importer="wav"
|
|
839
|
+
type="AudioStreamWAV"
|
|
840
|
+
uid="uid://${this.nextUID()}"
|
|
841
|
+
path="res://.godot/imported/${asset.name}.sample"
|
|
842
|
+
|
|
843
|
+
[deps]
|
|
844
|
+
|
|
845
|
+
source_file="res://assets/audio/${asset.name}"
|
|
846
|
+
dest_files=["res://.godot/imported/${asset.name}.sample"]
|
|
847
|
+
|
|
848
|
+
[params]
|
|
849
|
+
|
|
850
|
+
force/8_bit=false
|
|
851
|
+
force/mono=false
|
|
852
|
+
force/max_rate=false
|
|
853
|
+
force/max_rate_hz=44100
|
|
854
|
+
edit/trim=false
|
|
855
|
+
edit/normalize=false
|
|
856
|
+
edit/loop_mode=0
|
|
857
|
+
edit/loop_begin=0
|
|
858
|
+
edit/loop_end=-1
|
|
859
|
+
compress/mode=0
|
|
860
|
+
`;
|
|
861
|
+
case 'font':
|
|
862
|
+
return `[remap]
|
|
863
|
+
|
|
864
|
+
importer="font_data_dynamic"
|
|
865
|
+
type="FontFile"
|
|
866
|
+
uid="uid://${this.nextUID()}"
|
|
867
|
+
path="res://.godot/imported/${asset.name}.fontdata"
|
|
868
|
+
|
|
869
|
+
[deps]
|
|
870
|
+
|
|
871
|
+
source_file="res://assets/fonts/${asset.name}"
|
|
872
|
+
dest_files=["res://.godot/imported/${asset.name}.fontdata"]
|
|
873
|
+
|
|
874
|
+
[params]
|
|
875
|
+
|
|
876
|
+
Rendering=null
|
|
877
|
+
antialiasing=1
|
|
878
|
+
generate_mipmaps=false
|
|
879
|
+
multichannel_signed_distance_field=false
|
|
880
|
+
msdf_pixel_range=8
|
|
881
|
+
msdf_size=48
|
|
882
|
+
allow_system_fallback=true
|
|
883
|
+
force_autohinter=false
|
|
884
|
+
hinting=1
|
|
885
|
+
subpixel_positioning=1
|
|
886
|
+
oversampling=0.0
|
|
887
|
+
Fallbacks=null
|
|
888
|
+
fallbacks=[]
|
|
889
|
+
Compress=null
|
|
890
|
+
compress=true
|
|
891
|
+
preload=[]
|
|
892
|
+
language_support={}
|
|
893
|
+
script_support={}
|
|
894
|
+
opentype_features={}
|
|
895
|
+
`;
|
|
896
|
+
default:
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
getAssetPath(asset) {
|
|
901
|
+
switch (asset.type) {
|
|
902
|
+
case 'sprite':
|
|
903
|
+
return `assets/sprites/${asset.name}`;
|
|
904
|
+
case 'audio':
|
|
905
|
+
return `assets/audio/${asset.name}`;
|
|
906
|
+
case 'font':
|
|
907
|
+
return `assets/fonts/${asset.name}`;
|
|
908
|
+
case 'tileset':
|
|
909
|
+
return `assets/tilesets/${asset.name}`;
|
|
910
|
+
default:
|
|
911
|
+
return `assets/${asset.name}`;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
/* ── Resource Helpers ───────────────────────────────────────── */
|
|
915
|
+
addScriptResource(script, resources) {
|
|
916
|
+
const id = this.nextResourceId().toString();
|
|
917
|
+
resources.push({
|
|
918
|
+
type: 'GDScript',
|
|
919
|
+
id,
|
|
920
|
+
path: `res://scripts/${this.sanitizeName(script.name)}.gd`,
|
|
921
|
+
properties: {},
|
|
922
|
+
});
|
|
923
|
+
return id;
|
|
924
|
+
}
|
|
925
|
+
addTextureResource(asset, resources) {
|
|
926
|
+
const id = this.nextResourceId().toString();
|
|
927
|
+
resources.push({
|
|
928
|
+
type: 'Texture2D',
|
|
929
|
+
id,
|
|
930
|
+
path: `res://assets/sprites/${asset.name}`,
|
|
931
|
+
properties: {},
|
|
932
|
+
});
|
|
933
|
+
return id;
|
|
934
|
+
}
|
|
935
|
+
addAudioResource(asset, resources) {
|
|
936
|
+
const id = this.nextResourceId().toString();
|
|
937
|
+
resources.push({
|
|
938
|
+
type: 'AudioStream',
|
|
939
|
+
id,
|
|
940
|
+
path: `res://assets/audio/${asset.name}`,
|
|
941
|
+
properties: {},
|
|
942
|
+
});
|
|
943
|
+
return id;
|
|
944
|
+
}
|
|
945
|
+
addTileSetResource(asset, tilemap, resources) {
|
|
946
|
+
const id = this.nextResourceId().toString();
|
|
947
|
+
resources.push({
|
|
948
|
+
type: 'TileSet',
|
|
949
|
+
id,
|
|
950
|
+
path: `res://resources/tilesets/${this.sanitizeName(asset.name)}.tres`,
|
|
951
|
+
properties: {},
|
|
952
|
+
});
|
|
953
|
+
return id;
|
|
954
|
+
}
|
|
955
|
+
/* ── TSCN Serialization ─────────────────────────────────────── */
|
|
956
|
+
serializeTSCN(resources, nodes, sceneName) {
|
|
957
|
+
const extResources = resources.filter((r) => r.path);
|
|
958
|
+
const subResources = resources.filter((r) => !r.path);
|
|
959
|
+
const loadSteps = extResources.length + subResources.length + 1;
|
|
960
|
+
let output = `[gd_scene load_steps=${loadSteps} format=3 uid="uid://${this.nextUID()}"]
|
|
961
|
+
|
|
962
|
+
`;
|
|
963
|
+
// External resources
|
|
964
|
+
for (const res of extResources) {
|
|
965
|
+
output += `[ext_resource type="${res.type}" path="${res.path}" id="${res.id}"]\n`;
|
|
966
|
+
}
|
|
967
|
+
if (extResources.length > 0)
|
|
968
|
+
output += '\n';
|
|
969
|
+
// Sub-resources
|
|
970
|
+
for (const res of subResources) {
|
|
971
|
+
output += `[sub_resource type="${res.type}" id="${res.id}"]\n`;
|
|
972
|
+
for (const [key, value] of Object.entries(res.properties)) {
|
|
973
|
+
if (value !== undefined) {
|
|
974
|
+
output += `${key} = ${this.formatValue(value)}\n`;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
output += '\n';
|
|
978
|
+
}
|
|
979
|
+
// Nodes
|
|
980
|
+
output += this.serializeNodes(nodes);
|
|
981
|
+
return output;
|
|
982
|
+
}
|
|
983
|
+
serializeNodes(nodes, parent) {
|
|
984
|
+
let output = '';
|
|
985
|
+
for (const node of nodes) {
|
|
986
|
+
if (node.instance) {
|
|
987
|
+
// Instance of packed scene
|
|
988
|
+
output += `[node name="${node.name}" parent="${parent || '.'}" instance=ExtResource("${node.instance}")]\n`;
|
|
989
|
+
}
|
|
990
|
+
else if (!parent) {
|
|
991
|
+
// Root node
|
|
992
|
+
output += `[node name="${node.name}" type="${node.type}"]\n`;
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
output += `[node name="${node.name}" type="${node.type}" parent="${parent}"]\n`;
|
|
996
|
+
}
|
|
997
|
+
// Node properties
|
|
998
|
+
for (const [key, value] of Object.entries(node.properties)) {
|
|
999
|
+
if (value !== undefined && key !== 'script') {
|
|
1000
|
+
output += `${key} = ${this.formatValue(value)}\n`;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
// Script last
|
|
1004
|
+
if (node.properties.script) {
|
|
1005
|
+
output += `script = ${node.properties.script}\n`;
|
|
1006
|
+
}
|
|
1007
|
+
output += '\n';
|
|
1008
|
+
// Children
|
|
1009
|
+
if (node.children && node.children.length > 0) {
|
|
1010
|
+
const nodePath = parent ? `${parent}/${node.name}` : '.';
|
|
1011
|
+
output += this.serializeNodes(node.children, nodePath);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
return output;
|
|
1015
|
+
}
|
|
1016
|
+
/* ── Utility Methods ────────────────────────────────────────── */
|
|
1017
|
+
formatValue(value) {
|
|
1018
|
+
if (typeof value === 'string') {
|
|
1019
|
+
if (value.startsWith('Vector2(') ||
|
|
1020
|
+
value.startsWith('Vector3(') ||
|
|
1021
|
+
value.startsWith('Color(') ||
|
|
1022
|
+
value.startsWith('ExtResource(') ||
|
|
1023
|
+
value.startsWith('SubResource(')) {
|
|
1024
|
+
return value;
|
|
1025
|
+
}
|
|
1026
|
+
return `"${value}"`;
|
|
1027
|
+
}
|
|
1028
|
+
if (typeof value === 'boolean') {
|
|
1029
|
+
return value ? 'true' : 'false';
|
|
1030
|
+
}
|
|
1031
|
+
if (typeof value === 'number') {
|
|
1032
|
+
return value.toString();
|
|
1033
|
+
}
|
|
1034
|
+
if (value === null) {
|
|
1035
|
+
return 'null';
|
|
1036
|
+
}
|
|
1037
|
+
return String(value);
|
|
1038
|
+
}
|
|
1039
|
+
hexToGodotColor(hex) {
|
|
1040
|
+
const clean = hex.replace('#', '');
|
|
1041
|
+
const r = parseInt(clean.slice(0, 2), 16) / 255;
|
|
1042
|
+
const g = parseInt(clean.slice(2, 4), 16) / 255;
|
|
1043
|
+
const b = parseInt(clean.slice(4, 6), 16) / 255;
|
|
1044
|
+
const a = clean.length > 6 ? parseInt(clean.slice(6, 8), 16) / 255 : 1;
|
|
1045
|
+
return `${r.toFixed(3)}, ${g.toFixed(3)}, ${b.toFixed(3)}, ${a.toFixed(3)}`;
|
|
1046
|
+
}
|
|
1047
|
+
linearToDb(linear) {
|
|
1048
|
+
if (linear <= 0)
|
|
1049
|
+
return -80;
|
|
1050
|
+
return 20 * Math.log10(linear);
|
|
1051
|
+
}
|
|
1052
|
+
sanitizeName(name) {
|
|
1053
|
+
return name.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
1054
|
+
}
|
|
1055
|
+
nextResourceId() {
|
|
1056
|
+
return this.resourceIdCounter++;
|
|
1057
|
+
}
|
|
1058
|
+
nextUID() {
|
|
1059
|
+
return (this.uidCounter++).toString().padStart(12, '0');
|
|
1060
|
+
}
|
|
1061
|
+
getHorizontalAlignment(alignment) {
|
|
1062
|
+
switch (alignment) {
|
|
1063
|
+
case 'left':
|
|
1064
|
+
case 'top-left':
|
|
1065
|
+
case 'bottom-left':
|
|
1066
|
+
return 0;
|
|
1067
|
+
case 'center':
|
|
1068
|
+
case 'top-center':
|
|
1069
|
+
case 'bottom-center':
|
|
1070
|
+
return 1;
|
|
1071
|
+
case 'right':
|
|
1072
|
+
case 'top-right':
|
|
1073
|
+
case 'bottom-right':
|
|
1074
|
+
return 2;
|
|
1075
|
+
default:
|
|
1076
|
+
return 0;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
getVerticalAlignment(alignment) {
|
|
1080
|
+
switch (alignment) {
|
|
1081
|
+
case 'top':
|
|
1082
|
+
case 'top-left':
|
|
1083
|
+
case 'top-center':
|
|
1084
|
+
case 'top-right':
|
|
1085
|
+
return 0;
|
|
1086
|
+
case 'center':
|
|
1087
|
+
case 'left':
|
|
1088
|
+
case 'right':
|
|
1089
|
+
return 1;
|
|
1090
|
+
case 'bottom':
|
|
1091
|
+
case 'bottom-left':
|
|
1092
|
+
case 'bottom-center':
|
|
1093
|
+
case 'bottom-right':
|
|
1094
|
+
return 2;
|
|
1095
|
+
default:
|
|
1096
|
+
return 0;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
exports.GodotExporter = GodotExporter;
|
|
1102
|
+
//# sourceMappingURL=GodotExporter.js.map
|