Commit dd5386d5 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/select_action/card_modal' into 'main'

Optimize/select action/card modal

See merge request mycard/Neos!187
parents 892fb37f e03b628e
Pipeline #21582 passed with stages
in 15 minutes and 3 seconds
......@@ -114,7 +114,7 @@ export default (move: MsgMove) => {
for (const hand of matStore.in(to.location).of(to.controler)) {
hand.focus = false;
}
}, 200);
}, 500);
}
break;
}
......
......@@ -27,13 +27,13 @@ export const fetchCheckCardMeta = async (
? code
: matStore.in(location.location).of(controller)[location.sequence]
?.occupant?.id || 0;
const meta = await fetchCard(code);
const meta = await fetchCard(newID);
const effectDesc = effectDescCode
? getCardStr(meta, effectDescCode & 0xf)
: undefined;
const newOption = {
code: newID,
meta,
location: location.toObject(),
level1,
level2,
......
......@@ -3,7 +3,7 @@ type CardLocation = ReturnType<typeof ygopro.CardLocation.prototype.toObject>;
interface Option {
// card id
code: number;
meta: CardMeta;
location?: CardLocation;
// 效果
effectDesc?: string;
......
......@@ -20,7 +20,7 @@ const NeosConfig = useConfig();
const CANCEL_RESPONSE = -1;
const FINISH_RESPONSE = -1;
const { selectCardActions } = messageStore;
const { selectCardActions, cardModal } = messageStore;
export const SelectActionsModal = () => {
const snap = useSnapshot(selectCardActions);
......@@ -121,9 +121,13 @@ export const SelectActionsModal = () => {
multiple
bordered
size="small"
onChange={(value) => {
// @ts-ignore
setResponse(value);
onChange={(values: any) => {
if (values.length > 0) {
const meta = values[values.length - 1].meta;
cardModal.meta = meta;
cardModal.isOpen = true;
}
setResponse(values);
}}
>
<Row>
......@@ -135,10 +139,10 @@ export const SelectActionsModal = () => {
style={{ width: 120 }}
cover={
<img
alt={option.code.toString()}
alt={option.meta.id.toString()}
src={
option.code
? `${NeosConfig.cardImgUrl}/${option.code}.jpg`
option.meta.id
? `${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
: `${NeosConfig.assetsPath}/card_back.jpg`
}
style={{ width: 100 }}
......@@ -159,10 +163,10 @@ export const SelectActionsModal = () => {
style={{ width: 120 }}
cover={
<img
alt={option.code.toString()}
alt={option.meta.id.toString()}
src={
option.code
? `${NeosConfig.cardImgUrl}/${option.code}.jpg`
option.meta.id
? `${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
: `${NeosConfig.assetsPath}/card_back.jpg`
}
/>
......
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