Commit 44bd0e29 authored by Chunchi Che's avatar Chunchi Che

add chaining in Cardstate

parent 76ae995f
Pipeline #21627 passed with stages
in 11 minutes and 33 seconds
...@@ -51,6 +51,7 @@ function reloadDuelField( ...@@ -51,6 +51,7 @@ function reloadDuelField(
idleInteractivities: [], idleInteractivities: [],
counters: {}, counters: {},
focus: false, focus: false,
chaining: false,
reload: true, reload: true,
}; };
}); });
......
...@@ -40,6 +40,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -40,6 +40,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.DECK, zone: ygopro.CardZone.DECK,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -57,6 +58,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -57,6 +58,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.DECK, zone: ygopro.CardZone.DECK,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -75,6 +77,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -75,6 +77,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.EXTRA, zone: ygopro.CardZone.EXTRA,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
......
...@@ -41,6 +41,7 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -41,6 +41,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
position == undefined ? ygopro.CardPosition.FACEUP_ATTACK : position, position == undefined ? ygopro.CardPosition.FACEUP_ATTACK : position,
}, },
focus: focus ?? false, focus: focus ?? false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -161,6 +162,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) => ...@@ -161,6 +162,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
zone, zone,
}, },
focus: false, focus: false,
chaining: false,
idleInteractivities: [], idleInteractivities: [],
counters: {}, counters: {},
})); }));
......
...@@ -121,6 +121,7 @@ export interface CardState { ...@@ -121,6 +121,7 @@ export interface CardState {
position?: ygopro.CardPosition; // 卡片的姿势:攻击还是守备 position?: ygopro.CardPosition; // 卡片的姿势:攻击还是守备
}; // 位置信息,叫location的原因是为了和ygo对齐 }; // 位置信息,叫location的原因是为了和ygo对齐
focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示 focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining: boolean; // 是否在连锁中
idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息 idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息
placeInteractivity?: Interactivity<{ placeInteractivity?: Interactivity<{
controler: number; controler: number;
......
...@@ -13,6 +13,7 @@ const ASSETS_BASE = ...@@ -13,6 +13,7 @@ const ASSETS_BASE =
: import.meta.env.BASE_URL + NeosConfig.assetsPath; : import.meta.env.BASE_URL + NeosConfig.assetsPath;
const FOCUS_SCALE = 2.5; const FOCUS_SCALE = 2.5;
const CHAINING_SCALE = 1.5;
const FOCUS_HIGHT = 100; const FOCUS_HIGHT = 100;
export const Card: React.FC<{ export const Card: React.FC<{
...@@ -25,8 +26,8 @@ export const Card: React.FC<{ ...@@ -25,8 +26,8 @@ export const Card: React.FC<{
facedown?: boolean; facedown?: boolean;
vertical?: boolean; vertical?: boolean;
highlight?: boolean; highlight?: boolean;
fly?: boolean;
focus?: boolean; focus?: boolean;
chaining?: boolean;
transTime?: number; transTime?: number;
onClick?: MouseEventHandler<{}>; onClick?: MouseEventHandler<{}>;
style?: CSSProperties; style?: CSSProperties;
...@@ -40,8 +41,8 @@ export const Card: React.FC<{ ...@@ -40,8 +41,8 @@ export const Card: React.FC<{
opponent = false, opponent = false,
vertical = false, vertical = false,
highlight = false, highlight = false,
fly = false,
focus = false, focus = false,
chaining = false,
transTime = 0.3, transTime = 0.3,
onClick, onClick,
style = {}, style = {},
...@@ -49,7 +50,7 @@ export const Card: React.FC<{ ...@@ -49,7 +50,7 @@ export const Card: React.FC<{
<div <div
className={classnames("card", { className={classnames("card", {
"card-defense": defense, "card-defense": defense,
fly, fly: chaining,
})} })}
style={ style={
{ {
...@@ -61,7 +62,7 @@ export const Card: React.FC<{ ...@@ -61,7 +62,7 @@ export const Card: React.FC<{
"--vertical": vertical ? 1 : 0, "--vertical": vertical ? 1 : 0,
"--trans-time": `${transTime}s`, "--trans-time": `${transTime}s`,
"--highlight-on": highlight ? 1 : 0, "--highlight-on": highlight ? 1 : 0,
"--scale-focus": focus ? FOCUS_SCALE : 1, "--scale-focus": focus ? FOCUS_SCALE : chaining ? CHAINING_SCALE : 1,
"--card-img": facedown "--card-img": facedown
? `url(${ASSETS_BASE + "/card_back.jpg"})` ? `url(${ASSETS_BASE + "/card_back.jpg"})`
: `url(${NeosConfig.cardImgUrl + "/" + code + ".jpg"})`, : `url(${NeosConfig.cardImgUrl + "/" + code + ".jpg"})`,
......
...@@ -104,6 +104,7 @@ export const Mat = () => { ...@@ -104,6 +104,7 @@ export const Mat = () => {
vertical={card.location.zone == YgoZone.HAND || card.focus} vertical={card.location.zone == YgoZone.HAND || card.focus}
highlight={card.idleInteractivities.length > 0} highlight={card.idleInteractivities.length > 0}
focus={card.focus} focus={card.focus}
chaining={card.chaining}
opponent={card.opponent} opponent={card.opponent}
onClick={ onClick={
card.location.zone == YgoZone.SZONE || card.location.zone == YgoZone.SZONE ||
......
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