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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): platform shortcuts, version single-source, recents dedup, accent family
yhhde0f958623fb
diff --git a/desktop/electron/launcher.ts b/desktop/electron/launcher.tsindex 0c628a450..1eda70ada 100644--- a/desktop/electron/launcher.ts+++ b/desktop/electron/launcher.ts@@ -60,12 +60,26 @@ async function manifestBuild(root: string): Promise<string | undefined> {}}-/** Recent projects, newest first, with stale entries (no manifest) dropped. */+/** Canonical identity of a project root: resolved to one absolute spelling and+ * case-folded on Windows (its paths are case-insensitive). Entries keep their+ * stored spelling for display — only comparisons go through this, so the same+ * folder opened as `F:\x` and `F:/x` is one recent, not two. */+function canonRoot(root: string): string {+ const r = path.resolve(root);+ return process.platform === 'win32' ? r.toLowerCase() : r;+}++/** Recent projects, newest first, with stale entries (no manifest) dropped and+ * spelling-variant duplicates collapsed to their newest entry. */export async function listRecents(): Promise<RecentEntry[]> {const stored = await readStored();+ const seen = new Set<string>();const out: RecentEntry[] = [];for (const r of stored) {if (!r?.root || !existsSync(path.join(r.root, PROJECT_MANIFEST_FILE))) continue;+ const key = canonRoot(r.root);+ if (seen.has(key)) continue;+ seen.add(key);out.push({ ...r, build: await manifestBuild(r.root), thumbnail: await thumbnailUrl(r.root) });}return out;@@ -73,15 +87,17 @@ export async function listRecents(): Promise<RecentEntry[]> {/** Record a freshly-opened project at the top of the recents list (de-duped, newest first). */export async function addRecent(root: string, name: string): Promise<void> {- const stored = (await readStored()).filter((r) => r.root !== root);- stored.unshift({ root, name, openedAt: Date.now() });+ const key = canonRoot(root);+ const stored = (await readStored()).filter((r) => !!r?.root && canonRoot(r.root) !== key);+ stored.unshift({ root: path.resolve(root), name, openedAt: Date.now() });await writeFile(recentsFile(), JSON.stringify(stored.slice(0, MAX_RECENTS), null, 2));}/** Drop a project from the recents list. The project on disk is untouched — this* only forgets it in the launcher (the user's explicit "remove from recents"). */export async function removeRecent(root: string): Promise<void> {- const stored = (await readStored()).filter((r) => r.root !== root);+ const key = canonRoot(root);+ const stored = (await readStored()).filter((r) => !!r?.root && canonRoot(r.root) !== key);await writeFile(recentsFile(), JSON.stringify(stored, null, 2));}diff --git a/desktop/src/commands/keybinding.ts b/desktop/src/commands/keybinding.tsindex f5b294489..7196bce3c 100644--- a/desktop/src/commands/keybinding.ts+++ b/desktop/src/commands/keybinding.ts@@ -70,6 +70,10 @@ export function chordMatches(e: KeyboardEvent, kb: Keybinding): boolean {return list.some((k) => normalizeChord(k) === chord);}+/** Platform command-key prefix for composing compact hints (e.g. `${MOD_LABEL}C`):+ * '⌘' on macOS, 'Ctrl+' elsewhere. Prefer formatKeybinding for full chords. */+export const MOD_LABEL = IS_MAC ? '⌘' : 'Ctrl+';+function displayKey(key: string): string {const map: Record<string, string> = {delete: IS_MAC ? '⌫' : 'Del',diff --git a/desktop/src/launcher/Launcher.tsx b/desktop/src/launcher/Launcher.tsxindex c5ee145c6..3c8862d64 100644--- a/desktop/src/launcher/Launcher.tsx+++ b/desktop/src/launcher/Launcher.tsx@@ -6,6 +6,7 @@ import { useEditorStore } from '@/store/editorStore';import { ProjectStore } from '@/project/ProjectStore';import { WindowControls } from '@/layout/WindowControls';import type { RecentEntry, TemplateEntry } from '@/project/format';+import { version } from '../../package.json';// Project browser shown before a project is open. A hub layout — persistent top// actions, a build-aware project list with grid/list views, and a template@@ -155,8 +156,8 @@ function RecentView({<buttontype="button"className="proj-card__remove"- title="从最近列表移除"- aria-label="从最近列表移除"+ title="Remove from recents"+ aria-label="Remove from recents"onClick={(e) => { e.stopPropagation(); onRemove(p.root); }}><X size={13} strokeWidth={2} />@@ -189,8 +190,8 @@ function RecentView({<buttontype="button"className="proj-row__remove"- title="从最近列表移除"- aria-label="从最近列表移除"+ title="Remove from recents"+ aria-label="Remove from recents"onClick={(e) => { e.stopPropagation(); onRemove(p.root); }}><X size={13} strokeWidth={2} />@@ -391,7 +392,7 @@ export function Launcher() {</nav><div className="lc-rail__foot"><Constellation />- <span className="mono">v0.4.0 · web</span>+ <span className="mono">v{version}</span></div></aside>diff --git a/desktop/src/layout/StatusBar.tsx b/desktop/src/layout/StatusBar.tsxindex 62d31cb00..cebcde789 100644--- a/desktop/src/layout/StatusBar.tsx+++ b/desktop/src/layout/StatusBar.tsx@@ -8,6 +8,7 @@ import { StatsStore } from '@/engine/StatsStore';import { EngineHost } from '@/engine/EngineHost';import { SubsystemIndicator } from './SubsystemIndicator';import { Perf } from '@/components/Perf';+import { version } from '../../package.json';const formatMb = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);@@ -83,7 +84,7 @@ export function StatusBar() {<Cpu size={11} strokeWidth={1.85} />{EngineHost.activeBackend === 'webgpu' ? 'WebGPU' : 'WebGL2'}</span>- <span className="sitem smute">esengine 0.10.0</span>+ <span className="sitem smute">esengine {version}</span></footer>);}diff --git a/desktop/src/panels/Outliner.tsx b/desktop/src/panels/Outliner.tsxindex 9ead3d25e..1ce175ab6 100644--- a/desktop/src/panels/Outliner.tsx+++ b/desktop/src/panels/Outliner.tsx@@ -11,6 +11,7 @@ import { SceneModel } from '@/engine/SceneModel';import { PlayInspect } from '@/engine/PlayInspect';import { ProjectStore } from '@/project/ProjectStore';import { ContextMenu, type MenuItem } from '@/components/Menu';+import { formatKeybinding } from '@/commands/keybinding';import { VirtualTree } from '@/components/VirtualTree';import { buildOutlinerItems, collectExpandableKeys, entityKey, folderKey, parseQuery, type OutlinerItem } from '@/outliner/OutlinerModel';import { useOutliner } from '@/outliner/OutlinerController';@@ -502,7 +503,7 @@ export function Outliner() {{ label: 'Rename', shortcut: 'F2', onClick: () => setRenaming(entityKey(id)) },{label: 'Duplicate',- shortcut: '⌘D',+ shortcut: formatKeybinding('mod+d'),onClick: () => {const d = SceneCommands.duplicateEntity(id);if (d != null) select(d);@@ -511,7 +512,7 @@ export function Outliner() {{ label: 'Create Prefab', onClick: () => void ProjectStore.createPrefabFromEntity(id) },{label: 'Delete',- shortcut: '⌫',+ shortcut: formatKeybinding('delete'),onClick: () => {selectionOrTarget(id).forEach((i) => SceneCommands.deleteEntity(i));select(null);diff --git a/desktop/src/settings/editorSettings.ts b/desktop/src/settings/editorSettings.tsindex 3e9e59c46..35fb4a0ad 100644--- a/desktop/src/settings/editorSettings.ts+++ b/desktop/src/settings/editorSettings.ts@@ -29,6 +29,20 @@ settingsRegistry.registerSection({ id: 'console', label: 'Console', category: 'esettingsRegistry.registerSection({ id: 'renderer', label: 'Renderer', category: 'editor', order: 6 });// ── Appearance (store-owned, applied via CSS) ───────────────────────────────+// The accent is a family, not one color — hover/pressed shades and the+// translucent selection/focus tints all derive from the chosen hue. On the+// default azure the overrides are removed so the hand-tuned tokens.css values+// stay pixel-exact; other accents derive their shades numerically.+const ACCENT_DEFAULT = '#2f88d6';+const ACCENT_VARS = ['--star', '--acc', '--star-hi', '--star-deep', '--star-dim', '--star-soft', '--star-line'];++function hexToRgb(hex: string): [number, number, number] | null {+ const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());+ if (!m) return null;+ const n = parseInt(m[1], 16);+ return [(n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff];+}+settingsRegistry.register({id: 'appearance.accent',type: 'color',@@ -37,11 +51,26 @@ settingsRegistry.register({group: 'Appearance',label: 'Accent color',description: 'Used for selection, active controls, and focus.',- default: '#2f88d6',- swatches: ['#2f88d6', '#46b08c', '#b272d6', '#e08c43', '#c75d6e'],+ default: ACCENT_DEFAULT,+ swatches: [ACCENT_DEFAULT, '#46b08c', '#b272d6', '#e08c43', '#c75d6e'],effect: (v) => {+ const rgb = hexToRgb(v);+ if (!rgb || v.toLowerCase() === ACCENT_DEFAULT) {+ for (const p of ACCENT_VARS) root().removeProperty(p);+ return;+ }+ const [r, g, b] = rgb;+ const toward = (t: number) =>+ t >= 0+ ? `rgb(${rgb.map((c) => Math.round(c + (255 - c) * t)).join(' ')})`+ : `rgb(${rgb.map((c) => Math.round(c * (1 + t))).join(' ')})`;root().setProperty('--star', v);root().setProperty('--acc', v);+ root().setProperty('--star-hi', toward(0.16));+ root().setProperty('--star-deep', toward(-0.25));+ root().setProperty('--star-dim', `rgba(${r}, ${g}, ${b}, 0.18)`);+ root().setProperty('--star-soft', `rgba(${r}, ${g}, ${b}, 0.3)`);+ root().setProperty('--star-line', `rgba(${r}, ${g}, ${b}, 0.55)`);},});