migtrate cookie to pudding
This commit is contained in:
parent
e2ff9e065c
commit
816a8bd298
25 changed files with 52 additions and 52 deletions
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
|
@ -7,9 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div>
|
||||
<div v-if="game.ready" :class="$style.game">
|
||||
<div :class="$style.cps" class="">{{ number(cps) }}cps</div>
|
||||
<div :class="$style.count" class=""><i class="ti ti-cookie" style="font-size: 70%;"></i> {{ number(cookies) }}</div>
|
||||
<div :class="$style.count" class=""><i class="ti ti-cookie" style="font-size: 70%;"></i> {{ number(puddings) }}</div>
|
||||
<button v-click-anime class="_button" @click="onClick">
|
||||
<img src="/client-assets/cookie.png" :class="$style.img">
|
||||
<img src="/client-assets/pudding.png" :class="$style.img">
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
|
|
@ -28,29 +28,29 @@ import number from '@/filters/number.js';
|
|||
import { claimAchievement } from '@/scripts/achievements.js';
|
||||
|
||||
const saveData = game.saveData;
|
||||
const cookies = computed(() => saveData.value?.cookies);
|
||||
const puddings = computed(() => saveData.value?.puddings);
|
||||
let cps = $ref(0);
|
||||
let prevCookies = $ref(0);
|
||||
let prevPuddings = $ref(0);
|
||||
|
||||
function onClick(ev: MouseEvent) {
|
||||
const x = ev.clientX;
|
||||
const y = ev.clientY;
|
||||
os.popup(MkPlusOneEffect, { x, y }, {}, 'end');
|
||||
|
||||
saveData.value!.cookies++;
|
||||
saveData.value!.totalCookies++;
|
||||
saveData.value!.totalHandmadeCookies++;
|
||||
saveData.value!.puddings++;
|
||||
saveData.value!.totalPuddings++;
|
||||
saveData.value!.totalHandmadePuddings++;
|
||||
saveData.value!.clicked++;
|
||||
|
||||
if (cookies.value === 1) {
|
||||
claimAchievement('cookieClicked');
|
||||
if (puddings.value === 1) {
|
||||
claimAchievement('puddingClicked');
|
||||
}
|
||||
}
|
||||
|
||||
useInterval(() => {
|
||||
const diff = saveData.value!.cookies - prevCookies;
|
||||
const diff = saveData.value!.puddings - prevPuddings;
|
||||
cps = diff;
|
||||
prevCookies = saveData.value!.cookies;
|
||||
prevPuddings = saveData.value!.puddings;
|
||||
}, 1000, {
|
||||
immediate: false,
|
||||
afterMounted: true,
|
||||
|
|
@ -63,7 +63,7 @@ useInterval(game.save, 1000 * 5, {
|
|||
|
||||
onMounted(async () => {
|
||||
await game.load();
|
||||
prevCookies = saveData.value!.cookies;
|
||||
prevPuddings = saveData.value!.puddings;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import MkClickerGame from '@/components/MkClickerGame.vue';
|
|||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
|
||||
definePageMetadata({
|
||||
title: '🍪👈',
|
||||
title: '🍮👈',
|
||||
icon: 'ti ti-cookie',
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export const ACHIEVEMENT_TYPES = [
|
|||
'clickedClickHere',
|
||||
'justPlainLucky',
|
||||
'setNameToSyuilo',
|
||||
'cookieClicked',
|
||||
'puddingClicked',
|
||||
'brainDiver',
|
||||
'smashTestNotificationButton',
|
||||
'tutorialCompleted',
|
||||
|
|
@ -446,7 +446,7 @@ export const ACHIEVEMENT_BADGES = {
|
|||
bg: 'linear-gradient(0deg, rgb(255 144 144), rgb(255 232 168))',
|
||||
frame: 'silver',
|
||||
},
|
||||
'cookieClicked': {
|
||||
'puddingClicked': {
|
||||
img: '/fluent-emoji/1f36a.png',
|
||||
bg: 'linear-gradient(0deg, rgb(187 183 59), rgb(255 143 77))',
|
||||
frame: 'bronze',
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import * as os from '@/os.js';
|
|||
|
||||
type SaveData = {
|
||||
gameVersion: number;
|
||||
cookies: number;
|
||||
totalCookies: number;
|
||||
totalHandmadeCookies: number;
|
||||
puddings: number;
|
||||
totalPuddings: number;
|
||||
totalHandmadePuddings: number;
|
||||
clicked: number;
|
||||
achievements: any[];
|
||||
facilities: any[];
|
||||
|
|
@ -31,9 +31,9 @@ export async function load() {
|
|||
if (err.code === 'NO_SUCH_KEY') {
|
||||
saveData.value = {
|
||||
gameVersion: 2,
|
||||
cookies: 0,
|
||||
totalCookies: 0,
|
||||
totalHandmadeCookies: 0,
|
||||
puddings: 0,
|
||||
totalPuddings: 0,
|
||||
totalHandmadePuddings: 0,
|
||||
clicked: 0,
|
||||
achievements: [],
|
||||
facilities: [],
|
||||
|
|
@ -48,9 +48,9 @@ export async function load() {
|
|||
if (saveData.value.gameVersion === 1) {
|
||||
saveData.value = {
|
||||
gameVersion: 2,
|
||||
cookies: saveData.value.cookies,
|
||||
totalCookies: saveData.value.cookies,
|
||||
totalHandmadeCookies: saveData.value.cookies,
|
||||
puddings: saveData.value.puddings,
|
||||
totalPuddings: saveData.value.puddings,
|
||||
totalHandmadePuddings: saveData.value.puddings,
|
||||
clicked: saveData.value.clicked,
|
||||
achievements: [],
|
||||
facilities: [],
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function toolsMenuItems(): MenuItem[] {
|
|||
}, {
|
||||
type: 'link',
|
||||
to: '/clicker',
|
||||
text: '🍪👈',
|
||||
text: '🍮👈',
|
||||
icon: 'ti ti-cookie',
|
||||
}, ($i && ($i.isAdmin || $i.policies.canManageCustomEmojis)) ? {
|
||||
type: 'link',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue