Commit b93e1471 authored by timel's avatar timel

feat: 按需加载预设卡组

parent 4e1a921f
Pipeline #22924 failed with stages
in 11 minutes and 49 seconds
......@@ -3,12 +3,6 @@ import { proxy } from "valtio";
import { type NeosStore } from "./shared";
// 给玩家预设了几套卡组,一旦idb为空,就会给玩家添加这几套卡组
const PRESET_DECKS: Record<string, { default: Omit<IDeck, "deckName"> }> =
import.meta.glob("/neos-assets/structure-decks/*.ydk", {
eager: true,
});
const IDB_NAME = "decks";
const deckIdb = createStore(IDB_NAME, IDB_NAME);
......@@ -57,6 +51,11 @@ export const deckStore = proxy({
async initialize() {
deckStore.decks = await values<IDeck>(deckIdb);
if (!deckStore.decks.length) {
// 给玩家预设了几套卡组,一旦idb为空,就会给玩家添加这几套卡组
const PRESET_DECKS: Record<string, { default: Omit<IDeck, "deckName"> }> =
import.meta.glob("/neos-assets/structure-decks/*.ydk", {
eager: true,
});
for (const key in PRESET_DECKS) {
const deck = PRESET_DECKS[key].default;
const deckName =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment