Files

255 lines
13 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>朝比奈真冬 · 攻击音效 A/B 试听</title>
<style>
:root {
color-scheme: dark;
--ink: #f6f1ff;
--muted: #aca3bd;
--panel: rgba(23, 19, 35, .82);
--line: rgba(226, 209, 255, .14);
--violet: #b39aff;
--pink: #f3a6d5;
--cyan: #8ce0ef;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
color: var(--ink);
font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
background:
radial-gradient(circle at 18% 8%, rgba(134, 100, 208, .19), transparent 35rem),
radial-gradient(circle at 88% 4%, rgba(77, 185, 207, .11), transparent 28rem),
linear-gradient(150deg, #0b0912, #171121 52%, #0c1018);
}
body::before {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
opacity: .19;
background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
background-size: 36px 36px;
mask-image: linear-gradient(to bottom, black, transparent 80%);
}
main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.eyebrow { color: var(--pink); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; }
h1 { margin: 10px 0 12px; font-size: clamp(30px, 5vw, 54px); font-weight: 650; letter-spacing: -.035em; }
.intro { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.75; }
.toolbar {
position: sticky;
top: 12px;
z-index: 5;
display: grid;
grid-template-columns: 1fr auto auto;
gap: 12px;
align-items: center;
margin: 30px 0 34px;
padding: 14px;
border: 1px solid var(--line);
border-radius: 18px;
background: rgba(16, 13, 25, .88);
box-shadow: 0 16px 50px rgba(0,0,0,.3);
backdrop-filter: blur(16px);
}
.now { min-width: 0; }
.now small { display: block; margin-bottom: 3px; color: var(--muted); }
#nowName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button {
border: 1px solid var(--line);
border-radius: 12px;
padding: 10px 14px;
color: var(--ink);
font: inherit;
cursor: pointer;
background: rgba(255,255,255,.055);
transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
button:hover { border-color: rgba(179,154,255,.62); background: rgba(179,154,255,.11); }
button:active { transform: translateY(1px) scale(.985); }
button.primary { color: #130d1c; border: 0; background: linear-gradient(135deg, var(--violet), var(--pink)); font-weight: 700; }
.settings {
display: flex;
gap: 18px;
align-items: center;
flex-wrap: wrap;
margin-bottom: 34px;
color: var(--muted);
font-size: 13px;
}
.settings label { display: flex; gap: 9px; align-items: center; }
input[type="range"] { accent-color: var(--violet); width: 150px; }
section { margin-top: 34px; }
.section-head { display: flex; gap: 14px; align-items: baseline; margin-bottom: 13px; }
h2 { margin: 0; font-size: 20px; font-weight: 620; }
.section-head span { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card {
position: relative;
min-height: 152px;
padding: 17px;
border: 1px solid var(--line);
border-radius: 17px;
background: var(--panel);
overflow: hidden;
transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(179,154,255,.36); }
.card.selected { border-color: var(--violet); background: rgba(47, 36, 69, .91); box-shadow: inset 0 0 0 1px rgba(179,154,255,.18); }
.card::after { content: ""; position: absolute; right: -32px; bottom: -42px; width: 110px; height: 110px; border-radius: 50%; background: var(--accent, var(--violet)); opacity: .08; filter: blur(2px); }
.card-top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.card h3 { margin: 12px 0 7px; font-size: 17px; }
.card p { min-height: 37px; margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-actions { display: flex; gap: 8px; }
.card-actions button { position: relative; z-index: 1; padding: 8px 11px; font-size: 12px; }
.physical { --accent: var(--pink); }
.energy { --accent: var(--cyan); }
.layered { --accent: var(--violet); }
.help { margin-top: 46px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; color: var(--muted); background: rgba(10,9,16,.55); line-height: 1.7; }
.help strong { color: var(--ink); }
code { color: #e4d7ff; overflow-wrap: anywhere; }
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; translate: -50% 12px; padding: 10px 15px; border-radius: 999px; color: #160e21; background: #eadfff; opacity: 0; pointer-events: none; transition: .2s ease; }
#toast.show { translate: -50% 0; opacity: 1; }
@media (max-width: 800px) { .grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 590px) {
main { width: min(100% - 22px, 1120px); padding-top: 32px; }
.toolbar { grid-template-columns: 1fr 1fr; }
.now { grid-column: 1 / -1; }
.toolbar button { width: 100%; }
.grid { grid-template-columns: 1fr; }
input[type="range"] { width: 122px; }
}
</style>
</head>
<body>
<main>
<div class="eyebrow">Silent Corridor · Sound Lab</div>
<h1>攻击音效 A/B 试听</h1>
<p class="intro">现有攻击音效作为 A 基准,不会被这个页面修改。先在卡片中选择一个候选 B,再用顶部按钮反复对比;建议戴耳机,同时尝试不同播放速度。</p>
<div class="toolbar">
<div class="now"><small>当前候选 B</small><div id="nowName">尚未选择</div></div>
<button id="playA">A · 当前音效</button>
<button id="playB" class="primary" disabled>B · 播放候选</button>
</div>
<div class="settings">
<label>音量 <input id="volume" type="range" min="0" max="1" step="0.05" value="0.75"><output id="volumeOut">75%</output></label>
<label>速度 <input id="rate" type="range" min="0.75" max="1.35" step="0.05" value="1"><output id="rateOut">1.00×</output></label>
<span>快捷键:A 播放原音效,B 播放候选,空格重播上一次</span>
</div>
<div id="groups"></div>
<div class="help">
<strong>选定后如何替换:</strong>先备份 <code>assets/audio/sfx-attack.ogg</code>,再把所选候选文件复制并改名为 <code>sfx-attack.ogg</code>。也可以只修改 <code>game.js</code> 中 <code>SFX_TRACKS.attack</code> 的路径。点击卡片里的“复制替换命令”可复制一条 PowerShell 命令;页面本身不会写入游戏文件。
</div>
</main>
<div id="toast" role="status"></div>
<script>
const groups = [
{ id: 'physical', title: '挥砍 / 风切', hint: '短促、实体感强,适合普通近战', items: [
['physical-swish-01.ogg', 'Swish 01', '极短挥动样本,适合轻攻击。'],
['physical-swish-02.ogg', 'Swish 02', '另一种极短风切,可用于更快的起手。'],
['physical-swish-03.ogg', 'Swish 03', '短挥动样本,轮廓相对完整。'],
['physical-swish-04.ogg', 'Swish 04', '紧凑风切,可尝试稍低播放速度。'],
['physical-swish-07.ogg', 'Swish 07', '较长的挥动尾音,动作存在感更明显。'],
['physical-swish-08.ogg', 'Swish 08', '轻量短尾,适合连续攻击。'],
['physical-swish-09.ogg', 'Swish 09', '中短风切,适合作为节拍音刃底层。'],
['physical-swish-12.ogg', 'Swish 12', '非常短促,可叠加命中特效音。'],
['physical-knife-slice-alt.ogg', 'Knife Slice Alt', 'Kenney 的另一条切割声,不是游戏当前文件。']
]},
{ id: 'energy', title: '能量 / 音符', hint: '更贴近 SEKAI 与节奏音刃的电子质感', items: [
['energy-phaser-rise.ogg', 'Phaser Rise', '短数字上升音,适合 PERFECT 攻击。'],
['energy-phase-snap.ogg', 'Phase Snap', '紧凑相位脉冲,起音较明确。'],
['energy-laser-short.ogg', 'Laser Short', '激光素材的短裁切版,尾部已淡出。'],
['energy-magic-01-short.ogg', 'Magic 01 Short', '魔法素材短版,可尝试 1.10× 速度。'],
['energy-magic-02-short.ogg', 'Magic 02 Short', '第二条魔法素材短版。'],
['energy-magic-03-short.ogg', 'Magic 03 Short', '第三条魔法素材短版。']
]},
{ id: 'layered', title: '混合版本', hint: '挥动声负责手感,电子或魔法层负责角色辨识度', items: [
['layered-swish-phaser.ogg', 'Swish + Phaser', '风切与数字上升音的双层版本。'],
['layered-swish-magic.ogg', 'Swish + Magic', '风切与短魔法尾音的双层版本。'],
['layered-knife-phase.ogg', 'Knife + Phase', '切割与相位脉冲结合,实体感更强。']
]}
];
const root = document.querySelector('#groups');
const audio = new Audio();
const volume = document.querySelector('#volume');
const rate = document.querySelector('#rate');
const playB = document.querySelector('#playB');
const nowName = document.querySelector('#nowName');
const toast = document.querySelector('#toast');
let selected = null;
let lastSource = null;
let toastTimer = 0;
function escapeShellSingle(value) { return value.replaceAll("'", "''"); }
function notify(message) {
toast.textContent = message;
toast.classList.add('show');
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toast.classList.remove('show'), 1800);
}
function play(source, label) {
lastSource = { source, label };
audio.pause();
audio.src = source;
audio.currentTime = 0;
audio.volume = Number(volume.value);
audio.playbackRate = Number(rate.value);
audio.play().then(() => { nowName.textContent = `正在播放:${label}`; }).catch(() => notify('浏览器阻止了播放,请再点击一次'));
}
function select(item, title, card) {
selected = { source: item, title };
document.querySelectorAll('.card').forEach(node => node.classList.toggle('selected', node === card));
card.classList.add('selected');
nowName.textContent = title;
playB.disabled = false;
localStorage.setItem('attack-candidate', item);
}
async function copyCommand(file) {
const command = `Copy-Item -LiteralPath 'assets\\audio\\attack-candidates\\${escapeShellSingle(file)}' -Destination 'assets\\audio\\sfx-attack.ogg' -Force`;
try { await navigator.clipboard.writeText(command); notify('替换命令已复制'); }
catch { window.prompt('请手动复制:', command); }
}
groups.forEach(group => {
const section = document.createElement('section');
section.innerHTML = `<div class="section-head"><h2>${group.title}</h2><span>${group.hint}</span></div><div class="grid"></div>`;
const grid = section.querySelector('.grid');
group.items.forEach(([file, title, note], index) => {
const card = document.createElement('article');
card.className = `card ${group.id}`;
card.innerHTML = `<div class="card-top"><span>${group.id}</span><span class="duration">读取时长…</span></div><h3>${title}</h3><p>${note}</p><div class="card-actions"><button class="listen">选择并播放</button><button class="copy">复制替换命令</button></div>`;
const probe = new Audio(file);
probe.preload = 'metadata';
probe.addEventListener('loadedmetadata', () => card.querySelector('.duration').textContent = `${probe.duration.toFixed(2)} s`);
card.querySelector('.listen').addEventListener('click', () => { select(file, title, card); play(file, title); });
card.querySelector('.copy').addEventListener('click', () => copyCommand(file));
grid.append(card);
if (localStorage.getItem('attack-candidate') === file) select(file, title, card);
});
root.append(section);
});
document.querySelector('#playA').addEventListener('click', () => play('../sfx-attack.ogg', 'A · 游戏当前音效'));
playB.addEventListener('click', () => selected && play(selected.source, `B · ${selected.title}`));
volume.addEventListener('input', () => { audio.volume = Number(volume.value); document.querySelector('#volumeOut').value = `${Math.round(volume.value * 100)}%`; });
rate.addEventListener('input', () => { audio.playbackRate = Number(rate.value); document.querySelector('#rateOut').value = `${Number(rate.value).toFixed(2)}×`; });
document.addEventListener('keydown', event => {
if (event.target.matches('input, button')) return;
if (event.code === 'KeyA') play('../sfx-attack.ogg', 'A · 游戏当前音效');
if (event.code === 'KeyB' && selected) play(selected.source, `B · ${selected.title}`);
if (event.code === 'Space' && lastSource) { event.preventDefault(); play(lastSource.source, lastSource.label); }
});
</script>
</body>
</html>