Commit bce465aa authored by timel's avatar timel

fix: minimal probability of card deck not found

parent c521af67
Pipeline #21159 passed with stages
in 10 minutes and 38 seconds
...@@ -8,7 +8,8 @@ const DECKS: Record<string, { default: IDeck }> = import.meta.glob( ...@@ -8,7 +8,8 @@ const DECKS: Record<string, { default: IDeck }> = import.meta.glob(
export const DeckManager = _objToMap( export const DeckManager = _objToMap(
Object.keys(DECKS).map((key) => ({ Object.keys(DECKS).map((key) => ({
...DECKS[key].default, ...DECKS[key].default,
deckName: key.split("/").pop()?.split(".")[0] ?? "undefined", deckName:
key.split("/").pop()?.split(".").slice(0, -1).join(".") ?? "undefined",
})) }))
); );
......
...@@ -11,14 +11,14 @@ interface DefaultsConfig { ...@@ -11,14 +11,14 @@ interface DefaultsConfig {
const defaultConfig: DefaultsConfig = { const defaultConfig: DefaultsConfig = {
defaultPlayer: "", defaultPlayer: "",
// 无需考虑undefined的情况,如果为undefined,界面上会显示【请选择】 defaultDeck: "",
defaultDeck: VITE_AI_MODE_DEFAULT_DECK,
defaultPassword: "", defaultPassword: "",
defaultMora: "scissors", defaultMora: "scissors",
}; };
const aiModeConfig: DefaultsConfig = { const aiModeConfig: DefaultsConfig = {
...defaultConfig, ...defaultConfig,
defaultDeck: VITE_AI_MODE_DEFAULT_DECK || "Hero",
defaultPlayer: `AiKiller${Math.random().toString(36).slice(2)}}`, defaultPlayer: `AiKiller${Math.random().toString(36).slice(2)}}`,
defaultPassword: "AI", defaultPassword: "AI",
}; };
......
...@@ -275,7 +275,6 @@ const WaitRoom = () => { ...@@ -275,7 +275,6 @@ const WaitRoom = () => {
<Space wrap size={16}> <Space wrap size={16}>
<Select <Select
placeholder="请选择卡组" placeholder="请选择卡组"
defaultValue={defaultDeck}
onChange={handleChoseDeck} onChange={handleChoseDeck}
options={decks} options={decks}
style={{ width: 160 }} style={{ width: 160 }}
......
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