Commit e273124f authored by Chunchi Che's avatar Chunchi Che

optimize waiting hint

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