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

Merge branch 'optimize/chain' into 'main'

optimize chain effect

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