Commit non-media application and asset changes while leaving audio, video, and environment files out of version control. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
const STORAGE_KEY = 'debug:progression-unlock-all'
|
|
const BADGE_ID = 'progression-debug-badge'
|
|
|
|
const isUnlockAllEnabled = () => {
|
|
return window.sessionStorage.getItem(STORAGE_KEY) !== 'false'
|
|
}
|
|
|
|
const getBadgeText = () => {
|
|
return isUnlockAllEnabled() ? '测试包:全解锁' : '测试包:真实进度'
|
|
}
|
|
|
|
const updateBadge = () => {
|
|
let badge = document.getElementById(BADGE_ID)
|
|
if (!badge) {
|
|
badge = document.createElement('div')
|
|
badge.id = BADGE_ID
|
|
badge.style.position = 'fixed'
|
|
badge.style.right = '12px'
|
|
badge.style.top = '12px'
|
|
badge.style.zIndex = '99999'
|
|
badge.style.padding = '8px 10px'
|
|
badge.style.borderRadius = '8px'
|
|
badge.style.background = 'rgba(0, 0, 0, 0.72)'
|
|
badge.style.color = '#fff'
|
|
badge.style.fontSize = '12px'
|
|
badge.style.lineHeight = '1.5'
|
|
badge.style.pointerEvents = 'none'
|
|
badge.style.whiteSpace = 'pre-line'
|
|
document.body.appendChild(badge)
|
|
}
|
|
|
|
badge.textContent = `${getBadgeText()}\nCtrl+Shift+U 切换`
|
|
}
|
|
|
|
const toggleUnlockAll = () => {
|
|
const nextValue = isUnlockAllEnabled() ? 'false' : 'true'
|
|
window.sessionStorage.setItem(STORAGE_KEY, nextValue)
|
|
updateBadge()
|
|
window.location.reload()
|
|
}
|
|
|
|
export const setupProgressionDebug = () => {
|
|
updateBadge()
|
|
|
|
window.addEventListener('keydown', (event) => {
|
|
if (!event.ctrlKey || !event.shiftKey || event.key.toLowerCase() !== 'u') return
|
|
|
|
event.preventDefault()
|
|
toggleUnlockAll()
|
|
})
|
|
}
|