Commit 75cc489c authored by Chunchi Che's avatar Chunchi Che

fix room

parent dbaab022
Pipeline #23003 passed with stages
in 14 minutes and 45 seconds
...@@ -18,6 +18,10 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -18,6 +18,10 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
? 1 ? 1
: 0; : 0;
// 通知房间页面决斗开始
// 这行在该函数中的位置不能随便放,否则可能会block住
roomStore.stage = RoomStage.DUEL_START;
matStore.initInfo.set(0, { matStore.initInfo.set(0, {
life: start.life1, life: start.life1,
deckSize: start.deckSize1, deckSize: start.deckSize1,
...@@ -82,9 +86,6 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -82,9 +86,6 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
// 初始化完后,sleep 1s,让UI初始化完成, // 初始化完后,sleep 1s,让UI初始化完成,
// 否则在和AI对战时,由于后端给传给前端的`MSG`频率太高,会导致一些问题。 // 否则在和AI对战时,由于后端给传给前端的`MSG`频率太高,会导致一些问题。
await sleep(useConfig().startDelay); await sleep(useConfig().startDelay);
// 通知房间页面决斗开始
roomStore.stage = RoomStage.DUEL_START;
}; };
// 自动从code推断出occupant // 自动从code推断出occupant
......
...@@ -29,7 +29,7 @@ export const EndModal: React.FC = () => { ...@@ -29,7 +29,7 @@ export const EndModal: React.FC = () => {
const onReturn = () => { const onReturn = () => {
resetUniverse(); resetUniverse();
rs(); rs();
navigate("/home"); navigate("/match");
}; };
return ( return (
......
...@@ -23,7 +23,8 @@ export const MoraPopover: React.FC< ...@@ -23,7 +23,8 @@ export const MoraPopover: React.FC<
// 需要在mora的service之中,emit一个事件,让这个组件监听到,然后打开popover // 需要在mora的service之中,emit一个事件,让这个组件监听到,然后打开popover
useEffect(() => { useEffect(() => {
eventbus.once(Task.Mora, () => { // 这里不能用`once`,因为如果双方猜拳结果一样的话会重新猜拳
eventbus.on(Task.Mora, () => {
setOpen(true); setOpen(true);
}); });
}, []); }, []);
......
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