update:修复大乱斗特效飘移

This commit is contained in:
2026-07-03 17:46:00 +08:00
parent 3c7467fbdf
commit 0a678cb387
2 changed files with 81 additions and 27 deletions
+16 -3
View File
@@ -34,6 +34,7 @@ const phase = ref("idle");
const activePlayKey = ref("");
const animationKey = ref("");
const impactEmitted = ref(false);
const activeShot = ref(null);
let timers = [];
const isActive = computed(() => phase.value !== "idle");
@@ -54,9 +55,17 @@ const safeTargetSize = computed(() => {
};
});
function hasShotPoint(shot) {
const x = Number(shot?.x);
const y = Number(shot?.y);
return Number.isFinite(x) && Number.isFinite(y);
}
const effectiveShot = computed(() => activeShot.value || props.shot);
const shotPoint = computed(() => {
const x = Number(props.shot?.x);
const y = Number(props.shot?.y);
const x = Number(effectiveShot.value?.x);
const y = Number(effectiveShot.value?.y);
return {
x: Number.isFinite(x) ? x : 0,
y: Number.isFinite(y) ? y : 0,
@@ -179,16 +188,20 @@ function finish(playKey) {
clearTimers();
phase.value = "idle";
activePlayKey.value = "";
activeShot.value = null;
emit("complete", playKey);
}
function play() {
if (!props.playKey || !props.shot || !props.shot.ring) return;
if (!props.playKey || !props.shot || !props.shot.ring || !hasShotPoint(props.shot)) {
return;
}
clearTimers();
activePlayKey.value = props.playKey;
animationKey.value = `${props.playKey}`;
impactEmitted.value = false;
activeShot.value = { ...props.shot };
phase.value = "playing";
queueTimer(() => {