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