Commit 321c3729 authored by chechunchi's avatar chechunchi

fix flip summon

parent d5e5008c
...@@ -185,7 +185,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -185,7 +185,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
case "update_data": { case "update_data": {
onMsgUpdateData(msg.update_data); await onMsgUpdateData(msg.update_data);
break; break;
} }
......
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import MsgUpdateData = ygopro.StocGameMessage.MsgUpdateData; import MsgUpdateData = ygopro.StocGameMessage.MsgUpdateData;
import { eventbus, Task } from "@/infra";
import { cardStore } from "@/stores"; import { cardStore } from "@/stores";
export default (updateData: MsgUpdateData) => { export default async (updateData: MsgUpdateData) => {
const { player: controller, zone, actions } = updateData; const { player: controller, zone, actions } = updateData;
if (controller !== undefined && zone !== undefined && actions !== undefined) { if (controller !== undefined && zone !== undefined && actions !== undefined) {
const field = cardStore.at(zone, controller); const field = cardStore.at(zone, controller);
actions.forEach((action) => { for (const action of actions) {
const sequence = action.location?.sequence; const sequence = action.location?.sequence;
if (typeof sequence !== "undefined") { if (typeof sequence !== "undefined") {
const target = field const target = field
...@@ -21,7 +22,12 @@ export default (updateData: MsgUpdateData) => { ...@@ -21,7 +22,12 @@ export default (updateData: MsgUpdateData) => {
meta.text.id = action.code; meta.text.id = action.code;
} }
if (action.location !== undefined) { if (action.location !== undefined) {
target.location.position = action.location.position; if (target.location.position != action.location.position) {
// Currently only update position
target.location.position = action.location.position;
// animation
await eventbus.call(Task.Move, target.uuid);
}
} }
if (action?.type_ >= 0) { if (action?.type_ >= 0) {
meta.data.type = action.type_; meta.data.type = action.type_;
...@@ -49,6 +55,6 @@ export default (updateData: MsgUpdateData) => { ...@@ -49,6 +55,6 @@ export default (updateData: MsgUpdateData) => {
console.info(field); console.info(field);
} }
} }
}); }
} }
}; };
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