Commit 892fb37f authored by Chunchi Che's avatar Chunchi Che

fix focus

parent 4d7d9493
Pipeline #21574 passed with stages
in 23 minutes and 32 seconds
......@@ -109,12 +109,12 @@ export default (move: MsgMove) => {
true
);
setTimeout(
() =>
(matStore.in(to.location).of(to.controler)[to.sequence].focus =
false),
200
);
setTimeout(() => {
// 因为手牌可能会洗牌,sequence就对不上了,所以这里把所有手牌的focus字段都设置成false
for (const hand of matStore.in(to.location).of(to.controler)) {
hand.focus = false;
}
}, 200);
}
break;
}
......
......@@ -50,6 +50,7 @@ function reloadDuelField(
},
idleInteractivities: [],
counters: {},
focus: false,
reload: true,
};
});
......
......@@ -39,6 +39,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
controler: 1 - opponent,
zone: ygopro.CardZone.DECK,
},
focus: false,
counters: {},
idleInteractivities: [],
});
......@@ -55,6 +56,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
controler: opponent,
zone: ygopro.CardZone.DECK,
},
focus: false,
counters: {},
idleInteractivities: [],
});
......@@ -72,6 +74,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
controler: opponent,
zone: ygopro.CardZone.EXTRA,
},
focus: false,
counters: {},
idleInteractivities: [],
});
......
......@@ -40,7 +40,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
position:
position == undefined ? ygopro.CardPosition.FACEUP_ATTACK : position,
},
focus,
focus: focus ?? false,
counters: {},
idleInteractivities: [],
});
......@@ -84,7 +84,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
) {
const meta = await fetchCard(id);
const target = this[sequence];
target.focus = focus;
target.focus = focus ?? false;
target.occupant = meta;
if (position) {
target.location.position = position;
......@@ -160,6 +160,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
location: {
zone,
},
focus: false,
idleInteractivities: [],
counters: {},
}));
......
......@@ -120,7 +120,7 @@ export interface CardState {
zone: ygopro.CardZone; // 怪兽区/魔法陷阱区/手牌/卡组/墓地/除外区
position?: ygopro.CardPosition; // 卡片的姿势:攻击还是守备
}; // 位置信息,叫location的原因是为了和ygo对齐
focus?: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息
placeInteractivity?: Interactivity<{
controler: number;
......
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