修复自动缩放失效的bug

This commit is contained in:
unanmed 2023-04-24 17:27:36 +08:00
parent 0ad9158bd2
commit 5e3f143db9
4 changed files with 4 additions and 10 deletions

View File

@ -328,7 +328,7 @@ main.prototype.init = async function (mode, callback) {
].forEach(function (t) {
coreData[t] = main[t];
});
core.init(coreData, callback);
await core.init(coreData, callback);
core.resize();
main.core = core;

View File

@ -44,6 +44,7 @@ let shopOpened = false;
let openedShopId = '';
core.registerReplayAction('openShop', name => {
if (!name.startsWith('openShop:')) return false;
if (shopOpened) return false;
openedShopId = name.slice(9);
shopOpened = true;
core.replay();

2
src/types/core.d.ts vendored
View File

@ -1070,7 +1070,7 @@ interface Core extends Pick<Main, CoreDataFromMain> {
* @param coreData
* @param callback
*/
init(coreData: MainData, callback?: () => void): void;
init(coreData: MainData, callback?: () => void): Promise<void>;
/**
* @deprecated

View File

@ -175,10 +175,6 @@ import { isMobile } from '../plugin/use';
import BoxAnimate from '../components/boxAnimate.vue';
import { KeyCode } from '../plugin/keyCodes';
import { sleep } from 'mutate-animate';
import {
completeAchievement,
hasCompletedAchievement
} from '../plugin/ui/achievement';
const id = core.plugin.openedShopId;
const shop = core.status.shops[core.plugin.openedShopId] as ItemShopEvent;
@ -201,8 +197,6 @@ const count = ref(0);
const nowMoney = ref(core.status.hero.money);
const update = ref(false);
let achiN = 0;
let bought = false;
watch(count, n => {
@ -248,10 +242,8 @@ function confirm() {
if (count.value === 0) {
return;
}
achiN = 0;
const money = core.status.hero.money;
bought = true;
core.status.route.push(`openShop:${id}`);
if (mode.value === 'buy') {
if (cost.value <= money) {
core.getItem(item.value.id, count.value);
@ -319,6 +311,7 @@ onMounted(async () => {
if (core.plugin.transition.value) await sleep(600);
document.addEventListener('keyup', keyup);
document.addEventListener('keydown', keydown);
core.status.route.push(`openShop:${id}`);
});
onUnmounted(() => {