diff --git a/packages/frontend/src/pages/drop-and-fusion.game.vue b/packages/frontend/src/pages/drop-and-fusion.game.vue index 1ac5e027a..c973b4582 100644 --- a/packages/frontend/src/pages/drop-and-fusion.game.vue +++ b/packages/frontend/src/pages/drop-and-fusion.game.vue @@ -110,6 +110,7 @@ SPDX-License-Identifier: AGPL-3.0-only
SCORE: {{ gameMode === 'yen' ? '円' : 'pt' }}
HIGH SCORE: {{ gameMode === 'yen' ? '円' : 'pt' }}-
+
TOTAL EARNINGS: -
@@ -609,6 +610,7 @@ const dropReady = ref(true); const isGameOver = ref(false); const gameLoaded = ref(false); const highScore = ref(null); +const yenTotal = ref(null); const showConfig = ref(false); const replaying = ref(false); const replayPlaybackRate = ref(1); @@ -1071,6 +1073,15 @@ function attachGameEvents() { logs: DropAndFusionGame.serializeLogs(logs), }); + if (props.gameMode === 'yen') { + yenTotal.value = (yenTotal.value ?? 0) + score.value; + misskeyApi('i/registry/set', { + scope: ['dropAndFusionGame'], + key: 'yenTotal', + value: yenTotal.value, + }); + } + if (score.value > (highScore.value ?? 0)) { highScore.value = score.value; @@ -1135,6 +1146,25 @@ onMounted(async () => { highScore.value = null; } + if (props.gameMode === 'yen') { + try { + yenTotal.value = await misskeyApi('i/registry/get', { + scope: ['dropAndFusionGame'], + key: 'yenTotal', + }); + } catch (err) { + if (err.code === 'NO_SUCH_KEY') { + // nop + } else { + os.alert({ + type: 'error', + text: i18n.ts.cannotLoad, + }); + return; + } + } + } + await start(); const bgmBuffer = await sound.loadAudio('/client-assets/drop-and-fusion/bgm_1.mp3');