enhance(drop-and-fusion): refactor and new mode(wip)
This commit is contained in:
parent
920888ed2a
commit
4846ab077b
45 changed files with 1992 additions and 48 deletions
|
@ -27,6 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<option value="normal">NORMAL</option>
|
||||
<option value="square">SQUARE</option>
|
||||
<option value="yen">YEN</option>
|
||||
<!--<option value="sweets">SWEETS</option>-->
|
||||
</MkSelect>
|
||||
<MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton>
|
||||
</div>
|
||||
|
@ -48,7 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<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() }} {{ gameMode === 'yen' ? '円' : 'pt' }}</b>
|
||||
<b style="margin-left: auto;">{{ r.score.toLocaleString() }} {{ getScoreUnit(gameMode) }}</b>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>{{ i18n.ts.loading }}</div>
|
||||
|
@ -84,7 +85,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { computed, 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';
|
||||
|
@ -93,7 +94,7 @@ import MkSelect from '@/components/MkSelect.vue';
|
|||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
|
||||
const gameMode = ref<'normal' | 'square' | 'yen'>('normal');
|
||||
const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets'>('normal');
|
||||
const gameStarted = ref(false);
|
||||
const mute = ref(false);
|
||||
const ranking = ref(null);
|
||||
|
@ -102,6 +103,14 @@ watch(gameMode, async () => {
|
|||
ranking.value = await misskeyApiGet('bubble-game/ranking', { gameMode: gameMode.value });
|
||||
}, { immediate: true });
|
||||
|
||||
function getScoreUnit(gameMode: string) {
|
||||
return gameMode === 'normal' ? 'pt' :
|
||||
gameMode === 'square' ? 'pt' :
|
||||
gameMode === 'yen' ? '円' :
|
||||
gameMode === 'sweets' ? 'kcal' :
|
||||
'' as never;
|
||||
}
|
||||
|
||||
async function start() {
|
||||
gameStarted.value = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue