Commit b201cb28 authored by Chunchi Che's avatar Chunchi Che

migrate

parent 632dbdbb
Pipeline #22688 passed with stages
in 16 minutes and 50 seconds
......@@ -203,7 +203,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "win": {
onMsgWin(msg.win);
await onMsgWin(msg.win);
break;
}
......
import { fetchStrings, ygopro } from "@/api";
import { matStore } from "@/stores";
import { displayEndModal } from "@/ui/Duel/Message";
import MsgWin = ygopro.StocGameMessage.MsgWin;
export default (win: MsgWin) => {
export default async (win: MsgWin) => {
const { win_player, reason } = win;
matStore.result = {
isWin: matStore.isMe(win_player),
reason: fetchStrings("!victory", `0x${reason.toString(16)}`),
};
await displayEndModal(
matStore.isMe(win_player),
fetchStrings("!victory", `0x${reason.toString(16)}`)
);
};
......@@ -30,11 +30,6 @@ export interface MatState {
isReplay: boolean; // 是否是回放模式
result?: {
isWin: boolean;
reason: string;
};
unimplemented: number; // 未处理的`Message`
tossResult?: string; // 骰子/硬币结果
......
......@@ -6,6 +6,7 @@ import {
CardListModal,
CardModal,
CheckCounterModal,
EndModal,
HintNotification,
OptionModal,
PositionModal,
......@@ -34,6 +35,7 @@ const NeosDuel = () => {
<SortCardModal />
<AnnounceModal />
<SimpleSelectCardsModal />
<EndModal />
</>
);
};
......
......@@ -4,7 +4,7 @@ import React from "react";
import { proxy, useSnapshot } from "valtio";
import { fetchStrings } from "@/api";
import { replayStore } from "@/stores";
import { matStore, replayStore } from "@/stores";
import { NeosModal } from "../NeosModal";
......@@ -44,7 +44,7 @@ export const EndModal: React.FC = () => {
>
<p>{isWin ? "Win" : "Defeated"}</p>
<p>{reason}</p>
<p>{fetchStrings("!system", 1340)}</p>
{matStore.isReplay ? <></> : <p>{fetchStrings("!system", 1340)}</p>}
</NeosModal>
);
};
......
......@@ -24,7 +24,6 @@ export const HintNotification = () => {
const toss = snap.tossResult;
const handResults = snap.handResults;
const currentPhase = snap.phase.currentPhase;
const result = snap.result;
const [notify, notifyContextHolder] = notification.useNotification({
maxCount: NeosConfig.ui.hint.maxCount,
......@@ -85,17 +84,6 @@ export const HintNotification = () => {
}
}, [currentPhase]);
useEffect(() => {
if (result) {
const message = result.isWin ? "Win" : "Defeated" + " " + result.reason;
notify.open({
message,
placement: "bottom",
style: style,
});
}
}, [result]);
return (
<>
{notifyContextHolder}
......
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