feat: save games and edit scene darkness
Persist show state to local saves; author map darkness in scene editor with bake-to-scene and help updates. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -105,4 +105,30 @@ export class SceneMarkerStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exportByCard(): Record<string, SceneMarkerStroke[]> {
|
||||
if (this.currentKey !== null) {
|
||||
this.cache.set(this.currentKey, this.state.strokes.map(cloneStroke));
|
||||
}
|
||||
const out: Record<string, SceneMarkerStroke[]> = {};
|
||||
for (const [key, strokes] of this.cache) {
|
||||
if (strokes.length === 0) continue;
|
||||
out[key] = strokes.map(cloneStroke);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
importByCard(byCard: Record<string, SceneMarkerStroke[]>): void {
|
||||
this.cache.clear();
|
||||
this.currentKey = null;
|
||||
this.state = emptyState();
|
||||
for (const [key, strokes] of Object.entries(byCard)) {
|
||||
if (!Array.isArray(strokes) || strokes.length === 0) continue;
|
||||
this.cache.set(key, strokes.map(cloneStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cloneStroke(stroke: SceneMarkerStroke): SceneMarkerStroke {
|
||||
return { ...stroke, points: stroke.points.map((p) => ({ ...p })) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user