Commit 255aa6df authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/chain' into 'main'

optimize chain effect

See merge request !207
parents 381e6fb9 aaf2a7ee
Pipeline #21810 passed with stages
in 13 minutes and 20 seconds
......@@ -9,12 +9,12 @@ import { matStore } from "@/stores";
// 对于这三种情况`service`层的逻辑是一致的,但是UI展示应该有区别,
// 因为现在还没实现连锁处理的动画,因此暂时先都一致处理,
// 体现在 `penetrage.json`文件中三个一样的配置。
export default (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
export default async (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
const location = matStore.chains
.splice(chainSolved.solved_index - 1, 1)
.at(0);
if (location) {
// 设置被连锁状态为空
// 设置被连锁状态为空,解除连锁
matStore.setChained(location, undefined);
} else {
console.warn(
......
......@@ -231,7 +231,7 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "chain_solved": {
onMsgChainSolved(msg.chain_solved);
await onMsgChainSolved(msg.chain_solved);
break;
}
......
......@@ -102,7 +102,7 @@ export default async (move: MsgMove) => {
chainIndex;
await sleep(NeosConfig.ui.moveDelay);
matStore.in(to.location).of(to.controler)[to.sequence].focus = false;
matStore.setFocus(to, false);
break;
}
case ygopro.CardZone.REMOVED:
......@@ -132,7 +132,7 @@ export default async (move: MsgMove) => {
);
await sleep(NeosConfig.ui.moveDelay);
matStore.in(to.location).of(to.controler)[to.sequence].focus = false;
matStore.setFocus(to, false);
}
break;
}
......
......@@ -297,6 +297,16 @@ export const matStore: MatState = proxy<MatState>({
console.warn(`target is null in setChained, location=${location}`);
}
},
setFocus(location, focus) {
const target = this.in(location.location)
.of(location.controler)
.at(location.sequence);
if (target) {
target.focus = focus;
} else {
console.warn(`target is null in setFocus, location=${location}`);
}
},
});
// @ts-ignore 挂到全局,便于调试
......
......@@ -112,6 +112,8 @@ export interface MatState {
) => Promise<void>;
// 添加被连锁状态
setChained: (location: ygopro.CardLocation, chainIndex?: number) => void;
// 设置聚焦状态
setFocus: (location: ygopro.CardLocation, focus: boolean) => void;
}
export interface InitInfo {
......
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