Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(editor): Scenes-in-build list in the Package Project dialog

yhh179e56b2256b
diff --git a/desktop/src/components/BuildDialog.tsx b/desktop/src/components/BuildDialog.tsx
index 2692db4fa..52c989260 100644
--- a/desktop/src/components/BuildDialog.tsx
+++ b/desktop/src/components/BuildDialog.tsx
@@ -11,7 +11,7 @@
* / Playable) are live.
*/
import { useState, useSyncExternalStore } from 'react';
-import { Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy, ExternalLink } from 'lucide-react';
+import { Loader2, FolderOpen, CheckCircle2, AlertCircle, Boxes, Info, Copy, ExternalLink, Play } from 'lucide-react';
import { Modal } from '@/components/Modal';
import { Segmented } from '@/components/Segmented';
import { ProjectStore } from '@/project/ProjectStore';
@@ -104,6 +104,16 @@ export function BuildDialog() {
const def = PLATFORMS.find((p) => p.id === platform)!;
const running = phase === 'running';
+ // The build's scene set, mirroring the exporter's discovery: every scene
+ // under the project's scenes dir (plus the entry wherever it lives), entry
+ // first. Reads the live asset index, so it tracks file changes.
+ const scenesDir = project?.layout?.scenes ?? 'assets/scenes';
+ const excludedScenes = new Set(project?.packaging?.excludeScenes ?? []);
+ const sceneList = ProjectStore.listAssets()
+ .filter((a) => a.type === 'scene' && (a.path.startsWith(`${scenesDir}/`) || a.path === project?.defaultScene))
+ .sort((a, b) =>
+ a.path === project?.defaultScene ? -1 : b.path === project?.defaultScene ? 1 : a.path.localeCompare(b.path));
+
const pickPlatform = (p: PlatformDef) => {
if (!p.ready) return;
setPlatform(p.id);
@@ -264,8 +274,43 @@ export function BuildDialog() {
</div>
)}
- <div className="build__summary">
- Entry: <strong>{project?.defaultScene ?? '—'}</strong>
+ {/* Scenes in build — the same single source the exporters read
+ (defaultScene + packaging.excludeScenes), edited in place. The
+ startup scene is pinned: it boots the game, so it always ships. */}
+ <div className="build__scenes">
+ <div className="build__scenes-head">Scenes in build</div>
+ {sceneList.map((s) => {
+ const isEntry = s.path === project?.defaultScene;
+ const ships = isEntry || !excludedScenes.has(s.path);
+ return (
+ <div key={s.path} className={`build__scene${ships ? '' : ' is-excluded'}`}>
+ <button
+ type="button"
+ className={`build__scene-start${isEntry ? ' is-on' : ''}`}
+ title={isEntry ? 'Startup scene' : 'Set as startup scene'}
+ aria-label={isEntry ? 'Startup scene' : `Set ${s.name} as startup scene`}
+ disabled={running || isEntry}
+ onClick={() => void ProjectStore.setDefaultScene(s.path)}
+ >
+ <Play size={11} strokeWidth={2.5} />
+ </button>
+ <label className="build__scene-row">
+ <input
+ type="checkbox"
+ checked={ships}
+ disabled={running || isEntry}
+ onChange={(e) => void ProjectStore.setSceneExcluded(s.path, !e.target.checked)}
+ />
+ <span className="build__scene-name">{s.name.replace(/\.esscene$/i, '')}</span>
+ <span className="build__scene-path mono">{s.path}</span>
+ </label>
+ </div>
+ );
+ })}
+ {sceneList.length === 0 && <div className="build__scenes-empty">No scenes found under the project's scenes folder.</div>}
+ {platform === 'playable' && sceneList.length > 1 && (
+ <div className="build__scenes-note">Playable ships the startup scene only — a size-capped single file.</div>
+ )}
</div>
{phase !== 'idle' && (
diff --git a/desktop/src/theme/menus.css b/desktop/src/theme/menus.css
index d05e4c12b..518189f43 100644
--- a/desktop/src/theme/menus.css
+++ b/desktop/src/theme/menus.css
@@ -163,6 +163,19 @@
.build__opt { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-dim); cursor: pointer; }
.build__summary { font-size: var(--fs-xs); color: var(--text-mute); }
.build__summary strong { color: var(--text-dim); font-family: var(--mono); }
+/* Scenes in build — the exporter's scene set (startup pinned, exclusions live). */
+.build__scenes { display: flex; flex-direction: column; gap: 2px; max-height: 148px; overflow-y: auto; padding: 6px 8px; background: var(--srf-3); border: 1px solid var(--border-line); border-radius: var(--r-sm); }
+.build__scenes-head { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-mute); padding-bottom: 3px; }
+.build__scene { display: flex; align-items: center; gap: 6px; height: 24px; }
+.build__scene-start { display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-xs); color: transparent; background: none; }
+.build__scene-start.is-on { color: var(--star-hi); }
+.build__scene:hover .build__scene-start:not(.is-on):not(:disabled) { color: var(--text-mute); }
+.build__scene-start:not(.is-on):not(:disabled):hover { color: var(--star-hi); background: var(--srf-4); }
+.build__scene-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text); cursor: pointer; }
+.build__scene-name { flex-shrink: 0; }
+.build__scene-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-2xs); color: var(--text-mute); }
+.build__scene.is-excluded .build__scene-name, .build__scene.is-excluded .build__scene-path { color: var(--text-mute); text-decoration: line-through; }
+.build__scenes-empty, .build__scenes-note { font-size: var(--fs-2xs); color: var(--text-mute); padding: 2px 0; }
.build__status { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 9px 11px; border-radius: var(--r-sm); font-size: var(--fs-xs); background: var(--srf-3); color: var(--text-dim); word-break: break-all; }
.build__status-line { display: flex; align-items: center; gap: 7px; }
.build__status.done .build__status-line { color: var(--run-hi); }