diff --git a/libs/file_navigator.py b/libs/file_navigator.py index a686aae..73805f4 100644 --- a/libs/file_navigator.py +++ b/libs/file_navigator.py @@ -1356,8 +1356,8 @@ class FileNavigator: for song_list_path in song_list_files: with open(song_list_path, 'r', encoding='utf-8-sig') as song_list_file: tja_count += len([line for line in song_list_file.readlines() if line.strip()]) - # Fallback: Use recursive counting of .tja files - tja_count += sum(1 for _ in folder_path.rglob("*.tja")) + # Fallback: Use recursive counting of .tja or dan.json files + tja_count += sum(1 for _ in list(folder_path.rglob("*.tja")) + list(folder_path.rglob("dan.json"))) return tja_count diff --git a/scenes/dan/dan_result.py b/scenes/dan/dan_result.py index 1cc08e3..3552ead 100644 --- a/scenes/dan/dan_result.py +++ b/scenes/dan/dan_result.py @@ -171,8 +171,8 @@ class DanResultScreen(Screen): tex.draw_texture('exam_info', exam_data.bar_texture, x2=tex.skin_config["dan_exam_info"].width *exam_data.progress*scale, y=y_offset, fade=fade, scale=scale) # Draw exam type and red value counter red_counter = str(exam.red) - self._draw_counter(red_counter, margin=tex.skin_config["dan_exam_info"].x*scale, texture='value_counter', index=0, y=y_offset, fade=fade, scale=scale) - tex.draw_texture('exam_info', f'exam_{exam.type}', y=y_offset, x=-len(red_counter)*20*scale, fade=fade, scale=scale) + self._draw_counter(red_counter, margin=tex.skin_config["dan_exam_info"].x*scale, texture='value_counter', index=0, y=y_offset, fade=fade, scale=scale, exam_type=exam.type) + tex.draw_texture('exam_info', f'exam_{exam.type}', y=y_offset, x=-len(red_counter)*(20 * tex.screen_scale), fade=fade, scale=scale) # Draw range indicator if exam.range == 'less': tex.draw_texture('exam_info', 'exam_less', y=y_offset, fade=fade, scale=scale) @@ -183,17 +183,21 @@ class DanResultScreen(Screen): value_counter = str(exam_data.counter_value) self._draw_counter(value_counter, margin=tex.skin_config["dan_exam_info"].x*scale, texture='value_counter', index=1, y=y_offset, fade=fade, scale=scale) if exam.type == 'gauge': + tex.draw_texture('exam_info', 'exam_percent', y=y_offset, index=0, fade=fade, scale=scale) tex.draw_texture('exam_info', 'exam_percent', y=y_offset, index=1, fade=fade, scale=scale) if exam_data.failed: tex.draw_texture('exam_info', 'exam_bg', fade=min(fade, 0.5), y=y_offset, scale=scale) tex.draw_texture('exam_info', 'exam_failed', y=y_offset, fade=fade, scale=scale) - def _draw_counter(self, counter, margin, texture, index=None, y: float = 0.0, fade=0.0, scale=1.0): + def _draw_counter(self, counter, margin, texture, index=None, y: float = 0.0, fade=0.0, scale=1.0, exam_type=None): """Helper to draw digit counters""" for j in range(len(counter)): kwargs = {'frame': int(counter[j]), 'x': -(len(counter) - j) * margin, 'y': y, 'fade': fade, 'scale': scale} if index is not None: kwargs['index'] = index + if exam_type == 'gauge': + # Add space for percentage + kwargs['x'] = kwargs['x'] - margin tex.draw_texture('exam_info', texture, **kwargs) def draw(self): diff --git a/scenes/dan/game_dan.py b/scenes/dan/game_dan.py index 621e9b0..a61eb4b 100644 --- a/scenes/dan/game_dan.py +++ b/scenes/dan/game_dan.py @@ -149,6 +149,7 @@ class DanGameScreen(GameScreen): 'judgeperfect': self.player_1.good_count, 'judgegood': self.player_1.ok_count + self.player_1.bad_count, 'judgebad': self.player_1.bad_count, + 'hit': self.player_1.good_count + self.player_1.ok_count + self.player_1.total_drumroll, 'score': self.player_1.score, 'combo': self.player_1.max_combo } @@ -156,7 +157,7 @@ class DanGameScreen(GameScreen): @override def global_keys(self): - if ray.is_key_pressed(ray.KeyboardKey.KEY_F1): + if ray.is_key_pressed(global_data.config["keys"]["restart_key"]): if self.song_music is not None: audio.stop_music_stream(self.song_music) audio.seek_music_stream(self.song_music, 0) @@ -164,7 +165,7 @@ class DanGameScreen(GameScreen): audio.play_sound('restart', 'sound') self.init_dan() - if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE): + if ray.is_key_pressed(global_data.config["keys"]["back_key"]): if self.song_music is not None: audio.stop_music_stream(self.song_music) return self.on_screen_end('DAN_SELECT') @@ -296,7 +297,7 @@ class DanGameScreen(GameScreen): # Draw exam type and red value counter red_counter = str(exam_info['red_value']) - self._draw_counter(red_counter, margin=tex.skin_config["dan_score_box_margin"].x, texture='value_counter', index=0, y=y_offset) + self._draw_counter(red_counter, margin=tex.skin_config["dan_score_box_margin"].x, texture='value_counter', index=0, y=y_offset, exam_type=exam.type) tex.draw_texture('dan_info', f'exam_{exam.type}', y=y_offset, x=-len(red_counter)*(20 * tex.screen_scale)) # Draw range indicator @@ -311,6 +312,7 @@ class DanGameScreen(GameScreen): self._draw_counter(value_counter, margin=tex.skin_config["dan_score_box_margin"].x, texture='value_counter', index=1, y=y_offset) if exam.type == 'gauge': + tex.draw_texture('dan_info', 'exam_percent', y=y_offset, index=0) tex.draw_texture('dan_info', 'exam_percent', y=y_offset, index=1) if self.exam_failed[i]: @@ -323,12 +325,15 @@ class DanGameScreen(GameScreen): self.hori_name.draw(outline_color=ray.BLACK, x=tex.skin_config["dan_game_hori_name"].x - (self.hori_name.texture.width//2), y=tex.skin_config["dan_game_hori_name"].y, x2=min(self.hori_name.texture.width, tex.skin_config["dan_game_hori_name"].width)-self.hori_name.texture.width) - def _draw_counter(self, counter: str, margin: float, texture: str, index: Optional[int] = None, y: float = 0): + def _draw_counter(self, counter: str, margin: float, texture: str, index: Optional[int] = None, y: float = 0, exam_type: Optional[str] = None): """Helper to draw digit counters""" for j in range(len(counter)): kwargs = {'frame': int(counter[j]), 'x': -(len(counter) - j) * margin, 'y': y} if index is not None: kwargs['index'] = index + if exam_type == 'gauge': + # Add space for percentage + kwargs['x'] = kwargs['x'] - margin tex.draw_texture('dan_info', texture, **kwargs) @override