@nice2dev/game-engine 1.2.0 → 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 +103 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @nice2dev/game-engine — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8c82c30: 1.2.1 — the decisions that waited since 1.2.0, and the debts the CI gates were holding. One API
|
|
8
|
+
change, agreed: `NiceIconSuggestorAI` suggests Nice icons only. Two stylesheets to import if you use
|
|
9
|
+
the packages: `@nice2dev/social/style.css`, `@nice2dev/ui-science/style.css`. Upgrade notes:
|
|
10
|
+
`documentation/omniverk/OMNIVERK_UPGRADE_1.2.1.md`.
|
|
11
|
+
|
|
12
|
+
**Tree-shaking.** An import from a package no longer brings the whole package. Module-level
|
|
13
|
+
statements that may have a side effect — a `displayName` assigned after each component (now
|
|
14
|
+
`Object.assign` inside `/* @__PURE__ */`, or under a development check for plain functions),
|
|
15
|
+
unannotated `forwardRef` / `memo` / `createContext` / icon-factory calls, spreads, registries filled
|
|
16
|
+
at import, `<style>` tags injected at import, a direct `eval` in ui-math — are gone. One import from
|
|
17
|
+
each of 53 packages: 5066.5 kB → 1171.6 kB (`@nice2dev/ui` 1928.2 kB → 12.9 kB, icon packs 48–275 kB
|
|
18
|
+
→ 1.6–2.6 kB). `defaultViewRegistry` has the Nice\* input controls from the start, each loading its
|
|
19
|
+
module on first render; sixteen controls add their styles to `<head>` on first render.
|
|
20
|
+
|
|
21
|
+
**Dead code.** 405 source files no entry point imported (never on npm) are deleted;
|
|
22
|
+
`NiceClipboardStack` (`@nice2dev/ui`) and `NiceSampleBrowser` (`@nice2dev/ui-audio`), finished and
|
|
23
|
+
documented, are exported.
|
|
24
|
+
|
|
25
|
+
**ui-mobile draws Nice icons.** New peer `@nice2dev/icons ^1.2.0`; `TabIcons`, `DrawerIcons`,
|
|
26
|
+
`HeaderIcons`, the `NiceSwipeActions` presets and the `NiceInfiniteScroll` states are `Ntd*` icons
|
|
27
|
+
instead of pasted `<svg>`, simple glyphs are CSS marks. `@nice2dev/icons` adds `NtdReply` and
|
|
28
|
+
`NtdInbox`; an icon no longer throws without `window.matchMedia`.
|
|
29
|
+
|
|
30
|
+
**`NiceIconSuggestorAI` (breaking, agreed).** `AIIconLibrary` is `'nice'`; `svgPath` and `unicode`
|
|
31
|
+
left `AISuggestedIcon`; the preview is a `<NiceIcon>`, "Copy SVG" is "Copy JSX".
|
|
32
|
+
|
|
33
|
+
**Peer ranges.** Every internal `@nice2dev/*` peer is `^1.2.0` (was as wide as `^1.0.20`), except
|
|
34
|
+
`@nice2dev/icons ^1.2.1` where a package draws an icon new in 1.2.1: ui-mobile (`NtdReply`,
|
|
35
|
+
`NtdInbox`), ui-audio (`NtdMicrophoneOff`) and ui-security (`NtdBackspace`). ui-security, licensing
|
|
36
|
+
(`^1.2.0`) and templates (`^1.2.0`) gain the `@nice2dev/icons` peer: their glyph icons (`⌫`, `←`,
|
|
37
|
+
`→`, `↑`, `↓`) are Nice icons now. `@nice2dev/icons` adds `NtdBackspace`.
|
|
38
|
+
|
|
39
|
+
**Class names inside components.** 834 class names in library stylesheets had no `nice-` prefix
|
|
40
|
+
(`.tab-button`, `.status-badge`, `.selected`, …) and styled every element of that name on the page.
|
|
41
|
+
They follow `nice-{block}__{element}--{modifier}` now — no change on screen. The class theme hooks
|
|
42
|
+
next to `[data-theme]` on seven controls (`dark` on the AI chart / data grid / code and HTML
|
|
43
|
+
editors / form builder, `light-theme` on `NiceMAM` and `NiceVideoAnnotator`) are `nice-dark` /
|
|
44
|
+
`nice-light`; `NiceLowPowerMode` marks `<html>` with `nice-lpm-no-animations` /
|
|
45
|
+
`nice-lpm-reduced-quality`; the `NiceVideoEditor` of `@nice2dev/ui-video` styles its elements under
|
|
46
|
+
`nice-video-studio`, so they no longer collide with the `NiceVideoEditor` of `@nice2dev/ui`.
|
|
47
|
+
Rules for classes nothing rendered are gone, among them the stylesheet of `NiceGanttChart`, which
|
|
48
|
+
left ui-erp in 1.0.10.
|
|
49
|
+
|
|
50
|
+
**Translations.** About 3,400 UI texts in 32 packages were hard-coded; they go through `t()` now,
|
|
51
|
+
with the English text unchanged and pl / de / fr / es / uk in `@nice2dev/i18n` (ui-diagrams,
|
|
52
|
+
ui-presentations and ui-math in their own dictionaries). In `@nice2dev/events` and
|
|
53
|
+
`@nice2dev/admin` that includes column headers, option labels and the statuses and roles they used
|
|
54
|
+
to print raw (`checked-in`, `no-show`) — English labels for those come from the dictionary. ui-3d and ui-graphics read the app's
|
|
55
|
+
global translator, as ui-audio does since 1.2.0 — their own provider overrides it. ui-audio's
|
|
56
|
+
controls used 631 keys the dictionary did not have (English in every language), and the radio
|
|
57
|
+
player showed raw keys (`search_stations`). Texts that were hard-coded **in Polish** — in
|
|
58
|
+
`NiceSidebarNav`, `NiceNetworkDiscoveryPanel`, the backup and smart-home controls,
|
|
59
|
+
`NiceSavedQueryPanel`, `NiceNotificationPreferences`, the ui-buildings panels, the ui-printing
|
|
60
|
+
template editor and the photo editor — default to English now; Polish is in the dictionary. English
|
|
61
|
+
plurals glued on (`result{s}`) are two keys. `presentationsTranslator(lang)` (ui-presentations)
|
|
62
|
+
translates outside its provider.
|
|
63
|
+
|
|
64
|
+
**List props are optional.** 170 list props (`items`, `columns`, `data`, …) in 15 packages that
|
|
65
|
+
were required without a default are optional, with a stable empty default; every one of those
|
|
66
|
+
controls mounts without data (tested). `NiceStockChart` without data no longer computes NaN
|
|
67
|
+
coordinates.
|
|
68
|
+
|
|
69
|
+
**Unstyled components get stylesheets.** 98 components rendered class names no stylesheet had —
|
|
70
|
+
admin panels, auth forms, events rounds and pickers, the ERP invoice / purchase order / VAT table /
|
|
71
|
+
HR dashboard, the radio player, `NiceInbox`, PWA prompts, `NiceViewRenderer`, shells, smart-home,
|
|
72
|
+
… The fixed layout that sat in inline style objects is in classes now, so an app can override it;
|
|
73
|
+
values that depend on data stay inline. **`@nice2dev/social` and `@nice2dev/ui-science` ship a
|
|
74
|
+
stylesheet — import `@nice2dev/social/style.css` / `@nice2dev/ui-science/style.css`.** ui-science's
|
|
75
|
+
`sideEffects` is `["*.css"]`. Colours, spacing and radii in every stylesheet come from theme tokens
|
|
76
|
+
(visible in dark themes: `NiceRecipe` difficulty badges, transcoder states, warehouse heat map).
|
|
77
|
+
|
|
78
|
+
**Icons only from Nice.** About 130 glyphs (`×`, `→`, `↑`) and 100 pasted `<svg>` used as icons
|
|
79
|
+
are Nice icons; 11 `<svg>` stay as the control's own graphic (logos, spinners, checkbox mark). `NiceIcon`
|
|
80
|
+
gains `pin`, `mic-off`, `log-out`, `chevrons-left`, `chevrons-right`, `zoom-in`, `zoom-out`,
|
|
81
|
+
`navigation`, `refresh-ccw`, `minimize` and `smartphone`; `@nice2dev/icons` gains
|
|
82
|
+
`NtdMicrophoneOff`. The `icon` fields of the module, menu, tab, mode, quick-action, scene and admin
|
|
83
|
+
widget DTOs, notification channels and view toolbar items are rendered through `NiceIcon` — they
|
|
84
|
+
used to be printed as text. `NiceRatings` `thumbs` draws shapes instead of emoji.
|
|
85
|
+
|
|
86
|
+
**Dialogs instead of `window.prompt` / `confirm` / `alert`.** New `useNiceDialogs()` — `prompt`,
|
|
87
|
+
`confirm` and `alert` as promises on `NicePromptDialog` / `NiceConfirmDialog` — and
|
|
88
|
+
`NiceConfirmDialog.showReject`. Seventeen controls asked through the browser's blocking dialogs and
|
|
89
|
+
use the library's now (`NiceFileManager`, `NiceHtmlEditor`, `NiceViewRenderer` action `confirm`, the 3D,
|
|
90
|
+
vector and pixel editors, …). Keys pressed in `NicePromptDialog` / `NiceConfirmDialog` no longer
|
|
91
|
+
reach the page's shortcuts (Escape still closes them), and `NicePromptDialog`'s backdrop covers the
|
|
92
|
+
whole viewport.
|
|
93
|
+
|
|
94
|
+
**Smaller fixes.** `NiceFileManager.items` is optional. `NiceMLStudio` status badges: `draft`,
|
|
95
|
+
`registered`, `archived`, `cancelled` get a neutral colour, deploying / stopped deployments theirs.
|
|
96
|
+
Component docs (`doc.json`) list only props the components have. `NiceMobileTabs`: tabs beyond
|
|
97
|
+
`maxTabs` open from "More" (it only logged). `NiceInventoryManager`: new `onCreatePurchaseOrder`;
|
|
98
|
+
without it the "Create PO" button is gone (it only logged). Keyboard: `NiceNavShell` tabs follow the
|
|
99
|
+
WAI-ARIA tabs pattern, clickable `NiceDeviceTile` / `NiceCardGroup` cards and animated icons with
|
|
100
|
+
`trigger="click"` are focusable. ui-math: `CalculatorService.evaluate` parses instead of running
|
|
101
|
+
`new Function` (`asin`, `sinh`, `ceil`, exponents and `angleUnit` were wrong); `ExpressionParser`
|
|
102
|
+
takes `functions`, `constants`, `ignoreCase` and `strict`, multiplies implicitly (`2x`) and reads `^`
|
|
103
|
+
right to left. `InvoiceLine.vatRate` and `VatRate.rate` are documented as fractions (0.23).
|
|
104
|
+
`AmqpServerBinding` is `Record<string, never>`.
|
|
105
|
+
|
|
3
106
|
## 1.2.0
|
|
4
107
|
|
|
5
108
|
### Minor Changes
|
|
@@ -128,7 +128,7 @@ class BTNode {
|
|
|
128
128
|
this.name = name;
|
|
129
129
|
}
|
|
130
130
|
/** Initialize the node */
|
|
131
|
-
initialize(
|
|
131
|
+
initialize(_context) { }
|
|
132
132
|
/** Reset the node state */
|
|
133
133
|
reset() {
|
|
134
134
|
this.lastStatus = 'inactive';
|
|
@@ -266,7 +266,7 @@ class BTParallel extends BTComposite {
|
|
|
266
266
|
this.failurePolicy = 'one';
|
|
267
267
|
this.childStatuses = [];
|
|
268
268
|
}
|
|
269
|
-
initialize(
|
|
269
|
+
initialize(_context) {
|
|
270
270
|
this.childStatuses = new Array(this.children.length).fill('running');
|
|
271
271
|
}
|
|
272
272
|
tick(context) {
|
|
@@ -350,7 +350,7 @@ class BTRandomSelector extends BTComposite {
|
|
|
350
350
|
super('randomSelector', name);
|
|
351
351
|
this.shuffledOrder = [];
|
|
352
352
|
}
|
|
353
|
-
initialize(
|
|
353
|
+
initialize(_context) {
|
|
354
354
|
this.shuffle();
|
|
355
355
|
}
|
|
356
356
|
shuffle() {
|
|
@@ -400,7 +400,7 @@ class BTRandomSequence extends BTComposite {
|
|
|
400
400
|
super('randomSequence', name);
|
|
401
401
|
this.shuffledOrder = [];
|
|
402
402
|
}
|
|
403
|
-
initialize(
|
|
403
|
+
initialize(_context) {
|
|
404
404
|
this.shuffle();
|
|
405
405
|
}
|
|
406
406
|
shuffle() {
|
|
@@ -454,7 +454,9 @@ const GameAudioSettings = ({ bridge, className, style, }) => {
|
|
|
454
454
|
},
|
|
455
455
|
}, `${Math.round((volumes[bus] ?? 1) * 100)}%`))));
|
|
456
456
|
};
|
|
457
|
-
|
|
457
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
458
|
+
GameAudioSettings.displayName = 'GameAudioSettings';
|
|
459
|
+
}
|
|
458
460
|
|
|
459
461
|
exports.AudioBusMixer = AudioBusMixer;
|
|
460
462
|
exports.DEFAULT_SPATIAL = DEFAULT_SPATIAL;
|
|
@@ -274,7 +274,7 @@ window/size/viewport_height=1080
|
|
|
274
274
|
renderer/rendering_method="${config.scriptLanguage === 'csharp' ? 'forward_plus' : 'mobile'}"
|
|
275
275
|
`;
|
|
276
276
|
}
|
|
277
|
-
generateExportPresets(
|
|
277
|
+
generateExportPresets(_config) {
|
|
278
278
|
return `[preset.0]
|
|
279
279
|
|
|
280
280
|
name="Linux/X11"
|
|
@@ -333,7 +333,7 @@ class UnrealBuildCloud {
|
|
|
333
333
|
],
|
|
334
334
|
}, null, 2);
|
|
335
335
|
}
|
|
336
|
-
generateDefaultGameIni(
|
|
336
|
+
generateDefaultGameIni(_config) {
|
|
337
337
|
return `[/Script/EngineSettings.GeneralProjectSettings]
|
|
338
338
|
ProjectID=${this.generateGuid()}
|
|
339
339
|
ProjectName=Nice2Dev Project
|
|
@@ -21,15 +21,17 @@ const DEFAULT_RENDERING = {
|
|
|
21
21
|
antiAlias: true,
|
|
22
22
|
backgroundColor: WHITE,
|
|
23
23
|
};
|
|
24
|
-
const DEFAULT_SETTINGS = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
24
|
+
const DEFAULT_SETTINGS = /* @__PURE__ */ (function () {
|
|
25
|
+
return {
|
|
26
|
+
width: 1280,
|
|
27
|
+
height: 720,
|
|
28
|
+
targetFps: 60,
|
|
29
|
+
maxPlayers: 4,
|
|
30
|
+
physics: { ...DEFAULT_PHYSICS },
|
|
31
|
+
audio: { ...DEFAULT_AUDIO },
|
|
32
|
+
rendering: { ...DEFAULT_RENDERING },
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
33
35
|
class GameConfig {
|
|
34
36
|
constructor(overrides) {
|
|
35
37
|
this._settings = mergeSettings(DEFAULT_SETTINGS, overrides ?? {});
|
|
@@ -663,7 +663,9 @@ const AnalyticsDashboard = ({ analytics, className, style, }) => {
|
|
|
663
663
|
style: { padding: 16, fontFamily: 'monospace', fontSize: 13, ...style },
|
|
664
664
|
}, React.createElement('h3', { style: { margin: '0 0 12px 0' } }, 'Gameplay Analytics'), React.createElement('div', { style: statStyle }, React.createElement('span', null, 'Session ID'), React.createElement('code', null, summary.sessionId)), React.createElement('div', { style: statStyle }, React.createElement('span', null, 'Total Events'), React.createElement('span', null, String(summary.totalEvents))), React.createElement('div', { style: statStyle }, React.createElement('span', null, 'Heatmaps'), React.createElement('span', null, String(summary.heatmapCount))), React.createElement('div', { style: statStyle }, React.createElement('span', null, 'Recording'), React.createElement('span', null, summary.isRecording ? `ON (${summary.recordedFrames} frames)` : 'OFF')));
|
|
665
665
|
};
|
|
666
|
-
|
|
666
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
667
|
+
AnalyticsDashboard.displayName = 'AnalyticsDashboard';
|
|
668
|
+
}
|
|
667
669
|
|
|
668
670
|
exports.AnalyticsDashboard = AnalyticsDashboard;
|
|
669
671
|
exports.DEFAULT_HEATMAP_CONFIG = DEFAULT_HEATMAP_CONFIG;
|
|
@@ -21,114 +21,116 @@
|
|
|
21
21
|
// ============================================================
|
|
22
22
|
// Math Utilities
|
|
23
23
|
// ============================================================
|
|
24
|
-
const MathUtils = {
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
dot
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
24
|
+
const MathUtils = /* @__PURE__ */ (function () {
|
|
25
|
+
return {
|
|
26
|
+
vector3Zero() {
|
|
27
|
+
return { x: 0, y: 0, z: 0 };
|
|
28
|
+
},
|
|
29
|
+
vector3One() {
|
|
30
|
+
return { x: 1, y: 1, z: 1 };
|
|
31
|
+
},
|
|
32
|
+
quaternionIdentity() {
|
|
33
|
+
return { x: 0, y: 0, z: 0, w: 1 };
|
|
34
|
+
},
|
|
35
|
+
multiplyQuaternion(a, b) {
|
|
36
|
+
return {
|
|
37
|
+
x: a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y,
|
|
38
|
+
y: a.w * b.y - a.x * b.z + a.y * b.w + a.z * b.x,
|
|
39
|
+
z: a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w,
|
|
40
|
+
w: a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
inverseQuaternion(q) {
|
|
44
|
+
const lengthSq = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
|
|
45
|
+
if (lengthSq === 0) {
|
|
46
|
+
return this.quaternionIdentity();
|
|
47
|
+
}
|
|
48
|
+
const inv = 1 / lengthSq;
|
|
49
|
+
return {
|
|
50
|
+
x: -q.x * inv,
|
|
51
|
+
y: -q.y * inv,
|
|
52
|
+
z: -q.z * inv,
|
|
53
|
+
w: q.w * inv,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
slerpQuaternion(a, b, t) {
|
|
57
|
+
let dot = a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
|
58
|
+
// Ensure shortest path
|
|
59
|
+
const bNeg = { ...b };
|
|
60
|
+
if (dot < 0) {
|
|
61
|
+
dot = -dot;
|
|
62
|
+
bNeg.x = -bNeg.x;
|
|
63
|
+
bNeg.y = -bNeg.y;
|
|
64
|
+
bNeg.z = -bNeg.z;
|
|
65
|
+
bNeg.w = -bNeg.w;
|
|
66
|
+
}
|
|
67
|
+
// Linear interpolation for very close quaternions
|
|
68
|
+
if (dot > 0.9995) {
|
|
69
|
+
return this.normalizeQuaternion({
|
|
70
|
+
x: a.x + t * (bNeg.x - a.x),
|
|
71
|
+
y: a.y + t * (bNeg.y - a.y),
|
|
72
|
+
z: a.z + t * (bNeg.z - a.z),
|
|
73
|
+
w: a.w + t * (bNeg.w - a.w),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const theta = Math.acos(dot);
|
|
77
|
+
const sinTheta = Math.sin(theta);
|
|
78
|
+
const wa = Math.sin((1 - t) * theta) / sinTheta;
|
|
79
|
+
const wb = Math.sin(t * theta) / sinTheta;
|
|
80
|
+
return {
|
|
81
|
+
x: wa * a.x + wb * bNeg.x,
|
|
82
|
+
y: wa * a.y + wb * bNeg.y,
|
|
83
|
+
z: wa * a.z + wb * bNeg.z,
|
|
84
|
+
w: wa * a.w + wb * bNeg.w,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
normalizeQuaternion(q) {
|
|
88
|
+
const length = Math.sqrt(q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w);
|
|
89
|
+
if (length === 0) {
|
|
90
|
+
return this.quaternionIdentity();
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
x: q.x / length,
|
|
94
|
+
y: q.y / length,
|
|
95
|
+
z: q.z / length,
|
|
96
|
+
w: q.w / length,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
lerpVector3(a, b, t) {
|
|
100
|
+
return {
|
|
101
|
+
x: a.x + (b.x - a.x) * t,
|
|
102
|
+
y: a.y + (b.y - a.y) * t,
|
|
103
|
+
z: a.z + (b.z - a.z) * t,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
multiplyVector3(v, scalar) {
|
|
107
|
+
return { x: v.x * scalar, y: v.y * scalar, z: v.z * scalar };
|
|
108
|
+
},
|
|
109
|
+
addVector3(a, b) {
|
|
110
|
+
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
111
|
+
},
|
|
112
|
+
mirrorVector3X(v) {
|
|
113
|
+
return { x: -v.x, y: v.y, z: v.z };
|
|
114
|
+
},
|
|
115
|
+
mirrorQuaternionX(q) {
|
|
116
|
+
return { x: q.x, y: -q.y, z: -q.z, w: q.w };
|
|
117
|
+
},
|
|
118
|
+
eulerToQuaternion(euler) {
|
|
119
|
+
const c1 = Math.cos(euler.x / 2);
|
|
120
|
+
const c2 = Math.cos(euler.y / 2);
|
|
121
|
+
const c3 = Math.cos(euler.z / 2);
|
|
122
|
+
const s1 = Math.sin(euler.x / 2);
|
|
123
|
+
const s2 = Math.sin(euler.y / 2);
|
|
124
|
+
const s3 = Math.sin(euler.z / 2);
|
|
125
|
+
return {
|
|
126
|
+
x: s1 * c2 * c3 + c1 * s2 * s3,
|
|
127
|
+
y: c1 * s2 * c3 - s1 * c2 * s3,
|
|
128
|
+
z: c1 * c2 * s3 + s1 * s2 * c3,
|
|
129
|
+
w: c1 * c2 * c3 - s1 * s2 * s3,
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
})();
|
|
132
134
|
// ============================================================
|
|
133
135
|
// Animation Retargeting System
|
|
134
136
|
// ============================================================
|
|
@@ -417,7 +417,7 @@ class CraftingEditor {
|
|
|
417
417
|
this.activeProgress.delete(progressId);
|
|
418
418
|
this.onCraftingCompleted?.(recipe, outputs, quality);
|
|
419
419
|
}
|
|
420
|
-
determineQuality(recipe,
|
|
420
|
+
determineQuality(recipe, _playerId) {
|
|
421
421
|
const qualities = [
|
|
422
422
|
'poor',
|
|
423
423
|
'normal',
|
|
@@ -535,7 +535,7 @@ class CraftingEditor {
|
|
|
535
535
|
return this.discoveredRecipes.has(recipeId);
|
|
536
536
|
}
|
|
537
537
|
// ─── Salvage ───────────────────────────────────────────
|
|
538
|
-
canSalvage(itemId,
|
|
538
|
+
canSalvage(itemId, _playerId) {
|
|
539
539
|
const rule = this.salvageRules.get(itemId);
|
|
540
540
|
if (!rule) {
|
|
541
541
|
return false;
|
|
@@ -121,7 +121,7 @@ function editorReducer(state, action) {
|
|
|
121
121
|
return state;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const EditorContext = React.createContext(null);
|
|
124
|
+
const EditorContext = /* @__PURE__ */ React.createContext(null);
|
|
125
125
|
function useEditor() {
|
|
126
126
|
const ctx = React.useContext(EditorContext);
|
|
127
127
|
if (!ctx) {
|
|
@@ -838,59 +838,61 @@ class UndoRedoManager {
|
|
|
838
838
|
// ============================================================
|
|
839
839
|
// Common Action Executors
|
|
840
840
|
// ============================================================
|
|
841
|
-
const CommonExecutors = {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
data
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
data
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
arrayPush: {
|
|
857
|
-
execute(data) {
|
|
858
|
-
data.array.push(data.value);
|
|
859
|
-
},
|
|
860
|
-
undo(data) {
|
|
861
|
-
data.array.pop();
|
|
841
|
+
const CommonExecutors = /* @__PURE__ */ (function () {
|
|
842
|
+
return {
|
|
843
|
+
setProperty: {
|
|
844
|
+
execute(data) {
|
|
845
|
+
data.target[data.property] = data.value;
|
|
846
|
+
},
|
|
847
|
+
undo(data) {
|
|
848
|
+
data.target[data.property] = data.oldValue;
|
|
849
|
+
},
|
|
850
|
+
merge(oldData, newData) {
|
|
851
|
+
if (oldData.property !== newData.property) {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
return { ...oldData, value: newData.value };
|
|
855
|
+
},
|
|
862
856
|
},
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
857
|
+
arrayPush: {
|
|
858
|
+
execute(data) {
|
|
859
|
+
data.array.push(data.value);
|
|
860
|
+
},
|
|
861
|
+
undo(data) {
|
|
862
|
+
data.array.pop();
|
|
863
|
+
},
|
|
867
864
|
},
|
|
868
|
-
|
|
869
|
-
|
|
865
|
+
arrayRemove: {
|
|
866
|
+
execute(data) {
|
|
867
|
+
data.array.splice(data.index, 1);
|
|
868
|
+
},
|
|
869
|
+
undo(data) {
|
|
870
|
+
data.array.splice(data.index, 0, data.value);
|
|
871
|
+
},
|
|
870
872
|
},
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
873
|
+
mapSet: {
|
|
874
|
+
execute(data) {
|
|
875
|
+
data.map.set(data.key, data.value);
|
|
876
|
+
},
|
|
877
|
+
undo(data) {
|
|
878
|
+
if (data.hadValue) {
|
|
879
|
+
data.map.set(data.key, data.oldValue);
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
data.map.delete(data.key);
|
|
883
|
+
}
|
|
884
|
+
},
|
|
875
885
|
},
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
data.map.set(data.key, data.oldValue);
|
|
879
|
-
}
|
|
880
|
-
else {
|
|
886
|
+
mapDelete: {
|
|
887
|
+
execute(data) {
|
|
881
888
|
data.map.delete(data.key);
|
|
882
|
-
}
|
|
889
|
+
},
|
|
890
|
+
undo(data) {
|
|
891
|
+
data.map.set(data.key, data.value);
|
|
892
|
+
},
|
|
883
893
|
},
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
execute(data) {
|
|
887
|
-
data.map.delete(data.key);
|
|
888
|
-
},
|
|
889
|
-
undo(data) {
|
|
890
|
-
data.map.set(data.key, data.value);
|
|
891
|
-
},
|
|
892
|
-
},
|
|
893
|
-
};
|
|
894
|
+
};
|
|
895
|
+
})();
|
|
894
896
|
// ============================================================
|
|
895
897
|
// Factory Functions
|
|
896
898
|
// ============================================================
|
|
@@ -138,7 +138,7 @@ runner = "wasm-server-runner"
|
|
|
138
138
|
`;
|
|
139
139
|
this.rustFiles.set('Cargo.toml', cargoToml);
|
|
140
140
|
}
|
|
141
|
-
generateMain(
|
|
141
|
+
generateMain(_project) {
|
|
142
142
|
const { useRapier, useAssetLoader, useStates, hotReloading } = this.config;
|
|
143
143
|
const imports = ['use bevy::prelude::*;'];
|
|
144
144
|
if (useRapier) {
|
|
@@ -269,7 +269,7 @@ class CocosExporter extends PlatformExporter.PlatformExporter {
|
|
|
269
269
|
this.generateEntityScript(entityType, options);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
generateGameManager(project,
|
|
272
|
+
generateGameManager(project, _options) {
|
|
273
273
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
274
274
|
const res = project.settings.resolution;
|
|
275
275
|
const script = `import { _decorator, Component, Node, director } from 'cc';
|
|
@@ -336,7 +336,7 @@ export class GameManager extends Component {
|
|
|
336
336
|
this.addTextFile(`assets/scripts/GameManager.${ext}`, script);
|
|
337
337
|
this.generateMetaFile(`assets/scripts/GameManager.${ext}`, 'typescript');
|
|
338
338
|
}
|
|
339
|
-
generateEntityScript(entityType,
|
|
339
|
+
generateEntityScript(entityType, _options) {
|
|
340
340
|
const ext = this.useTypeScript ? 'ts' : 'js';
|
|
341
341
|
const className = entityType.charAt(0).toUpperCase() + entityType.slice(1);
|
|
342
342
|
const script = `import { _decorator, Component, Node, Vec2, Vec3 } from 'cc';
|
|
@@ -413,7 +413,7 @@ export class ${className} extends Component {
|
|
|
413
413
|
this.generateMetaFile(`assets/scripts/entities/${className}.${ext}`, 'typescript');
|
|
414
414
|
}
|
|
415
415
|
/* ── Scene Export ───────────────────────────────────────────── */
|
|
416
|
-
async exportScene(scene, project,
|
|
416
|
+
async exportScene(scene, project, _options) {
|
|
417
417
|
const sceneData = this.buildSceneData(scene, project);
|
|
418
418
|
const scenePath = `assets/scenes/${scene.name}.scene`;
|
|
419
419
|
this.addTextFile(scenePath, JSON.stringify(sceneData, null, 2));
|
|
@@ -562,7 +562,7 @@ export class ${className} extends Component {
|
|
|
562
562
|
return value;
|
|
563
563
|
}
|
|
564
564
|
/* ── Prefab Export ──────────────────────────────────────────── */
|
|
565
|
-
async exportPrefab(prefab,
|
|
565
|
+
async exportPrefab(prefab, _options) {
|
|
566
566
|
const prefabData = this.buildPrefabData(prefab);
|
|
567
567
|
const prefabPath = `assets/prefabs/${prefab.name}.prefab`;
|
|
568
568
|
this.addTextFile(prefabPath, JSON.stringify(prefabData, null, 2));
|