Commit 4b8c5cff authored by Chunchi Che's avatar Chunchi Che

move interactTypeToString to util.ts

parent 8e4708ae
......@@ -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 { Hand, InteractType } from "../../reducers/duel/util";
import { Hand } from "../../reducers/duel/util";
import {
setCardModalImgUrl,
setCardModalIsOpen,
......@@ -14,7 +14,7 @@ import { useHover } from "react-babylonjs";
import { useClick } from "./hook";
import { useState, useRef, useEffect } from "react";
import { useSpring, animated } from "./spring";
import { zip } from "./util";
import { zip, interactTypeToString } from "./util";
const groundShape = CONFIG.GroundShape();
const left = -(groundShape.width / 2);
......@@ -142,32 +142,6 @@ const CHand = (props: {
);
};
function interactTypeToString(t: InteractType): string {
switch (t) {
case InteractType.SUMMON: {
return "普通召唤";
}
case InteractType.SP_SUMMON: {
return "特殊召唤";
}
case InteractType.POS_CHANGE: {
return "改变表示形式";
}
case InteractType.MSET: {
return "前场放置";
}
case InteractType.SSET: {
return "后场放置";
}
case InteractType.ACTIVATE: {
return "发动效果";
}
default: {
return "未知选项";
}
}
}
const handPositons = (player: number, hands: Hand[]) => {
const gap = groundShape.width / (hands.length - 1);
const y = handShape.height / 2;
......
import { InteractType } from "../../reducers/duel/util";
export function zip<S1, S2>(
firstCollection: Array<S1>,
lastCollection: Array<S2>
......@@ -11,3 +13,29 @@ export function zip<S1, S2>(
return zipped;
}
export function interactTypeToString(t: InteractType): string {
switch (t) {
case InteractType.SUMMON: {
return "普通召唤";
}
case InteractType.SP_SUMMON: {
return "特殊召唤";
}
case InteractType.POS_CHANGE: {
return "改变表示形式";
}
case InteractType.MSET: {
return "前场放置";
}
case InteractType.SSET: {
return "后场放置";
}
case InteractType.ACTIVATE: {
return "发动效果";
}
default: {
return "未知选项";
}
}
}
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