Surn commited on
Commit
c004d56
·
1 Parent(s): 63cbfa3

Update incorrect guess icon to text

Browse files

change incorrect_guess volume
fix music playing when disabled after game over

README.md CHANGED
@@ -106,6 +106,11 @@ docker run -p 8501:8501 battlewords
106
 
107
  ## Changelog
108
 
 
 
 
 
 
109
  -0.2.14
110
  - bug fix on final score popup
111
  - score panel alignment centered
 
106
 
107
  ## Changelog
108
 
109
+ -0.2.15
110
+ - fix music playing after game end
111
+ - change incorrect guesses icon
112
+ - fix sound effect and music volume issues
113
+
114
  -0.2.14
115
  - bug fix on final score popup
116
  - score panel alignment centered
battlewords/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.2.14"
2
  __all__ = ["models", "generator", "logic", "ui"]
 
1
+ __version__ = "0.2.15"
2
  __all__ = ["models", "generator", "logic", "ui"]
battlewords/assets/audio/effects/incorrect_guess.mp3 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dda2212a4c7fab5d3a402d4639c11fc80d93f01e14523a20bbbfd747e873d13d
3
- size 49663
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e6f7fb1f8e3b4fe3ca958d486ba667a3a05482a88dff16016e058687ffd41a5
3
+ size 49659
battlewords/ui.py CHANGED
@@ -1034,21 +1034,42 @@ def _render_guess_form(state: GameState):
1034
  font-size: 0.7rem;
1035
  color: #ff9999;
1036
  margin-top: -10px;
1037
- #padding: 4px 8px;
1038
- #background: rgba(255, 255, 255, 0.05);
1039
- #border-radius: 4px;
1040
  font-style: italic;
1041
  }
 
1042
  .stTooltipIcon {
1043
  position: absolute;
1044
  left: 0;
1045
  bottom: -22px;
 
1046
  }
1047
- .stForm {
1048
- padding-bottom: 30px;
 
1049
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1050
  @media (max-width: 640px) {
1051
- .st-emotion-cache-1xwdq91, .st-emotion-cache-1r70o5b {max-width: max-content; min-width:33%;}
 
 
1052
  }
1053
  </style>
1054
  """,
@@ -1083,7 +1104,7 @@ def _render_guess_form(state: GameState):
1083
  if correct:
1084
  st.session_state.radar_gif_path = None
1085
  st.session_state.radar_gif_signature = None
1086
- play_sound_effect("correct_guess", volume=0.6)
1087
  else:
1088
  # Update incorrect guesses list - keep only last 10
1089
  st.session_state.incorrect_guesses.append(guess_text)
@@ -1351,12 +1372,16 @@ def _render_game_over(state: GameState):
1351
  _mount_background_audio(False, None, 0.0)
1352
  _game_over_dialog(state)
1353
  else:
1354
- # Mount background music (loop by default)
1355
- background_path = os.path.join(music_dir, "background.mp3")
1356
- if os.path.exists(background_path):
1357
- src_url = _load_audio_data_url(background_path)
1358
- _mount_background_audio(True, src_url, (st.session_state.get("music_volume", 100)) / 100)
 
 
 
1359
  else:
 
1360
  _mount_background_audio(False, None, 0.0)
1361
 
1362
  def _sort_wordlist(filename):
 
1034
  font-size: 0.7rem;
1035
  color: #ff9999;
1036
  margin-top: -10px;
 
 
 
1037
  font-style: italic;
1038
  }
1039
+ /* Reposition tooltip anchor under the input */
1040
  .stTooltipIcon {
1041
  position: absolute;
1042
  left: 0;
1043
  bottom: -22px;
1044
+ width: auto !important;
1045
  }
1046
+ /* Hide the default SVG info icon */
1047
+ .stTooltipIcon svg.icon {
1048
+ display: none !important;
1049
  }
1050
+ /* Make the tooltip trigger look like a link reading "incorrect guesses" */
1051
+ .stTooltipIcon .stTooltipHoverTarget {
1052
+ display: inline-flex;
1053
+ align-items: center;
1054
+ width: auto;
1055
+ }
1056
+ .stTooltipIcon .stTooltipHoverTarget::after {
1057
+ content: "incorrect guesses";
1058
+ color: #FFFFFF;
1059
+ text-decoration: underline;
1060
+ font-size: 0.8rem;
1061
+ cursor: help;
1062
+ }
1063
+ .stTooltipIcon .stTooltipHoverTarget:hover::after {
1064
+ color: #ff9999;
1065
+ }
1066
+
1067
+ .stForm { padding-bottom: 30px; }
1068
+
1069
  @media (max-width: 640px) {
1070
+ .st-emotion-cache-1xwdq91, .st-emotion-cache-1r70o5b {
1071
+ max-width: max-content; min-width:33%;
1072
+ }
1073
  }
1074
  </style>
1075
  """,
 
1104
  if correct:
1105
  st.session_state.radar_gif_path = None
1106
  st.session_state.radar_gif_signature = None
1107
+ play_sound_effect("correct_guess", volume=0.5)
1108
  else:
1109
  # Update incorrect guesses list - keep only last 10
1110
  st.session_state.incorrect_guesses.append(guess_text)
 
1372
  _mount_background_audio(False, None, 0.0)
1373
  _game_over_dialog(state)
1374
  else:
1375
+ # Only play background music if music is enabled
1376
+ if st.session_state.get("music_enabled", False):
1377
+ background_path = os.path.join(music_dir, "background.mp3")
1378
+ if os.path.exists(background_path):
1379
+ src_url = _load_audio_data_url(background_path)
1380
+ _mount_background_audio(True, src_url, (st.session_state.get("music_volume", 100)) / 100)
1381
+ else:
1382
+ _mount_background_audio(False, None, 0.0)
1383
  else:
1384
+ # Disable all music playback
1385
  _mount_background_audio(False, None, 0.0)
1386
 
1387
  def _sort_wordlist(filename):