Commit a1f9891e authored by Chunchi Che's avatar Chunchi Che

finish selectSum

parent 32c15388
Pipeline #20892 passed with stages
in 20 minutes and 20 seconds
...@@ -10,6 +10,7 @@ import MsgSelectCard = ygopro.StocGameMessage.MsgSelectCard; ...@@ -10,6 +10,7 @@ import MsgSelectCard = ygopro.StocGameMessage.MsgSelectCard;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
// FIXME: handle it correctly
const reader = new BufferReaderExt(data); const reader = new BufferReaderExt(data);
const player = reader.inner.readUint8(); const player = reader.inner.readUint8();
......
...@@ -60,6 +60,7 @@ import { ...@@ -60,6 +60,7 @@ import {
setCheckCardModalV3ResponseAbleImpl, setCheckCardModalV3ResponseAbleImpl,
resetCheckCardModalV3Impl, resetCheckCardModalV3Impl,
setCheckCardModalV3SelectedImpl, setCheckCardModalV3SelectedImpl,
checkCardModalV3Case,
} from "./modal/mod"; } from "./modal/mod";
import { import {
MonsterState, MonsterState,
...@@ -310,6 +311,7 @@ const duelSlice = createSlice({ ...@@ -310,6 +311,7 @@ const duelSlice = createSlice({
YesNoModalCase(builder); YesNoModalCase(builder);
optionModalCase(builder); optionModalCase(builder);
checkCardModalV2Case(builder); checkCardModalV2Case(builder);
checkCardModalV3Case(builder);
}, },
}); });
......
...@@ -91,6 +91,7 @@ export interface ModalState { ...@@ -91,6 +91,7 @@ export interface ModalState {
level2: number; level2: number;
response: number; response: number;
}[]; }[];
// TODO: remove this prop
selectedList: { selectedList: {
meta: CardMeta; meta: CardMeta;
level1: number; level1: number;
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore"; import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { import {
setCheckCardModalV3AllLevel, setCheckCardModalV3AllLevel,
setCheckCardModalV3IsOpen,
setCheckCardModalV3MinMax, setCheckCardModalV3MinMax,
setCheckCardModalV3OverFlow, setCheckCardModalV3OverFlow,
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
...@@ -26,4 +27,5 @@ export default (selectSum: MsgSelectSum, dispatch: AppDispatch) => { ...@@ -26,4 +27,5 @@ export default (selectSum: MsgSelectSum, dispatch: AppDispatch) => {
options: selectSum.selectable_cards, options: selectSum.selectable_cards,
}) })
); );
dispatch(setCheckCardModalV3IsOpen(true));
}; };
import React from "react"; import React, { useState } from "react";
import { useAppSelector } from "../../hook"; import { useAppSelector } from "../../hook";
import { store } from "../../store"; import { store } from "../../store";
import { Modal, Button, Card, Row, Col } from "antd"; import { Modal, Button, Card, Row, Col } from "antd";
...@@ -8,7 +8,6 @@ import { ...@@ -8,7 +8,6 @@ import {
resetCheckCardModalV3, resetCheckCardModalV3,
setCheckCardModalV3IsOpen, setCheckCardModalV3IsOpen,
setCheckCardModalV3ResponseAble, setCheckCardModalV3ResponseAble,
setCheckCardModalV3Selected,
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import NeosConfig from "../../../neos.config.json"; import NeosConfig from "../../../neos.config.json";
import { selectCheckCardModalV3 } from "../../reducers/duel/modal/checkCardModalV3Slice"; import { selectCheckCardModalV3 } from "../../reducers/duel/modal/checkCardModalV3Slice";
...@@ -21,7 +20,7 @@ const CheckCardModalV3 = () => { ...@@ -21,7 +20,7 @@ const CheckCardModalV3 = () => {
const max = state.selectMax || 0; const max = state.selectMax || 0;
const mustSelectOptions = state.mustSelectList; const mustSelectOptions = state.mustSelectList;
const selectAbleOptions = state.selectAbleList; const selectAbleOptions = state.selectAbleList;
const selectedOptions = state.selectedList; const [selectedOptions, setSelectedOptions] = useState(state.selectedList);
const overflow = state.overflow; const overflow = state.overflow;
const LevelSum = state.allLevel; const LevelSum = state.allLevel;
const Level1Sum = mustSelectOptions const Level1Sum = mustSelectOptions
...@@ -68,7 +67,8 @@ const CheckCardModalV3 = () => { ...@@ -68,7 +67,8 @@ const CheckCardModalV3 = () => {
size="small" size="small"
multiple={true} multiple={true}
onChange={(values: any) => { onChange={(values: any) => {
setCheckCardModalV3Selected(values); console.log(values);
setSelectedOptions(values);
}} }}
> >
<Row> <Row>
...@@ -95,7 +95,7 @@ const CheckCardModalV3 = () => { ...@@ -95,7 +95,7 @@ const CheckCardModalV3 = () => {
</CheckCard.Group> </CheckCard.Group>
<p>必须选择的卡片</p> <p>必须选择的卡片</p>
<Row> <Row>
{selectedOptions.map((option, idx) => { {mustSelectOptions.map((option, idx) => {
return ( return (
<Col span={4} key={idx}> <Col span={4} key={idx}>
<Card <Card
......
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