Commit 8ad1ec59 authored by Chunchi Che's avatar Chunchi Che

update hands

parent 73863a6f
Pipeline #18174 passed with stages
in 2 minutes and 30 seconds
...@@ -47,7 +47,10 @@ export const Floating = 0.02; ...@@ -47,7 +47,10 @@ export const Floating = 0.02;
// 手牌 // 手牌
export const HandShape = () => { export const HandShape = () => {
return { width: 0.5, height: 0.75 }; return { width: 0.8, height: 1 };
};
export const HandRotation = () => {
return new BABYLON.Vector3(1, 0, 0);
}; };
export const HandColor = () => { export const HandColor = () => {
return BABYLON.Color3.White(); return BABYLON.Color3.White();
......
...@@ -5,7 +5,7 @@ import { CardMeta } from "../../../api/cards"; ...@@ -5,7 +5,7 @@ import { CardMeta } from "../../../api/cards";
export default (hands: CardMeta[], scene: BABYLON.Scene) => { export default (hands: CardMeta[], scene: BABYLON.Scene) => {
const groundShape = CONFIG.GroundShape(); const groundShape = CONFIG.GroundShape();
const handShape = CONFIG.HandShape(); const handShape = CONFIG.HandShape();
const gap = groundShape.width / hands.length; const gap = groundShape.width / (hands.length - 1);
const left = -(groundShape.width / 2); const left = -(groundShape.width / 2);
hands.forEach((item, idx, _) => { hands.forEach((item, idx, _) => {
const hand = BABYLON.MeshBuilder.CreatePlane( const hand = BABYLON.MeshBuilder.CreatePlane(
...@@ -19,6 +19,7 @@ export default (hands: CardMeta[], scene: BABYLON.Scene) => { ...@@ -19,6 +19,7 @@ export default (hands: CardMeta[], scene: BABYLON.Scene) => {
handShape.height / 2, handShape.height / 2,
-(groundShape.height / 2) - 1 -(groundShape.height / 2) - 1
); );
hand.rotation = CONFIG.HandRotation();
// 材质 // 材质
const handMaterial = new BABYLON.StandardMaterial("handMaterial", scene); const handMaterial = new BABYLON.StandardMaterial("handMaterial", scene);
// 材质贴纸 // 材质贴纸
......
...@@ -31,7 +31,7 @@ export default class SimpleDuelPlateImpl implements IDuelPlate { ...@@ -31,7 +31,7 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
// 默认的手牌Selector,返回五个code为-1的Card。 // 默认的手牌Selector,返回五个code为-1的Card。
const defaultHandsSelector = (_: RootState) => { const defaultHandsSelector = (_: RootState) => {
return []; return new Array(5).fill({ id: 10000, data: {}, text: {} });
}; };
const hands = useAppSelector(this.handsSelector || defaultHandsSelector); const hands = useAppSelector(this.handsSelector || defaultHandsSelector);
......
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