Lashtw commited on
Commit
d5447a5
·
verified ·
1 Parent(s): c0b6856

Upload 3 files

Browse files
Files changed (3) hide show
  1. algebra.html +1 -1
  2. harbor.html +55 -12
  3. index.html +92 -30
algebra.html CHANGED
@@ -154,7 +154,7 @@
154
 
155
  <!-- 秘密揭曉畫面 (從 secret.html 整合進來) -->
156
  <div id="secret-view" class="absolute inset-0 w-screen h-screen flex items-center justify-center p-4 opacity-0 hidden transition-opacity duration-500 bg-gray-900/50">
157
- <div class="container mx-auto p-6 md:p-8 bg-white rounded-xl shadow-2xl max-w-4xl text-center">
158
  <h1 class="text-3xl md:text-4xl font-bold text-indigo-600 mb-8">代數之丘最大的秘密</h1>
159
 
160
  <div class="grid md:grid-cols-3 gap-6 md:gap-8 mb-8">
 
154
 
155
  <!-- 秘密揭曉畫面 (從 secret.html 整合進來) -->
156
  <div id="secret-view" class="absolute inset-0 w-screen h-screen flex items-center justify-center p-4 opacity-0 hidden transition-opacity duration-500 bg-gray-900/50">
157
+ <div class="container mx-auto p-6 md:p-8 bg-white rounded-xl shadow-2xl max-w-4xl text-center overflow-y-auto max-h-[90vh]">
158
  <h1 class="text-3xl md:text-4xl font-bold text-indigo-600 mb-8">代數之丘最大的秘密</h1>
159
 
160
  <div class="grid md:grid-cols-3 gap-6 md:gap-8 mb-8">
harbor.html CHANGED
@@ -151,7 +151,7 @@
151
  </div>
152
  <div id="market-choices" class="hidden flex-col">
153
  <h2 class="text-3xl font-bold text-amber-300 text-center mb-4">你要把<span class="market-fish-name"></span>賣到哪裡?</h2>
154
- <div id="market-images-container" class="grid grid-cols-1 md:grid-cols-3 gap-4">
155
  <!-- Market images will be inserted here by JS -->
156
  </div>
157
  <p id="market-feedback" class="text-center text-xl font-bold min-h-[32px] mt-4"></p>
@@ -193,9 +193,14 @@
193
  回到探險島地圖
194
  </a>
195
  </div>
196
-
 
 
 
 
197
  </div>
198
 
 
199
  <script>
200
  document.addEventListener('DOMContentLoaded', () => {
201
  // --- 畫面元素 ---
@@ -225,6 +230,8 @@
225
  const nextLevelButton = document.getElementById('next-level-button');
226
  const startFinalStageButton = document.getElementById('start-final-stage-button');
227
  const finalSecretScreen = document.getElementById('final-secret-screen');
 
 
228
 
229
  // --- 遊戲設定 ---
230
  const MAX_FISH_ON_SCREEN = 8;
@@ -486,17 +493,33 @@
486
  const marketLevel = marketLevels[currentLevel];
487
  document.querySelectorAll('.market-fish-name').forEach(el => el.textContent = levels[currentLevel].targetFish);
488
  marketImagesContainer.innerHTML = '';
489
- // A, B, C keys correspond to left, middle, right images
490
  const marketOrder = ['A', 'B', 'C'];
491
  marketOrder.forEach(key => {
492
  const src = marketLevel.images[key];
 
 
 
 
 
493
  const img = document.createElement('img');
494
  img.src = src;
495
- img.dataset.market = key;
496
- img.alt = `[${key}市場的統計圖表]`;
497
- img.className = 'market-choice cursor-pointer rounded-lg border-4 border-transparent hover:border-yellow-400';
498
- img.addEventListener('click', handleMarketChoice);
499
- marketImagesContainer.appendChild(img);
 
 
 
 
 
 
 
 
 
 
 
500
  });
501
 
502
  marketFeedback.textContent = '';
@@ -505,13 +528,16 @@
505
  }
506
 
507
  function handleMarketChoice(e) {
508
- const choice = e.target.dataset.market;
 
 
509
  const marketLevel = marketLevels[currentLevel];
510
 
511
- document.querySelectorAll('.market-choice').forEach(img => img.classList.remove('selected'));
512
 
513
  if (currentLevel === 0) {
514
  if (choice === marketLevel.correctAnswer) {
 
515
  marketFeedback.textContent = marketLevel.feedback.correct;
516
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
517
  nextLevelButton.textContent = "前往第二關";
@@ -523,6 +549,7 @@
523
  } else if (currentLevel === 1) {
524
  if (firstChoice === choice) {
525
  if (choice === marketLevel.correctAnswer) {
 
526
  marketFeedback.textContent = marketLevel.feedback.correct;
527
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
528
  nextLevelButton.textContent = "經營之神的攻略";
@@ -534,12 +561,13 @@
534
  firstChoice = null;
535
  } else {
536
  firstChoice = choice;
537
- e.target.classList.add('selected');
538
  marketFeedback.textContent = marketLevel.feedback.firstClick[choice];
539
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-cyan-300';
540
  }
541
  } else if (currentLevel === 2) {
542
  if (choice === marketLevel.correctAnswer) {
 
543
  marketFeedback.textContent = marketLevel.feedback.correct;
544
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
545
  nextLevelButton.textContent = "查看海風港灣的秘密";
@@ -550,6 +578,16 @@
550
  }
551
  }
552
  }
 
 
 
 
 
 
 
 
 
 
553
 
554
 
555
  // --- 事件監聽 ---
@@ -591,6 +629,8 @@
591
  continueButton.addEventListener('click', () => {
592
  hideOverlay();
593
  showScreen('market-screen');
 
 
594
  marketInstructions.style.display = 'block';
595
  marketChoices.style.display = 'none';
596
  });
@@ -645,10 +685,13 @@
645
  goalCount.textContent = levelSettings.goal;
646
  });
647
 
 
 
 
 
648
  // --- 初始啟動 ---
649
  showScreen('start-screen');
650
  });
651
  </script>
652
  </body>
653
  </html>
654
-
 
151
  </div>
152
  <div id="market-choices" class="hidden flex-col">
153
  <h2 class="text-3xl font-bold text-amber-300 text-center mb-4">你要把<span class="market-fish-name"></span>賣到哪裡?</h2>
154
+ <div id="market-images-container" class="grid grid-cols-1 md:grid-cols-3 gap-6">
155
  <!-- Market images will be inserted here by JS -->
156
  </div>
157
  <p id="market-feedback" class="text-center text-xl font-bold min-h-[32px] mt-4"></p>
 
193
  回到探險島地圖
194
  </a>
195
  </div>
196
+ </div>
197
+
198
+ <!-- Image Zoom Modal -->
199
+ <div id="zoom-modal" class="hidden fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4 cursor-pointer">
200
+ <img id="zoomed-image" src="" alt="放大的統計圖表" class="max-w-full max-h-full rounded-lg shadow-2xl">
201
  </div>
202
 
203
+
204
  <script>
205
  document.addEventListener('DOMContentLoaded', () => {
206
  // --- 畫面元素 ---
 
230
  const nextLevelButton = document.getElementById('next-level-button');
231
  const startFinalStageButton = document.getElementById('start-final-stage-button');
232
  const finalSecretScreen = document.getElementById('final-secret-screen');
233
+ const zoomModal = document.getElementById('zoom-modal');
234
+ const zoomedImage = document.getElementById('zoomed-image');
235
 
236
  // --- 遊戲設定 ---
237
  const MAX_FISH_ON_SCREEN = 8;
 
493
  const marketLevel = marketLevels[currentLevel];
494
  document.querySelectorAll('.market-fish-name').forEach(el => el.textContent = levels[currentLevel].targetFish);
495
  marketImagesContainer.innerHTML = '';
496
+
497
  const marketOrder = ['A', 'B', 'C'];
498
  marketOrder.forEach(key => {
499
  const src = marketLevel.images[key];
500
+
501
+ const choiceContainer = document.createElement('div');
502
+ choiceContainer.className = 'market-choice relative p-2 rounded-lg border-4 border-transparent cursor-pointer transition-all duration-200';
503
+ choiceContainer.dataset.market = key;
504
+
505
  const img = document.createElement('img');
506
  img.src = src;
507
+ img.alt = `[統計圖表]`;
508
+ img.className = 'w-full h-auto rounded-lg shadow-lg';
509
+
510
+ const zoomIcon = document.createElement('button');
511
+ zoomIcon.className = 'absolute top-2 right-2 bg-black/50 p-2 rounded-full text-white hover:bg-black/80 transition-colors z-10';
512
+ zoomIcon.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8zm8-3a1 1 0 011 1v2h2a1 1 0 110 2h-2v2a1 1 0 11-2 0v-2H5a1 1 0 110-2h2V6a1 1 0 011-1z" clip-rule="evenodd" /></svg>`;
513
+ zoomIcon.onclick = (e) => {
514
+ e.stopPropagation();
515
+ showEnlargedImage(src);
516
+ };
517
+
518
+ choiceContainer.appendChild(img);
519
+ choiceContainer.appendChild(zoomIcon);
520
+
521
+ choiceContainer.addEventListener('click', handleMarketChoice);
522
+ marketImagesContainer.appendChild(choiceContainer);
523
  });
524
 
525
  marketFeedback.textContent = '';
 
528
  }
529
 
530
  function handleMarketChoice(e) {
531
+ const choiceContainer = e.target.closest('.market-choice');
532
+ if (!choiceContainer) return;
533
+ const choice = choiceContainer.dataset.market;
534
  const marketLevel = marketLevels[currentLevel];
535
 
536
+ document.querySelectorAll('.market-choice').forEach(div => div.classList.remove('selected'));
537
 
538
  if (currentLevel === 0) {
539
  if (choice === marketLevel.correctAnswer) {
540
+ choiceContainer.classList.add('selected');
541
  marketFeedback.textContent = marketLevel.feedback.correct;
542
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
543
  nextLevelButton.textContent = "前往第二關";
 
549
  } else if (currentLevel === 1) {
550
  if (firstChoice === choice) {
551
  if (choice === marketLevel.correctAnswer) {
552
+ choiceContainer.classList.add('selected');
553
  marketFeedback.textContent = marketLevel.feedback.correct;
554
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
555
  nextLevelButton.textContent = "經營之神的攻略";
 
561
  firstChoice = null;
562
  } else {
563
  firstChoice = choice;
564
+ choiceContainer.classList.add('selected');
565
  marketFeedback.textContent = marketLevel.feedback.firstClick[choice];
566
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-cyan-300';
567
  }
568
  } else if (currentLevel === 2) {
569
  if (choice === marketLevel.correctAnswer) {
570
+ choiceContainer.classList.add('selected');
571
  marketFeedback.textContent = marketLevel.feedback.correct;
572
  marketFeedback.className = 'text-center text-xl font-bold min-h-[32px] mt-4 text-green-400';
573
  nextLevelButton.textContent = "查看海風港灣的秘密";
 
578
  }
579
  }
580
  }
581
+
582
+ function showEnlargedImage(src) {
583
+ zoomedImage.src = src;
584
+ zoomModal.classList.remove('hidden');
585
+ }
586
+
587
+ function hideEnlargedImage() {
588
+ zoomModal.classList.add('hidden');
589
+ zoomedImage.src = '';
590
+ }
591
 
592
 
593
  // --- 事件監聽 ---
 
629
  continueButton.addEventListener('click', () => {
630
  hideOverlay();
631
  showScreen('market-screen');
632
+ // FIX: Update the fish name immediately when showing the market screen instructions.
633
+ document.querySelectorAll('.market-fish-name').forEach(el => el.textContent = levels[currentLevel].targetFish);
634
  marketInstructions.style.display = 'block';
635
  marketChoices.style.display = 'none';
636
  });
 
685
  goalCount.textContent = levelSettings.goal;
686
  });
687
 
688
+ zoomModal.addEventListener('click', () => {
689
+ hideEnlargedImage();
690
+ });
691
+
692
  // --- 初始啟動 ---
693
  showScreen('start-screen');
694
  });
695
  </script>
696
  </body>
697
  </html>
 
index.html CHANGED
@@ -88,7 +88,7 @@
88
  }
89
  #philosophy-tower {
90
  top: 35%;
91
- left: 37%; /* 再次偏左 */
92
  width: 22%;
93
  height: 40%;
94
  }
@@ -137,44 +137,106 @@
137
  stroke-dashoffset: -550; /* 移動到路徑的另一端外 */
138
  }
139
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  </style>
142
  </head>
143
  <body class="bg-gray-900 flex items-center justify-center min-h-screen p-4">
144
 
145
- <div id="map-container">
146
- <!-- 動態痕跡 SVG -->
147
- <svg id="footprints-svg" viewBox="0 0 1200 900" preserveAspectRatio="xMidYMid meet">
148
- <!-- 重新設計的、更不規則的曲線路徑 -->
149
- <path class="footprint-path" d="M600 900 C 500 880, 350 800, 300 675" />
150
- <path class="footprint-path" d="M600 900 C 600 700, 380 550, 444 315" />
151
- <path class="footprint-path" d="M600 900 C 750 850, 950 700, 1056 522" />
152
- <path class="footprint-path" d="M600 900 C 700 750, 980 500, 1056 252" />
153
- </svg>
154
-
155
- <!-- 地點連結 -->
156
- <a id="algebra-hill" href="algebra.html" class="location-link">
157
- <span class="label">代數之丘</span>
158
- </a>
159
- <a id="philosophy-tower" href="philosophy.html" class="location-link">
160
- <span class="label">哲學之塔</span>
161
- </a>
162
- <a id="gemstone-cave" href="gemstone.html" class="location-link">
163
- <span class="label">寶石洞窟</span>
164
- </a>
165
- <a id="harbor-bay" href="harbor.html" class="location-link">
166
- <span class="label">海風港灣</span>
167
- </a>
168
  </div>
169
 
170
- <h1 class="main-title text-4xl md:text-5xl font-bold text-white text-center" style="text-shadow: 3px 3px 5px rgba(0,0,0,0.5);">歡迎來到數學探險島</h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
- <!-- 設計者資訊 -->
173
- <div class="absolute bottom-4 right-4 text-right text-white text-sm opacity-80 z-10" style="text-shadow: 1px 1px 3px rgba(0,0,0,0.7);">
174
- <p>遊戲設計者:新竹縣精華國中藍星宇</p>
175
- <p>FB教育社群:<a href="https://www.facebook.com/groups/1554372228718393" target="_blank" class="underline hover:text-yellow-300 transition-colors">萬物皆數</a></p>
 
 
 
176
  </div>
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </body>
179
  </html>
180
-
 
88
  }
89
  #philosophy-tower {
90
  top: 35%;
91
+ left: 37%;
92
  width: 22%;
93
  height: 40%;
94
  }
 
137
  stroke-dashoffset: -550; /* 移動到路徑的另一端外 */
138
  }
139
  }
140
+
141
+ /* 載入畫面樣式 */
142
+ #loading-screen {
143
+ position: absolute;
144
+ inset: 0;
145
+ z-index: 99;
146
+ background-color: #1a202c;
147
+ transition: opacity 0.5s ease-out;
148
+ }
149
+ .loader {
150
+ border: 8px solid #f3f3f3;
151
+ border-top: 8px solid #3498db;
152
+ border-radius: 50%;
153
+ width: 60px;
154
+ height: 60px;
155
+ animation: spin 1s linear infinite;
156
+ }
157
+ @keyframes spin {
158
+ 0% { transform: rotate(0deg); }
159
+ 100% { transform: rotate(360deg); }
160
+ }
161
 
162
  </style>
163
  </head>
164
  <body class="bg-gray-900 flex items-center justify-center min-h-screen p-4">
165
 
166
+ <!-- 載入畫面 -->
167
+ <div id="loading-screen" class="w-full h-full flex flex-col items-center justify-center">
168
+ <div class="loader"></div>
169
+ <p class="text-white text-xl mt-4">地圖載入中...</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  </div>
171
 
172
+ <!-- 主內容 (預設隱藏) -->
173
+ <div id="main-content" class="opacity-0 transition-opacity duration-500">
174
+ <div id="map-container">
175
+ <!-- 動態痕跡 SVG -->
176
+ <svg id="footprints-svg" viewBox="0 0 1200 900" preserveAspectRatio="xMidYMid meet">
177
+ <!-- 重新設計的、更不規則的曲線路徑 -->
178
+ <path class="footprint-path" d="M600 900 C 500 880, 350 800, 300 675" />
179
+ <path class="footprint-path" d="M600 900 C 600 700, 380 550, 444 315" />
180
+ <path class="footprint-path" d="M600 900 C 750 850, 950 700, 1056 522" />
181
+ <path class="footprint-path" d="M600 900 C 700 750, 980 500, 1056 252" />
182
+ </svg>
183
+
184
+ <!-- 地點連結 -->
185
+ <a id="algebra-hill" href="algebra.html" class="location-link">
186
+ <span class="label">代數之丘</span>
187
+ </a>
188
+ <a id="philosophy-tower" href="philosophy.html" class="location-link">
189
+ <span class="label">哲學之塔</span>
190
+ </a>
191
+ <a id="gemstone-cave" href="gemstone.html" class="location-link">
192
+ <span class="label">寶石洞窟</span>
193
+ </a>
194
+ <a id="harbor-bay" href="harbor.html" class="location-link">
195
+ <span class="label">海風港灣</span>
196
+ </a>
197
+ </div>
198
 
199
+ <h1 class="main-title text-4xl md:text-5xl font-bold text-white text-center" style="text-shadow: 3px 3px 5px rgba(0,0,0,0.5);">歡迎來到數學探險島</h1>
200
+
201
+ <!-- 設計者資訊 -->
202
+ <div class="absolute bottom-4 right-4 text-right text-white text-sm opacity-80 z-10" style="text-shadow: 1px 1px 3px rgba(0,0,0,0.7);">
203
+ <p>遊戲設計者:新竹縣精華國中藍星宇</p>
204
+ <p>FB教育社群:<a href="https://www.facebook.com/groups/1554372228718393" target="_blank" class="underline hover:text-yellow-300 transition-colors">萬物皆數</a></p>
205
+ </div>
206
  </div>
207
 
208
+ <script>
209
+ document.addEventListener('DOMContentLoaded', () => {
210
+ const loadingScreen = document.getElementById('loading-screen');
211
+ const mainContent = document.getElementById('main-content');
212
+ const imageUrl = 'https://i.meee.com.tw/emt8qds.png';
213
+
214
+ const image = new Image();
215
+ image.src = imageUrl;
216
+
217
+ image.onload = () => {
218
+ // 圖片載入完成後,淡出載入畫面
219
+ loadingScreen.style.opacity = '0';
220
+
221
+ // 淡入主內容
222
+ mainContent.style.opacity = '1';
223
+
224
+ // 在淡出動畫結束後,徹底隱藏載入畫面
225
+ setTimeout(() => {
226
+ loadingScreen.style.display = 'none';
227
+ }, 500); // 需與 transition duration 匹配
228
+ };
229
+
230
+ image.onerror = () => {
231
+ // 如果圖片載入失敗,也顯示主內容,避免卡住
232
+ console.error('背景圖片載入失敗!');
233
+ loadingScreen.style.opacity = '0';
234
+ mainContent.style.opacity = '1';
235
+ setTimeout(() => {
236
+ loadingScreen.style.display = 'none';
237
+ }, 500);
238
+ }
239
+ });
240
+ </script>
241
  </body>
242
  </html>