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

rename Card to Hand

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