Commit b819730b authored by Chunchi Che's avatar Chunchi Che

Merge branch 'animation/confirm_card' into 'main'

add animation for confirm_card

See merge request !217
parents e8698018 2130f915
import { fetchCard, ygopro } from "@/api";
import { eventbus, sleep, Task } from "@/infra";
import { cardStore } from "@/stores";
export default async (confirmCards: ygopro.StocGameMessage.MsgConfirmCards) => {
......@@ -12,8 +13,11 @@ export default async (confirmCards: ygopro.StocGameMessage.MsgConfirmCards) => {
// 设置`occupant`
const meta = await fetchCard(card.code);
target.meta = meta;
// 设置`position`,否则会横放
target.location.position = ygopro.CardPosition.ATTACK;
// 动画
await eventbus.call(Task.Focus, target.uuid);
// 临时措施,延迟一会,让动画逐个展示
// 长期:需要实现动画序列,一个动画完成后才执行下一个动画
await sleep(500);
} else {
console.warn(`card of ${card} is null`);
}
......
import { ygopro } from "@/api";
import { sleep } from "@/infra";
import { matStore } from "@/stores";
import onAnnounce from "./announce";
......@@ -112,6 +113,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
}
case "move": {
await onMsgMove(msg.move);
await sleep(500);
break;
}
......
......@@ -8,12 +8,16 @@ import { asyncStart } from "./utils";
export const focus = async (props: { card: CardType; api: SpringApi }) => {
const { card, api } = props;
const current = api.current[0].get();
if (card.location.zone === ygopro.CardZone.HAND) {
if (
card.location.zone == ygopro.CardZone.HAND ||
card.location.zone == ygopro.CardZone.DECK
) {
await asyncStart(api)({
y: current.y + (matStore.isMe(card.location.controller) ? -1 : 1) * 200, // TODO: 放到config之中
ry: 0,
rz: 0,
});
await asyncStart(api)({ y: current.y, rz: current.rz });
await asyncStart(api)({ y: current.y, ry: current.ry, rz: current.rz });
} else {
await asyncStart(api)({ z: 200 });
await asyncStart(api)({ z: current.z });
......
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