Spaces:
Running
Running
Upload 41 files
Browse files- achievements.js +2 -0
- script.js +13 -8
- spring.js +6 -6
achievements.js
CHANGED
|
@@ -511,7 +511,9 @@ class AchievementSystem {
|
|
| 511 |
// 當頁面載入完成後初始化成就系統
|
| 512 |
document.addEventListener('DOMContentLoaded', () => {
|
| 513 |
// 創建成就系統實例
|
|
|
|
| 514 |
window.achievementSystem = new AchievementSystem();
|
|
|
|
| 515 |
console.log('成就系統已掛載到全域 window 物件');
|
| 516 |
|
| 517 |
// 測試用:添加模擬解鎖按鈕
|
|
|
|
| 511 |
// 當頁面載入完成後初始化成就系統
|
| 512 |
document.addEventListener('DOMContentLoaded', () => {
|
| 513 |
// 創建成就系統實例
|
| 514 |
+
document.addEventListener(\'DOMContentLoaded\', function() {
|
| 515 |
window.achievementSystem = new AchievementSystem();
|
| 516 |
+
});
|
| 517 |
console.log('成就系統已掛載到全域 window 物件');
|
| 518 |
|
| 519 |
// 測試用:添加模擬解鎖按鈕
|
script.js
CHANGED
|
@@ -20,17 +20,22 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 20 |
|
| 21 |
// 音樂控制
|
| 22 |
let isBgmPlaying = false;
|
| 23 |
-
|
| 24 |
-
// 播放背景音樂
|
| 25 |
function playBgm() {
|
| 26 |
-
bgmAudio
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
| 30 |
-
|
| 31 |
// 嘗試自動播放背景音樂(大多數瀏覽器會阻止)
|
| 32 |
-
playBgm();
|
| 33 |
-
|
| 34 |
// 音樂開關按鈕
|
| 35 |
toggleBgmBtn.addEventListener('click', function() {
|
| 36 |
if (isBgmPlaying) {
|
|
|
|
| 20 |
|
| 21 |
// 音樂控制
|
| 22 |
let isBgmPlaying = false;
|
| 23 |
+
// 播放背景音樂
|
|
|
|
| 24 |
function playBgm() {
|
| 25 |
+
const bgmAudio = document.getElementById(\'bgm\');
|
| 26 |
+
const toggleBgmBtn = document.getElementById(\'toggle-bgm\');
|
| 27 |
+
if (bgmAudio) {
|
| 28 |
+
bgmAudio.volume = 0.3; // 設置音量
|
| 29 |
+
bgmAudio.play().catch(e => console.log(\'自動播放被阻止:\', e));
|
| 30 |
+
isBgmPlaying = true;
|
| 31 |
+
if (toggleBgmBtn) {
|
| 32 |
+
toggleBgmBtn.textContent = \'音樂關\';
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
}
|
| 36 |
+
|
| 37 |
// 嘗試自動播放背景音樂(大多數瀏覽器會阻止)
|
| 38 |
+
playBgm();
|
|
|
|
| 39 |
// 音樂開關按鈕
|
| 40 |
toggleBgmBtn.addEventListener('click', function() {
|
| 41 |
if (isBgmPlaying) {
|
spring.js
CHANGED
|
@@ -95,15 +95,15 @@ document.addEventListener(\'DOMContentLoaded\', function() {
|
|
| 95 |
let startTime = null;
|
| 96 |
let questionStartTime = null;
|
| 97 |
let fastestQuestionTime = 999;
|
| 98 |
-
let errors = 0;
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
quizSection.style.display = 'block';
|
| 104 |
startTime = new Date();
|
| 105 |
questionStartTime = new Date();
|
| 106 |
showQuestion(currentQuestionIndex);
|
|
|
|
| 107 |
});
|
| 108 |
|
| 109 |
// 預先載入成就系統
|
|
|
|
| 95 |
let startTime = null;
|
| 96 |
let questionStartTime = null;
|
| 97 |
let fastestQuestionTime = 999;
|
| 98 |
+
let errors = 0; // 開始考驗按鈕點擊事件
|
| 99 |
+
startChallengeBtn.addEventListener(\'click\', function() {
|
| 100 |
+
console.log(\'開始考驗按鈕被點擊\');
|
| 101 |
+
storySection.style.display = \'none\';
|
| 102 |
+
quizSection.style.display = \'block\';
|
|
|
|
| 103 |
startTime = new Date();
|
| 104 |
questionStartTime = new Date();
|
| 105 |
showQuestion(currentQuestionIndex);
|
| 106 |
+
});tion(currentQuestionIndex);
|
| 107 |
});
|
| 108 |
|
| 109 |
// 預先載入成就系統
|