Commit 31503a72 authored by Chunchi Che's avatar Chunchi Che

rename Card to Hand

parent 7495764e
...@@ -7,12 +7,12 @@ import { ...@@ -7,12 +7,12 @@ import {
import { DuelState } from "./mod"; import { DuelState } from "./mod";
import { RootState } from "../../store"; import { RootState } from "../../store";
import { fetchCard, CardMeta } from "../../api/cards"; import { fetchCard, CardMeta } from "../../api/cards";
import { judgeSelf, Card, Interactivity } from "./util"; import { judgeSelf, Hand, Interactivity } from "./util";
import * as UICONFIG from "../../config/ui"; import * as UICONFIG from "../../config/ui";
export interface Hands { export interface Hands {
// 注意:手牌的位置顺序是有约束的 // 注意:手牌的位置顺序是有约束的
cards: Card[]; cards: Hand[];
} }
// 增加手牌 // 增加手牌
...@@ -86,7 +86,7 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -86,7 +86,7 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
// 更新手牌的位置和旋转信息 // 更新手牌的位置和旋转信息
// //
// TODO: 兼容对方手牌 // TODO: 兼容对方手牌
function setHandsTransform(hands: Card[]): void { function setHandsTransform(hands: Hand[]): void {
const groundShape = UICONFIG.GroundShape(); const groundShape = UICONFIG.GroundShape();
const handShape = UICONFIG.HandShape(); const handShape = UICONFIG.HandShape();
const gap = groundShape.width / (hands.length - 1); const gap = groundShape.width / (hands.length - 1);
......
...@@ -25,10 +25,7 @@ export function judgeSelf(player: number, state: Draft<DuelState>): boolean { ...@@ -25,10 +25,7 @@ export function judgeSelf(player: number, state: Draft<DuelState>): boolean {
} }
} }
/* export interface Hand {
* `Neos`中表示卡牌的通用结构
* */
export interface Card {
meta: CardMeta; meta: CardMeta;
transform: CardTransform; transform: CardTransform;
interactivities: Interactivity<number>[]; interactivities: Interactivity<number>[];
......
...@@ -2,7 +2,7 @@ import * as BABYLON from "@babylonjs/core"; ...@@ -2,7 +2,7 @@ import * as BABYLON from "@babylonjs/core";
import { useAppSelector } from "../../hook"; import { useAppSelector } from "../../hook";
import { selectMeHands } from "../../reducers/duel/handsSlice"; import { selectMeHands } from "../../reducers/duel/handsSlice";
import * as CONFIG from "../../config/ui"; import * as CONFIG from "../../config/ui";
import { Card, InteractType } from "../../reducers/duel/util"; import { Hand, InteractType } from "../../reducers/duel/util";
import { import {
setCardModalImgUrl, setCardModalImgUrl,
setCardModalIsOpen, setCardModalIsOpen,
...@@ -20,13 +20,13 @@ const Hands = () => { ...@@ -20,13 +20,13 @@ const Hands = () => {
return ( return (
<> <>
{hands.map((hand, idx) => { {hands.map((hand, idx) => {
return <Hand state={hand} idx={idx} key={idx} />; return <CHand state={hand} idx={idx} key={idx} />;
})} })}
</> </>
); );
}; };
const Hand = (props: { state: Card; idx: number }) => { const CHand = (props: { state: Hand; idx: number }) => {
const handShape = CONFIG.HandShape(); const handShape = CONFIG.HandShape();
const hoverScale = CONFIG.HandHoverScaling(); const hoverScale = CONFIG.HandHoverScaling();
const defaultScale = new BABYLON.Vector3(1, 1, 1); const defaultScale = new BABYLON.Vector3(1, 1, 1);
......
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