Commit 0863a675 authored by Chunchi Che's avatar Chunchi Che

fix room logic

parent a470cf07
Pipeline #25947 passed with stages
in 7 minutes and 34 seconds
......@@ -23,7 +23,7 @@ export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
}
case ErrorType.DECKERROR: {
const flag = error_code >> 28;
const code = error_code && 0xfffffff;
const code = error_code & 0xfffffff;
const card = fetchCard(code);
const baseMsg = `卡组非法,请检查:${card.text.name}`;
switch (flag) {
......
......@@ -53,12 +53,18 @@ export const Component: React.FC = () => {
const op = room.getOpPlayer();
const navigate = useNavigate();
const updateDeck = (deck: IDeck) => {
sendUpdateDeck(deck);
// 设置side里面的卡组
sideStore.deck = deck;
};
const onDeckSelected = (deckName: string) => {
const deck = deckStore.get(deckName);
if (deck) {
const newDeck = deckStore.get(deckName);
if (newDeck) {
sendHsNotReady();
sendUpdateDeck(deck);
setDeck(deck);
updateDeck(newDeck);
setDeck(newDeck);
} else {
message.error(`Deck ${deckName} not found`);
}
......@@ -67,9 +73,7 @@ export const Component: React.FC = () => {
const onReady = () => {
if (me?.state === PlayerState.NO_READY) {
if (deck) {
sendUpdateDeck(deck);
// 设置side里面的卡组
sideStore.deck = deck;
updateDeck(deck);
sendHsReady();
} else {
message.error("请先选择卡组");
......
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