diff --git a/resources/dist.rc b/resources/dist.rc index 2e847f5..d4b1907 100644 Binary files a/resources/dist.rc and b/resources/dist.rc differ diff --git a/src/celemod-ui/src/context/modManage.tsx b/src/celemod-ui/src/context/modManage.tsx index fb2b83b..144475c 100644 --- a/src/celemod-ui/src/context/modManage.tsx +++ b/src/celemod-ui/src/context/modManage.tsx @@ -1,10 +1,11 @@ import _i18n, { useI18N } from 'src/i18n'; import { callRemote } from '../utils'; import { - useInstalledMods, - useGamePath, - useStorage, - initGamePath, + useInstalledMods, + useGamePath, + useStorage, + initGamePath, + useCurrentEverestVersion, } from '../states'; import { useEffect, useMemo } from 'preact/hooks'; import { createPopup } from 'src/components/Popup'; @@ -13,81 +14,87 @@ import { ProgressIndicator } from 'src/components/Progress'; let lastGamePath = ''; export const createModManageContext = () => { - const { setInstalledMods } = useInstalledMods(); + const { setInstalledMods } = useInstalledMods(); - const [gamePath] = useGamePath(); - const { storage, save } = useStorage(); + const [gamePath] = useGamePath(); - useEffect(() => { - if (!gamePath) return; - if (!storage) return; + const { storage, save } = useStorage(); - storage.root ??= {}; - storage.root.lastGamePath = gamePath; - console.log('saving game path', gamePath); - save(); - }, [gamePath, storage]); + useEffect(() => { + if (!gamePath) return; + if (!storage) return; - initGamePath(); + storage.root ??= {}; + storage.root.lastGamePath = gamePath; + console.log('saving game path', gamePath); + save(); + }, [gamePath, storage]); - const ctx = { - reloadMods: () => { - return new Promise((rs, rj) => { - if (!gamePath) { - console.warn('game path not set'); - rj('game path not set'); - return; - } - callRemote('get_installed_mods', gamePath + '/Mods', (data: string) => { - console.log('mod reload finished'); - const da = JSON.parse(data); - rs(da); - setInstalledMods(da); - }); - }); - }, - gamePath, - modsPath: gamePath + '/Mods', - }; + initGamePath(); + + const ctx = { + reloadMods: () => { + return new Promise((rs, rj) => { + if (!gamePath) { + console.warn('game path not set'); + rj('game path not set'); + return; + } + callRemote('get_installed_mods', gamePath + '/Mods', (data: string) => { + console.log('mod reload finished'); + const da = JSON.parse(data); + rs(da); + setInstalledMods(da); + }); + }); + }, + gamePath, + modsPath: gamePath + '/Mods', + }; - // WHY THE FUCK useEffect doesn't trigger here - if (lastGamePath !== gamePath) { - lastGamePath = gamePath; + // WHY THE FUCK useEffect doesn't trigger here + if (lastGamePath !== gamePath) { + lastGamePath = gamePath; - if (gamePath) { - setTimeout(() => { - const popup = createPopup( - () => { - return ( -
{_i18n.t('请检查游戏路径是否正确,或网络连接是否正常')}
-{_i18n.t('部分功能将不可用')}
-{e}
-{_i18n.t('请检查游戏路径是否正确,或网络连接是否正常')}
+{_i18n.t('部分功能将不可用')}
+{e}
+