From 87ffc672ddac7007b7b7c7a7dbe41fbc15b9c14c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 12 Jan 2024 21:01:38 +0900 Subject: [PATCH] =?UTF-8?q?enhance(drop-and-fusion):=20yen=E3=83=A2?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=A7=E7=94=9F=E6=B6=AF=E3=81=A7=E7=A8=BC?= =?UTF-8?q?=E3=81=84=E3=81=A0=E9=A1=8D=E3=82=92=E8=A8=98=E9=8C=B2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/drop-and-fusion.game.vue | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/frontend/src/pages/drop-and-fusion.game.vue b/packages/frontend/src/pages/drop-and-fusion.game.vue index 1ac5e027a4..c973b4582b 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');