Commit 66bd0a97 authored by Chunchi Che's avatar Chunchi Che

update

parent b052428d
Pipeline #26168 passed with stages
in 8 minutes and 4 seconds
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 2;
} }
.chain { .chain {
...@@ -23,8 +24,10 @@ ...@@ -23,8 +24,10 @@
.text { .text {
position: absolute; position: absolute;
font-size: 2rem; font-size: 2rem;
font-weight: bold;
top: 50%; top: 50%;
left: 50%; left: 50%;
-webkit-text-stroke: 1px black;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
......
...@@ -9,7 +9,7 @@ export const BgChain: React.FC<{ chains: readonly number[] }> = ({ ...@@ -9,7 +9,7 @@ export const BgChain: React.FC<{ chains: readonly number[] }> = ({
}) => ( }) => (
<div className={styles.container}> <div className={styles.container}>
{chains.map((chain) => ( {chains.map((chain) => (
<div className={styles.chain}> <div className={styles.chain} key={chain}>
<img src={`${assetsPath}/chain.png`} /> <img src={`${assetsPath}/chain.png`} />
<div className={styles.text}>{chain}</div> <div className={styles.text}>{chain}</div>
</div> </div>
......
...@@ -13,7 +13,8 @@ import { ...@@ -13,7 +13,8 @@ import {
import { BgChain } from "./Chain"; import { BgChain } from "./Chain";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
// TODO: 展示连锁图标 const { MZONE, SZONE, EXTRA, GRAVE, REMOVED } = ygopro.CardZone;
const BgBlock: React.FC< const BgBlock: React.FC<
React.HTMLProps<HTMLDivElement> & { React.HTMLProps<HTMLDivElement> & {
disabled?: boolean; disabled?: boolean;
...@@ -58,7 +59,7 @@ const BgExtraRow: React.FC<{ ...@@ -58,7 +59,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} chains={meSnap[i].chainIndex.concat(opSnap[i].chainIndex)}
/> />
))} ))}
</div> </div>
...@@ -84,7 +85,6 @@ const BgRow: React.FC<{ ...@@ -84,7 +85,6 @@ const BgRow: React.FC<{
</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;
...@@ -92,27 +92,43 @@ const BgOtherBlocks: React.FC<{ op?: boolean }> = ({ op }) => { ...@@ -92,27 +92,43 @@ const BgOtherBlocks: React.FC<{ op?: boolean }> = ({ op }) => {
!!cardStore !!cardStore
.at(zone, meController) .at(zone, meController)
.reduce((sum, c) => (sum += c.idleInteractivities.length), 0); .reduce((sum, c) => (sum += c.idleInteractivities.length), 0);
const glowingExtra = judgeGlowing(ygopro.CardZone.EXTRA); const glowingExtra = judgeGlowing(EXTRA);
const glowingGraveyard = judgeGlowing(ygopro.CardZone.GRAVE); const glowingGraveyard = judgeGlowing(GRAVE);
const glowingBanish = judgeGlowing(ygopro.CardZone.REMOVED); const glowingBanish = judgeGlowing(REMOVED);
const snap = useSnapshot(placeStore.inner); const snap = useSnapshot(placeStore.inner);
const field = op const field = op ? snap[SZONE].op[5] : snap[SZONE].me[5];
? snap[ygopro.CardZone.SZONE].op[5]
: snap[ygopro.CardZone.SZONE].me[5]; const genChains = (states: Snapshot<BlockState[]>) => {
const chains: number[] = states.flatMap((state) => state.chainIndex);
chains.sort();
return chains;
};
return ( return (
<div className={classnames(styles["other-blocks"], { [styles.op]: op })}> <div className={classnames(styles["other-blocks"], { [styles.op]: op })}>
<BgBlock className={styles.banish} glowing={!op && glowingBanish} /> <BgBlock
<BgBlock className={styles.graveyard} glowing={!op && glowingGraveyard} /> className={styles.banish}
glowing={!op && glowingBanish}
chains={genChains(op ? snap[REMOVED].op : snap[REMOVED].me)}
/>
<BgBlock
className={styles.graveyard}
glowing={!op && glowingGraveyard}
chains={genChains(op ? snap[GRAVE].op : snap[GRAVE].me)}
/>
<BgBlock <BgBlock
className={styles.field} className={styles.field}
onClick={() => onBlockClick(field.interactivity)} onClick={() => onBlockClick(field.interactivity)}
disabled={field.disabled} disabled={field.disabled}
highlight={!!field.interactivity} highlight={!!field.interactivity}
chains={field.chainIndex}
/> />
<BgBlock className={styles.deck} /> <BgBlock className={styles.deck} />
<BgBlock <BgBlock
className={classnames(styles.deck, styles["extra-deck"])} className={classnames(styles.deck, styles["extra-deck"])}
glowing={!op && glowingExtra} glowing={!op && glowingExtra}
chains={genChains(op ? snap[EXTRA].op : snap[EXTRA].me)}
/> />
</div> </div>
); );
...@@ -122,14 +138,14 @@ export const Bg: React.FC = () => { ...@@ -122,14 +138,14 @@ export const Bg: React.FC = () => {
const snap = useSnapshot(placeStore.inner); const snap = useSnapshot(placeStore.inner);
return ( return (
<div className={styles["mat-bg"]}> <div className={styles["mat-bg"]}>
<BgRow snap={snap[ygopro.CardZone.SZONE].op} szone opponent /> <BgRow snap={snap[SZONE].op} szone opponent />
<BgRow snap={snap[ygopro.CardZone.MZONE].op} opponent /> <BgRow snap={snap[MZONE].op} opponent />
<BgExtraRow <BgExtraRow
meSnap={snap[ygopro.CardZone.MZONE].me.slice(5, 7)} meSnap={snap[MZONE].me.slice(5, 7)}
opSnap={snap[ygopro.CardZone.MZONE].op.slice(5, 7)} opSnap={snap[MZONE].op.slice(5, 7)}
/> />
<BgRow snap={snap[ygopro.CardZone.MZONE].me} /> <BgRow snap={snap[MZONE].me} />
<BgRow snap={snap[ygopro.CardZone.SZONE].me} szone /> <BgRow snap={snap[SZONE].me} szone />
<BgOtherBlocks /> <BgOtherBlocks />
<BgOtherBlocks op /> <BgOtherBlocks op />
</div> </div>
......
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