Commit 540efd5a authored by Chunchi Che's avatar Chunchi Che

fix clear idle cmds

parent d70ae0ee
Pipeline #27001 passed with stages
in 11 minutes and 35 seconds
...@@ -22,6 +22,7 @@ import { ...@@ -22,6 +22,7 @@ import {
displaySimpleSelectCardsModal, displaySimpleSelectCardsModal,
} from "../../Message"; } from "../../Message";
import { import {
clearAllIdleInteractivities,
clearSelectInfo, clearSelectInfo,
interactTypeToIcon, interactTypeToIcon,
interactTypeToString, interactTypeToString,
...@@ -161,6 +162,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => { ...@@ -161,6 +162,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
// 单卡: 直接召唤/特殊召唤/... // 单卡: 直接召唤/特殊召唤/...
const card = cards[0]; const card = cards[0];
sendSelectIdleCmdResponse(getNonEffectResponse(action, card)); sendSelectIdleCmdResponse(getNonEffectResponse(action, card));
clearAllIdleInteractivities();
} else { } else {
// 场地: 选择卡片 // 场地: 选择卡片
// TODO: hint // TODO: hint
...@@ -171,7 +173,10 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => { ...@@ -171,7 +173,10 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
response: getNonEffectResponse(action, card), response: getNonEffectResponse(action, card),
})), })),
}); });
sendSelectIdleCmdResponse(option[0].response!); if (option.length > 0) {
sendSelectIdleCmdResponse(option[0].response!);
clearAllIdleInteractivities();
}
} }
}, },
}), }),
......
...@@ -26,20 +26,15 @@ import { ...@@ -26,20 +26,15 @@ import {
sendSurrender, sendSurrender,
ygopro, ygopro,
} from "@/api"; } from "@/api";
import { cardStore, ChainSetting, matStore } from "@/stores"; import { ChainSetting, matStore } from "@/stores";
import { IconFont } from "@/ui/Shared"; import { IconFont } from "@/ui/Shared";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import PhaseType = ygopro.StocGameMessage.MsgNewPhase.PhaseType; import PhaseType = ygopro.StocGameMessage.MsgNewPhase.PhaseType;
import { clearSelectInfo } from "../../utils"; import { clearAllIdleInteractivities, clearSelectInfo } from "../../utils";
import { openChatBox } from "../ChatBox"; import { openChatBox } from "../ChatBox";
const { useToken } = theme; const { useToken } = theme;
const clearAllIdleInteractivities = () => {
for (const card of cardStore.inner) {
card.idleInteractivities = [];
}
};
const FINISH_CANCEL_RESPONSE = -1; const FINISH_CANCEL_RESPONSE = -1;
......
import { cardStore } from "@/stores";
export function clearAllIdleInteractivities() {
for (const card of cardStore.inner) {
card.idleInteractivities = [];
}
}
export * from "./clearAllIdleInteractivities";
export * from "./clearSelectInfo"; export * from "./clearSelectInfo";
export * from "./groupBy"; export * from "./groupBy";
export * from "./interactTypeToStringIcon"; export * from "./interactTypeToStringIcon";
......
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