Commit 57584ef1 authored by Chunchi Che's avatar Chunchi Che

fix timing of playEffect on summon and super summon

parent 6b369c71
Pipeline #27220 passed with stages
in 8 minutes and 8 seconds
......@@ -21,6 +21,6 @@ export default (data: Uint8Array) => {
code,
from: fromLocation,
to: toLocation,
reason: reader.inner.readUint8(),
reason: reader.inner.readUint32(),
});
};
......@@ -6,7 +6,9 @@ import { callCardMove } from "@/ui/Duel/PlayMat/Card";
import { REASON_DESTROY, REASON_MATERIAL, TYPE_TOKEN } from "../../common";
type MsgMove = ygopro.StocGameMessage.MsgMove;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, TZONE } = ygopro.CardZone;
const { HAND, GRAVE, REMOVED, DECK, EXTRA, MZONE, SZONE, TZONE } =
ygopro.CardZone;
const { FACEDOWN, FACEDOWN_ATTACK, FACEDOWN_DEFENSE } = ygopro.CardPosition;
const overlayStack: ygopro.CardLocation[] = [];
......@@ -48,18 +50,6 @@ export default async (move: MsgMove) => {
}
}
switch (to.zone) {
case REMOVED:
playEffect(AudioActionType.SOUND_BANISHED);
break;
default:
break;
}
if (reason & REASON_DESTROY) {
playEffect(AudioActionType.SOUND_DESTROYED);
}
// log出来看看
console.color("green")(
`${meta.text.name} ${ygopro.CardZone[from.zone]}:${from.sequence}${
......@@ -174,7 +164,21 @@ export default async (move: MsgMove) => {
target.code = code;
target.location = to;
// 维护完了之后,开始动画
// 维护完了之后,开始播放音效和动画
if (to.zone === REMOVED) {
playEffect(AudioActionType.SOUND_BANISHED);
} else if (
(to.zone === MZONE || to.zone === SZONE) &&
(to.position === FACEDOWN ||
to.position === FACEDOWN_ATTACK ||
to.position === FACEDOWN_DEFENSE)
) {
playEffect(AudioActionType.SOUND_SET);
} else if (reason === REASON_DESTROY) {
playEffect(AudioActionType.SOUND_DESTROYED);
}
const p = callCardMove(target.uuid, { fromZone: from.zone });
// 如果from或者to是手卡,那么需要刷新除了这张卡之外,这个玩家的所有手卡
if ([from.zone, to.zone].includes(HAND)) {
......
import { ygopro } from "@/api";
import { AudioActionType, playEffect } from "@/infra/audio";
import { fetchEsHintMeta } from "@/stores";
export default (_set: ygopro.StocGameMessage.MsgSet) => {
playEffect(AudioActionType.SOUND_SET);
fetchEsHintMeta({ originMsg: 1601 });
};
import { ygopro } from "@/api";
import { AudioActionType, playEffect } from "@/infra/audio";
import { fetchEsHintMeta } from "@/stores";
export default (_: ygopro.StocGameMessage.MsgSpSummoned) => {
// 这里服务器没有传特殊召唤的怪兽的ID,
// 所以如果要判断是否是衍生物召唤的话,需要从`MsgSpSummoning`中获取
// 并保存,在处理这个消息的时候再取出来进行判断。
//
// 这里暂时在所有情况下都播放`SOUND_SPECIAL_SUMMON`
playEffect(AudioActionType.SOUND_SPECIAL_SUMMON);
fetchEsHintMeta({ originMsg: 1606 });
};
import { fetchCard, ygopro } from "@/api";
import { TYPE_TOKEN } from "@/common";
import { AudioActionType, playEffect } from "@/infra/audio";
import { ygopro } from "@/api";
import { fetchEsHintMeta } from "@/stores";
export default (spSummoning: ygopro.StocGameMessage.MsgSpSummoning) => {
const card = fetchCard(spSummoning.code);
if (card.data.type && card.data.type & TYPE_TOKEN) {
playEffect(AudioActionType.SOUND_TOKEN);
} else {
playEffect(AudioActionType.SOUND_SPECIAL_SUMMON);
}
fetchEsHintMeta({
originMsg: "「[?]」特殊召唤宣言时",
cardID: spSummoning.code,
......
import { ygopro } from "@/api";
import { AudioActionType, playEffect } from "@/infra/audio";
import { fetchEsHintMeta } from "@/stores";
export default (_: ygopro.StocGameMessage.MsgSummoned) => {
playEffect(AudioActionType.SOUND_SUMMON);
fetchEsHintMeta({ originMsg: 1604 });
};
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