Commit 27941bf4 authored by Chunchi Che's avatar Chunchi Che

todo shuffleHand

parent 532c71e4
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { cardStore, matStore } from "@/stores"; import { cardStore } from "@/stores";
import { zip } from "@/ui/Duel/utils";
type MsgShuffleHand = ygopro.StocGameMessage.MsgShuffleHand; type MsgShuffleHand = ygopro.StocGameMessage.MsgShuffleHand;
...@@ -21,17 +20,4 @@ export default (shuffleHand: MsgShuffleHand) => { ...@@ -21,17 +20,4 @@ export default (shuffleHand: MsgShuffleHand) => {
} }
hand.sequence = sequence; hand.sequence = sequence;
}); });
const uuids = matStore.hands.of(controller).map((hand) => hand.uuid);
const data = zip(uuids, codes).map(([uuid, id]) => {
return { uuid, id };
});
const indexMap = new Map(codes.map((code, idx) => [code, idx]));
matStore.hands.of(controller).sort((a, b) => {
const indexA = indexMap.get(a.occupant?.id ?? 0) ?? 0;
const indexB = indexMap.get(b.occupant?.id ?? 0) ?? 0;
return indexA - indexB;
});
}; };
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