@@ -679,9 +679,11 @@ function endReplay() {
|
||||
function exportLog() {
|
||||
if (!logs) return;
|
||||
const data = JSON.stringify({
|
||||
seed: seed,
|
||||
date: new Date().toISOString(),
|
||||
logs: logs,
|
||||
v: game.GAME_VERSION,
|
||||
m: props.gameMode,
|
||||
s: seed,
|
||||
d: new Date().toISOString(),
|
||||
l: DropAndFusionGame.serializeLogs(logs),
|
||||
});
|
||||
copyToClipboard(data);
|
||||
os.success();
|
||||
@@ -723,8 +725,15 @@ function getGameImageDriveFile() {
|
||||
const [frame, logo] = images;
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, game.GAME_WIDTH, game.GAME_HEIGHT);
|
||||
|
||||
ctx.drawImage(frame, 0, 0, game.GAME_WIDTH, game.GAME_HEIGHT);
|
||||
ctx.drawImage(canvasEl.value!, 0, 0, game.GAME_WIDTH, game.GAME_HEIGHT);
|
||||
|
||||
ctx.fillStyle = '#000';
|
||||
ctx.font = '16px bold sans-serif';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.fillText(`SCORE: ${score.value.toLocaleString()}`, 10, 10);
|
||||
|
||||
ctx.globalAlpha = 0.7;
|
||||
ctx.drawImage(logo, game.GAME_WIDTH * 0.55, 6, game.GAME_WIDTH * 0.45, game.GAME_WIDTH * 0.45 * (logo.height / logo.width));
|
||||
ctx.globalAlpha = 1;
|
||||
@@ -765,7 +774,7 @@ async function share() {
|
||||
os.post({
|
||||
initialText: `#BubbleGame
|
||||
MODE: ${props.gameMode}
|
||||
SCORE: ${score.value} (MAX CHAIN: ${maxCombo.value})`,
|
||||
SCORE: ${score.value.toLocaleString()} (MAX CHAIN: ${maxCombo.value})`,
|
||||
initialFiles: [file],
|
||||
instant: true,
|
||||
});
|
||||
@@ -859,6 +868,14 @@ function attachGameEvents() {
|
||||
dropReady.value = false;
|
||||
isGameOver.value = true;
|
||||
|
||||
misskeyApi('bubble-game/register', {
|
||||
seed,
|
||||
score: score.value,
|
||||
gameMode: props.gameMode,
|
||||
gameVersion: game.GAME_VERSION,
|
||||
logs: DropAndFusionGame.serializeLogs(logs),
|
||||
});
|
||||
|
||||
if (score.value > (highScore.value ?? 0)) {
|
||||
highScore.value = score.value;
|
||||
|
||||
|
@@ -39,6 +39,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="$style.frame">
|
||||
<div :class="$style.frameInner">
|
||||
<div class="_gaps_s" style="padding: 16px;">
|
||||
<div><b>{{ i18n.ts.ranking }}</b> ({{ gameMode }})</div>
|
||||
<div v-if="ranking" class="_gaps_s">
|
||||
<div v-for="r in ranking" :key="r.id" :class="$style.rankingRecord">
|
||||
<MkAvatar :link="true" style="width: 24px; height: 24px; margin-right: 4px;" :user="r.user"/>
|
||||
<MkUserName :user="r.user" :nowrap="true"/>
|
||||
<b style="margin-left: auto;">{{ r.score.toLocaleString() }} pt</b>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>{{ i18n.ts.loading }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="$style.frame">
|
||||
<div :class="$style.frameInner" style="padding: 16px;">
|
||||
<div style="font-weight: bold;">{{ i18n.ts._bubbleGame.howToPlay }}</div>
|
||||
@@ -70,17 +85,23 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import XGame from './drop-and-fusion.game.vue';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
|
||||
const gameMode = ref<'normal' | 'square'>('normal');
|
||||
const gameStarted = ref(false);
|
||||
const mute = ref(false);
|
||||
const ranking = ref(null);
|
||||
|
||||
watch(gameMode, async () => {
|
||||
ranking.value = await misskeyApiGet('bubble-game/ranking', { gameMode: gameMode.value });
|
||||
}, { immediate: true });
|
||||
|
||||
async function start() {
|
||||
gameStarted.value = true;
|
||||
@@ -149,4 +170,13 @@ definePageMetadata({
|
||||
border-top: 1px solid #693410;
|
||||
border-bottom: 1px solid #ce8a5c;
|
||||
}
|
||||
|
||||
.rankingRecord {
|
||||
display: flex;
|
||||
line-height: 24px;
|
||||
padding-top: 4px;
|
||||
white-space: nowrap;
|
||||
overflow: visible;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user