Commit f12960ff authored by Chunchi Che's avatar Chunchi Che

fix small but not done

parent 294a516d
......@@ -3,19 +3,29 @@ import { Engine, Scene } from "react-babylonjs";
import * as BABYLON from "@babylonjs/core";
import * as CONFIG from "../../config/ui";
import DuelHands from "./hands_";
import { selectMeHands } from "../../reducers/duel/handsSlice";
import { useAppSelector } from "../../hook";
import CardModal from "./cardModal";
import HintNotification from "./hintNotification";
const BabylonCanvas = () => (
<div>
<Engine antialias adaptToDeviceRatio canvasId="babylonJS">
<Scene>
<DuelCamera />
<DuelLight />
<DuelHands />
<DuelGround />
</Scene>
</Engine>
</div>
);
const BabylonCanvas = () => {
const hands = useAppSelector(selectMeHands).cards;
return (
<div>
<Engine antialias adaptToDeviceRatio canvasId="babylonJS">
<Scene>
<DuelCamera />
<DuelLight />
<DuelHands hands={hands} />
<DuelGround />
</Scene>
</Engine>
<CardModal />
<HintNotification />
</div>
);
};
const DuelCamera = () => (
<freeCamera
......
import * as BABYLON from "@babylonjs/core";
import { useAppSelector } from "../../hook";
import { selectMeHands } from "../../reducers/duel/handsSlice";
import * as CONFIG from "../../config/ui";
import { Card, InteractType } from "../../reducers/duel/util";
import {
......@@ -13,13 +11,11 @@ import { store } from "../../store";
import { useClick, useHover } from "react-babylonjs";
import { useState, useRef } from "react";
const DuelHands = () => {
const hands = useAppSelector(selectMeHands).cards;
const DuelHands = (props: { hands: Card[] }) => {
return (
<>
{hands.map((hand, idx) => {
return <DuelHand state={hand} idx={idx} />;
{props.hands.map((hand, idx) => {
return <DuelHand state={hand} idx={idx} key={idx} />;
})}
</>
);
......@@ -58,6 +54,7 @@ const DuelHand = (props: { state: Card; idx: number }) => {
);
dispatch(setCardModalIsOpen(true));
}, planeRef);
return (
<>
<plane
......
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