Spaces:
Running
Running
Upload 40 files
Browse files- index.html +2 -18
- kingdom_map.html +2 -18
- script.js +3 -3
- spring.html +2 -0
- spring.js +11 -11
- tower.js +8 -1
index.html
CHANGED
|
@@ -52,25 +52,9 @@
|
|
| 52 |
<!-- 成就解鎖通知容器 -->
|
| 53 |
<div class="toast-container" id="toast-container"></div>
|
| 54 |
|
| 55 |
-
<script src="script.js"></script>
|
| 56 |
-
|
| 57 |
<!-- 初始化成就系統 -->
|
| 58 |
-
<script>
|
| 59 |
-
|
| 60 |
-
function initAchievementSystem() {
|
| 61 |
-
if (!window.achievementSystem) {
|
| 62 |
-
const script = document.createElement('script');
|
| 63 |
-
script.src = 'achievements.js';
|
| 64 |
-
script.onload = function() {
|
| 65 |
-
console.log('成就系統腳本載入完成');
|
| 66 |
-
};
|
| 67 |
-
document.head.appendChild(script);
|
| 68 |
-
}
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
// 在頁面載入時初始化成就系統
|
| 72 |
-
document.addEventListener('DOMContentLoaded', initAchievementSystem);
|
| 73 |
-
</script>
|
| 74 |
|
| 75 |
<!-- 音樂連續播放控制 -->
|
| 76 |
<script>
|
|
|
|
| 52 |
<!-- 成就解鎖通知容器 -->
|
| 53 |
<div class="toast-container" id="toast-container"></div>
|
| 54 |
|
|
|
|
|
|
|
| 55 |
<!-- 初始化成就系統 -->
|
| 56 |
+
<script src="achievements.js"></script>
|
| 57 |
+
<script src="script.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
<!-- 音樂連續播放控制 -->
|
| 60 |
<script>
|
kingdom_map.html
CHANGED
|
@@ -273,25 +273,9 @@
|
|
| 273 |
<!-- 成就解鎖通知容器 -->
|
| 274 |
<div class="toast-container" id="toast-container"></div>
|
| 275 |
|
| 276 |
-
<script src="kingdom_map.js"></script>
|
| 277 |
-
|
| 278 |
<!-- 初始化成就系統 -->
|
| 279 |
-
<script>
|
| 280 |
-
|
| 281 |
-
function initAchievementSystem() {
|
| 282 |
-
if (!window.achievementSystem) {
|
| 283 |
-
const script = document.createElement('script');
|
| 284 |
-
script.src = 'achievements.js';
|
| 285 |
-
script.onload = function() {
|
| 286 |
-
console.log('成就系統腳本載入完成');
|
| 287 |
-
};
|
| 288 |
-
document.head.appendChild(script);
|
| 289 |
-
}
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
// 在頁面載入時初始化成就系統
|
| 293 |
-
document.addEventListener('DOMContentLoaded', initAchievementSystem);
|
| 294 |
-
</script>
|
| 295 |
|
| 296 |
<!-- 音樂連續播放控制 -->
|
| 297 |
<script>
|
|
|
|
| 273 |
<!-- 成就解鎖通知容器 -->
|
| 274 |
<div class="toast-container" id="toast-container"></div>
|
| 275 |
|
|
|
|
|
|
|
| 276 |
<!-- 初始化成就系統 -->
|
| 277 |
+
<script src="achievements.js"></script>
|
| 278 |
+
<script src="kingdom_map.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
|
| 280 |
<!-- 音樂連續播放控制 -->
|
| 281 |
<script>
|
script.js
CHANGED
|
@@ -301,9 +301,9 @@ function checkAchievements() {
|
|
| 301 |
gameState.visitedTrials.push(trialName);
|
| 302 |
|
| 303 |
gameState.completedTrials[trialName] = {
|
| 304 |
-
completed: trialData.
|
| 305 |
-
stars:
|
| 306 |
-
noErrors: trialData.
|
| 307 |
};
|
| 308 |
}
|
| 309 |
}
|
|
|
|
| 301 |
gameState.visitedTrials.push(trialName);
|
| 302 |
|
| 303 |
gameState.completedTrials[trialName] = {
|
| 304 |
+
completed: trialData.completed,
|
| 305 |
+
stars: trialData.stars,
|
| 306 |
+
noErrors: trialData.noErrors
|
| 307 |
};
|
| 308 |
}
|
| 309 |
}
|
spring.html
CHANGED
|
@@ -138,6 +138,8 @@
|
|
| 138 |
<!-- 成就解鎖通知容器 -->
|
| 139 |
<div class="toast-container" id="toast-container"></div>
|
| 140 |
|
|
|
|
|
|
|
| 141 |
<script src="spring.js"></script>
|
| 142 |
</body>
|
| 143 |
</html>
|
|
|
|
| 138 |
<!-- 成就解鎖通知容器 -->
|
| 139 |
<div class="toast-container" id="toast-container"></div>
|
| 140 |
|
| 141 |
+
<!-- 初始化成就系統 -->
|
| 142 |
+
<script src="achievements.js"></script>
|
| 143 |
<script src="spring.js"></script>
|
| 144 |
</body>
|
| 145 |
</html>
|
spring.js
CHANGED
|
@@ -295,20 +295,22 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 295 |
// 檢查成就
|
| 296 |
function checkAchievements(gameProgress, currentStars, trialTime, isPerfect) {
|
| 297 |
console.log('檢查成就');
|
| 298 |
-
|
| 299 |
-
// 構建遊戲狀態
|
| 300 |
const gameState = {
|
| 301 |
// 基本信息
|
| 302 |
-
loginCount: parseInt(localStorage.getItem('loginCount') || '1'),
|
| 303 |
-
prologueCompleted: localStorage.getItem('prologueCompleted') === 'true',
|
| 304 |
|
| 305 |
// 試煉相關
|
| 306 |
-
visitedTrials: ['平方之泉'],
|
| 307 |
completedTrials: {
|
| 308 |
"平方之泉": {
|
| 309 |
completed: true,
|
|
|
|
| 310 |
stars: currentStars,
|
| 311 |
-
|
|
|
|
|
|
|
| 312 |
}
|
| 313 |
},
|
| 314 |
|
|
@@ -316,13 +318,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 316 |
maxCorrectStreak: maxCorrectStreak,
|
| 317 |
fastestTrialTime: trialTime,
|
| 318 |
fastestQuestionTime: fastestQuestionTime,
|
| 319 |
-
retriesAfterFailure: parseInt(localStorage.getItem('retriesAfterFailure') || '0'),
|
| 320 |
lastTrialCompletionTime: new Date(),
|
| 321 |
lastTrialStartTime: startTime,
|
| 322 |
|
| 323 |
// 特殊條件
|
| 324 |
allThreeStarsSameDay: false,
|
| 325 |
-
firstAttemptAllThreeStars:
|
| 326 |
musicEnabledAllTrials: isBgmPlaying,
|
| 327 |
musicDisabledAllTrials: !isBgmPlaying,
|
| 328 |
|
|
@@ -331,9 +333,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 331 |
currentTrialTime: trialTime,
|
| 332 |
currentTrialErrors: errors,
|
| 333 |
currentTrialCombo: maxCorrectStreak
|
| 334 |
-
};
|
| 335 |
-
|
| 336 |
-
// 檢查其他試煉的完成情況
|
| 337 |
if (gameProgress.completedTrials && gameProgress.completedTrials["變換山谷"]?.completed) {
|
| 338 |
gameState.visitedTrials.push('變換山谷');
|
| 339 |
gameState.completedTrials["變換山谷"] = {
|
|
|
|
| 295 |
// 檢查成就
|
| 296 |
function checkAchievements(gameProgress, currentStars, trialTime, isPerfect) {
|
| 297 |
console.log('檢查成就');
|
| 298 |
+
// 構建遊戲狀態
|
|
|
|
| 299 |
const gameState = {
|
| 300 |
// 基本信息
|
| 301 |
+
loginCount: parseInt(localStorage.getItem(\'loginCount\') || \'1\'),
|
| 302 |
+
prologueCompleted: localStorage.getItem(\'prologueCompleted\') === \'true\'),
|
| 303 |
|
| 304 |
// 試煉相關
|
| 305 |
+
visitedTrials: [\'平方之泉\'],
|
| 306 |
completedTrials: {
|
| 307 |
"平方之泉": {
|
| 308 |
completed: true,
|
| 309 |
+
score: currentScore,
|
| 310 |
stars: currentStars,
|
| 311 |
+
challengesCompleted: Array(questions.length).fill(false).map((_, i) => i < correctAnswers),
|
| 312 |
+
noErrors: isPerfect,
|
| 313 |
+
completionTime: trialTime
|
| 314 |
}
|
| 315 |
},
|
| 316 |
|
|
|
|
| 318 |
maxCorrectStreak: maxCorrectStreak,
|
| 319 |
fastestTrialTime: trialTime,
|
| 320 |
fastestQuestionTime: fastestQuestionTime,
|
| 321 |
+
retriesAfterFailure: parseInt(localStorage.getItem(\'retriesAfterFailure\') || \'0\'),
|
| 322 |
lastTrialCompletionTime: new Date(),
|
| 323 |
lastTrialStartTime: startTime,
|
| 324 |
|
| 325 |
// 特殊條件
|
| 326 |
allThreeStarsSameDay: false,
|
| 327 |
+
firstAttemptAllThreeStars: isFirstThreeStars,
|
| 328 |
musicEnabledAllTrials: isBgmPlaying,
|
| 329 |
musicDisabledAllTrials: !isBgmPlaying,
|
| 330 |
|
|
|
|
| 333 |
currentTrialTime: trialTime,
|
| 334 |
currentTrialErrors: errors,
|
| 335 |
currentTrialCombo: maxCorrectStreak
|
| 336 |
+
}; // 檢查其他試煉的完成情況
|
|
|
|
|
|
|
| 337 |
if (gameProgress.completedTrials && gameProgress.completedTrials["變換山谷"]?.completed) {
|
| 338 |
gameState.visitedTrials.push('變換山谷');
|
| 339 |
gameState.completedTrials["變換山谷"] = {
|
tower.js
CHANGED
|
@@ -737,7 +737,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 737 |
totalStars: score,
|
| 738 |
currentTrialCompleted: true,
|
| 739 |
currentTrialErrors: questions.length - correctAnswers,
|
| 740 |
-
currentTrialCombo: correctAnswers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
};
|
| 742 |
|
| 743 |
window.achievementSystem.checkAllAchievements(gameState);
|
|
|
|
| 737 |
totalStars: score,
|
| 738 |
currentTrialCompleted: true,
|
| 739 |
currentTrialErrors: questions.length - correctAnswers,
|
| 740 |
+
currentTrialCombo: correctAnswers,
|
| 741 |
+
completedTrials: {
|
| 742 |
+
"展開之塔": {
|
| 743 |
+
completed: true,
|
| 744 |
+
stars: score,
|
| 745 |
+
noErrors: (questions.length - correctAnswers) === 0
|
| 746 |
+
}
|
| 747 |
+
}
|
| 748 |
};
|
| 749 |
|
| 750 |
window.achievementSystem.checkAllAchievements(gameState);
|