diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/ImportOverview.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/ImportOverview.tsx new file mode 100644 index 000000000..1d68da7f1 --- /dev/null +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/ImportOverview.tsx @@ -0,0 +1,68 @@ +import type { Node as UiNode } from '../../../features/ui-editor/types/Node'; +import type { SpriteAsset } from '../../../features/ui-editor/types/SpriteAsset'; +import type { UIDesignImage } from '../../../features/ui-editor/types/UIDesignImage'; +import type { UITree } from '../../../features/ui-editor/types/UITree'; + +function countUiComponents(nodes: UiNode[]): number { + return nodes.reduce( + (total, node) => total + node.components.length + countUiComponents(node.children), + 0, + ); +} + +export function ImportOverview({ + images, + sprites, + uiTrees, +}: { + images: Record; + sprites: Record; + uiTrees: UITree[]; +}) { + const componentCount = uiTrees.reduce( + (total, tree) => total + countUiComponents(tree.children), + 0, + ); + + return ( +
+
+
+ + Overview + +

导入概览

+
+
+
+
+ + {Object.keys(images).length} + + + 界面图数量 + +
+
+ + {Object.keys(sprites).length} + + + 素材数量 + +
+
+ + {componentCount} + + + 已有组件 + +
+
+
+ ); +} diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/InputSidebar.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/InputSidebar.tsx index a760c58b7..370756c29 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/components/InputSidebar.tsx +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/InputSidebar.tsx @@ -1,6 +1,7 @@ import { Image as ImageIcon, Plus } from 'lucide-react'; import type { UiEditorPageController } from '../useUiEditorPage'; +import { ImportOverview } from './ImportOverview'; import { UiTreePanel } from './UiTreePanel'; export function InputSidebar({ controller }: { controller: UiEditorPageController }) { @@ -125,6 +126,12 @@ export function InputSidebar({ controller }: { controller: UiEditorPageControlle + + {activeTool !== 'input' ? ( ) : null}