Commit 6ab710fe authored by Chunchi Che's avatar Chunchi Che

optimize

parent 9eea2046
Pipeline #21630 passed with stages
in 13 minutes and 55 seconds
...@@ -71,7 +71,9 @@ ...@@ -71,7 +71,9 @@
"hint":{ "hint":{
"waitingDuration":1.5, "waitingDuration":1.5,
"maxCount": 1 "maxCount": 1
} },
"moveDelay": 500,
"chainingDelay": 800
}, },
"unimplementedWhiteList":[ "unimplementedWhiteList":[
1, 1,
......
...@@ -71,7 +71,9 @@ ...@@ -71,7 +71,9 @@
"hint":{ "hint":{
"waitingDuration":1.5, "waitingDuration":1.5,
"maxCount": 1 "maxCount": 1
} },
"moveDelay": 500,
"chainingDelay": 800
}, },
"unimplementedWhiteList":[ "unimplementedWhiteList":[
1, 1,
......
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { useConfig } from "@/config";
import { fetchEsHintMeta, matStore } from "@/stores"; import { fetchEsHintMeta, matStore } from "@/stores";
export default (chaining: ygopro.StocGameMessage.MsgChaining) => { export default (chaining: ygopro.StocGameMessage.MsgChaining) => {
fetchEsHintMeta({ fetchEsHintMeta({
originMsg: "「[?]」被发动时", originMsg: "「[?]」被发动时",
...@@ -11,5 +13,5 @@ export default (chaining: ygopro.StocGameMessage.MsgChaining) => { ...@@ -11,5 +13,5 @@ export default (chaining: ygopro.StocGameMessage.MsgChaining) => {
setTimeout(() => { setTimeout(() => {
matStore.setChaining(chaining.location, chaining.code, false); matStore.setChaining(chaining.location, chaining.code, false);
// TODO: set chained // TODO: set chained
}, 500); }, useConfig().ui.chainingDelay);
}; };
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { useConfig } from "@/config";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
import onMsgAttack from "./attack"; import onMsgAttack from "./attack";
...@@ -56,7 +57,7 @@ const ActiveList = [ ...@@ -56,7 +57,7 @@ const ActiveList = [
"select_yes_no", "select_yes_no",
]; ];
const TIME_GAP = 200; const NeosConfig = useConfig();
export default function handleGameMsg(pb: ygopro.YgoStocMsg) { export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
// 防止MSG更新太频繁,做下控频 // 防止MSG更新太频繁,做下控频
...@@ -69,6 +70,9 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -69,6 +70,9 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
matStore.waiting = false; matStore.waiting = false;
} }
// 先重置`delay`
matStore.delay = 0;
switch (msg.gameMsg) { switch (msg.gameMsg) {
case "start": { case "start": {
onMsgStart(msg.start); onMsgStart(msg.start);
...@@ -108,6 +112,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -108,6 +112,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "move": { case "move": {
onMsgMove(msg.move); onMsgMove(msg.move);
matStore.delay = NeosConfig.ui.moveDelay;
break; break;
} }
case "select_card": { case "select_card": {
...@@ -233,6 +239,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -233,6 +239,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "chaining": { case "chaining": {
onMsgChaining(msg.chaining); onMsgChaining(msg.chaining);
matStore.delay = NeosConfig.ui.chainingDelay;
break; break;
} }
case "chain_solved": { case "chain_solved": {
...@@ -279,5 +287,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -279,5 +287,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
} }
}, TIME_GAP); }, matStore.delay);
} }
...@@ -255,6 +255,7 @@ export const matStore: MatState = proxy<MatState>({ ...@@ -255,6 +255,7 @@ export const matStore: MatState = proxy<MatState>({
result: ygopro.StocGameMessage.MsgWin.ActionType.UNKNOWN, result: ygopro.StocGameMessage.MsgWin.ActionType.UNKNOWN,
waiting: false, waiting: false,
unimplemented: 0, unimplemented: 0,
delay: 0,
// methods // methods
in: getZone, in: getZone,
isMe, isMe,
......
...@@ -94,6 +94,8 @@ export interface MatState { ...@@ -94,6 +94,8 @@ export interface MatState {
unimplemented: number; // 未处理的`Message` unimplemented: number; // 未处理的`Message`
delay: number; // MSG处理的延迟时间,目的时为了让一些动画处理完后再开始处理下一个MSG
// >>> methods >>> // >>> methods >>>
/** 根据zone获取hands/masters/magics... */ /** 根据zone获取hands/masters/magics... */
in: (zone: ygopro.CardZone) => BothSide<DuelFieldState>; in: (zone: ygopro.CardZone) => BothSide<DuelFieldState>;
......
...@@ -59,7 +59,9 @@ export const Card: React.FC<{ ...@@ -59,7 +59,9 @@ export const Card: React.FC<{
"--shadow": hight > 0 ? 1 : 0, "--shadow": hight > 0 ? 1 : 0,
"--opponent-deg": opponent ? "180deg" : "0deg", "--opponent-deg": opponent ? "180deg" : "0deg",
"--vertical": vertical ? 1 : 0, "--vertical": vertical ? 1 : 0,
"--trans-time": `${transTime}s`, "--trans-time": `${
chaining ? NeosConfig.ui.chainingDelay / 1000 : transTime
}s`,
"--highlight-on": highlight ? 1 : 0, "--highlight-on": highlight ? 1 : 0,
"--scale-focus": focus ? FOCUS_SCALE : 1, "--scale-focus": focus ? FOCUS_SCALE : 1,
"--card-img": facedown "--card-img": facedown
......
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