Commit 93156113 authored by Chunchi Che's avatar Chunchi Che

finish

parent 6040948f
...@@ -3,6 +3,12 @@ import * as BABYLON_GUI from "@babylonjs/gui"; ...@@ -3,6 +3,12 @@ import * as BABYLON_GUI from "@babylonjs/gui";
import * as CONFIG from "../../../config/ui"; import * as CONFIG from "../../../config/ui";
import { Card, InteractType } from "../../../reducers/duel/util"; import { Card, InteractType } from "../../../reducers/duel/util";
import { sendSelectIdleCmdResponse } from "../../../api/ocgcore/ocgHelper"; 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) => { export default (hands: Card[], scene: BABYLON.Scene) => {
const handShape = CONFIG.HandShape(); const handShape = CONFIG.HandShape();
...@@ -101,17 +107,27 @@ function setupHandInteractivity( ...@@ -101,17 +107,27 @@ function setupHandInteractivity(
function setupHandAction( function setupHandAction(
mesh: BABYLON.Mesh, mesh: BABYLON.Mesh,
state: Card, state: Card,
handIdx: number, _handIdx: number,
scene: BABYLON.Scene scene: BABYLON.Scene
) { ) {
const dispatch = store.dispatch;
mesh.actionManager = new BABYLON.ActionManager(scene); mesh.actionManager = new BABYLON.ActionManager(scene);
mesh.actionManager.isRecursive = true; mesh.actionManager.isRecursive = true;
// 监听点击事件 // 监听点击事件
mesh.actionManager.registerAction( mesh.actionManager.registerAction(
new BABYLON.ExecuteCodeAction( new BABYLON.ExecuteCodeAction(
BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionManager.OnPickTrigger,
(event) => { (_event) => {
console.log(`<Click>hand: ${handIdx}`, "card:", state, "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