Commit 865766e8 authored by chechunchi's avatar chechunchi

optimize chaining

parent 745e7944
Pipeline #22136 passed with stages
in 12 minutes and 57 seconds
import { ygopro } from "@/api";
import { fetchCard, ygopro } from "@/api";
import { eventbus, Task } from "@/infra";
import { cardStore, fetchEsHintMeta, matStore } from "@/stores";
......@@ -18,6 +18,14 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
// 设置连锁序号
target.chainIndex = matStore.chains.length;
const meta = await fetchCard(chaining.code);
// 这里不能设置`code`,因为存在一个场景:
// 对方的`魔神仪-曼德拉护肤草`发动效果后,后端会发一次`MSG_SHUFFLE_HAND`,但传给前端的codes全是0,如果这里设置了`code`的话,在后面的`MSG_SHUFFLE_HAND`处理就会有问题。
// target.code = meta.id;
// 设置`Meta`信息,让对手发动效果的卡也能展示正面卡图
target.meta = meta;
// 发动效果动画
await eventbus.call(Task.Focus, target.uuid);
console.color("blue")(`${target.meta.text.name} chaining`);
......
......@@ -127,7 +127,7 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
onError={() => {
console.log("");
}}
src={getCardImgUrl(snap.code)}
src={getCardImgUrl(snap.code == 0 ? snap.meta.id : snap.code)}
/>
<img className="card-back" src={getCardImgUrl(0, true)} />
</div>
......
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