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