Hide catch-up panel and notifications in full-game replay
This commit is contained in:
parent
b4dba345b2
commit
eccf37f68d
7 changed files with 87 additions and 20 deletions
|
|
@ -75,3 +75,5 @@ Viewer 0.1.37 and engine 0.4.46 skip the payment prompt when New Ideas or Synerg
|
|||
Viewer 0.1.38 and engine 0.4.47 explicitly confirm attacks that break Great Diplomat agreements, explaining the 2-culture cost and card discard with resource icons. Capturing an undefended city or settlers now ends the agreement and discards its owner's Great Diplomat, just like a battle with defenders. Empty cities also require the diplomatic payment. Attacks involving a third party preserve the agreement. All supported locales include the confirmation. Publish the matching viewer and engine together.
|
||||
|
||||
Viewer 0.1.39 removes the redundant Cancel button from the diplomatic attack warning. The existing movement controls cancel the move; the warning and explicit attack confirmation remain. Engine 0.4.47 is unchanged.
|
||||
|
||||
Viewer 0.1.40 keeps full-game replay under the BGS toolbar: the extra bottom recap panel and card/objective notifications are hidden while seeking through the game. Battle results remain available, and ongoing-game last-turn recaps keep their controls and notifications. Engine 0.4.47 is unchanged.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.39",
|
||||
"version": "0.1.40",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.39",
|
||||
"version": "0.1.40",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.39",
|
||||
"version": "0.1.40",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1285,7 +1285,7 @@
|
|||
{#if !$session.playback}<ContextualCards {controller} context="after-battle" />{/if}
|
||||
</div>
|
||||
<nav class="table-tools" aria-label="Table controls">
|
||||
{#if lastTurn && !$session.analysis}<button
|
||||
{#if lastTurn && !$session.analysis && !$session.playback}<button
|
||||
class="last-turn-button"
|
||||
title="Replay all actions since your last turn"
|
||||
aria-label="Replay since your last turn"
|
||||
|
|
@ -1717,7 +1717,7 @@
|
|||
use:chatPanel
|
||||
></div>
|
||||
</section>
|
||||
{#if !$session.playback && $session.battles?.length}<div class="live-battle floating-panel">
|
||||
{#if (!$session.playback || $session.playback.range === 'all') && $session.battles?.length}<div class="live-battle floating-panel">
|
||||
<BattlePlayback {controller} />
|
||||
</div>{/if}
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -33,18 +33,18 @@
|
|||
const recap = $derived(playback?.range !== 'all');
|
||||
</script>
|
||||
|
||||
{#if playback}
|
||||
{#if playback && recap}
|
||||
<section class="playback-bar floating-panel" aria-label="Board replay">
|
||||
{#if $session.battles?.length}<BattlePlayback {controller} />{/if}
|
||||
<div class="playback-description" aria-live="polite">
|
||||
<strong
|
||||
><History size={16} />{playback.range === 'all' ? 'Replay' : 'Since your last turn'}
|
||||
><History size={16} />Since your last turn
|
||||
{#if playback.end > playback.start}<span class="playback-progress"
|
||||
>{atStart ? 'Start' : `Action ${progress} of ${count}`}</span
|
||||
>{/if}
|
||||
</strong>
|
||||
<small
|
||||
>{#if atStart && recap}Use Next to step through, or Play to watch.{:else}<ResourceText
|
||||
>{#if atStart}Use Next to step through, or Play to watch.{:else}<ResourceText
|
||||
text={details.caption}
|
||||
compactResources
|
||||
/>{/if}</small
|
||||
|
|
@ -72,15 +72,15 @@
|
|||
>
|
||||
{/if}
|
||||
</div>{/if}
|
||||
{#if recap}<label class="playback-preference" title="Remember this preference for future opponent recaps">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={$session.replayAutoplay}
|
||||
onchange={(event) => controller.setReplayAutoplay(event.currentTarget.checked)}
|
||||
/>Autoplay on return
|
||||
</label>{/if}
|
||||
<label class="playback-preference" title="Remember this preference for future opponent recaps">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={$session.replayAutoplay}
|
||||
onchange={(event) => controller.setReplayAutoplay(event.currentTarget.checked)}
|
||||
/>Autoplay on return
|
||||
</label>
|
||||
<button class="playback-exit" onclick={() => controller.endPlayback()}>
|
||||
{atEnd ? 'Back to game' : recap ? 'Skip' : 'Done'}<X size={15} />
|
||||
{atEnd ? 'Back to game' : 'Skip'}<X size={15} />
|
||||
</button>
|
||||
</section>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -1331,6 +1331,68 @@ test('opponent recap steps animate and pause, replay stays within its turn, and
|
|||
}
|
||||
});
|
||||
|
||||
test('BGS full-game replay clears recap notifications and stays silent while seeking', (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const app = paymentController(),
|
||||
c = app.controller;
|
||||
const report = t.mock.method(c.commands, 'setReplayInfo');
|
||||
try {
|
||||
const effect = { player: 1, kind: 'action' as const, label: 'Drew an action card' };
|
||||
const frames = [
|
||||
{ cursor: 100, actor: 0, title: 'End turn', ended_turn: true },
|
||||
{ cursor: 101, actor: 1, title: 'Research', effects: [effect] },
|
||||
{ cursor: 102, actor: 1, title: 'Collect' },
|
||||
].map((f) => ({ players: [], tiles: [], age: 1, round: 1, ended_turn: false, ...f }));
|
||||
c.patch({
|
||||
game: {
|
||||
state: 'Finished',
|
||||
players: [],
|
||||
map: { tiles: [] },
|
||||
current_player_index: 0,
|
||||
actions_left: 0,
|
||||
age: 1,
|
||||
round: 1,
|
||||
log_index: 0,
|
||||
board_history: { id: 'platform-replay', frames },
|
||||
},
|
||||
seat: 0,
|
||||
});
|
||||
c.replayLastTurn();
|
||||
c.stepPlayback(1);
|
||||
assert.equal(app.session().publicEffects?.length, 1, 'last-turn recap still shows card notifications');
|
||||
c.togglePlayback();
|
||||
|
||||
// The same calls as the viewer's replay:start and replay:to protocol handlers.
|
||||
c.startPlayback();
|
||||
assert.deepEqual(app.session().publicEffects, [], 'entering full replay clears any recap notification');
|
||||
assert.deepEqual(report.mock.calls.at(-1)?.arguments, [{ start: 100, current: 100, end: 102 }]);
|
||||
for (const cursor of [102, 100, 101, 102]) {
|
||||
c.seekPlayback(cursor);
|
||||
assert.equal(app.session().playback!.frame!.cursor, cursor);
|
||||
assert.equal(app.session().playback!.range, 'all');
|
||||
assert.deepEqual(app.session().publicEffects, [], 'seeking does not show recap notifications');
|
||||
assert.deepEqual(report.mock.calls.at(-1)?.arguments, [{ start: 100, current: cursor, end: 102 }]);
|
||||
t.mock.timers.tick(10000);
|
||||
assert.equal(
|
||||
app.session().playback!.frame!.cursor,
|
||||
cursor,
|
||||
'old recap timers cannot advance BGS replay',
|
||||
);
|
||||
}
|
||||
c.endPlayback();
|
||||
c.replayLastTurn();
|
||||
c.stepPlayback(1);
|
||||
assert.equal(
|
||||
app.session().publicEffects?.length,
|
||||
1,
|
||||
'leaving full replay restores normal recap behavior',
|
||||
);
|
||||
assert.deepEqual(app.sent, [], 'replay never submits game moves');
|
||||
} finally {
|
||||
app.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('finished games open on the final state and stop an automatic recap already in progress', async (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const game = JSON.parse(await engine.init(2, [], {}, 'finished-recap', {}));
|
||||
|
|
|
|||
|
|
@ -800,10 +800,13 @@ export class Controller {
|
|||
playing: playing && index < p.end,
|
||||
animate: index !== p.index && !s.reducedMotion,
|
||||
},
|
||||
publicEffects: (index === p.start ? [] : (frames[index].effects ?? [])).map((e, i) => ({
|
||||
...e,
|
||||
key: `replay:${frames[index].cursor}:${i}`,
|
||||
})),
|
||||
// Full-game replay is controlled by the BGS toolbar, without recap notifications.
|
||||
publicEffects: (p.range === 'all' || index === p.start ? [] : (frames[index].effects ?? [])).map(
|
||||
(e, i) => ({
|
||||
...e,
|
||||
key: `replay:${frames[index].cursor}:${i}`,
|
||||
}),
|
||||
),
|
||||
});
|
||||
this.reportPlayback();
|
||||
this.scheduleEffect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue