|
|
@ -23,7 +23,7 @@ import { computed, onMounted, ref, onBeforeUnmount } from "vue"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
import { Tooltip, Dialog } from "@/components" |
|
|
|
import { Tooltip, Dialog } from "@/components" |
|
|
|
import { menu_icons } from "@/config"; |
|
|
|
import { menu_icons } from "@/config"; |
|
|
|
import { getArchive, AES_CBC_ENCRYPT, AES_CBC_DECRYPT, checkImportArchive, saveArchive } from "@/tool"; |
|
|
|
import { getArchive, AES_CBC_ENCRYPT, AES_CBC_DECRYPT, checkImportArchive, saveArchive, replace, archive_version } from "@/tool"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n(); |
|
|
|
const { t } = useI18n(); |
|
|
@ -33,6 +33,7 @@ const showArchive = computed(() => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
const archive = ref(''); |
|
|
|
const archive = ref(''); |
|
|
|
const key = 'KUf4hM5rThssysJhcRFCfxLR8Imihjl0eMsyhh1M7Wk'; |
|
|
|
const key = 'KUf4hM5rThssysJhcRFCfxLR8Imihjl0eMsyhh1M7Wk'; |
|
|
|
|
|
|
|
let timeOut = 0; |
|
|
|
|
|
|
|
|
|
|
|
const showMenu = () => { |
|
|
|
const showMenu = () => { |
|
|
|
if (showArchive.value) { |
|
|
|
if (showArchive.value) { |
|
|
@ -69,9 +70,23 @@ const importArchive = async () => { |
|
|
|
if (!data || data == 'undfind') { |
|
|
|
if (!data || data == 'undfind') { |
|
|
|
commit('set_sys_info', { msg: t('loadEmpty'), type: 'warning' }); |
|
|
|
commit('set_sys_info', { msg: t('loadEmpty'), type: 'warning' }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (data.version != archive_version) { |
|
|
|
|
|
|
|
commit('set_sys_info', { msg: t('importArchive.3'), type: 'warning' }); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
await checkImportArchive(data); |
|
|
|
await checkImportArchive(data); |
|
|
|
await dispatch('loadGame', data); |
|
|
|
await dispatch('loadGame', data); |
|
|
|
|
|
|
|
if (state.experiential) { |
|
|
|
|
|
|
|
commit('set_sys_info', { msg: replace(t('experiential.0'), [data.experientialTime]), type: 'win' }); |
|
|
|
|
|
|
|
const time = data.experientialTime || 10; |
|
|
|
|
|
|
|
clearTimeout(timeOut); |
|
|
|
|
|
|
|
timeOut = setTimeout(() => { |
|
|
|
|
|
|
|
commit('set_sys_info', { msg: replace(t('experiential.2'), [data.experientialTime]), type: 'warning' }); |
|
|
|
|
|
|
|
dispatch('loadGame'); |
|
|
|
|
|
|
|
}, time * 60 * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
saveArchive(state); |
|
|
|
saveArchive(state); |
|
|
|
|
|
|
|
} |
|
|
|
showMenu(); |
|
|
|
showMenu(); |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
console.log(error); |
|
|
|
console.log(error); |
|
|
@ -85,10 +100,11 @@ const keydown = (e) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
document.addEventListener('keydown', keydown) |
|
|
|
document.addEventListener('keydown', keydown); |
|
|
|
}); |
|
|
|
}); |
|
|
|
onBeforeUnmount(() => { |
|
|
|
onBeforeUnmount(() => { |
|
|
|
document.removeEventListener('keydown', keydown) |
|
|
|
document.removeEventListener('keydown', keydown); |
|
|
|
|
|
|
|
clearTimeout(timeOut); |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { }); |
|
|
|
onMounted(() => { }); |
|
|
|