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:
@@ -67,6 +67,66 @@ void test('SceneDarknessStore: draft синхронизируется и сбр
|
||||
assert.equal(store.getState().strokes.length, 1);
|
||||
});
|
||||
|
||||
void test('SceneDarknessStore: cache miss берёт seedStrokes из сцены', () => {
|
||||
const store = new SceneDarknessStore();
|
||||
const seed = [
|
||||
{
|
||||
id: 'base1',
|
||||
seed: 7,
|
||||
createdAtMs: 50,
|
||||
points: [{ x: 0.3, y: 0.4, tMs: 50 }],
|
||||
radiusN: 0.06,
|
||||
mode: 'reveal' as const,
|
||||
},
|
||||
];
|
||||
store.switchScene('card_a', true, seed);
|
||||
assert.equal(store.getState().strokes.length, 1);
|
||||
assert.equal(store.getState().strokes[0]?.id, 'base1');
|
||||
store.dispatch({
|
||||
kind: 'stroke.add',
|
||||
stroke: {
|
||||
id: 'session1',
|
||||
seed: 2,
|
||||
createdAtMs: 100,
|
||||
points: [{ x: 0.5, y: 0.5, tMs: 100 }],
|
||||
radiusN: 0.08,
|
||||
mode: 'cover',
|
||||
},
|
||||
});
|
||||
store.switchScene('card_b', true, []);
|
||||
store.switchScene('card_a', true, seed);
|
||||
assert.equal(store.getState().strokes.length, 2);
|
||||
assert.equal(store.getState().strokes[1]?.id, 'session1');
|
||||
});
|
||||
|
||||
void test('SceneDarknessStore: resetSession снова берёт seed', () => {
|
||||
const store = new SceneDarknessStore();
|
||||
const seed = [
|
||||
{
|
||||
id: 'base1',
|
||||
seed: 1,
|
||||
createdAtMs: 10,
|
||||
points: [{ x: 0.1, y: 0.1, tMs: 10 }],
|
||||
radiusN: 0.05,
|
||||
},
|
||||
];
|
||||
store.switchScene('card_a', true, seed);
|
||||
store.dispatch({
|
||||
kind: 'stroke.add',
|
||||
stroke: {
|
||||
id: 's1',
|
||||
seed: 2,
|
||||
createdAtMs: 20,
|
||||
points: [{ x: 0.2, y: 0.2, tMs: 20 }],
|
||||
radiusN: 0.05,
|
||||
},
|
||||
});
|
||||
store.resetSession();
|
||||
store.switchScene('card_a', true, seed);
|
||||
assert.equal(store.getState().strokes.length, 1);
|
||||
assert.equal(store.getState().strokes[0]?.id, 'base1');
|
||||
});
|
||||
|
||||
void test('SceneDarknessStore: cover-штрих сохраняется в кэше сцены', () => {
|
||||
const store = new SceneDarknessStore();
|
||||
store.switchScene('scene_a', true);
|
||||
|
||||
Reference in New Issue
Block a user