Commit b04f80cf authored by Chunchi Che's avatar Chunchi Che

update

parent a77c4f12
Pipeline #21632 failed with stages
in 10 minutes and 56 seconds
......@@ -72,6 +72,7 @@
"waitingDuration":1.5,
"maxCount": 1
},
"commonoDelay": 200,
"moveDelay": 500,
"chainingDelay": 800
},
......
......@@ -72,6 +72,7 @@
"waitingDuration":1.5,
"maxCount": 1
},
"commonDelay": 200,
"moveDelay": 500,
"chainingDelay": 800
},
......
......@@ -71,7 +71,7 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
}
// 先重置`delay`
matStore.delay = 0;
matStore.delay = NeosConfig.ui.commonDelay;
switch (msg.gameMsg) {
case "start": {
......@@ -112,7 +112,7 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "move": {
onMsgMove(msg.move);
matStore.delay = NeosConfig.ui.moveDelay;
matStore.delay += NeosConfig.ui.moveDelay;
break;
}
......@@ -239,7 +239,7 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "chaining": {
onMsgChaining(msg.chaining);
matStore.delay = NeosConfig.ui.chainingDelay;
matStore.delay += NeosConfig.ui.chainingDelay;
break;
}
......
......@@ -3,10 +3,12 @@ import { v4 as v4uuid } from "uuid";
import { ygopro } from "@/api";
import { fetchOverlayMeta, store } from "@/stores";
type MsgMove = ygopro.StocGameMessage.MsgMove;
import { useConfig } from "@/config";
import { REASON_MATERIAL } from "../../common";
const { matStore } = store;
const NeosConfig = useConfig();
const OVERLAY_STACK: { uuid: string; code: number; sequence: number }[] = [];
......@@ -81,7 +83,7 @@ export default (move: MsgMove) => {
() =>
(matStore.in(to.location).of(to.controler)[to.sequence].focus =
false),
500 // TODO: use config
NeosConfig.ui.moveDelay
);
break;
}
......@@ -114,7 +116,7 @@ export default (move: MsgMove) => {
for (const hand of matStore.in(to.location).of(to.controler)) {
hand.focus = false;
}
}, 500);
}, NeosConfig.ui.moveDelay);
}
break;
}
......
import { sendTimeConfirm, ygopro } from "@/api";
import { useConfig } from "@/config";
import { matStore } from "@/stores";
export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) {
setTimeout(() => {
matStore.timeLimits.set(timeLimit.player, timeLimit.left_time);
sendTimeConfirm();
}, useConfig().ui.commonDelay);
}
......@@ -26,7 +26,7 @@ export const Card: React.FC<{
vertical?: boolean;
highlight?: boolean;
focus?: boolean;
chaining?: boolean;
fly?: boolean;
transTime?: number;
onClick?: MouseEventHandler<{}>;
style?: CSSProperties;
......@@ -41,7 +41,7 @@ export const Card: React.FC<{
vertical = false,
highlight = false,
focus = false,
chaining = false,
fly = false,
transTime = 0.3,
onClick,
style = {},
......@@ -49,7 +49,7 @@ export const Card: React.FC<{
<div
className={classnames("card", {
"card-defense": defense,
fly: chaining && !focus,
fly: fly && !focus,
})}
style={
{
......@@ -60,7 +60,7 @@ export const Card: React.FC<{
"--opponent-deg": opponent ? "180deg" : "0deg",
"--vertical": vertical ? 1 : 0,
"--trans-time": `${
chaining ? NeosConfig.ui.chainingDelay / 1000 : transTime
fly ? NeosConfig.ui.chainingDelay / 1000 : transTime
}s`,
"--highlight-on": highlight ? 1 : 0,
"--scale-focus": focus ? FOCUS_SCALE : 1,
......
......@@ -103,8 +103,11 @@ export const Mat = () => {
facedown={CardStateToFaceDown(card)}
vertical={card.location.zone == YgoZone.HAND || card.focus}
highlight={card.idleInteractivities.length > 0}
focus={card.focus}
chaining={card.chaining}
focus={
card.focus ||
(card.chaining && card.location.zone == YgoZone.HAND)
}
fly={card.chaining && card.location.zone != YgoZone.HAND}
opponent={card.opponent}
onClick={
card.location.zone == YgoZone.SZONE ||
......@@ -131,7 +134,7 @@ function cardStateToRow(state: RenderCard): number {
case YgoZone.DECK:
return 0;
case YgoZone.HAND:
return -1;
return state.chaining ? 2 : -1;
case YgoZone.SZONE:
return state.sequence >= 5 ? 1 : 0;
case YgoZone.GRAVE:
......@@ -149,7 +152,7 @@ function cardStateToRow(state: RenderCard): number {
case YgoZone.DECK:
return 4;
case YgoZone.HAND:
return 5;
return state.chaining ? 2 : 5;
case YgoZone.SZONE:
return state.sequence >= 5 ? 3 : 4;
case YgoZone.GRAVE:
......@@ -171,7 +174,7 @@ function cardStateToCol(state: RenderCard): number {
case YgoZone.EXTRA:
return 5;
case YgoZone.HAND:
return 4 - state.sequence;
return state.chaining ? 2 : 4 - state.sequence;
case YgoZone.SZONE:
return state.sequence >= 5 ? 5 : 4 - state.sequence;
case YgoZone.DECK:
......@@ -192,7 +195,7 @@ function cardStateToCol(state: RenderCard): number {
case YgoZone.EXTRA:
return -1;
case YgoZone.HAND:
return state.sequence;
return state.chaining ? 2 : state.sequence;
case YgoZone.SZONE:
return state.sequence >= 5 ? -1 : state.sequence;
case YgoZone.DECK:
......
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