Commit 84aa34c6 authored by Chunchi Che's avatar Chunchi Che

handle selectTrubute

parent 8a1a90de
Pipeline #20916 passed with stages
in 16 minutes and 11 seconds
......@@ -25,6 +25,7 @@ import onUnimplemented from "./unimplemented";
import onMsgUpdateData from "./updateData";
import onMsgReloadField from "./reloadField";
import onMsgSelectSum from "./selectSum";
import onMsgSelectTribute from "./selectTribute";
import { setWaiting } from "../../reducers/duel/mod";
const ActiveList = [
......@@ -169,6 +170,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "select_tribute": {
onMsgSelectTribute(msg.select_tribute, dispatch);
break;
}
case "unimplemented": {
onUnimplemented(msg.unimplemented, dispatch);
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import {
setCheckCardModalV3AllLevel,
setCheckCardModalV3IsOpen,
setCheckCardModalV3MinMax,
setCheckCardModalV3OverFlow,
} from "../../reducers/duel/mod";
import { fetchCheckCardMetasV3 } from "../../reducers/duel/modal/checkCardModalV3Slice";
import { AppDispatch } from "../../store";
import MsgSelectTribute = ygopro.StocGameMessage.MsgSelectTribute;
export default (selectTribute: MsgSelectTribute, dispatch: AppDispatch) => {
// TODO: 当玩家选择卡数大于`max`时,是否也合法?
dispatch(setCheckCardModalV3OverFlow(true));
dispatch(setCheckCardModalV3AllLevel(0));
dispatch(
setCheckCardModalV3MinMax({
min: selectTribute.min,
max: selectTribute.max,
})
);
dispatch(
fetchCheckCardMetasV3({
mustSelect: false,
options: selectTribute.selectable_cards.map((card) => {
return {
code: card.code,
level1: card.level,
level2: card.level,
response: card.response,
};
}),
})
);
dispatch(setCheckCardModalV3IsOpen(true));
};
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