Commit d65b0b86 authored by Chunchi Che's avatar Chunchi Che

add phase ui

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