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