Commit c21a0cbe authored by Chunchi Che's avatar Chunchi Che

add BgChain component

parent 89b0e9c9
Pipeline #26157 failed with stages
in 8 minutes and 29 seconds
...@@ -20,7 +20,8 @@ const { MZONE, SZONE, HAND, GRAVE, REMOVED, EXTRA } = ygopro.CardZone; ...@@ -20,7 +20,8 @@ const { MZONE, SZONE, HAND, GRAVE, REMOVED, EXTRA } = ygopro.CardZone;
export interface BlockState { export interface BlockState {
interactivity?: PlaceInteractivity; // 互动性 interactivity?: PlaceInteractivity; // 互动性
disabled: boolean; // 是否被禁用 disabled: boolean; // 是否被禁用
chainIndex: number[]; // 当前位置上的连锁序号。YGOPRO和MASTER DUEL的连锁都是和位置绑定的,因此在`PlaceStore`中记录连锁状态。 chainIndex: number[] /* 当前位置上的连锁序号。
YGOPRO和MASTER DUEL的连锁都是和位置绑定的,因此在`PlaceStore`中记录连锁状态。*/;
} }
const genPLaces = (n: number): BlockState[] => const genPLaces = (n: number): BlockState[] =>
......
export const BgChain: React.FC<{ chains: readonly number[] }> = ({
chains,
}) => <div></div>;
...@@ -10,19 +10,23 @@ import { ...@@ -10,19 +10,23 @@ import {
placeStore, placeStore,
} from "@/stores"; } from "@/stores";
import { BgChain } from "./Chain";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
// TODO: 展示连锁图标
const BgBlock: React.FC< const BgBlock: React.FC<
React.HTMLProps<HTMLDivElement> & { React.HTMLProps<HTMLDivElement> & {
disabled?: boolean; disabled?: boolean;
highlight?: boolean; highlight?: boolean;
glowing?: boolean; glowing?: boolean;
chains?: readonly number[];
} }
> = ({ > = ({
disabled = false, disabled = false,
highlight = false, highlight = false,
glowing = false, glowing = false,
className, className,
chains,
...rest ...rest
}) => ( }) => (
<div <div
...@@ -34,6 +38,7 @@ const BgBlock: React.FC< ...@@ -34,6 +38,7 @@ const BgBlock: React.FC<
> >
{<DecoTriangles />} {<DecoTriangles />}
{<DisabledCross disabled={disabled} />} {<DisabledCross disabled={disabled} />}
{<BgChain chains={chains ?? []} />}
</div> </div>
); );
...@@ -53,6 +58,7 @@ const BgExtraRow: React.FC<{ ...@@ -53,6 +58,7 @@ const BgExtraRow: React.FC<{
}} }}
disabled={meSnap[i].disabled || opSnap[i].disabled} disabled={meSnap[i].disabled || opSnap[i].disabled}
highlight={!!meSnap[i].interactivity || !!opSnap[i].interactivity} highlight={!!meSnap[i].interactivity || !!opSnap[i].interactivity}
chains={meSnap[i].chainIndex}
/> />
))} ))}
</div> </div>
...@@ -72,11 +78,13 @@ const BgRow: React.FC<{ ...@@ -72,11 +78,13 @@ const BgRow: React.FC<{
onClick={() => onBlockClick(snap[i].interactivity)} onClick={() => onBlockClick(snap[i].interactivity)}
disabled={snap[i].disabled} disabled={snap[i].disabled}
highlight={!!snap[i].interactivity} highlight={!!snap[i].interactivity}
chains={snap[i].chainIndex}
/> />
))} ))}
</div> </div>
); );
// TODO: chain
const BgOtherBlocks: React.FC<{ op?: boolean }> = ({ op }) => { const BgOtherBlocks: React.FC<{ op?: boolean }> = ({ op }) => {
useSnapshot(cardStore); useSnapshot(cardStore);
const meController = isMe(0) ? 0 : 1; const meController = isMe(0) ? 0 : 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