document.getElementById('hackTimer').textContent = systemState.timer;
// 颜色变化
const timerElem = document.getElementById('hackTimer');
if (systemState.timer <= 5) {
timerElem.style.color = '#ff5555';
} else if (systemState.timer <= 15) {
timerElem.style.color = '#ffff55';
} else {
timerElem.style.color = '#00ffff';
}
}
// ==================== 辅助功能 ====================
function showNotification(message) {
const notif = document.getElementById('notification');
notif.textContent = message;
// 样式
if (message.includes('✅') || message.includes('Unlocked')) {
notif.style.borderColor = '#00ff00';
notif.style.color = '#00ff00';
} else if (message.includes('🔒') || message.includes('Locked')) {
notif.style.borderColor = '#ff5555';
notif.style.color = '#ff5555';
} else if (message.includes('🎯')) {
notif.style.borderColor = '#00aaff';
notif.style.color = '#00aaff';
} else {
notif.style.borderColor = '#ffaa00';
notif.style.color = '#ffaa00';
}
notif.style.display = 'block';
setTimeout(() => {
notif.style.display = 'none';
}, 3000);
}
function updateStatusBar() {
const now = new Date();
const timeStr = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', second:'2-digit'});
document.getElementById('statusBar').innerHTML =
`Game Portal | HACK: ${systemState.isUnlocked ? "UNLOCKED" : "LOCKED"} | ${timeStr}`;
}
function updateHackStatus(status) {
document.getElementById('hackStatus').textContent = status;
document.getElementById('hackStatus').style.color =
status === "UNLOCKED" ? '#00ff00' : '#ff0000';
}
// ==================== 启动系统 ====================
window.onload = initializeSystem;
// 添加CSS动画
const style = document.createElement('style');
style.textContent = `
@keyframes shake {
0%, 100% { transform: translateX(0); }
10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
20%, 40%, 60%, 80% { transform: translateX(5px); }
}
`;
document.head.appendChild(style);