@nice2dev/game-engine 1.1.10 → 1.2.1
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 +173 -0
- package/dist/cjs/ai/BehaviorTree.js +4 -4
- package/dist/cjs/audio/AudioBridge.js +3 -1
- package/dist/cjs/build-cloud/GodotBuildCloud.js +1 -1
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +1 -1
- package/dist/cjs/core/GameConfig.js +11 -9
- package/dist/cjs/devtools/GameplayAnalytics.js +3 -1
- package/dist/cjs/editor/AnimationRetargeting.js +110 -108
- package/dist/cjs/editor/CraftingEditor.js +2 -2
- package/dist/cjs/editor/NiceGameEditor.js +1 -1
- package/dist/cjs/editor/UndoRedoPro.js +49 -47
- package/dist/cjs/export/BevyExporter.js +1 -1
- package/dist/cjs/export/CocosExporter.js +4 -4
- package/dist/cjs/export/Construct3Exporter.js +4 -4
- package/dist/cjs/export/DefoldExporter.js +4 -4
- package/dist/cjs/export/GDevelopExporter.js +2 -2
- package/dist/cjs/export/GameMakerExporter.js +3 -3
- package/dist/cjs/export/GodotExporter.js +3 -3
- package/dist/cjs/export/MinecraftBedrockExporter.js +2 -2
- package/dist/cjs/export/MonoGameExporter.js +2 -2
- package/dist/cjs/export/Pico8Exporter.js +6 -6
- package/dist/cjs/export/RPGMakerExporter.js +4 -4
- package/dist/cjs/export/RobloxExporter.js +5 -5
- package/dist/cjs/export/Solar2DExporter.js +2 -2
- package/dist/cjs/export/ThreeJSExporter.js +3 -3
- package/dist/cjs/export/Tic80Exporter.js +6 -6
- package/dist/cjs/export/UnityExporter.js +4 -4
- package/dist/cjs/export/UnrealExporter.js +7 -7
- package/dist/cjs/export/WebExporter.js +2 -2
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +4 -4
- package/dist/cjs/i18n/useTranslation.js +1 -1
- package/dist/cjs/import/GodotSceneImporter.js +4 -4
- package/dist/cjs/import/LDtkImporter.js +1 -1
- package/dist/cjs/import/OgmoImporter.js +1 -1
- package/dist/cjs/import/TiledMapImporter.js +1 -1
- package/dist/cjs/input/GamepadNavigation.js +1 -1
- package/dist/cjs/inventory/InventorySystem.js +1 -1
- package/dist/cjs/native-engine/NetworkingSystem.js +1 -1
- package/dist/cjs/rendering/WebGPURenderPipeline.js +41 -30
- package/dist/cjs/unity-integration/UnityImport.js +2 -2
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +4 -4
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +8 -5
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +5 -5
- package/dist/esm/ai/BehaviorTree.js +4 -4
- package/dist/esm/audio/AudioBridge.js +3 -1
- package/dist/esm/build-cloud/GodotBuildCloud.js +1 -1
- package/dist/esm/build-cloud/UnrealBuildCloud.js +1 -1
- package/dist/esm/core/GameConfig.js +11 -9
- package/dist/esm/devtools/GameplayAnalytics.js +3 -1
- package/dist/esm/editor/AnimationRetargeting.js +110 -108
- package/dist/esm/editor/CraftingEditor.js +2 -2
- package/dist/esm/editor/NiceGameEditor.js +2 -2
- package/dist/esm/editor/UndoRedoPro.js +49 -47
- package/dist/esm/export/BevyExporter.js +1 -1
- package/dist/esm/export/CocosExporter.js +4 -4
- package/dist/esm/export/Construct3Exporter.js +4 -4
- package/dist/esm/export/DefoldExporter.js +4 -4
- package/dist/esm/export/GDevelopExporter.js +2 -2
- package/dist/esm/export/GameMakerExporter.js +3 -3
- package/dist/esm/export/GodotExporter.js +3 -3
- package/dist/esm/export/MinecraftBedrockExporter.js +2 -2
- package/dist/esm/export/MonoGameExporter.js +2 -2
- package/dist/esm/export/Pico8Exporter.js +6 -6
- package/dist/esm/export/RPGMakerExporter.js +4 -4
- package/dist/esm/export/RobloxExporter.js +5 -5
- package/dist/esm/export/Solar2DExporter.js +2 -2
- package/dist/esm/export/ThreeJSExporter.js +3 -3
- package/dist/esm/export/Tic80Exporter.js +6 -6
- package/dist/esm/export/UnityExporter.js +4 -4
- package/dist/esm/export/UnrealExporter.js +7 -7
- package/dist/esm/export/WebExporter.js +2 -2
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +5 -5
- package/dist/esm/i18n/useTranslation.js +2 -2
- package/dist/esm/import/GodotSceneImporter.js +4 -4
- package/dist/esm/import/LDtkImporter.js +1 -1
- package/dist/esm/import/OgmoImporter.js +1 -1
- package/dist/esm/import/TiledMapImporter.js +1 -1
- package/dist/esm/input/GamepadNavigation.js +2 -2
- package/dist/esm/inventory/InventorySystem.js +1 -1
- package/dist/esm/native-engine/NetworkingSystem.js +1 -1
- package/dist/esm/rendering/WebGPURenderPipeline.js +41 -30
- package/dist/esm/unity-integration/UnityImport.js +2 -2
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +5 -5
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +9 -6
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +6 -6
- package/dist/types/ai/BehaviorTree.d.ts +4 -4
- package/dist/types/editor/CraftingEditor.d.ts +1 -1
- package/dist/types/godot-integration/components/GodotProjectBrowser.d.ts +3 -1
- package/dist/types/unity-integration/components/UnityAssetStoreBrowser.d.ts +3 -1
- package/dist/types/unity-integration/components/UnityProjectBrowser.d.ts +3 -1
- package/dist/types/unreal-integration/components/UnrealProjectBrowser.d.ts +3 -1
- package/package.json +5 -5
|
@@ -19,114 +19,116 @@
|
|
|
19
19
|
// ============================================================
|
|
20
20
|
// Math Utilities
|
|
21
21
|
// ============================================================
|
|
22
|
-
const MathUtils = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
dot
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
22
|
+
const MathUtils = /* @__PURE__ */ (function () {
|
|
23
|
+
return {
|
|
24
|
+
vector3Zero() {
|
|
25
|
+
return { x: 0, y: 0, z: 0 };
|
|
26
|
+
},
|
|
27
|
+
vector3One() {
|
|
28
|
+
return { x: 1, y: 1, z: 1 };
|
|
29
|
+
},
|
|
30
|
+
quaternionIdentity() {
|
|
31
|
+
return { x: 0, y: 0, z: 0, w: 1 };
|
|
32
|
+
},
|
|
33
|
+
multiplyQuaternion(a, b) {
|
|
34
|
+
return {
|
|
35
|
+
x: a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y,
|
|
36
|
+
y: a.w * b.y - a.x * b.z + a.y * b.w + a.z * b.x,
|
|
37
|
+
z: a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w,
|
|
38
|
+
w: a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
inverseQuaternion(q) {
|
|
42
|
+
const lengthSq = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
|
|
43
|
+
if (lengthSq === 0) {
|
|
44
|
+
return this.quaternionIdentity();
|
|
45
|
+
}
|
|
46
|
+
const inv = 1 / lengthSq;
|
|
47
|
+
return {
|
|
48
|
+
x: -q.x * inv,
|
|
49
|
+
y: -q.y * inv,
|
|
50
|
+
z: -q.z * inv,
|
|
51
|
+
w: q.w * inv,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
slerpQuaternion(a, b, t) {
|
|
55
|
+
let dot = a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
|
56
|
+
// Ensure shortest path
|
|
57
|
+
const bNeg = { ...b };
|
|
58
|
+
if (dot < 0) {
|
|
59
|
+
dot = -dot;
|
|
60
|
+
bNeg.x = -bNeg.x;
|
|
61
|
+
bNeg.y = -bNeg.y;
|
|
62
|
+
bNeg.z = -bNeg.z;
|
|
63
|
+
bNeg.w = -bNeg.w;
|
|
64
|
+
}
|
|
65
|
+
// Linear interpolation for very close quaternions
|
|
66
|
+
if (dot > 0.9995) {
|
|
67
|
+
return this.normalizeQuaternion({
|
|
68
|
+
x: a.x + t * (bNeg.x - a.x),
|
|
69
|
+
y: a.y + t * (bNeg.y - a.y),
|
|
70
|
+
z: a.z + t * (bNeg.z - a.z),
|
|
71
|
+
w: a.w + t * (bNeg.w - a.w),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const theta = Math.acos(dot);
|
|
75
|
+
const sinTheta = Math.sin(theta);
|
|
76
|
+
const wa = Math.sin((1 - t) * theta) / sinTheta;
|
|
77
|
+
const wb = Math.sin(t * theta) / sinTheta;
|
|
78
|
+
return {
|
|
79
|
+
x: wa * a.x + wb * bNeg.x,
|
|
80
|
+
y: wa * a.y + wb * bNeg.y,
|
|
81
|
+
z: wa * a.z + wb * bNeg.z,
|
|
82
|
+
w: wa * a.w + wb * bNeg.w,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
normalizeQuaternion(q) {
|
|
86
|
+
const length = Math.sqrt(q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w);
|
|
87
|
+
if (length === 0) {
|
|
88
|
+
return this.quaternionIdentity();
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
x: q.x / length,
|
|
92
|
+
y: q.y / length,
|
|
93
|
+
z: q.z / length,
|
|
94
|
+
w: q.w / length,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
lerpVector3(a, b, t) {
|
|
98
|
+
return {
|
|
99
|
+
x: a.x + (b.x - a.x) * t,
|
|
100
|
+
y: a.y + (b.y - a.y) * t,
|
|
101
|
+
z: a.z + (b.z - a.z) * t,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
multiplyVector3(v, scalar) {
|
|
105
|
+
return { x: v.x * scalar, y: v.y * scalar, z: v.z * scalar };
|
|
106
|
+
},
|
|
107
|
+
addVector3(a, b) {
|
|
108
|
+
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
109
|
+
},
|
|
110
|
+
mirrorVector3X(v) {
|
|
111
|
+
return { x: -v.x, y: v.y, z: v.z };
|
|
112
|
+
},
|
|
113
|
+
mirrorQuaternionX(q) {
|
|
114
|
+
return { x: q.x, y: -q.y, z: -q.z, w: q.w };
|
|
115
|
+
},
|
|
116
|
+
eulerToQuaternion(euler) {
|
|
117
|
+
const c1 = Math.cos(euler.x / 2);
|
|
118
|
+
const c2 = Math.cos(euler.y / 2);
|
|
119
|
+
const c3 = Math.cos(euler.z / 2);
|
|
120
|
+
const s1 = Math.sin(euler.x / 2);
|
|
121
|
+
const s2 = Math.sin(euler.y / 2);
|
|
122
|
+
const s3 = Math.sin(euler.z / 2);
|
|
123
|
+
return {
|
|
124
|
+
x: s1 * c2 * c3 + c1 * s2 * s3,
|
|
125
|
+
y: c1 * s2 * c3 - s1 * c2 * s3,
|
|
126
|
+
z: c1 * c2 * s3 + s1 * s2 * c3,
|
|
127
|
+
w: c1 * c2 * c3 - s1 * s2 * s3,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
})();
|
|
130
132
|
// ============================================================
|
|
131
133
|
// Animation Retargeting System
|
|
132
134
|
// ============================================================
|
|
@@ -415,7 +415,7 @@ class CraftingEditor {
|
|
|
415
415
|
this.activeProgress.delete(progressId);
|
|
416
416
|
this.onCraftingCompleted?.(recipe, outputs, quality);
|
|
417
417
|
}
|
|
418
|
-
determineQuality(recipe,
|
|
418
|
+
determineQuality(recipe, _playerId) {
|
|
419
419
|
const qualities = [
|
|
420
420
|
'poor',
|
|
421
421
|
'normal',
|
|
@@ -533,7 +533,7 @@ class CraftingEditor {
|
|
|
533
533
|
return this.discoveredRecipes.has(recipeId);
|
|
534
534
|
}
|
|
535
535
|
// ─── Salvage ───────────────────────────────────────────
|
|
536
|
-
canSalvage(itemId,
|
|
536
|
+
canSalvage(itemId, _playerId) {
|
|
537
537
|
const rule = this.salvageRules.get(itemId);
|
|
538
538
|
if (!rule) {
|
|
539
539
|
return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { NiceTutorialButton, resolveTutorial, NiceIcon } from '@nice2dev/ui';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useReducer, useRef, useState, useCallback, useMemo, useContext, useEffect, createContext } from 'react';
|
|
4
4
|
import { EventBus } from '../core/EventBus.js';
|
|
5
5
|
import { World } from '../ecs/World.js';
|
|
6
6
|
import { useTranslation } from '../i18n/useTranslation.js';
|
|
@@ -119,7 +119,7 @@ function editorReducer(state, action) {
|
|
|
119
119
|
return state;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
const EditorContext = createContext(null);
|
|
122
|
+
const EditorContext = /* @__PURE__ */ createContext(null);
|
|
123
123
|
function useEditor() {
|
|
124
124
|
const ctx = useContext(EditorContext);
|
|
125
125
|
if (!ctx) {
|
|
@@ -836,59 +836,61 @@ class UndoRedoManager {
|
|
|
836
836
|
// ============================================================
|
|
837
837
|
// Common Action Executors
|
|
838
838
|
// ============================================================
|
|
839
|
-
const CommonExecutors = {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
data
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
data
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
arrayPush: {
|
|
855
|
-
execute(data) {
|
|
856
|
-
data.array.push(data.value);
|
|
857
|
-
},
|
|
858
|
-
undo(data) {
|
|
859
|
-
data.array.pop();
|
|
839
|
+
const CommonExecutors = /* @__PURE__ */ (function () {
|
|
840
|
+
return {
|
|
841
|
+
setProperty: {
|
|
842
|
+
execute(data) {
|
|
843
|
+
data.target[data.property] = data.value;
|
|
844
|
+
},
|
|
845
|
+
undo(data) {
|
|
846
|
+
data.target[data.property] = data.oldValue;
|
|
847
|
+
},
|
|
848
|
+
merge(oldData, newData) {
|
|
849
|
+
if (oldData.property !== newData.property) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
return { ...oldData, value: newData.value };
|
|
853
|
+
},
|
|
860
854
|
},
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
855
|
+
arrayPush: {
|
|
856
|
+
execute(data) {
|
|
857
|
+
data.array.push(data.value);
|
|
858
|
+
},
|
|
859
|
+
undo(data) {
|
|
860
|
+
data.array.pop();
|
|
861
|
+
},
|
|
865
862
|
},
|
|
866
|
-
|
|
867
|
-
|
|
863
|
+
arrayRemove: {
|
|
864
|
+
execute(data) {
|
|
865
|
+
data.array.splice(data.index, 1);
|
|
866
|
+
},
|
|
867
|
+
undo(data) {
|
|
868
|
+
data.array.splice(data.index, 0, data.value);
|
|
869
|
+
},
|
|
868
870
|
},
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
871
|
+
mapSet: {
|
|
872
|
+
execute(data) {
|
|
873
|
+
data.map.set(data.key, data.value);
|
|
874
|
+
},
|
|
875
|
+
undo(data) {
|
|
876
|
+
if (data.hadValue) {
|
|
877
|
+
data.map.set(data.key, data.oldValue);
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
data.map.delete(data.key);
|
|
881
|
+
}
|
|
882
|
+
},
|
|
873
883
|
},
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
data.map.set(data.key, data.oldValue);
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
884
|
+
mapDelete: {
|
|
885
|
+
execute(data) {
|
|
879
886
|
data.map.delete(data.key);
|
|
880
|
-
}
|
|
887
|
+
},
|
|
888
|
+
undo(data) {
|
|
889
|
+
data.map.set(data.key, data.value);
|
|
890
|
+
},
|
|
881
891
|
},
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
execute(data) {
|
|
885
|
-
data.map.delete(data.key);
|
|
886
|
-
},
|
|
887
|
-
undo(data) {
|
|
888
|
-
data.map.set(data.key, data.value);
|
|
889
|
-
},
|
|
890
|
-
},
|
|
891
|
-
};
|
|
892
|
+
};
|
|
893
|
+
})();
|
|
892
894
|
// ============================================================
|
|
893
895
|
// Factory Functions
|
|
894
896
|
// ============================================================
|
|
@@ -136,7 +136,7 @@ runner = "wasm-server-runner"
|
|
|
136
136
|
`;
|
|
137
137
|
this.rustFiles.set('Cargo.toml', cargoToml);
|
|
138
138
|
}
|
|
139
|
-
generateMain(
|
|
139
|
+
generateMain(_project) {
|
|
140
140
|
const { useRapier, useAssetLoader, useStates, hotReloading } = this.config;
|
|
141
141
|
const imports = ['use bevy::prelude::*;'];
|
|
142
142
|
if (useRapier) {
|
|
@@ -267,7 +267,7 @@ class CocosExporter extends PlatformExporter {
|
|
|
267
267
|
this.generateEntityScript(entityType, options);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
generateGameManager(project,
|
|
270
|
+
generateGameManager(project, _options) {
|
|
271
271
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
272
272
|
const res = project.settings.resolution;
|
|
273
273
|
const script = `import { _decorator, Component, Node, director } from 'cc';
|
|
@@ -334,7 +334,7 @@ export class GameManager extends Component {
|
|
|
334
334
|
this.addTextFile(`assets/scripts/GameManager.${ext}`, script);
|
|
335
335
|
this.generateMetaFile(`assets/scripts/GameManager.${ext}`, 'typescript');
|
|
336
336
|
}
|
|
337
|
-
generateEntityScript(entityType,
|
|
337
|
+
generateEntityScript(entityType, _options) {
|
|
338
338
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
339
339
|
const className = entityType.charAt(0).toUpperCase() + entityType.slice(1);
|
|
340
340
|
const script = `import { _decorator, Component, Node, Vec2, Vec3 } from 'cc';
|
|
@@ -411,7 +411,7 @@ export class ${className} extends Component {
|
|
|
411
411
|
this.generateMetaFile(`assets/scripts/entities/${className}.${ext}`, 'typescript');
|
|
412
412
|
}
|
|
413
413
|
/* ── Scene Export ───────────────────────────────────────────── */
|
|
414
|
-
async exportScene(scene, project,
|
|
414
|
+
async exportScene(scene, project, _options) {
|
|
415
415
|
const sceneData = this.buildSceneData(scene, project);
|
|
416
416
|
const scenePath = `assets/scenes/${scene.name}.scene`;
|
|
417
417
|
this.addTextFile(scenePath, JSON.stringify(sceneData, null, 2));
|
|
@@ -560,7 +560,7 @@ export class ${className} extends Component {
|
|
|
560
560
|
return value;
|
|
561
561
|
}
|
|
562
562
|
/* ── Prefab Export ──────────────────────────────────────────── */
|
|
563
|
-
async exportPrefab(prefab,
|
|
563
|
+
async exportPrefab(prefab, _options) {
|
|
564
564
|
const prefabData = this.buildPrefabData(prefab);
|
|
565
565
|
const prefabPath = `assets/prefabs/${prefab.name}.prefab`;
|
|
566
566
|
this.addTextFile(prefabPath, JSON.stringify(prefabData, null, 2));
|
|
@@ -275,7 +275,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
275
275
|
await this.generateObjectType(typeName, prefab.entity, options);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
async generateObjectType(typeName, entity,
|
|
278
|
+
async generateObjectType(typeName, entity, _options) {
|
|
279
279
|
const behaviors = {};
|
|
280
280
|
const instanceVariables = {};
|
|
281
281
|
// Map components to behaviors
|
|
@@ -331,7 +331,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
331
331
|
return result;
|
|
332
332
|
}
|
|
333
333
|
/* ── Layout Export ──────────────────────────────────────────── */
|
|
334
|
-
async exportLayout(scene, project,
|
|
334
|
+
async exportLayout(scene, project, _options) {
|
|
335
335
|
const layoutName = scene.name.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
336
336
|
const layout = {
|
|
337
337
|
c3dtg: true,
|
|
@@ -398,7 +398,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
/* ── Event Sheet ────────────────────────────────────────────── */
|
|
401
|
-
async generateEventSheet(scene, _project,
|
|
401
|
+
async generateEventSheet(scene, _project, _options) {
|
|
402
402
|
const sheetName = `${scene.name.replace(/[^a-zA-Z0-9_]/g, '_')}_Events`;
|
|
403
403
|
const eventSheet = {
|
|
404
404
|
c3eventsheet: true,
|
|
@@ -461,7 +461,7 @@ class Construct3Exporter extends PlatformExporter {
|
|
|
461
461
|
return events;
|
|
462
462
|
}
|
|
463
463
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
464
|
-
async generateScripts(project,
|
|
464
|
+
async generateScripts(project, _options) {
|
|
465
465
|
// Main script
|
|
466
466
|
const mainScript = `// ${project.name} - Nice2Dev Export for Construct 3
|
|
467
467
|
// Generated automatically
|
|
@@ -321,7 +321,7 @@ _plugins =
|
|
|
321
321
|
this.addTextFile('game.project', projectContent);
|
|
322
322
|
}
|
|
323
323
|
/* ── Main Collection ────────────────────────────────────────── */
|
|
324
|
-
async generateMainCollection(project,
|
|
324
|
+
async generateMainCollection(project, _options) {
|
|
325
325
|
const firstScene = project.scenes[0];
|
|
326
326
|
const sceneName = firstScene
|
|
327
327
|
? firstScene.name.toLowerCase().replace(/[^a-z0-9_]/g, '_')
|
|
@@ -437,7 +437,7 @@ scale_along_z: 0
|
|
|
437
437
|
}
|
|
438
438
|
`;
|
|
439
439
|
}
|
|
440
|
-
async generateGameObject(entity,
|
|
440
|
+
async generateGameObject(entity, _options) {
|
|
441
441
|
const name = (entity.name ?? entity.id).toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
442
442
|
let goContent = '';
|
|
443
443
|
// Add components
|
|
@@ -684,7 +684,7 @@ end
|
|
|
684
684
|
`;
|
|
685
685
|
}
|
|
686
686
|
/* ── Shared Scripts ─────────────────────────────────────────── */
|
|
687
|
-
async generateSharedScripts(project,
|
|
687
|
+
async generateSharedScripts(project, _options) {
|
|
688
688
|
// Game Manager Script
|
|
689
689
|
const gameManagerScript = `-- Game Manager
|
|
690
690
|
-- Central game state and utility management
|
|
@@ -938,7 +938,7 @@ return M
|
|
|
938
938
|
this.addTextFile('main/scripts/utility.lua', utilityModule);
|
|
939
939
|
}
|
|
940
940
|
/* ── App Manifest ───────────────────────────────────────────── */
|
|
941
|
-
async generateAppManifest(_project,
|
|
941
|
+
async generateAppManifest(_project, _options) {
|
|
942
942
|
const manifest = `platforms:
|
|
943
943
|
x86_64-osx:
|
|
944
944
|
context:
|
|
@@ -355,7 +355,7 @@ class GDevelopExporter extends PlatformExporter {
|
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
357
|
/* ── Event Generation ───────────────────────────────────────── */
|
|
358
|
-
generateSceneEvents(scene, _project,
|
|
358
|
+
generateSceneEvents(scene, _project, _options) {
|
|
359
359
|
const events = [];
|
|
360
360
|
// Header comment
|
|
361
361
|
events.push({
|
|
@@ -675,7 +675,7 @@ class GDevelopExporter extends PlatformExporter {
|
|
|
675
675
|
sceneVariables: [],
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
|
-
async generateNice2DevExtension(project,
|
|
678
|
+
async generateNice2DevExtension(project, _options) {
|
|
679
679
|
// Extension is already embedded in the project, this generates a standalone version
|
|
680
680
|
const extension = this.createNice2DevExtension(project);
|
|
681
681
|
this.addTextFile('extensions/Nice2Dev.json', JSON.stringify(extension, null, 2));
|
|
@@ -87,7 +87,7 @@ class GameMakerExporter extends PlatformExporter {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
/* ── Project File ───────────────────────────────────────────── */
|
|
90
|
-
async generateProjectFile(project,
|
|
90
|
+
async generateProjectFile(project, _options) {
|
|
91
91
|
const projectFile = {
|
|
92
92
|
resourceType: 'GMProject',
|
|
93
93
|
resourceVersion: '1.6',
|
|
@@ -155,7 +155,7 @@ class GameMakerExporter extends PlatformExporter {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
158
|
-
async generateScripts(
|
|
158
|
+
async generateScripts(_project, _options) {
|
|
159
159
|
// Utility script
|
|
160
160
|
const utilScript = `/// @description Nice2Dev Utility Functions
|
|
161
161
|
|
|
@@ -390,7 +390,7 @@ event_inherited();
|
|
|
390
390
|
id: { name: 'obj_nice2dev_base', path: 'objects/obj_nice2dev_base/obj_nice2dev_base.yy' },
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
async generateObjectFromEntity(entity, objectName,
|
|
393
|
+
async generateObjectFromEntity(entity, objectName, _options) {
|
|
394
394
|
const safeName = objectName.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
395
395
|
const hasPhysics = entity.components.some((c) => c.type === 'rigidbody');
|
|
396
396
|
// Find sprite component
|
|
@@ -179,7 +179,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
/* ── Scenes ─────────────────────────────────────────────────── */
|
|
182
|
-
async exportScenes(project,
|
|
182
|
+
async exportScenes(project, _options) {
|
|
183
183
|
for (const scene of project.scenes) {
|
|
184
184
|
const tscn = this.createSceneTSCN(scene, project);
|
|
185
185
|
const path = `scenes/${this.sanitizeName(scene.name)}.tscn`;
|
|
@@ -498,7 +498,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
/* ── Prefabs ────────────────────────────────────────────────── */
|
|
501
|
-
async exportPrefabs(project,
|
|
501
|
+
async exportPrefabs(project, _options) {
|
|
502
502
|
for (const prefab of project.prefabs) {
|
|
503
503
|
const tscn = this.createPrefabTSCN(prefab, project);
|
|
504
504
|
const path = `prefabs/${this.sanitizeName(prefab.name)}.tscn`;
|
|
@@ -512,7 +512,7 @@ environment/defaults/default_clear_color=Color(${this.hexToGodotColor(project.se
|
|
|
512
512
|
return this.serializeTSCN(resources, [rootNode], prefab.name);
|
|
513
513
|
}
|
|
514
514
|
/* ── Resources ──────────────────────────────────────────────── */
|
|
515
|
-
async exportResources(project,
|
|
515
|
+
async exportResources(project, _options) {
|
|
516
516
|
// Export materials as ShaderMaterial resources
|
|
517
517
|
const materials = project.assets.filter((a) => a.type === 'material');
|
|
518
518
|
for (const material of materials) {
|
|
@@ -213,7 +213,7 @@ class MinecraftBedrockExporter extends PlatformExporter {
|
|
|
213
213
|
this.addTextFile(`${bpPath}/texts/en_US.lang`, `pack.name=${project.name} Behavior Pack\npack.description=Behavior pack from Nice2Dev project`);
|
|
214
214
|
}
|
|
215
215
|
/* ── Scripts ────────────────────────────────────────────────── */
|
|
216
|
-
async generateScripts(project,
|
|
216
|
+
async generateScripts(project, _options) {
|
|
217
217
|
const bpPath = `${this.projectName}_BP`;
|
|
218
218
|
// Main entry script
|
|
219
219
|
const mainScript = `// ${project.name} - Nice2Dev Minecraft Bedrock Export
|
|
@@ -452,7 +452,7 @@ export function playSound(dimension, soundId, location, options = {}) {
|
|
|
452
452
|
this.addTextFile(`${bpPath}/scripts/utilities.js`, utilities);
|
|
453
453
|
}
|
|
454
454
|
/* ── Prefab Export (Custom Entity) ──────────────────────────── */
|
|
455
|
-
async exportPrefab(prefab,
|
|
455
|
+
async exportPrefab(prefab, _options) {
|
|
456
456
|
const bpPath = `${this.projectName}_BP`;
|
|
457
457
|
const rpPath = `${this.projectName}_RP`;
|
|
458
458
|
const entityId = `${this.namespace}:${prefab.name.toLowerCase().replace(/[^a-z0-9_]/g, '_')}`;
|
|
@@ -88,7 +88,7 @@ class MonoGameExporter {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
generateSolution(
|
|
91
|
+
generateSolution(_project) {
|
|
92
92
|
const projectGuid = this.generateGuid();
|
|
93
93
|
const solutionGuid = this.generateGuid();
|
|
94
94
|
const sln = `
|
|
@@ -167,7 +167,7 @@ ${packageRefs.map((r) => ` ${r}`).join('\n')}
|
|
|
167
167
|
`;
|
|
168
168
|
this.csharpFiles.set(`${this.config.solutionName}/${this.config.solutionName}.csproj`, csproj);
|
|
169
169
|
}
|
|
170
|
-
generateGame1(
|
|
170
|
+
generateGame1(_project) {
|
|
171
171
|
const { namespace, useECS, useNez } = this.config;
|
|
172
172
|
const usings = [
|
|
173
173
|
'using Microsoft.Xna.Framework;',
|