Spaces:
Running
Running
Upload 15 files
Browse files- .gitattributes +1 -0
- bgm.mp3 +3 -0
- bingo.mp3 +0 -0
- index.html +12 -0
- script.js +96 -69
- spring.html +20 -7
- spring.js +36 -8
- style.css +35 -44
- wrong.mp3 +0 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
Theme.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
palace.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
guadian.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 36 |
Theme.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
palace.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
guadian.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
bgm.mp3 filter=lfs diff=lfs merge=lfs -text
|
bgm.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4f837975450c437d063adc17950d6392e02a1127445b4fd9ee8998d25bb1569
|
| 3 |
+
size 2483949
|
bingo.mp3
ADDED
|
Binary file (25.5 kB). View file
|
|
|
index.html
CHANGED
|
@@ -7,6 +7,11 @@
|
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body class="home-page">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
<div class="game-container">
|
| 11 |
<h1 class="game-title">《數學魔法王國:平方之旅》</h1>
|
| 12 |
|
|
@@ -15,6 +20,13 @@
|
|
| 15 |
<button id="load-btn" class="menu-btn">讀取進度</button>
|
| 16 |
<button id="exit-btn" class="menu-btn">遊戲結束</button>
|
| 17 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</div>
|
| 19 |
|
| 20 |
<!-- ID輸入彈窗 -->
|
|
|
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body class="home-page">
|
| 10 |
+
<!-- 音效元素 -->
|
| 11 |
+
<audio id="bgm" loop>
|
| 12 |
+
<source src="bgm.mp3" type="audio/mpeg">
|
| 13 |
+
</audio>
|
| 14 |
+
|
| 15 |
<div class="game-container">
|
| 16 |
<h1 class="game-title">《數學魔法王國:平方之旅》</h1>
|
| 17 |
|
|
|
|
| 20 |
<button id="load-btn" class="menu-btn">讀取進度</button>
|
| 21 |
<button id="exit-btn" class="menu-btn">遊戲結束</button>
|
| 22 |
</div>
|
| 23 |
+
|
| 24 |
+
<!-- 音樂來源註記 -->
|
| 25 |
+
<div class="music-credit">
|
| 26 |
+
<p>背景音樂:샛별 - Level Up</p>
|
| 27 |
+
<p>推廣:J&B無版權音樂庫 <a href="https://bit.ly/2YfWIhw" target="_blank">https://bit.ly/2YfWIhw</a></p>
|
| 28 |
+
<button id="toggle-bgm" class="small-btn">音樂開/關</button>
|
| 29 |
+
</div>
|
| 30 |
</div>
|
| 31 |
|
| 32 |
<!-- ID輸入彈窗 -->
|
script.js
CHANGED
|
@@ -1,36 +1,3 @@
|
|
| 1 |
-
// 玩家資料
|
| 2 |
-
let playerData = [];
|
| 3 |
-
|
| 4 |
-
// 載入CSV檔案
|
| 5 |
-
async function loadPlayerData() {
|
| 6 |
-
try {
|
| 7 |
-
const response = await fetch('ID.csv');
|
| 8 |
-
const data = await response.text();
|
| 9 |
-
|
| 10 |
-
// 解析CSV
|
| 11 |
-
const rows = data.split('\n');
|
| 12 |
-
const headers = rows[0].split(',');
|
| 13 |
-
|
| 14 |
-
// 跳過標題行,處理每一行資料
|
| 15 |
-
for (let i = 1; i < rows.length; i++) {
|
| 16 |
-
if (rows[i].trim() === '') continue;
|
| 17 |
-
|
| 18 |
-
const values = rows[i].split(',');
|
| 19 |
-
const player = {
|
| 20 |
-
id: values[0].trim(),
|
| 21 |
-
name: values[1].trim(),
|
| 22 |
-
profession: values[2].trim()
|
| 23 |
-
};
|
| 24 |
-
playerData.push(player);
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
console.log('玩家資料載入成功:', playerData);
|
| 28 |
-
} catch (error) {
|
| 29 |
-
console.error('載入玩家資料失敗:', error);
|
| 30 |
-
}
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
// 頁面載入時執行
|
| 34 |
document.addEventListener('DOMContentLoaded', function() {
|
| 35 |
loadPlayerData();
|
| 36 |
|
|
@@ -47,6 +14,34 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 47 |
const idError = document.getElementById('id-error');
|
| 48 |
const welcomeMessage = document.getElementById('welcome-message');
|
| 49 |
const startAdventureBtn = document.getElementById('start-adventure');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
// 開始冒險按鈕點擊事件
|
| 52 |
startBtn.addEventListener('click', function() {
|
|
@@ -176,43 +171,75 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 176 |
alert('感謝遊玩《數學魔法王國:平方之旅》!');
|
| 177 |
}
|
| 178 |
});
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
}
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
| 191 |
}
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
|
|
|
|
|
|
| 216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
}
|
| 218 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
document.addEventListener('DOMContentLoaded', function() {
|
| 2 |
loadPlayerData();
|
| 3 |
|
|
|
|
| 14 |
const idError = document.getElementById('id-error');
|
| 15 |
const welcomeMessage = document.getElementById('welcome-message');
|
| 16 |
const startAdventureBtn = document.getElementById('start-adventure');
|
| 17 |
+
const bgmAudio = document.getElementById('bgm');
|
| 18 |
+
const toggleBgmBtn = document.getElementById('toggle-bgm');
|
| 19 |
+
|
| 20 |
+
// 音樂控制
|
| 21 |
+
let isBgmPlaying = false;
|
| 22 |
+
|
| 23 |
+
// 播放背景音樂
|
| 24 |
+
function playBgm() {
|
| 25 |
+
bgmAudio.volume = 0.3; // 設置音量
|
| 26 |
+
bgmAudio.play().catch(e => console.log('自動播放被阻止:', e));
|
| 27 |
+
isBgmPlaying = true;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// 嘗試自動播放背景音樂(大多數瀏覽器會阻止)
|
| 31 |
+
playBgm();
|
| 32 |
+
|
| 33 |
+
// 音樂開關按鈕
|
| 34 |
+
toggleBgmBtn.addEventListener('click', function() {
|
| 35 |
+
if (isBgmPlaying) {
|
| 36 |
+
bgmAudio.pause();
|
| 37 |
+
isBgmPlaying = false;
|
| 38 |
+
toggleBgmBtn.textContent = '音樂開';
|
| 39 |
+
} else {
|
| 40 |
+
bgmAudio.play();
|
| 41 |
+
isBgmPlaying = true;
|
| 42 |
+
toggleBgmBtn.textContent = '音樂關';
|
| 43 |
+
}
|
| 44 |
+
});
|
| 45 |
|
| 46 |
// 開始冒險按鈕點擊事件
|
| 47 |
startBtn.addEventListener('click', function() {
|
|
|
|
| 171 |
alert('感謝遊玩《數學魔法王國:平方之旅》!');
|
| 172 |
}
|
| 173 |
});
|
| 174 |
+
});
|
| 175 |
+
|
| 176 |
+
// 玩家資料
|
| 177 |
+
let playerData = [];
|
| 178 |
+
|
| 179 |
+
// 載入CSV檔案
|
| 180 |
+
async function loadPlayerData() {
|
| 181 |
+
try {
|
| 182 |
+
const response = await fetch('ID.csv');
|
| 183 |
+
const data = await response.text();
|
| 184 |
+
|
| 185 |
+
// 解析CSV
|
| 186 |
+
const rows = data.split('\n');
|
| 187 |
+
const headers = rows[0].split(',');
|
| 188 |
+
|
| 189 |
+
// 跳過標題行,處理每一行資料
|
| 190 |
+
for (let i = 1; i < rows.length; i++) {
|
| 191 |
+
if (rows[i].trim() === '') continue;
|
| 192 |
+
|
| 193 |
+
const values = rows[i].split(',');
|
| 194 |
+
const player = {
|
| 195 |
+
id: values[0].trim(),
|
| 196 |
+
name: values[1].trim(),
|
| 197 |
+
profession: values[2].trim()
|
| 198 |
+
};
|
| 199 |
+
playerData.push(player);
|
| 200 |
}
|
| 201 |
+
|
| 202 |
+
console.log('玩家資料載入成功:', playerData);
|
| 203 |
+
} catch (error) {
|
| 204 |
+
console.error('載入玩家資料失敗:', error);
|
| 205 |
}
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// 支援跨裝置存檔的功能
|
| 209 |
+
function generateSaveCode(playerId) {
|
| 210 |
+
const progress = localStorage.getItem(`gameProgress_${playerId}`);
|
| 211 |
+
if (progress) {
|
| 212 |
+
// 將遊戲進度轉為Base64編碼
|
| 213 |
+
return btoa(JSON.stringify({
|
| 214 |
+
id: playerId,
|
| 215 |
+
progress: JSON.parse(progress)
|
| 216 |
+
}));
|
| 217 |
+
}
|
| 218 |
+
return null;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
function loadFromSaveCode(saveCode) {
|
| 222 |
+
try {
|
| 223 |
+
// 解碼並解析存檔數據
|
| 224 |
+
const data = JSON.parse(atob(saveCode));
|
| 225 |
+
const playerId = data.id;
|
| 226 |
+
const progress = data.progress;
|
| 227 |
+
|
| 228 |
+
// 檢查ID是否存在
|
| 229 |
+
const player = playerData.find(p => p.id === playerId);
|
| 230 |
+
if (!player) {
|
| 231 |
+
return { success: false, message: '無效的玩家ID' };
|
| 232 |
}
|
| 233 |
+
|
| 234 |
+
// 儲存進度
|
| 235 |
+
localStorage.setItem(`gameProgress_${playerId}`, JSON.stringify(progress));
|
| 236 |
+
localStorage.setItem('currentPlayerId', playerId);
|
| 237 |
+
localStorage.setItem('playerName', player.name);
|
| 238 |
+
localStorage.setItem('playerProfession', player.profession);
|
| 239 |
+
|
| 240 |
+
return { success: true, player: player };
|
| 241 |
+
} catch (e) {
|
| 242 |
+
console.error("無效的存檔碼", e);
|
| 243 |
+
return { success: false, message: '無效的存檔碼格式' };
|
| 244 |
}
|
| 245 |
+
}
|
spring.html
CHANGED
|
@@ -7,6 +7,17 @@
|
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body class="spring-page">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
<div class="game-container">
|
| 11 |
<div class="spring-container">
|
| 12 |
<h1 class="spring-title">第一試煉:平方之泉</h1>
|
|
@@ -16,7 +27,7 @@
|
|
| 16 |
|
| 17 |
<p>守泉獸說道:「1 的平方是 1、2 的平方是 4……你真的記得它們嗎?若你能感受到數字膨脹的力量,你將能邁出第一步。」</p>
|
| 18 |
|
| 19 |
-
<p>守泉獸設下了六道考驗,測試你對平方數的直覺感知能力。每答對一題,
|
| 20 |
|
| 21 |
<div class="start-challenge-container">
|
| 22 |
<button id="start-challenge" class="action-btn">開始考驗</button>
|
|
@@ -35,11 +46,6 @@
|
|
| 35 |
<!-- 答題結果反饋將在這裡顯示 -->
|
| 36 |
</div>
|
| 37 |
|
| 38 |
-
<div class="spring-animation" id="spring-animation">
|
| 39 |
-
<!-- 泉水閃爍動畫區域 -->
|
| 40 |
-
<div class="water-ripple"></div>
|
| 41 |
-
</div>
|
| 42 |
-
|
| 43 |
<div class="progress-container">
|
| 44 |
<div class="progress-text">進度:<span id="progress-count">0</span>/6</div>
|
| 45 |
<div class="progress-bar">
|
|
@@ -50,7 +56,7 @@
|
|
| 50 |
|
| 51 |
<div class="completion-message" id="completion-section" style="display: none;">
|
| 52 |
<h2>恭喜你完成第一試煉!</h2>
|
| 53 |
-
<p>
|
| 54 |
<p>你已獲得「直覺感知」的能力!</p>
|
| 55 |
<p>守泉獸欣慰地說:「你已經掌握了平方的基本感知,但這只是開始。真正的勇者需要學會轉換的藝術。前往變換山谷吧,那裡的山谷之靈會教導你下一階段的力量。」</p>
|
| 56 |
|
|
@@ -59,6 +65,13 @@
|
|
| 59 |
<button id="next-trial" class="nav-btn">前往下一試煉</button>
|
| 60 |
</div>
|
| 61 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
</div>
|
| 63 |
</div>
|
| 64 |
|
|
|
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
</head>
|
| 9 |
<body class="spring-page">
|
| 10 |
+
<!-- 音效元素 -->
|
| 11 |
+
<audio id="bgm" loop>
|
| 12 |
+
<source src="bgm.mp3" type="audio/mpeg">
|
| 13 |
+
</audio>
|
| 14 |
+
<audio id="correct-sound">
|
| 15 |
+
<source src="bingo.mp3" type="audio/mpeg">
|
| 16 |
+
</audio>
|
| 17 |
+
<audio id="wrong-sound">
|
| 18 |
+
<source src="wrong.mp3" type="audio/mpeg">
|
| 19 |
+
</audio>
|
| 20 |
+
|
| 21 |
<div class="game-container">
|
| 22 |
<div class="spring-container">
|
| 23 |
<h1 class="spring-title">第一試煉:平方之泉</h1>
|
|
|
|
| 27 |
|
| 28 |
<p>守泉獸說道:「1 的平方是 1、2 的平方是 4……你真的記得它們嗎?若你能感受到數字膨脹的力量,你將能邁出第一步。」</p>
|
| 29 |
|
| 30 |
+
<p>守泉獸設下了六道考驗,測試你對平方數的直覺感知能力。每答對一題,你將更接近獲得「直覺感知」的力量。</p>
|
| 31 |
|
| 32 |
<div class="start-challenge-container">
|
| 33 |
<button id="start-challenge" class="action-btn">開始考驗</button>
|
|
|
|
| 46 |
<!-- 答題結果反饋將在這裡顯示 -->
|
| 47 |
</div>
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
<div class="progress-container">
|
| 50 |
<div class="progress-text">進度:<span id="progress-count">0</span>/6</div>
|
| 51 |
<div class="progress-bar">
|
|
|
|
| 56 |
|
| 57 |
<div class="completion-message" id="completion-section" style="display: none;">
|
| 58 |
<h2>恭喜你完成第一試煉!</h2>
|
| 59 |
+
<p>你感受到一股力量流入體內...</p>
|
| 60 |
<p>你已獲得「直覺感知」的能力!</p>
|
| 61 |
<p>守泉獸欣慰地說:「你已經掌握了平方的基本感知,但這只是開始。真正的勇者需要學會轉換的藝術。前往變換山谷吧,那裡的山谷之靈會教導你下一階段的力量。」</p>
|
| 62 |
|
|
|
|
| 65 |
<button id="next-trial" class="nav-btn">前往下一試煉</button>
|
| 66 |
</div>
|
| 67 |
</div>
|
| 68 |
+
|
| 69 |
+
<!-- 音樂來源註記 -->
|
| 70 |
+
<div class="music-credit">
|
| 71 |
+
<p>背景音樂:샛별 - Level Up</p>
|
| 72 |
+
<p>推廣:J&B無版權音樂庫 <a href="https://bit.ly/2YfWIhw" target="_blank">https://bit.ly/2YfWIhw</a></p>
|
| 73 |
+
<button id="toggle-bgm" class="small-btn">音樂開/關</button>
|
| 74 |
+
</div>
|
| 75 |
</div>
|
| 76 |
</div>
|
| 77 |
|
spring.js
CHANGED
|
@@ -19,12 +19,40 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 19 |
const questionText = document.getElementById('question-text');
|
| 20 |
const optionsContainer = document.getElementById('options-container');
|
| 21 |
const resultFeedback = document.getElementById('result-feedback');
|
| 22 |
-
const springAnimation = document.getElementById('spring-animation');
|
| 23 |
-
const waterRipple = document.querySelector('.water-ripple');
|
| 24 |
const progressCount = document.getElementById('progress-count');
|
| 25 |
const progressFill = document.getElementById('progress-fill');
|
| 26 |
const backToPrologueBtn = document.getElementById('back-to-prologue');
|
| 27 |
const nextTrialBtn = document.getElementById('next-trial');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
// 問題集
|
| 30 |
const questions = [
|
|
@@ -113,15 +141,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 113 |
if (selectedIndex !== correctIndex) {
|
| 114 |
optionButtons[selectedIndex].classList.add('incorrect');
|
| 115 |
resultFeedback.textContent = '答錯了,再接再厲!';
|
|
|
|
|
|
|
|
|
|
| 116 |
} else {
|
| 117 |
correctAnswers++;
|
| 118 |
resultFeedback.textContent = '答對了,太棒了!';
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
setTimeout(() => {
|
| 123 |
-
waterRipple.classList.add('animate');
|
| 124 |
-
}, 10);
|
| 125 |
}
|
| 126 |
|
| 127 |
// 更新進度
|
|
|
|
| 19 |
const questionText = document.getElementById('question-text');
|
| 20 |
const optionsContainer = document.getElementById('options-container');
|
| 21 |
const resultFeedback = document.getElementById('result-feedback');
|
|
|
|
|
|
|
| 22 |
const progressCount = document.getElementById('progress-count');
|
| 23 |
const progressFill = document.getElementById('progress-fill');
|
| 24 |
const backToPrologueBtn = document.getElementById('back-to-prologue');
|
| 25 |
const nextTrialBtn = document.getElementById('next-trial');
|
| 26 |
+
const bgmAudio = document.getElementById('bgm');
|
| 27 |
+
const correctSound = document.getElementById('correct-sound');
|
| 28 |
+
const wrongSound = document.getElementById('wrong-sound');
|
| 29 |
+
const toggleBgmBtn = document.getElementById('toggle-bgm');
|
| 30 |
+
|
| 31 |
+
// 音樂控制
|
| 32 |
+
let isBgmPlaying = false;
|
| 33 |
+
|
| 34 |
+
// 播放背景音樂
|
| 35 |
+
function playBgm() {
|
| 36 |
+
bgmAudio.volume = 0.3; // 設置音量
|
| 37 |
+
bgmAudio.play().catch(e => console.log('自動播放被阻止:', e));
|
| 38 |
+
isBgmPlaying = true;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// 嘗試自動播放背景音樂(大多數瀏覽器會阻止)
|
| 42 |
+
playBgm();
|
| 43 |
+
|
| 44 |
+
// 音樂開關按鈕
|
| 45 |
+
toggleBgmBtn.addEventListener('click', function() {
|
| 46 |
+
if (isBgmPlaying) {
|
| 47 |
+
bgmAudio.pause();
|
| 48 |
+
isBgmPlaying = false;
|
| 49 |
+
toggleBgmBtn.textContent = '音樂開';
|
| 50 |
+
} else {
|
| 51 |
+
bgmAudio.play();
|
| 52 |
+
isBgmPlaying = true;
|
| 53 |
+
toggleBgmBtn.textContent = '音樂關';
|
| 54 |
+
}
|
| 55 |
+
});
|
| 56 |
|
| 57 |
// 問題集
|
| 58 |
const questions = [
|
|
|
|
| 141 |
if (selectedIndex !== correctIndex) {
|
| 142 |
optionButtons[selectedIndex].classList.add('incorrect');
|
| 143 |
resultFeedback.textContent = '答錯了,再接再厲!';
|
| 144 |
+
// 播放錯誤音效
|
| 145 |
+
wrongSound.currentTime = 0;
|
| 146 |
+
wrongSound.play().catch(e => console.log('音效播放失敗:', e));
|
| 147 |
} else {
|
| 148 |
correctAnswers++;
|
| 149 |
resultFeedback.textContent = '答對了,太棒了!';
|
| 150 |
+
// 播放正確音效
|
| 151 |
+
correctSound.currentTime = 0;
|
| 152 |
+
correctSound.play().catch(e => console.log('音效播放失敗:', e));
|
|
|
|
|
|
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
// 更新進度
|
style.css
CHANGED
|
@@ -26,7 +26,7 @@ body.prologue-page {
|
|
| 26 |
}
|
| 27 |
|
| 28 |
body.spring-page {
|
| 29 |
-
background-image: url('
|
| 30 |
}
|
| 31 |
|
| 32 |
.game-container {
|
|
@@ -340,45 +340,6 @@ body.spring-page {
|
|
| 340 |
opacity: 0.7;
|
| 341 |
}
|
| 342 |
|
| 343 |
-
/* 泉水動畫區域 */
|
| 344 |
-
.spring-animation {
|
| 345 |
-
height: 150px;
|
| 346 |
-
margin: 30px 0;
|
| 347 |
-
position: relative;
|
| 348 |
-
overflow: hidden;
|
| 349 |
-
border-radius: 10px;
|
| 350 |
-
background-color: rgba(0, 100, 255, 0.3);
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
.water-ripple {
|
| 354 |
-
position: absolute;
|
| 355 |
-
top: 50%;
|
| 356 |
-
left: 50%;
|
| 357 |
-
transform: translate(-50%, -50%);
|
| 358 |
-
width: 0;
|
| 359 |
-
height: 0;
|
| 360 |
-
border-radius: 50%;
|
| 361 |
-
background-color: rgba(0, 200, 255, 0.6);
|
| 362 |
-
opacity: 0;
|
| 363 |
-
}
|
| 364 |
-
|
| 365 |
-
.water-ripple.animate {
|
| 366 |
-
animation: ripple 2s ease-out;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
@keyframes ripple {
|
| 370 |
-
0% {
|
| 371 |
-
width: 0;
|
| 372 |
-
height: 0;
|
| 373 |
-
opacity: 0.8;
|
| 374 |
-
}
|
| 375 |
-
100% {
|
| 376 |
-
width: 300px;
|
| 377 |
-
height: 300px;
|
| 378 |
-
opacity: 0;
|
| 379 |
-
}
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
/* 進度條樣式 */
|
| 383 |
.progress-container {
|
| 384 |
margin-top: 20px;
|
|
@@ -429,6 +390,40 @@ body.spring-page {
|
|
| 429 |
min-height: 30px;
|
| 430 |
}
|
| 431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
/* 響應式設計 */
|
| 433 |
@media (max-width: 768px) {
|
| 434 |
.game-title {
|
|
@@ -500,10 +495,6 @@ body.spring-page {
|
|
| 500 |
width: 100%;
|
| 501 |
}
|
| 502 |
|
| 503 |
-
.spring-animation {
|
| 504 |
-
height: 120px;
|
| 505 |
-
}
|
| 506 |
-
|
| 507 |
.completion-message h2 {
|
| 508 |
font-size: 1.5rem;
|
| 509 |
}
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
body.spring-page {
|
| 29 |
+
background-image: url('guadian.jpg');
|
| 30 |
}
|
| 31 |
|
| 32 |
.game-container {
|
|
|
|
| 340 |
opacity: 0.7;
|
| 341 |
}
|
| 342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
/* 進度條樣式 */
|
| 344 |
.progress-container {
|
| 345 |
margin-top: 20px;
|
|
|
|
| 390 |
min-height: 30px;
|
| 391 |
}
|
| 392 |
|
| 393 |
+
/* 音樂來源註記 */
|
| 394 |
+
.music-credit {
|
| 395 |
+
margin-top: 30px;
|
| 396 |
+
padding-top: 15px;
|
| 397 |
+
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
| 398 |
+
font-size: 0.8rem;
|
| 399 |
+
color: rgba(255, 255, 255, 0.7);
|
| 400 |
+
text-align: center;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
.music-credit a {
|
| 404 |
+
color: rgba(255, 165, 0, 0.9);
|
| 405 |
+
text-decoration: none;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
.music-credit a:hover {
|
| 409 |
+
text-decoration: underline;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
.small-btn {
|
| 413 |
+
padding: 5px 10px;
|
| 414 |
+
background-color: rgba(255, 140, 0, 0.6);
|
| 415 |
+
color: white;
|
| 416 |
+
border: none;
|
| 417 |
+
border-radius: 3px;
|
| 418 |
+
font-size: 0.8rem;
|
| 419 |
+
cursor: pointer;
|
| 420 |
+
margin-top: 5px;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
.small-btn:hover {
|
| 424 |
+
background-color: rgba(255, 165, 0, 0.8);
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
/* 響應式設計 */
|
| 428 |
@media (max-width: 768px) {
|
| 429 |
.game-title {
|
|
|
|
| 495 |
width: 100%;
|
| 496 |
}
|
| 497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
.completion-message h2 {
|
| 499 |
font-size: 1.5rem;
|
| 500 |
}
|
wrong.mp3
ADDED
|
Binary file (27.6 kB). View file
|
|
|