@nice2dev/ui-graphics 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/README.md +60 -63
- package/dist/cjs/animation/AnimationEditor.js +0 -3
- package/dist/cjs/animation/Audience.js +3 -1
- package/dist/cjs/animation/BodyRenderer.js +1 -4
- package/dist/cjs/animation/rig/RigPlayer.js +1 -1
- package/dist/cjs/animation/rig/presets.js +67 -55
- package/dist/cjs/animation/shapes/heads.js +0 -3
- package/dist/cjs/animation/shapes/headwear.js +4 -1
- package/dist/cjs/core/NiceBrushEngine.js +6 -6
- package/dist/cjs/core/editorAsk.js +48 -0
- package/dist/cjs/core/i18n.js +7 -3
- package/dist/cjs/core/plugins.js +1 -1
- package/dist/cjs/core/rtl.js +1 -1
- package/dist/cjs/core/theme.js +1 -1
- package/dist/cjs/font/NiceFontEditor.js +16 -14
- package/dist/cjs/game/GameAsset2dEditor.js +28 -19
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/nice2dev-ui-graphics.css +1 -1
- package/dist/cjs/photo/FilterThumb.js +3 -3
- package/dist/cjs/photo/NiceAITools.js +7 -5
- package/dist/cjs/photo/PhotoEditor.js +3 -1
- package/dist/cjs/photo/PhotoEditorCanvas.js +8 -6
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +19 -19
- package/dist/cjs/photo/PhotoEditorToolbar.js +5 -5
- package/dist/cjs/photo/photoFilters.js +1 -0
- package/dist/cjs/pixel/PixelEditor.js +6 -6
- package/dist/cjs/pixel/PixelEditor.module.css.js +1 -1
- package/dist/cjs/pixel/PixelEditorCanvas.js +10 -6
- package/dist/cjs/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/cjs/pixel/PixelEditorRightPanel.js +28 -24
- package/dist/cjs/pixel/PixelEditorStatusBar.js +8 -4
- package/dist/cjs/pixel/PixelEditorTimeline.js +11 -2
- package/dist/cjs/pixel/PixelEditorToolbar.js +10 -6
- package/dist/cjs/pixel/SpriteGeneratorPanel.js +12 -8
- package/dist/cjs/pixel/animalGeneratorPresets.js +31 -31
- package/dist/cjs/pixel/buildingGeneratorPresets.js +24 -24
- package/dist/cjs/pixel/characterGeneratorPresets.js +25 -25
- package/dist/cjs/pixel/usePixelEditor.js +13 -10
- package/dist/cjs/texture/Nice3DTexturePainter.js +12 -10
- package/dist/cjs/ui/NiceUIDesigner.js +18 -14
- package/dist/cjs/vector/NiceSvgToCode.js +6 -4
- package/dist/cjs/vector/VectorEditor.js +3 -5
- package/dist/cjs/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/cjs/vector/useVectorEditor.js +38 -29
- package/dist/cjs/vector/vectorEditorImport.js +1 -0
- package/dist/cjs/vector/vectorIconImport.js +1 -0
- package/dist/esm/animation/AnimationEditor.js +1 -3
- package/dist/esm/animation/Audience.js +3 -1
- package/dist/esm/animation/BodyRenderer.js +3 -5
- package/dist/esm/animation/rig/RigPlayer.js +1 -1
- package/dist/esm/animation/rig/presets.js +68 -56
- package/dist/esm/animation/shapes/heads.js +1 -3
- package/dist/esm/animation/shapes/headwear.js +4 -1
- package/dist/esm/animation/spineExport.js +1 -1
- package/dist/esm/core/NiceBrushEngine.js +6 -6
- package/dist/esm/core/editorAsk.js +45 -0
- package/dist/esm/core/i18n.js +8 -4
- package/dist/esm/core/plugins.js +1 -1
- package/dist/esm/core/rtl.js +1 -1
- package/dist/esm/core/theme.js +1 -1
- package/dist/esm/font/NiceFontEditor.js +16 -14
- package/dist/esm/game/GameAsset2dEditor.js +29 -19
- package/dist/esm/index.js +10 -10
- package/dist/esm/nice2dev-ui-graphics.css +1 -1
- package/dist/esm/photo/FilterThumb.js +3 -3
- package/dist/esm/photo/NiceAITools.js +7 -5
- package/dist/esm/photo/PhotoEditor.js +3 -1
- package/dist/esm/photo/PhotoEditorCanvas.js +8 -6
- package/dist/esm/photo/PhotoEditorLeftPanel.js +19 -19
- package/dist/esm/photo/PhotoEditorToolbar.js +5 -5
- package/dist/esm/photo/photoFilters.js +1 -0
- package/dist/esm/pixel/PixelEditor.js +7 -6
- package/dist/esm/pixel/PixelEditor.module.css.js +1 -1
- package/dist/esm/pixel/PixelEditorCanvas.js +10 -6
- package/dist/esm/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/esm/pixel/PixelEditorRightPanel.js +28 -24
- package/dist/esm/pixel/PixelEditorStatusBar.js +8 -4
- package/dist/esm/pixel/PixelEditorTimeline.js +11 -2
- package/dist/esm/pixel/PixelEditorToolbar.js +10 -6
- package/dist/esm/pixel/SpriteGeneratorPanel.js +12 -8
- package/dist/esm/pixel/animalGeneratorPresets.js +32 -32
- package/dist/esm/pixel/buildingGeneratorPresets.js +25 -25
- package/dist/esm/pixel/characterGeneratorPresets.js +26 -26
- package/dist/esm/pixel/usePixelEditor.js +13 -10
- package/dist/esm/texture/Nice3DTexturePainter.js +12 -10
- package/dist/esm/ui/NiceUIDesigner.js +18 -14
- package/dist/esm/vector/NiceSvgToCode.js +6 -4
- package/dist/esm/vector/VectorEditor.js +4 -5
- package/dist/esm/vector/VectorEditorShapeRenderer.js +3 -1
- package/dist/esm/vector/useVectorEditor.js +38 -29
- package/dist/esm/vector/vectorEditorImport.js +1 -0
- package/dist/esm/vector/vectorIconImport.js +1 -0
- package/dist/types/animation/AnimatedPerson.d.ts +0 -4
- package/dist/types/animation/AnimationEditor.d.ts +1 -5
- package/dist/types/animation/Audience.d.ts +0 -4
- package/dist/types/animation/BodyRenderer.d.ts +0 -4
- package/dist/types/animation/rig/RigPlayer.d.ts +0 -7
- package/dist/types/animation/rig/RiggedBody.d.ts +0 -4
- package/dist/types/animation/shapes/heads.d.ts +0 -4
- package/dist/types/core/LocalUI.d.ts +1 -2
- package/dist/types/core/editorAsk.d.ts +26 -0
- package/dist/types/core/i18n.d.ts +1 -17
- package/dist/types/game/GameAsset2dEditor.d.ts +0 -4
- package/dist/types/game/index.d.ts +1 -1
- package/dist/types/index.d.ts +9 -19
- package/dist/types/photo/index.d.ts +0 -2
- package/dist/types/pixel/PixelEditor.d.ts +0 -4
- package/dist/types/pixel/SpriteGeneratorPanel.d.ts +0 -4
- package/dist/types/pixel/usePixelEditor.d.ts +3 -0
- package/dist/types/vector/VectorEditor.d.ts +0 -4
- package/dist/types/vector/useVectorEditor.d.ts +2 -0
- package/package.json +5 -5
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var ui = require('@nice2dev/ui');
|
|
5
5
|
var uiCore = require('@nice2dev/ui-core');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var i18n = require('../core/i18n.js');
|
|
7
8
|
var GameAsset2dEditor_module = require('./GameAsset2dEditor.module.css.js');
|
|
8
9
|
var useGameAssetEditor = require('./useGameAssetEditor.js');
|
|
9
10
|
|
|
@@ -11,8 +12,9 @@ var useGameAssetEditor = require('./useGameAssetEditor.js');
|
|
|
11
12
|
MENU BAR
|
|
12
13
|
──────────────────────────────────────────────────────────────── */
|
|
13
14
|
const MenuBar = ({ api }) => {
|
|
15
|
+
const { t } = i18n.useNiceTranslation();
|
|
14
16
|
const fileInputRef = React.useRef(null);
|
|
15
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.menuBar, children: [jsxRuntime.jsxs("h3", { children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "gamepad", size: 16 }),
|
|
17
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.menuBar, children: [jsxRuntime.jsxs("h3", { children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "gamepad", size: 16 }), ' ', t('gameAsset2dEditor.gameAssetEditor', 'Game Asset Editor')] }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.menuGroup, children: [jsxRuntime.jsxs(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => api.newProject('New Project'), children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "file", size: 14 }), " New"] }), jsxRuntime.jsxs(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "folder", size: 14 }), " ", t('gameAsset2dEditor.open', 'Open')] }), jsxRuntime.jsxs(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: api.saveProject, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "save", size: 14 }), " ", t('gameAsset2dEditor.save', 'Save')] })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.spacer }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.menuGroup, children: [jsxRuntime.jsxs(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: api.undo, disabled: !api.canUndo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-left", size: 14 }), " ", t('gameAsset2dEditor.undo', 'Undo')] }), jsxRuntime.jsxs(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: api.redo, disabled: !api.canRedo, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-right", size: 14 }), " ", t('gameAsset2dEditor.redo', 'Redo')] })] }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: ".json", style: { display: 'none' }, onChange: (e) => {
|
|
16
18
|
var _a;
|
|
17
19
|
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
18
20
|
if (file) {
|
|
@@ -37,6 +39,7 @@ const ModeTabs = ({ api }) => {
|
|
|
37
39
|
TILE MAP TOOLBAR
|
|
38
40
|
──────────────────────────────────────────────────────────────── */
|
|
39
41
|
const TileMapToolbar = ({ api }) => {
|
|
42
|
+
const { t } = i18n.useNiceTranslation();
|
|
40
43
|
const tools = [
|
|
41
44
|
{ id: 'select', icon: 'square', label: 'Select' },
|
|
42
45
|
{ id: 'brush', icon: 'brush', label: 'Brush' },
|
|
@@ -46,22 +49,24 @@ const TileMapToolbar = ({ api }) => {
|
|
|
46
49
|
{ id: 'line', icon: 'line', label: 'Line' },
|
|
47
50
|
{ id: 'eyedropper', icon: 'eyedropper', label: 'Eyedropper' },
|
|
48
51
|
];
|
|
49
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolbar, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.toolGroup, children: tools.map((tool) => (jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.tileMapTool === tool.id ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.tileMapTool === tool.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setTileMapTool(tool.id), title: tool.label, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: tool.icon, size: 16 }) }, tool.id))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.spacer }), jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.showGrid ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.showGrid ? 'primary' : 'ghost', size: "sm", onClick: api.toggleGrid, title:
|
|
52
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolbar, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.toolGroup, children: tools.map((tool) => (jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.tileMapTool === tool.id ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.tileMapTool === tool.id ? 'primary' : 'ghost', size: "sm", onClick: () => api.setTileMapTool(tool.id), title: tool.label, children: jsxRuntime.jsx(uiCore.NiceIcon, { name: tool.icon, size: 16 }) }, tool.id))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.spacer }), jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.showGrid ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.showGrid ? 'primary' : 'ghost', size: "sm", onClick: api.toggleGrid, title: t('gameAsset2dEditor.toggleGrid', 'Toggle Grid'), "aria-label": t('gameAsset2dEditor.toggleGrid', 'Toggle Grid'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "grid", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.showCollision ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.showCollision ? 'primary' : 'ghost', size: "sm", onClick: api.toggleCollision, title: t('gameAsset2dEditor.showCollision', 'Show Collision'), "aria-label": t('gameAsset2dEditor.showCollision', 'Show Collision'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "square", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.snapToGrid ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.snapToGrid ? 'primary' : 'ghost', size: "sm", onClick: api.toggleSnap, title: t('gameAsset2dEditor.snapToGrid', 'Snap to Grid'), "aria-label": t('gameAsset2dEditor.snapToGrid', 'Snap to Grid'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "grid", size: 16 }) })] }));
|
|
50
53
|
};
|
|
51
54
|
/* ────────────────────────────────────────────────────────────────
|
|
52
55
|
SPRITE SHEET TOOLBAR
|
|
53
56
|
──────────────────────────────────────────────────────────────── */
|
|
54
57
|
const SpriteSheetToolbar = ({ api }) => {
|
|
58
|
+
const { t } = i18n.useNiceTranslation();
|
|
55
59
|
const [sliceWidth, setSliceWidth] = React.useState(16);
|
|
56
60
|
const [sliceHeight, setSliceHeight] = React.useState(16);
|
|
57
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolGroup, children: [jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.spriteSheetTool === 'select' ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.spriteSheetTool === 'select' ? 'primary' : 'ghost', size: "sm", onClick: () => api.setSpriteSheetTool('select'), title:
|
|
61
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolbar, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.toolGroup, children: [jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.spriteSheetTool === 'select' ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.spriteSheetTool === 'select' ? 'primary' : 'ghost', size: "sm", onClick: () => api.setSpriteSheetTool('select'), title: t('gameAsset2dEditor.select', 'Select'), "aria-label": t('gameAsset2dEditor.select', 'Select'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "square", size: 16 }) }), jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.toolBtn} ${api.editorState.spriteSheetTool === 'slice' ? GameAsset2dEditor_module.active : ''}`, variant: api.editorState.spriteSheetTool === 'slice' ? 'primary' : 'ghost', size: "sm", onClick: () => api.setSpriteSheetTool('slice'), title: t('gameAsset2dEditor.manualSlice', 'Manual Slice'), "aria-label": t('gameAsset2dEditor.manualSlice', 'Manual Slice'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "scissors", size: 16 }) })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.spacer }), jsxRuntime.jsxs("label", { style: { fontSize: 11, color: 'var(--nice-text-secondary, #8892a8)' }, children: ["Frame size:", jsxRuntime.jsx(ui.NiceNumberInput, { value: sliceWidth, onChange: (val) => setSliceWidth(val !== null && val !== void 0 ? val : 16), style: { width: 40, margin: '0 4px' }, className: GameAsset2dEditor_module.panelInput }), "\u00D7", jsxRuntime.jsx(ui.NiceNumberInput, { value: sliceHeight, onChange: (val) => setSliceHeight(val !== null && val !== void 0 ? val : 16), style: { width: 40, marginLeft: 4 }, className: GameAsset2dEditor_module.panelInput })] }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnSecondary, variant: "ghost", onClick: () => api.autoSlice(sliceWidth, sliceHeight), style: { marginLeft: 8 }, children: t('gameAsset2dEditor.autoSlice', 'Auto Slice') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnSecondary, variant: "ghost", onClick: api.detectSprites, style: { marginLeft: 4 }, children: t('gameAsset2dEditor.detectSprites', 'Detect Sprites') })] }));
|
|
58
62
|
};
|
|
59
63
|
/* ────────────────────────────────────────────────────────────────
|
|
60
64
|
TILE PALETTE (LEFT PANEL)
|
|
61
65
|
──────────────────────────────────────────────────────────────── */
|
|
62
66
|
const TilePalette = ({ api }) => {
|
|
67
|
+
const { t } = i18n.useNiceTranslation();
|
|
63
68
|
const fileInputRef = React.useRef(null);
|
|
64
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children:
|
|
69
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.tiles', 'Tiles') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: "+ Add" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: api.project.tileSets.length === 0 ? (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.emptyState, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.noTilesYet', 'No tiles yet') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnSecondary, variant: "ghost", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: t('gameAsset2dEditor.importTiles', 'Import Tiles') })] })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.tilePalette, children: api.project.tileSets.map((tile) => (jsxRuntime.jsx("div", { className: `${GameAsset2dEditor_module.tileItem} ${api.editorState.selectedTileId === tile.id ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectTile(tile.id), title: tile.name, children: jsxRuntime.jsx("img", { src: tile.thumbnail, alt: tile.name }) }, tile.id))) })) }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => {
|
|
65
70
|
var _a;
|
|
66
71
|
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
67
72
|
if (file) {
|
|
@@ -74,16 +79,18 @@ const TilePalette = ({ api }) => {
|
|
|
74
79
|
LAYERS PANEL (RIGHT PANEL)
|
|
75
80
|
──────────────────────────────────────────────────────────────── */
|
|
76
81
|
const LayersPanel = ({ api }) => {
|
|
82
|
+
const { t } = i18n.useNiceTranslation();
|
|
77
83
|
const activeMap = api.project.tileMaps.find((m) => m.id === api.editorState.activeTileMapId);
|
|
78
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children:
|
|
84
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.layers', 'Layers') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: api.addLayer, disabled: !activeMap, children: "+ Add" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: activeMap ? (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.layersList, children: [...activeMap.layers].reverse().map((layer) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.activeLayerId === layer.id ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectLayer(layer.id), children: [jsxRuntime.jsx(ui.NiceButton, { className: `${GameAsset2dEditor_module.layerVisibility} ${!layer.visible ? GameAsset2dEditor_module.hidden : ''}`, variant: "ghost", size: "sm", onClick: (e) => {
|
|
79
85
|
e.stopPropagation();
|
|
80
86
|
api.toggleLayerVisibility(layer.id);
|
|
81
|
-
}, "aria-label": layer.visible ? 'Hide layer' : 'Show layer', children: jsxRuntime.jsx(uiCore.NiceIcon, { name: layer.visible ? 'eye' : 'eye-off', size: 16 }) }), jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: layer.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [Math.round(layer.opacity * 100), "%"] })] }, layer.id))) })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children:
|
|
87
|
+
}, "aria-label": layer.visible ? 'Hide layer' : 'Show layer', children: jsxRuntime.jsx(uiCore.NiceIcon, { name: layer.visible ? 'eye' : 'eye-off', size: 16 }) }), jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: layer.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [Math.round(layer.opacity * 100), "%"] })] }, layer.id))) })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.noTileMapSelected', 'No tile map selected') }) })) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.maps', 'Maps') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => api.createTileMap('New Map', 32, 32), children: "+ New" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: api.project.tileMaps.map((map) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.activeTileMapId === map.id ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectTileMap(map.id), children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: map.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [map.width, "\u00D7", map.height] })] }, map.id))) })] }));
|
|
82
88
|
};
|
|
83
89
|
/* ────────────────────────────────────────────────────────────────
|
|
84
90
|
TILE MAP CANVAS
|
|
85
91
|
──────────────────────────────────────────────────────────────── */
|
|
86
92
|
const TileMapCanvas = ({ api }) => {
|
|
93
|
+
const { t } = i18n.useNiceTranslation();
|
|
87
94
|
const canvasRef = React.useRef(null);
|
|
88
95
|
const containerRef = React.useRef(null);
|
|
89
96
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
@@ -171,12 +178,13 @@ const TileMapCanvas = ({ api }) => {
|
|
|
171
178
|
(api.editorState.tileMapTool === 'brush' || api.editorState.tileMapTool === 'eraser')) {
|
|
172
179
|
handleCanvasClick(e);
|
|
173
180
|
}
|
|
174
|
-
} })) : (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.emptyState, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children:
|
|
181
|
+
} })) : (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.emptyState, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.createOrSelectATile', 'Create or select a tile map to start editing') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnPrimary, variant: "primary", onClick: () => api.createTileMap('New Map', 32, 32), children: t('gameAsset2dEditor.createTileMap', 'Create Tile Map') })] })) }));
|
|
175
182
|
};
|
|
176
183
|
/* ────────────────────────────────────────────────────────────────
|
|
177
184
|
SPRITE SHEET CANVAS
|
|
178
185
|
──────────────────────────────────────────────────────────────── */
|
|
179
186
|
const SpriteSheetCanvas = ({ api }) => {
|
|
187
|
+
const { t } = i18n.useNiceTranslation();
|
|
180
188
|
const canvasRef = React.useRef(null);
|
|
181
189
|
const fileInputRef = React.useRef(null);
|
|
182
190
|
const activeSheet = api.project.spriteSheets.find((s) => s.id === api.editorState.activeSpriteSheetId);
|
|
@@ -243,7 +251,7 @@ const SpriteSheetCanvas = ({ api }) => {
|
|
|
243
251
|
}, [activeSheet, api]);
|
|
244
252
|
return (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.viewport, children: activeSheet ? (jsxRuntime.jsx("canvas", { ref: canvasRef, className: GameAsset2dEditor_module.viewportCanvas, style: {
|
|
245
253
|
transform: `translate(-50%, -50%) scale(${api.editorState.zoom})`,
|
|
246
|
-
}, onClick: handleFrameClick })) : (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.emptyState, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children:
|
|
254
|
+
}, onClick: handleFrameClick })) : (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.emptyState, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.importASpriteSheetTo', 'Import a sprite sheet to start') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnPrimary, variant: "primary", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: t('gameAsset2dEditor.importSpriteSheet', 'Import Sprite Sheet') }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => {
|
|
247
255
|
var _a;
|
|
248
256
|
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
249
257
|
if (file) {
|
|
@@ -256,8 +264,9 @@ const SpriteSheetCanvas = ({ api }) => {
|
|
|
256
264
|
SPRITE SHEETS LIST
|
|
257
265
|
──────────────────────────────────────────────────────────────── */
|
|
258
266
|
const SpriteSheetsList = ({ api }) => {
|
|
267
|
+
const { t } = i18n.useNiceTranslation();
|
|
259
268
|
const fileInputRef = React.useRef(null);
|
|
260
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children:
|
|
269
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.spriteSheets', 'Sprite Sheets') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, children: "+ Import" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: api.project.spriteSheets.length === 0 ? (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.noSpriteSheets', 'No sprite sheets') }) })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.layersList, children: api.project.spriteSheets.map((sheet) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.activeSpriteSheetId === sheet.id ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectSpriteSheet(sheet.id), children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: sheet.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [sheet.frames.length, " frames"] })] }, sheet.id))) })) }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => {
|
|
261
270
|
var _a;
|
|
262
271
|
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
263
272
|
if (file) {
|
|
@@ -271,6 +280,7 @@ const SpriteSheetsList = ({ api }) => {
|
|
|
271
280
|
──────────────────────────────────────────────────────────────── */
|
|
272
281
|
const FramesPanel = ({ api }) => {
|
|
273
282
|
var _a;
|
|
283
|
+
const { t } = i18n.useNiceTranslation();
|
|
274
284
|
const [animName, setAnimName] = React.useState('');
|
|
275
285
|
const activeSheet = api.project.spriteSheets.find((s) => s.id === api.editorState.activeSpriteSheetId);
|
|
276
286
|
const createAnimationFromSelection = React.useCallback(() => {
|
|
@@ -279,13 +289,14 @@ const FramesPanel = ({ api }) => {
|
|
|
279
289
|
setAnimName('');
|
|
280
290
|
}
|
|
281
291
|
}, [animName, api]);
|
|
282
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsxs("span", { children: ["Frames (", (_a = activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.frames.length) !== null && _a !== void 0 ? _a : 0, ")"] }) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, style: { maxHeight: 200 }, children: activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.frames.map((frame) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.selectedFrameIds.includes(frame.id) ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectFrames([frame.id]), children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: frame.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [frame.width, "\u00D7", frame.height] })] }, frame.id))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children:
|
|
292
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsxs("span", { children: ["Frames (", (_a = activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.frames.length) !== null && _a !== void 0 ? _a : 0, ")"] }) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, style: { maxHeight: 200 }, children: activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.frames.map((frame) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.selectedFrameIds.includes(frame.id) ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectFrames([frame.id]), children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: frame.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [frame.width, "\u00D7", frame.height] })] }, frame.id))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.animations', 'Animations') }) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelContent, children: [api.editorState.selectedFrameIds.length > 0 && (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelSection, children: [jsxRuntime.jsx(ui.NiceTextInput, { className: GameAsset2dEditor_module.panelInput, placeholder: t('gameAsset2dEditor.animationName', 'Animation name...'), value: animName, onChange: (val) => setAnimName(val) }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnPrimary, variant: "primary", onClick: createAnimationFromSelection, style: { marginTop: 8, width: '100%' }, disabled: !animName, children: t('gameAsset2dEditor.createFromFrames', 'Create from {count} frames').replace('{count}', String(api.editorState.selectedFrameIds.length)) })] })), activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.animations.map((anim) => (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.layerItem, children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: anim.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [anim.frameIds.length, "f"] }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.effectRemove, variant: "ghost", size: "sm", onClick: () => api.removeAnimation(anim.id), "aria-label": t('gameAsset2dEditor.removeAnimation', 'Remove animation'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, anim.id)))] })] }));
|
|
283
293
|
};
|
|
284
294
|
/* ────────────────────────────────────────────────────────────────
|
|
285
295
|
ANIMATION STATE MACHINE
|
|
286
296
|
──────────────────────────────────────────────────────────────── */
|
|
287
297
|
const AnimationStateMachineView = ({ api }) => {
|
|
288
298
|
var _a;
|
|
299
|
+
const { t } = i18n.useNiceTranslation();
|
|
289
300
|
const [newStateName, setNewStateName] = React.useState('');
|
|
290
301
|
const activeSM = api.project.stateMachines.find((sm) => sm.id === api.editorState.activeStateMachineId);
|
|
291
302
|
// Get all animations from all sprite sheets
|
|
@@ -298,7 +309,7 @@ const AnimationStateMachineView = ({ api }) => {
|
|
|
298
309
|
}
|
|
299
310
|
return result;
|
|
300
311
|
}, [api.project.spriteSheets]);
|
|
301
|
-
return (jsxRuntime.jsxs("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children:
|
|
312
|
+
return (jsxRuntime.jsxs("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.stateMachines', 'State Machines') }), jsxRuntime.jsx("button", { className: GameAsset2dEditor_module.menuBtn, onClick: () => api.createStateMachine('New State Machine'), children: "+ New" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, style: { maxHeight: 150 }, children: api.project.stateMachines.map((sm) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.activeStateMachineId === sm.id ? GameAsset2dEditor_module.selected : ''}`, onClick: () => api.selectStateMachine(sm.id), children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: sm.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [sm.states.length, " states"] })] }, sm.id))) }), activeSM && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.states', 'States') }) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelContent, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelSection, children: [jsxRuntime.jsx(ui.NiceTextInput, { className: GameAsset2dEditor_module.panelInput, placeholder: t('gameAsset2dEditor.stateName', 'State name...'), value: newStateName, onChange: (val) => setNewStateName(val) }), allAnimations.length > 0 && newStateName && (jsxRuntime.jsx(ui.NiceSelect, { className: GameAsset2dEditor_module.panelInput, style: { marginTop: 4 }, onChange: (val) => {
|
|
302
313
|
if (val) {
|
|
303
314
|
api.addState(newStateName, val);
|
|
304
315
|
setNewStateName('');
|
|
@@ -312,7 +323,7 @@ const AnimationStateMachineView = ({ api }) => {
|
|
|
312
323
|
] }))] }), activeSM.states.map((state) => (jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.layerItem} ${api.editorState.selectedStateId === state.id ? GameAsset2dEditor_module.selected : ''} ${activeSM.entryStateId === state.id ? GameAsset2dEditor_module.entry : ''}`, onClick: () => api.selectState(state.id), children: [jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerName, children: [activeSM.entryStateId === state.id && jsxRuntime.jsx(uiCore.NiceIcon, { name: "play", size: 12 }), ' ', state.name] }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.effectRemove, variant: "ghost", size: "sm", onClick: (e) => {
|
|
313
324
|
e.stopPropagation();
|
|
314
325
|
api.removeState(state.id);
|
|
315
|
-
}, "aria-label":
|
|
326
|
+
}, "aria-label": t('gameAsset2dEditor.removeState', 'Remove state'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, state.id)))] })] }))] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.stateGraph, children: activeSM ? (jsxRuntime.jsxs("svg", { width: "100%", height: "100%", children: [jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto", children: jsxRuntime.jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--nice-text-secondary, #4a5a7e)" }) }) }), activeSM.transitions.map((trans) => {
|
|
316
327
|
const from = activeSM.states.find((s) => s.id === trans.fromStateId);
|
|
317
328
|
const to = activeSM.states.find((s) => s.id === trans.toStateId);
|
|
318
329
|
if (!from || !to) {
|
|
@@ -322,11 +333,11 @@ const AnimationStateMachineView = ({ api }) => {
|
|
|
322
333
|
}), activeSM.states.map((state) => {
|
|
323
334
|
var _a, _b;
|
|
324
335
|
return (jsxRuntime.jsx("foreignObject", { x: state.position.x, y: state.position.y, width: 120, height: 50, children: jsxRuntime.jsxs("div", { className: `${GameAsset2dEditor_module.stateNode} ${api.editorState.selectedStateId === state.id ? GameAsset2dEditor_module.selected : ''} ${activeSM.entryStateId === state.id ? GameAsset2dEditor_module.entry : ''}`, onClick: () => api.selectState(state.id), children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.stateNodeName, children: state.name }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.stateNodeAnim, children: (_b = (_a = allAnimations.find((a) => a.id === state.animationId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'No animation' })] }) }, state.id));
|
|
325
|
-
})] })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children:
|
|
336
|
+
})] })) : (jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.createAStateMachineTo', 'Create a state machine to design animation flows') }) })) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelHeader, children: [jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.parameters', 'Parameters') }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.menuBtn, variant: "ghost", size: "sm", onClick: () => api.addParameter('new_param', 'trigger'), disabled: !activeSM, children: "+ Add" })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: activeSM === null || activeSM === void 0 ? void 0 : activeSM.parameters.map((param) => (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.layerItem, children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerOpacity, children: param.type }), jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: param.name }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.effectRemove, variant: "ghost", size: "sm", onClick: () => api.removeParameter(param.id), "aria-label": t('gameAsset2dEditor.removeParameter', 'Remove parameter'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, param.id))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.transitions', 'Transitions') }) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelContent, children: [activeSM === null || activeSM === void 0 ? void 0 : activeSM.transitions.map((trans) => {
|
|
326
337
|
var _a, _b;
|
|
327
338
|
const from = activeSM.states.find((s) => s.id === trans.fromStateId);
|
|
328
339
|
const to = activeSM.states.find((s) => s.id === trans.toStateId);
|
|
329
|
-
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.layerItem, children: [jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerName, children: [(_a = from === null || from === void 0 ? void 0 : from.name) !== null && _a !== void 0 ? _a : '?', "
|
|
340
|
+
return (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.layerItem, children: [jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerName, children: [(_a = from === null || from === void 0 ? void 0 : from.name) !== null && _a !== void 0 ? _a : '?', " ", jsxRuntime.jsx(uiCore.NiceIcon, { name: "arrow-right", size: 12 }), " ", (_b = to === null || to === void 0 ? void 0 : to.name) !== null && _b !== void 0 ? _b : '?'] }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.effectRemove, variant: "ghost", size: "sm", onClick: () => api.removeTransition(trans.id), "aria-label": t('gameAsset2dEditor.removeTransition', 'Remove transition'), children: jsxRuntime.jsx(uiCore.NiceIcon, { name: "close", size: 14 }) })] }, trans.id));
|
|
330
341
|
}), api.editorState.selectedStateId && (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelSection, style: { marginTop: 12 }, children: [jsxRuntime.jsx("label", { className: GameAsset2dEditor_module.panelLabel, children: "Add transition to:" }), jsxRuntime.jsx(ui.NiceSelect, { className: GameAsset2dEditor_module.panelInput, onChange: (val) => {
|
|
331
342
|
if (val && api.editorState.selectedStateId) {
|
|
332
343
|
api.addTransition(api.editorState.selectedStateId, val);
|
|
@@ -340,6 +351,7 @@ const AnimationStateMachineView = ({ api }) => {
|
|
|
340
351
|
EFFECTS PANEL
|
|
341
352
|
──────────────────────────────────────────────────────────────── */
|
|
342
353
|
const EffectsView = ({ api }) => {
|
|
354
|
+
const { t } = i18n.useNiceTranslation();
|
|
343
355
|
const [_currentEffects, _setCurrentEffects] = React.useState([]);
|
|
344
356
|
const [presetName, setPresetName] = React.useState('');
|
|
345
357
|
const effectTypes = [
|
|
@@ -356,12 +368,12 @@ const EffectsView = ({ api }) => {
|
|
|
356
368
|
{ type: 'shadow', label: 'Shadow' },
|
|
357
369
|
{ type: 'palette-swap', label: 'Palette Swap' },
|
|
358
370
|
];
|
|
359
|
-
return (jsxRuntime.jsxs("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children:
|
|
371
|
+
return (jsxRuntime.jsxs("div", { style: { display: 'flex', flex: 1, overflow: 'hidden' }, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.leftPanel, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.addEffect', 'Add Effect') }) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: effectTypes.map(({ type, label }) => (jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.layerItem, variant: "ghost", onClick: () => api.addEffect(type), style: { cursor: 'pointer', border: 'none', textAlign: 'left' }, children: jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: label }) }, type))) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.presets', 'Presets') }) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelContent, children: [jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.panelSection, children: [jsxRuntime.jsx(ui.NiceTextInput, { className: GameAsset2dEditor_module.panelInput, placeholder: t('gameAsset2dEditor.presetName', 'Preset name...'), value: presetName, onChange: (val) => setPresetName(val) }), jsxRuntime.jsx(ui.NiceButton, { className: GameAsset2dEditor_module.btnSecondary, variant: "ghost", style: { marginTop: 4, width: '100%' }, onClick: () => {
|
|
360
372
|
if (presetName) {
|
|
361
373
|
api.saveEffectPreset(presetName);
|
|
362
374
|
setPresetName('');
|
|
363
375
|
}
|
|
364
|
-
}, disabled: !presetName, children:
|
|
376
|
+
}, disabled: !presetName, children: t('gameAsset2dEditor.saveCurrentEffects', 'Save Current Effects') })] }), api.project.effectPresets.map((preset) => (jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.layerItem, onClick: () => api.loadEffectPreset(preset.id), style: { cursor: 'pointer' }, children: [jsxRuntime.jsx("span", { className: GameAsset2dEditor_module.layerName, children: preset.name }), jsxRuntime.jsxs("span", { className: GameAsset2dEditor_module.layerOpacity, children: [preset.effects.length, " effects"] })] }, preset.id)))] })] }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.viewport, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.selectASpriteOrTile', 'Select a sprite or tile to preview effects') }) }) }), jsxRuntime.jsxs("div", { className: GameAsset2dEditor_module.rightPanel, children: [jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelHeader, children: jsxRuntime.jsx("span", { children: t('gameAsset2dEditor.activeEffects', 'Active Effects') }) }), jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.panelContent, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.effectsList, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyState, children: jsxRuntime.jsx("div", { className: GameAsset2dEditor_module.emptyStateText, children: t('gameAsset2dEditor.addEffectsFromTheLeft', 'Add effects from the left panel') }) }) }) })] })] }));
|
|
365
377
|
};
|
|
366
378
|
/* ────────────────────────────────────────────────────────────────
|
|
367
379
|
STATUS BAR
|
|
@@ -392,8 +404,5 @@ const NiceGameAsset2dEditor = ({ className, onSave, onExport, }) => {
|
|
|
392
404
|
};
|
|
393
405
|
return (jsxRuntime.jsx(ui.NiceAppShell, { className: `${GameAsset2dEditor_module.root} ${className || ''}`, flush: true, menubar: jsxRuntime.jsx(MenuBar, { api: api }), toolbar: jsxRuntime.jsx(ModeTabs, { api: api }), statusBar: jsxRuntime.jsx(StatusBar, { api: api }), children: jsxRuntime.jsx("div", { style: { display: 'flex', flexDirection: 'column', minHeight: 0, height: '100%' }, children: renderModeContent() }) }));
|
|
394
406
|
};
|
|
395
|
-
/** @deprecated Use NiceGameAsset2dEditor */
|
|
396
|
-
const GameAsset2dEditor = NiceGameAsset2dEditor;
|
|
397
407
|
|
|
398
|
-
exports.GameAsset2dEditor = GameAsset2dEditor;
|
|
399
408
|
exports.NiceGameAsset2dEditor = NiceGameAsset2dEditor;
|
package/dist/cjs/index.js
CHANGED
|
@@ -73,14 +73,9 @@ var designTools = require('./design/design-tools.js');
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
exports.NicePixelEditor = PixelEditor.NicePixelEditor;
|
|
76
|
-
exports.PixelEditor = PixelEditor.PixelEditor;
|
|
77
76
|
exports.NiceVectorEditor = VectorEditor.NiceVectorEditor;
|
|
78
|
-
exports.VectorEditor = VectorEditor.VectorEditor;
|
|
79
77
|
exports.NicePhotoEditor = PhotoEditor;
|
|
80
|
-
exports.PhotoEditor = PhotoEditor;
|
|
81
|
-
exports.AnimationEditor = AnimationEditor.AnimationEditor;
|
|
82
78
|
exports.NiceAnimationEditor = AnimationEditor.NiceAnimationEditor;
|
|
83
|
-
exports.AnimatedPerson = AnimatedPerson;
|
|
84
79
|
exports.NiceAnimatedPerson = AnimatedPerson;
|
|
85
80
|
exports.ALL_DIRECTIONS = spriteGeneratorCore.ALL_DIRECTIONS;
|
|
86
81
|
exports.applyIsometricProjection = spriteGeneratorCore.applyIsometricProjection;
|
|
@@ -115,8 +110,6 @@ exports.FUR_PALETTES = animalGeneratorPresets.FUR_PALETTES;
|
|
|
115
110
|
exports.SCALE_PALETTES = animalGeneratorPresets.SCALE_PALETTES;
|
|
116
111
|
exports.initAnimalParts = animalGeneratorPresets.initAnimalParts;
|
|
117
112
|
exports.NiceSpriteGeneratorPanel = SpriteGeneratorPanel;
|
|
118
|
-
exports.SpriteGeneratorPanel = SpriteGeneratorPanel;
|
|
119
|
-
exports.GameAsset2dEditor = GameAsset2dEditor.GameAsset2dEditor;
|
|
120
113
|
exports.NiceGameAsset2dEditor = GameAsset2dEditor.NiceGameAsset2dEditor;
|
|
121
114
|
exports.useGameAssetEditor = useGameAssetEditor.useGameAssetEditor;
|
|
122
115
|
exports.NiceI18nProvider = i18n.NiceI18nProvider;
|
|
@@ -190,7 +183,6 @@ exports.booChoreo = choreography.booChoreo;
|
|
|
190
183
|
exports.danceParty = choreography.danceParty;
|
|
191
184
|
exports.showcaseAll = choreography.showcaseAll;
|
|
192
185
|
exports.waveScoreChoreo = choreography.waveScoreChoreo;
|
|
193
|
-
exports.Audience = Audience;
|
|
194
186
|
exports.NiceAudience = Audience;
|
|
195
187
|
exports.attachScoreReactions = karaokeIntegration.attachScoreReactions;
|
|
196
188
|
exports.onScore = karaokeIntegration.onScore;
|
|
@@ -198,12 +190,9 @@ exports.playIntro = karaokeIntegration.playIntro;
|
|
|
198
190
|
exports.reactionForScore = karaokeIntegration.reactionForScore;
|
|
199
191
|
exports.scoreBus = karaokeIntegration.scoreBus;
|
|
200
192
|
exports.simulateScore = karaokeIntegration.simulateScore;
|
|
201
|
-
exports.BodyRenderer = BodyRenderer.BodyRenderer;
|
|
202
|
-
exports.BodyRendererDefault = BodyRenderer.NiceBodyRenderer;
|
|
203
193
|
exports.NiceBodyRenderer = BodyRenderer.NiceBodyRenderer;
|
|
204
194
|
exports.NiceBodyRendererDefault = BodyRenderer.NiceBodyRenderer;
|
|
205
195
|
exports.HEAD_RENDERERS = heads.HEAD_RENDERERS;
|
|
206
|
-
exports.Head = heads.Head;
|
|
207
196
|
exports.NiceHead = heads.NiceHead;
|
|
208
197
|
exports.EYES_RENDERERS = eyes.EYES_RENDERERS;
|
|
209
198
|
exports.Eyes = eyes.Eyes;
|