Commit e273124f authored by Chunchi Che's avatar Chunchi Che

optimize waiting hint

parent 65264fb4
Pipeline #20780 passed with stages
in 14 minutes and 43 seconds
......@@ -66,6 +66,9 @@
"avatarSize": 40,
"meAvatarColor": "#0e63e1",
"opAvatarColor": "#e10e68"
},
"hint": {
"waitingDuration": 1.5
}
}
}
......@@ -66,6 +66,9 @@
"avatarSize": 40,
"meAvatarColor": "#0e63e1",
"opAvatarColor": "#e10e68"
},
"hint": {
"waitingDuration": 1.5
}
}
}
......@@ -3,15 +3,17 @@ import { useAppSelector } from "../../hook";
import { selectMeHint, selectOpHint } from "../../reducers/duel/hintSlice";
import { selectCurrentPhase } from "../../reducers/duel/phaseSlice";
import { notification } from "antd";
import { selectDuelResult } from "../../reducers/duel/mod";
import { selectDuelResult, selectWaiting } from "../../reducers/duel/mod";
import { useNavigate } from "react-router-dom";
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import MsgWin = ygopro.StocGameMessage.MsgWin;
import NeosConfig from "../../../neos.config.json";
const HintNotification = () => {
const meHint = useAppSelector(selectMeHint);
const opHint = useAppSelector(selectOpHint);
const currentPhase = useAppSelector(selectCurrentPhase);
const waiting = useAppSelector(selectWaiting);
const result = useAppSelector(selectDuelResult);
const navigate = useNavigate();
......@@ -43,6 +45,16 @@ const HintNotification = () => {
}
}, [currentPhase]);
useEffect(() => {
if (waiting) {
api.info({
message: "...等待对方行动中...",
placement: "top",
duration: NeosConfig.ui.hint.waitingDuration,
});
}
}, [waiting]);
useEffect(() => {
if (result) {
const message =
......
......@@ -19,14 +19,13 @@ const OP_VALUE = "opponent";
const PlayerStatus = () => {
const meInfo = useAppSelector(selectMeInitInfo);
const opInfo = useAppSelector(selectOpInitInfo);
const myTurn = useAppSelector(selectCurrentPlayerIsMe);
const waiting = useAppSelector(selectWaiting) || false;
return (
<CheckCard.Group
bordered
style={{ height: `${NeosConfig.ui.layout.header.height}` }}
value={myTurn || !waiting ? ME_VALUE : OP_VALUE}
value={waiting ? OP_VALUE : ME_VALUE}
>
<CheckCard
avatar={
......
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