Commit 2549ef0e authored by Chunchi Che's avatar Chunchi Che

update toss.ts

parent 619b2226
Pipeline #22278 passed with stages
in 16 minutes and 43 seconds
import { ygopro } from "@/api";
import { fetchStrings, ygopro } from "@/api";
import { matStore } from "@/stores";
import MsgToss = ygopro.StocGameMessage.MsgToss;
export default (toss: MsgToss) => {
......@@ -6,13 +7,10 @@ export default (toss: MsgToss) => {
for (const x of toss.res) {
if (tossType == MsgToss.TossType.DICE) {
console.log(`骰子结果:${x}`);
matStore.tossResult = fetchStrings("!system", 1624) + x;
} else if (tossType == MsgToss.TossType.COIN) {
if (x) {
console.log(`硬币正面`);
} else {
console.log(`硬币反面`);
}
matStore.tossResult =
fetchStrings("!system", 1623) + fetchStrings("!system", 60 + x);
} else {
console.log(`Unknown tossType = ${tossType}`);
}
......
......@@ -37,6 +37,8 @@ export interface MatState {
unimplemented: number; // 未处理的`Message`
tossResult?: string; // 骰子/硬币结果
/** 根据自己的先后手判断是否是自己 */
isMe: (player: number) => boolean;
}
......
......@@ -17,6 +17,7 @@ const NeosConfig = useConfig();
export const HintNotification = () => {
const snap = useSnapshot(matStore);
const hintState = snap.hint;
const toss = snap.tossResult;
const currentPhase = snap.phase.currentPhase;
const waiting = snap.waiting;
......@@ -35,6 +36,16 @@ export const HintNotification = () => {
}
}, [hintState.msg]);
useEffect(() => {
if (toss) {
api.open({
message: `${toss}`,
placement: "topLeft",
style: style,
});
}
}, [toss]);
useEffect(() => {
if (currentPhase) {
const message = fetchStrings(
......
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