Lashtw commited on
Commit
4570db3
·
verified ·
1 Parent(s): 6a517c6

Upload 40 files

Browse files
ID.csv CHANGED
@@ -1,17 +1,16 @@
1
- ID,姓名,職業
2
- 100090601,張秉恆,影武者
3
- 101010302,羅忠聘,光靈術士
4
- 101010303,羅政聘,光靈術士
5
- 101032704,林均綻,影武者
6
- 101082905,劉家震,影武者
7
- 100090806,邱品潔,暮影使徒
8
- 100110907,陳妤芮,影武者
9
- 101020808,鍾依捷,光靈術士
10
- 101030409,羅文辛,光靈術士
11
- 101042710,鄭詠嬛,暮影使徒
12
- 101060511,黃薇榕,暮影使徒
13
- 101071112,劉軒妤,光靈術士
14
- 101063013,徐立洋,暗影法刃
15
- 101080414,王孝淇,刺客
16
- 1000099,遊戲測試員,GM
17
- 蔡英文,蔡英文,倫敦政經學院法學博士
 
1
+ ID,姓名,職業
2
+ 100090601,張秉恆,影武者
3
+ 101010302,羅忠聘,光靈術士
4
+ 101010303,羅政聘,光靈術士
5
+ 101032704,林均綻,影武者
6
+ 101082905,劉家震,影武者
7
+ 100090806,邱品潔,暮影使徒
8
+ 100110907,陳妤芮,影武者
9
+ 101020808,鍾依捷,光靈術士
10
+ 101030409,羅文辛,光靈術士
11
+ 101042710,鄭詠嬛,暮影使徒
12
+ 101060511,黃薇榕,暮影使徒
13
+ 101071112,劉軒妤,光靈術士
14
+ 101063013,徐立洋,暗影法刃
15
+ 101080414,王孝淇,刺客
16
+ 1000099,遊戲測試員,GM
 
achievement_system.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b5f8d0a1bfb7db7593f109fab7b6cc02bd1fb0f597a265f1c53bf3e73a528ca
3
+ size 19501
tower.js CHANGED
@@ -79,7 +79,8 @@ document.addEventListener('DOMContentLoaded', function() {
79
  stage1: {
80
  template: "100² + ___ × ___ + ___ × ___ + 1²",
81
  dragItems: ["100", "99", "200", "1", "2"],
82
- answers: [["1", "100"], ["1", "100"]] // 順序不限
 
83
  },
84
  stage2: {
85
  template: "100² + ___ × ___ × ___ + 1²",
@@ -92,7 +93,8 @@ document.addEventListener('DOMContentLoaded', function() {
92
  stage1: {
93
  template: "100² - ___ × ___ - ___ × ___ + 1²",
94
  dragItems: ["1", "2", "100", "98", "200"],
95
- answers: [["1", "100"], ["1", "100"]] // 順序不限
 
96
  },
97
  stage2: {
98
  template: "100² - ___ × ___ × ___ + 1²",
@@ -105,7 +107,8 @@ document.addEventListener('DOMContentLoaded', function() {
105
  stage1: {
106
  template: "20² + ___ × ___ + ___ × ___ + 3²",
107
  dragItems: ["2", "20", "3", "23", "17"],
108
- answers: [["20", "3"], ["3", "20"]] // 順序不限
 
109
  },
110
  stage2: {
111
  template: "20² + ___ × ___ × ___ + 3²",
@@ -118,7 +121,8 @@ document.addEventListener('DOMContentLoaded', function() {
118
  stage1: {
119
  template: "40² - ___ × ___ - ___ × ___ + 2²",
120
  dragItems: ["1", "2", "40", "38", "42"],
121
- answers: [["2", "40"], ["40", "2"]] // 順序不限
 
122
  },
123
  stage2: {
124
  template: "40² - ___ × ___ × ___ + 2²",
@@ -131,7 +135,8 @@ document.addEventListener('DOMContentLoaded', function() {
131
  stage1: {
132
  template: "200² + ___ × ___ + ___ × ___ + 3²",
133
  dragItems: ["2", "3", "200", "203", "197"],
134
- answers: [["3", "200"], ["200", "3"]] // 順序不限
 
135
  },
136
  stage2: {
137
  template: "200² + ___ × ___ × ___ + 3²",
@@ -144,7 +149,8 @@ document.addEventListener('DOMContentLoaded', function() {
144
  stage1: {
145
  template: "300² - ___ × ___ - ___ × ___ + 3²",
146
  dragItems: ["2", "300", "3", "297", "303"],
147
- answers: [["300", "3"], ["3", "300"]] // 順序不限
 
148
  },
149
  stage2: {
150
  template: "300² - ___ × ___ × ___ + 3²",
@@ -161,6 +167,7 @@ document.addEventListener('DOMContentLoaded', function() {
161
  let userAnswers = []; // 記錄用戶答案
162
  let dropZones = []; // 當前問題的所有拖放區
163
  let dragItemElements = []; // 當前問題的所有拖拽項
 
164
 
165
  // 獲取遊戲進度
166
  const gameProgress = JSON.parse(localStorage.getItem(`gameProgress_${currentPlayerId}`)) || {
@@ -188,6 +195,7 @@ document.addEventListener('DOMContentLoaded', function() {
188
  function loadQuestion(questionIndex, stageIndex) {
189
  currentQuestionIndex = questionIndex;
190
  currentStage = stageIndex;
 
191
 
192
  // 更新問題標題和進度
193
  currentQuestionSpan.textContent = questionIndex + 1;
@@ -214,6 +222,10 @@ document.addEventListener('DOMContentLoaded', function() {
214
  const existingReferences = document.querySelectorAll('.stage1-reference');
215
  existingReferences.forEach(ref => ref.remove());
216
 
 
 
 
 
217
  // 如果是第二階段,顯示第一階段的答案作為參考
218
  if (stageIndex === 2 && stage1Answers[questionIndex].length > 0) {
219
  // 創建參考區域
@@ -350,8 +362,9 @@ document.addEventListener('DOMContentLoaded', function() {
350
  }
351
  });
352
 
353
- this.appendChild(clonedItem);
354
- this.classList.add('filled');
 
355
 
356
  // 更新保存的答案
357
  updateSavedAnswers();
@@ -380,51 +393,6 @@ document.addEventListener('DOMContentLoaded', function() {
380
  dragItemElements.push(dragItem);
381
  });
382
 
383
- // 恢復已保存的答案
384
- if (savedAnswers.length > 0) {
385
- savedAnswers.forEach((answer, index) => {
386
- if (answer && index < dropZones.length) {
387
- const dropZone = dropZones[index];
388
- const matchingItem = Array.from(dragItems.children).find(item => item.textContent === answer);
389
-
390
- if (matchingItem) {
391
- // 創建拖拽項的克隆並放入拖放區
392
- const clonedItem = matchingItem.cloneNode(true);
393
- clonedItem.id = `placed-item-restore-${index}`;
394
- clonedItem.draggable = true;
395
- clonedItem.style.margin = '0';
396
- clonedItem.style.cursor = 'grab';
397
-
398
- // 為克隆項添加拖拽事件
399
- clonedItem.addEventListener('dragstart', function(e) {
400
- e.dataTransfer.setData('text/plain', this.id);
401
- this.classList.add('dragging');
402
- });
403
-
404
- clonedItem.addEventListener('dragend', function() {
405
- this.classList.remove('dragging');
406
- });
407
-
408
- // 添加點擊事件,點擊可移除
409
- clonedItem.addEventListener('click', function() {
410
- if (this.parentElement.classList.contains('drop-zone')) {
411
- this.parentElement.classList.remove('filled');
412
- this.parentElement.style.backgroundColor = 'rgba(100, 100, 100, 0.5)';
413
- this.remove();
414
-
415
- // 更新保存的答案
416
- updateSavedAnswers();
417
- }
418
- });
419
-
420
- dropZone.appendChild(clonedItem);
421
- dropZone.classList.add('filled');
422
- dropZone.style.backgroundColor = 'rgba(255, 140, 0, 0.3)';
423
- }
424
- }
425
- });
426
- }
427
-
428
  // 重置反饋和下一題按鈕
429
  feedbackContainer.style.display = 'none';
430
  feedbackContainer.className = 'feedback-container';
@@ -479,6 +447,63 @@ document.addEventListener('DOMContentLoaded', function() {
479
  // 將參考區域添加到公式模板之前
480
  formulaTemplate.parentNode.insertBefore(stage1AnswerReference, formulaTemplate);
481
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  // 檢查答案按鈕點擊事件
483
  checkAnswerBtn.addEventListener('click', function() {
484
  // 獲取所有填充的拖放區
@@ -598,25 +623,47 @@ document.addEventListener('DOMContentLoaded', function() {
598
  // 隱藏檢查按鈕,顯示下一步按鈕
599
  checkAnswerBtn.style.display = 'none';
600
  nextQuestionBtn.style.display = 'block';
 
 
 
 
 
601
  } else {
602
- feedbackContainer.textContent = '答錯了,請修正答案!';
603
- feedbackContainer.classList.add('incorrect');
604
- wrongSound.play();
605
 
606
- // 記錄當前階段答錯
607
  if (currentStage === 1) {
 
 
 
 
 
 
 
 
 
608
  questionStatus[currentQuestionIndex].stage1Correct = false;
 
 
 
 
609
  } else {
 
 
 
 
 
 
610
  questionStatus[currentQuestionIndex].stage2Correct = false;
611
 
612
  // 第二階段答錯也要更新門的狀態為錯誤
613
  doorsProgress[currentQuestionIndex].classList.add('opened');
614
  doorsProgress[currentQuestionIndex].style.backgroundColor = 'rgba(200, 100, 100, 0.8)';
 
 
 
 
615
  }
616
-
617
- // 答錯仍然可以繼續,顯示下一步按鈕
618
- checkAnswerBtn.style.display = 'none';
619
- nextQuestionBtn.style.display = 'block';
620
  }
621
  });
622
 
@@ -624,18 +671,27 @@ document.addEventListener('DOMContentLoaded', function() {
624
  nextQuestionBtn.addEventListener('click', function() {
625
  // 如果當前是第一階段,進入第二階段
626
  if (currentStage === 1) {
627
- // 無論錯,都進入第二階段
628
- currentStage = 2;
629
-
630
- // 隱藏第一階段按鈕,顯示第二階段按鈕
631
- stage1Btn.style.display = 'none';
632
- stage2Btn.style.display = 'inline-block';
633
-
634
- // 顯示第一階段答案參考
635
- stage1AnswerReference.style.display = 'block';
636
-
637
- // 載入第二階段題目
638
- loadQuestion(currentQuestionIndex, 2);
 
 
 
 
 
 
 
 
 
639
  }
640
  // 如果當前是第二階段,進入���一題或完成
641
  else {
@@ -736,10 +792,20 @@ document.addEventListener('DOMContentLoaded', function() {
736
  userAnswers = [];
737
  dropZones = [];
738
  dragItemElements = [];
 
 
 
 
 
 
 
 
 
739
 
740
  // 重置門的狀態
741
  for (let i = 0; i < doorsProgress.length; i++) {
742
  doorsProgress[i].classList.remove('opened');
 
743
  }
744
 
745
  // 顯示問題
 
79
  stage1: {
80
  template: "100² + ___ × ___ + ___ × ___ + 1²",
81
  dragItems: ["100", "99", "200", "1", "2"],
82
+ answers: [["1", "100"], ["1", "100"]], // 順序不限
83
+ correctAnswer: "100² + 1 × 100 + 1 × 100 + 1²"
84
  },
85
  stage2: {
86
  template: "100² + ___ × ___ × ___ + 1²",
 
93
  stage1: {
94
  template: "100² - ___ × ___ - ___ × ___ + 1²",
95
  dragItems: ["1", "2", "100", "98", "200"],
96
+ answers: [["1", "100"], ["1", "100"]], // 順序不限
97
+ correctAnswer: "100² - 1 × 100 - 1 × 100 + 1²"
98
  },
99
  stage2: {
100
  template: "100² - ___ × ___ × ___ + 1²",
 
107
  stage1: {
108
  template: "20² + ___ × ___ + ___ × ___ + 3²",
109
  dragItems: ["2", "20", "3", "23", "17"],
110
+ answers: [["20", "3"], ["3", "20"]], // 順序不限
111
+ correctAnswer: "20² + 3 × 20 + 3 × 20 + 3²"
112
  },
113
  stage2: {
114
  template: "20² + ___ × ___ × ___ + 3²",
 
121
  stage1: {
122
  template: "40² - ___ × ___ - ___ × ___ + 2²",
123
  dragItems: ["1", "2", "40", "38", "42"],
124
+ answers: [["2", "40"], ["40", "2"]], // 順序不限
125
+ correctAnswer: "40² - 2 × 40 - 2 × 40 + 2²"
126
  },
127
  stage2: {
128
  template: "40² - ___ × ___ × ___ + 2²",
 
135
  stage1: {
136
  template: "200² + ___ × ___ + ___ × ___ + 3²",
137
  dragItems: ["2", "3", "200", "203", "197"],
138
+ answers: [["3", "200"], ["200", "3"]], // 順序不限
139
+ correctAnswer: "200² + 3 × 200 + 3 × 200 + 3²"
140
  },
141
  stage2: {
142
  template: "200² + ___ × ___ × ___ + 3²",
 
149
  stage1: {
150
  template: "300² - ___ × ___ - ___ × ___ + 3²",
151
  dragItems: ["2", "300", "3", "297", "303"],
152
+ answers: [["300", "3"], ["3", "300"]], // 順序不限
153
+ correctAnswer: "300² - 3 × 300 - 3 × 300 + 3²"
154
  },
155
  stage2: {
156
  template: "300² - ___ × ___ × ___ + 3²",
 
167
  let userAnswers = []; // 記錄用戶答案
168
  let dropZones = []; // 當前問題的所有拖放區
169
  let dragItemElements = []; // 當前問題的所有拖拽項
170
+ let wrongAttempts = 0; // 記錄當前問題錯誤嘗試次數
171
 
172
  // 獲取遊戲進度
173
  const gameProgress = JSON.parse(localStorage.getItem(`gameProgress_${currentPlayerId}`)) || {
 
195
  function loadQuestion(questionIndex, stageIndex) {
196
  currentQuestionIndex = questionIndex;
197
  currentStage = stageIndex;
198
+ wrongAttempts = 0; // 重置錯誤嘗試次數
199
 
200
  // 更新問題標題和進度
201
  currentQuestionSpan.textContent = questionIndex + 1;
 
222
  const existingReferences = document.querySelectorAll('.stage1-reference');
223
  existingReferences.forEach(ref => ref.remove());
224
 
225
+ // 移除提示圖片
226
+ const existingHintImages = document.querySelectorAll('.hint-image');
227
+ existingHintImages.forEach(img => img.remove());
228
+
229
  // 如果是第二階段,顯示第一階段的答案作為參考
230
  if (stageIndex === 2 && stage1Answers[questionIndex].length > 0) {
231
  // 創建參考區域
 
362
  }
363
  });
364
 
365
+ dropZone.appendChild(clonedItem);
366
+ dropZone.classList.add('filled');
367
+ dropZone.style.backgroundColor = 'rgba(255, 140, 0, 0.3)';
368
 
369
  // 更新保存的答案
370
  updateSavedAnswers();
 
393
  dragItemElements.push(dragItem);
394
  });
395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  // 重置反饋和下一題按鈕
397
  feedbackContainer.style.display = 'none';
398
  feedbackContainer.className = 'feedback-container';
 
447
  // 將參考區域添加到公式模板之前
448
  formulaTemplate.parentNode.insertBefore(stage1AnswerReference, formulaTemplate);
449
 
450
+ // 顯示提示圖片和正確答案
451
+ function showHintAndCorrectAnswer() {
452
+ // 移除現有的提示圖片和提示文字
453
+ const existingHintImages = document.querySelectorAll('.hint-image');
454
+ existingHintImages.forEach(img => img.remove());
455
+
456
+ const existingHintTexts = document.querySelectorAll('.hint-text');
457
+ existingHintTexts.forEach(text => text.remove());
458
+
459
+ // 創建提示容器
460
+ const hintContainer = document.createElement('div');
461
+ hintContainer.className = 'hint-container';
462
+ hintContainer.style.marginTop = '15px';
463
+ hintContainer.style.marginBottom = '15px';
464
+ hintContainer.style.padding = '10px';
465
+ hintContainer.style.backgroundColor = 'rgba(60, 60, 60, 0.8)';
466
+ hintContainer.style.border = '2px solid rgba(255, 140, 0, 0.7)';
467
+ hintContainer.style.borderRadius = '10px';
468
+ hintContainer.style.textAlign = 'center';
469
+
470
+ // 創建提示圖片
471
+ const hintImage = document.createElement('img');
472
+ hintImage.className = 'hint-image';
473
+ hintImage.src = `/home/ubuntu/upload/towerhint${currentQuestionIndex + 1}1.jpg`;
474
+ hintImage.alt = `問題 ${currentQuestionIndex + 1} 提示`;
475
+ hintImage.style.maxWidth = '100%';
476
+ hintImage.style.height = 'auto';
477
+ hintImage.style.marginBottom = '10px';
478
+ hintImage.style.borderRadius = '5px';
479
+ hintContainer.appendChild(hintImage);
480
+
481
+ // 創建提示文字
482
+ const hintText = document.createElement('div');
483
+ hintText.className = 'hint-text';
484
+ hintText.style.color = 'white';
485
+ hintText.style.fontSize = '1.1rem';
486
+ hintText.style.marginTop = '10px';
487
+
488
+ // 根據錯誤嘗試次數顯示不同的提示
489
+ if (wrongAttempts === 1) {
490
+ hintText.innerHTML = `<p>請仔細觀察上方提示圖,按照展開公式填入正確答案。</p>`;
491
+ } else {
492
+ // 第二次或更多次錯誤,顯示正確答案
493
+ const correctAnswer = questions[currentQuestionIndex].stage1.correctAnswer;
494
+ hintText.innerHTML = `
495
+ <p>正確答案應為:</p>
496
+ <p style="font-weight: bold; color: #2ecc71;">${correctAnswer}</p>
497
+ <p>請依照此答案填入,才能進入第二階段。</p>
498
+ `;
499
+ }
500
+
501
+ hintContainer.appendChild(hintText);
502
+
503
+ // 插入到公式模板前面
504
+ formulaTemplate.parentNode.insertBefore(hintContainer, formulaTemplate);
505
+ }
506
+
507
  // 檢查答案按鈕點擊事件
508
  checkAnswerBtn.addEventListener('click', function() {
509
  // 獲取所有填充的拖放區
 
623
  // 隱藏檢查按鈕,顯示下一步按鈕
624
  checkAnswerBtn.style.display = 'none';
625
  nextQuestionBtn.style.display = 'block';
626
+
627
+ // 移除提示圖片和提示文字
628
+ const existingHintImages = document.querySelectorAll('.hint-image');
629
+ existingHintImages.forEach(img => img.parentElement.remove());
630
+
631
  } else {
632
+ // 答錯了
633
+ wrongAttempts++; // 增加錯誤嘗試次數
 
634
 
 
635
  if (currentStage === 1) {
636
+ // 第一階段答錯,顯示提示圖片和正確答案
637
+ feedbackContainer.textContent = '答錯了,請參考下方提示修正答案!';
638
+ feedbackContainer.classList.add('incorrect');
639
+ wrongSound.play();
640
+
641
+ // 顯示提示圖片和正確答案
642
+ showHintAndCorrectAnswer();
643
+
644
+ // 記錄當前階段答錯
645
  questionStatus[currentQuestionIndex].stage1Correct = false;
646
+
647
+ // 不顯示下一步按鈕,讓用戶繼續嘗試
648
+ checkAnswerBtn.style.display = 'block';
649
+ nextQuestionBtn.style.display = 'none';
650
  } else {
651
+ // 第二階段答錯
652
+ feedbackContainer.textContent = '答錯了,請修正答案!';
653
+ feedbackContainer.classList.add('incorrect');
654
+ wrongSound.play();
655
+
656
+ // 記錄當前階段答錯
657
  questionStatus[currentQuestionIndex].stage2Correct = false;
658
 
659
  // 第二階段答錯也要更新門的狀態為錯誤
660
  doorsProgress[currentQuestionIndex].classList.add('opened');
661
  doorsProgress[currentQuestionIndex].style.backgroundColor = 'rgba(200, 100, 100, 0.8)';
662
+
663
+ // 答錯仍然可以繼續,顯示下一步按鈕
664
+ checkAnswerBtn.style.display = 'none';
665
+ nextQuestionBtn.style.display = 'block';
666
  }
 
 
 
 
667
  }
668
  });
669
 
 
671
  nextQuestionBtn.addEventListener('click', function() {
672
  // 如果當前是第一階段,進入第二階段
673
  if (currentStage === 1) {
674
+ // 只有答第一階段才能進入第二階段
675
+ if (questionStatus[currentQuestionIndex].stage1Correct) {
676
+ currentStage = 2;
677
+
678
+ // 隱藏第一階段按鈕,顯示第二階段按鈕
679
+ stage1Btn.style.display = 'none';
680
+ stage2Btn.style.display = 'inline-block';
681
+
682
+ // 顯示第一階段答案參考
683
+ stage1AnswerReference.style.display = 'block';
684
+
685
+ // 載入第二階段題目
686
+ loadQuestion(currentQuestionIndex, 2);
687
+ } else {
688
+ // 如果第一階段未答對,提示用戶必須先答對第一階段
689
+ alert('請先正確回答第一階段問題,才能進入第二階段!');
690
+
691
+ // 重置檢查按鈕和下一題按鈕
692
+ checkAnswerBtn.style.display = 'block';
693
+ nextQuestionBtn.style.display = 'none';
694
+ }
695
  }
696
  // 如果當前是第二階段,進入���一題或完成
697
  else {
 
792
  userAnswers = [];
793
  dropZones = [];
794
  dragItemElements = [];
795
+ wrongAttempts = 0;
796
+
797
+ // 重置問題狀態
798
+ questionStatus = Array(questions.length).fill().map(() => ({
799
+ stage1Correct: false,
800
+ stage2Correct: false,
801
+ attempted: false,
802
+ firstAttemptCorrect: false
803
+ }));
804
 
805
  // 重置門的狀態
806
  for (let i = 0; i < doorsProgress.length; i++) {
807
  doorsProgress[i].classList.remove('opened');
808
+ doorsProgress[i].style.backgroundColor = 'rgba(150, 150, 150, 0.8)';
809
  }
810
 
811
  // 顯示問題
towerhint11.jpg ADDED
towerhint21.jpg ADDED
towerhint31.jpg ADDED
towerhint41.jpg ADDED
towerhint51.jpg ADDED
towerhint61.jpg ADDED