Commit e4711726 authored by Chunchi Che's avatar Chunchi Che

fix simpelDuel

parent f77b0872
Pipeline #18119 failed with stages
in 1 minute and 35 seconds
import { ygopro } from "../../api/ocgcore/idl/ocgcore"; import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { AppDispatch } from "../../store"; import { AppDispatch } from "../../store";
import { meAddHands, opAddHands } from "../../reducers/duel/mod"; import { meAddHands, opAddHands } from "../../reducers/duel/mod";
import {
fetchMeHandsMeta,
} from "../../reducers/duel/handsSlice";
export default ( export default (
draw: ygopro.StocGameMessage.MsgDraw, draw: ygopro.StocGameMessage.MsgDraw,
...@@ -9,6 +12,7 @@ export default ( ...@@ -9,6 +12,7 @@ export default (
// FIXME: draw.player 和先后攻有关系 // FIXME: draw.player 和先后攻有关系
if (draw.player === 0) { if (draw.player === 0) {
dispatch(meAddHands(draw.cards)); dispatch(meAddHands(draw.cards));
dispatch(fetchMeHandsMeta(draw.cards));
} else if (draw.player === 1) { } else if (draw.player === 1) {
dispatch(opAddHands(draw.cards)); dispatch(opAddHands(draw.cards));
} else { } else {
......
...@@ -13,9 +13,7 @@ import renderMonsters from "./monsters"; ...@@ -13,9 +13,7 @@ import renderMonsters from "./monsters";
import renderExtraMonsters from "./extraMonsters"; import renderExtraMonsters from "./extraMonsters";
import renderMagics from "./magics"; import renderMagics from "./magics";
import * as CONFIG from "./config"; import * as CONFIG from "./config";
import { store } from "../../../store";
import { CardMeta } from "../../../api/cards"; import { CardMeta } from "../../../api/cards";
import { fetchMeHandsMeta } from "../../../reducers/duel/handsSlice";
// CONFIG // CONFIG
...@@ -25,8 +23,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate { ...@@ -25,8 +23,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
constructor() {} constructor() {}
render(): React.ReactElement { render(): React.ReactElement {
const dispatch = store.dispatch;
// ----- 数据获取 ----- // ----- 数据获取 -----
// 默认的手牌Selector,返回五个code为-1的Card。 // 默认的手牌Selector,返回五个code为-1的Card。
...@@ -34,11 +30,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate { ...@@ -34,11 +30,6 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
return []; return [];
}; };
const hands = useAppSelector(this.handsSelector || defaultHandsSelector); const hands = useAppSelector(this.handsSelector || defaultHandsSelector);
// TODO: 每次hands更新的时候,需要更新meta数据
const ids = hands.map((hand) => {
return hand.id;
});
dispatch(fetchMeHandsMeta(ids));
// ----- WebGL渲染 ----- // ----- WebGL渲染 -----
const canvasRef = useRef<HTMLCanvasElement>(null); const canvasRef = useRef<HTMLCanvasElement>(null);
......
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