Commit 68c94d96 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/ui/phase' into 'main'

add phase ui

See merge request !45
parents da3d9236 d65b0b86
Pipeline #18794 passed with stages
in 2 minutes and 51 seconds
......@@ -15,14 +15,14 @@ import {
import { newTurnImpl } from "./turnSlice";
import { newPhaseImpl } from "./phaseSlice";
import { RootState } from "../../store";
import { HintState, hintCase } from "./hint";
import { HintState, hintCase } from "./hintSlice";
import {
ModalState,
setCardModalIsOpenImpl,
setCardModalTextImpl,
setCardModalImgUrlImpl,
setCardModalInteractiviesImpl,
} from "./modal";
} from "./modalSlice";
export interface DuelState {
selfType?: number;
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { AppDispatch } from "../../store";
import { fetchHintMeta } from "../../reducers/duel/hint";
import { fetchHintMeta } from "../../reducers/duel/hintSlice";
import MsgHint = ygopro.StocGameMessage.MsgHint;
export default (hint: MsgHint, dispatch: AppDispatch) => {
......
......@@ -6,5 +6,9 @@ export default (
newPhase: ygopro.StocGameMessage.MsgNewPhase,
dispatch: AppDispatch
) => {
dispatch(updatePhase(newPhase.phase_type.toString()));
dispatch(
updatePhase(
ygopro.StocGameMessage.MsgNewPhase.PhaseType[newPhase.phase_type]
)
);
};
......@@ -7,7 +7,7 @@ import {
selectCardModalDesc,
selectCardModalImgUrl,
selectCardModalInteractivies,
} from "../../../reducers/duel/modal";
} from "../../../reducers/duel/modalSlice";
import { setCardModalIsOpen } from "../../../reducers/duel/mod";
import { Modal, Card, Button } from "antd";
import { sendSelectIdleCmdResponse } from "../../../api/ocgcore/ocgHelper";
......
import React, { useEffect } from "react";
import { useAppSelector } from "../../../hook";
import { selectMeHint, selectOpHint } from "../../../reducers/duel/hint";
import { selectMeHint, selectOpHint } from "../../../reducers/duel/hintSlice";
import { selectCurrentPhase } from "../../../reducers/duel/phaseSlice";
import { notification } from "antd";
const HintNotification = () => {
const meHint = useAppSelector(selectMeHint);
const opHint = useAppSelector(selectOpHint);
const currentPhase = useAppSelector(selectCurrentPhase);
const [api, contextHolder] = notification.useNotification();
useEffect(() => {
......@@ -26,6 +28,14 @@ const HintNotification = () => {
}
}, [opHint]);
useEffect(() => {
if (currentPhase) {
api.info({
message: `<当前阶段>${currentPhase}`,
});
}
}, [currentPhase]);
return <>{contextHolder}</>;
};
......
......@@ -19,7 +19,6 @@ import renderField from "./field";
import * as CONFIG from "../../../config/ui";
import { Card } from "../../../reducers/duel/util";
import { selectCurrentPlayer } from "../../../reducers/duel/turnSlice";
import { selectCurrentPhase } from "../../../reducers/duel/phaseSlice";
import CardModal from "./cardModal";
import HintNotification from "./hintNotification";
......@@ -39,7 +38,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
};
const hands = useAppSelector(this.handsSelector || defaultHandsSelector);
const currentPlayer = useAppSelector(selectCurrentPlayer);
const currentPhase = useAppSelector(selectCurrentPhase);
// ----- WebGL渲染 -----
const canvasRef = useRef<HTMLCanvasElement>(null);
......@@ -111,8 +109,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
// 当前操作玩家
console.log(`currentPlayer:` + currentPlayer);
// 当前阶段
console.log(`currentPhase:` + currentPhase);
// 渲染循环
engine.runRenderLoop(() => {
......
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