Commit 93156113 authored by Chunchi Che's avatar Chunchi Che

finish

parent 6040948f
Pipeline #18746 passed with stages
in 4 minutes and 28 seconds
......@@ -3,6 +3,12 @@ import * as BABYLON_GUI from "@babylonjs/gui";
import * as CONFIG from "../../../config/ui";
import { Card, InteractType } from "../../../reducers/duel/util";
import { sendSelectIdleCmdResponse } from "../../../api/ocgcore/ocgHelper";
import {
setCardModalImgUrl,
setCardModalIsOpen,
setCardModalText,
} from "../../../reducers/duel/mod";
import { store } from "../../../store";
export default (hands: Card[], scene: BABYLON.Scene) => {
const handShape = CONFIG.HandShape();
......@@ -101,17 +107,27 @@ function setupHandInteractivity(
function setupHandAction(
mesh: BABYLON.Mesh,
state: Card,
handIdx: number,
_handIdx: number,
scene: BABYLON.Scene
) {
const dispatch = store.dispatch;
mesh.actionManager = new BABYLON.ActionManager(scene);
mesh.actionManager.isRecursive = true;
// 监听点击事件
mesh.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(
BABYLON.ActionManager.OnPickTrigger,
(event) => {
console.log(`<Click>hand: ${handIdx}`, "card:", state, "event:", event);
(_event) => {
dispatch(
setCardModalText([state.meta.text.name, state.meta.text.desc])
);
dispatch(
setCardModalImgUrl(
`https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${state.meta.id}.jpg`
)
);
dispatch(setCardModalIsOpen(true));
}
)
);
......
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