diff --git a/libs/tja.py b/libs/tja.py index 491feb9..06fab04 100644 --- a/libs/tja.py +++ b/libs/tja.py @@ -424,19 +424,19 @@ class TJAParser: elif item.startswith('BALLOONNOR'): balloon_data = item.split(':')[1] if balloon_data == '': - logger.warning(f"Invalid BALLOONNOR value: {balloon_data} in TJA file {self.file_path}") + logger.debug(f"Invalid BALLOONNOR value: {balloon_data} in TJA file {self.file_path}") continue self.metadata.course_data[current_diff].balloon.extend([int(x) for x in balloon_data.split(',') if x != '']) elif item.startswith('BALLOONEXP'): balloon_data = item.split(':')[1] if balloon_data == '': - logger.warning(f"Invalid BALLOONEXP value: {balloon_data} in TJA file {self.file_path}") + logger.debug(f"Invalid BALLOONEXP value: {balloon_data} in TJA file {self.file_path}") continue self.metadata.course_data[current_diff].balloon.extend([int(x) for x in balloon_data.split(',') if x != '']) elif item.startswith('BALLOONMAS'): balloon_data = item.split(':')[1] if balloon_data == '': - logger.warning(f"Invalid BALLOONMAS value: {balloon_data} in TJA file {self.file_path}") + logger.debug(f"Invalid BALLOONMAS value: {balloon_data} in TJA file {self.file_path}") continue self.metadata.course_data[current_diff].balloon = [int(x) for x in balloon_data.split(',') if x != ''] elif item.startswith('BALLOON'): @@ -445,13 +445,13 @@ class TJAParser: continue balloon_data = item.split(':')[1] if balloon_data == '': - logger.warning(f"Invalid BALLOON value: {balloon_data} in TJA file {self.file_path}") + logger.debug(f"Invalid BALLOON value: {balloon_data} in TJA file {self.file_path}") continue self.metadata.course_data[current_diff].balloon = [int(x) for x in balloon_data.split(',') if x != ''] elif item.startswith('SCOREINIT'): score_init = item.split(':')[1] if score_init == '': - logger.warning(f"Invalid SCOREINIT value: {score_init} in TJA file {self.file_path}") + logger.debug(f"Invalid SCOREINIT value: {score_init} in TJA file {self.file_path}") continue try: self.metadata.course_data[current_diff].scoreinit = [int(x) for x in score_init.split(',') if x != ''] @@ -461,7 +461,7 @@ class TJAParser: elif item.startswith('SCOREDIFF'): score_diff = item.split(':')[1] if score_diff == '': - logger.error(f"Invalid SCOREDIFF value: {score_diff} in TJA file {self.file_path}") + logger.debug(f"Invalid SCOREDIFF value: {score_diff} in TJA file {self.file_path}") continue self.metadata.course_data[current_diff].scorediff = int(float(score_diff)) for region_code in self.metadata.title: diff --git a/libs/transition.py b/libs/transition.py index 8e36c0e..fae240c 100644 --- a/libs/transition.py +++ b/libs/transition.py @@ -11,11 +11,11 @@ class Transition: subtitle: str - The subtitle of the chart. is_second: bool - Whether this is the second half of the transition.""" self.is_finished = False - self.rainbow_up = global_tex.get_animation(0) - self.mini_up = global_tex.get_animation(1) - self.chara_down = global_tex.get_animation(2) - self.song_info_fade = global_tex.get_animation(3) - self.song_info_fade_out = global_tex.get_animation(4) + self.rainbow_up = global_tex.get_animation(0, is_copy=True) + self.mini_up = global_tex.get_animation(1, is_copy=True) + self.chara_down = global_tex.get_animation(2, is_copy=True) + self.song_info_fade = global_tex.get_animation(3, is_copy=True) + self.song_info_fade_out = global_tex.get_animation(4, is_copy=True) if title == '' and subtitle == '': self.title = '' self.subtitle = '' diff --git a/scenes/dan_select.py b/scenes/dan_select.py index 0c1a9a7..667bf10 100644 --- a/scenes/dan_select.py +++ b/scenes/dan_select.py @@ -20,7 +20,6 @@ class DanSelectScreen(Screen): super().on_screen_start() self.navigator = navigator self.navigator.in_dan_select = True - self.navigator.select_current_item() self.coin_overlay = CoinOverlay() self.allnet_indicator = AllNetIcon() self.timer = Timer(60, get_current_ms(), self.navigator.select_current_item) diff --git a/scenes/game_dan.py b/scenes/game_dan.py index 5b7afbf..c88042f 100644 --- a/scenes/game_dan.py +++ b/scenes/game_dan.py @@ -1,3 +1,4 @@ +import copy from typing import override import pyray as ray import logging @@ -44,9 +45,21 @@ class DanGameScreen(GameScreen): logger.info("Loaded nijiiro notes textures") ray.set_shader_value_texture(self.mask_shader, ray.get_shader_location(self.mask_shader, "texture0"), tex.textures['balloon']['rainbow_mask'].texture) ray.set_shader_value_texture(self.mask_shader, ray.get_shader_location(self.mask_shader, "texture1"), tex.textures['balloon']['rainbow'].texture) + self.hori_name = OutlinedText(global_data.session_data[global_data.player_num-1].song_title, 40, ray.WHITE) + self.init_dan() + self.background = Background(global_data.player_num, self.bpm, scene_preset='DAN') + self.transition = Transition('', '', is_second=True) + self.transition.start() + self.dan_transition = DanTransition() + self.dan_transition.start() + self.allnet_indicator = AllNetIcon() + self.result_transition = ResultTransition(4) + self.load_hitsounds() + + def init_dan(self): session_data = global_data.session_data[global_data.player_num-1] - songs = session_data.selected_dan - self.exams = session_data.selected_dan_exam + songs = copy.deepcopy(session_data.selected_dan) + self.exams = copy.deepcopy(session_data.selected_dan_exam) self.total_notes = 0 for song, genre_index, difficulty in songs: notes, branch_m, branch_e, branch_n = song.notes_to_position(difficulty) @@ -59,22 +72,14 @@ class DanGameScreen(GameScreen): self.total_notes += sum(1 for note in branch.play_notes if note.type < 5) song, genre_index, difficulty = songs[self.song_index] session_data.selected_difficulty = difficulty - self.hori_name = OutlinedText(session_data.song_title, 40, ray.WHITE) self.init_tja(song.file_path) self.color = session_data.dan_color self.player_1.is_dan = True self.player_1.gauge = DanGauge(str(global_data.player_num), self.total_notes) - logger.info(f"TJA initialized for song: {song.file_path}") - self.load_hitsounds() self.song_info = SongInfo(song.metadata.title.get(global_data.config["general"]["language"], "en"), genre_index) - self.result_transition = ResultTransition(4) self.bpm = self.tja.metadata.bpm - self.background = Background(global_data.player_num, self.bpm, scene_preset='DAN') - self.transition = Transition('', '', is_second=True) - self.transition.start() - self.dan_transition = DanTransition() - self.dan_transition.start() - self.allnet_indicator = AllNetIcon() + logger.info(f"TJA initialized for song: {song.file_path}") + self.dan_info_cache = None self.exam_failed = [False] * len(self.exams) @@ -150,6 +155,22 @@ class DanGameScreen(GameScreen): } return int(type_mapping.get(exam.type, 0)) + @override + def global_keys(self): + if ray.is_key_pressed(ray.KeyboardKey.KEY_F1): + if self.song_music is not None: + audio.stop_music_stream(self.song_music) + audio.seek_music_stream(self.song_music, 0) + self.song_started = False + audio.play_sound('restart', 'sound') + self.init_dan() + + if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE): + if self.song_music is not None: + audio.stop_music_stream(self.song_music) + return self.on_screen_end('DAN_SELECT') + + @override def update(self): super(GameScreen, self).update() current_time = get_current_ms() diff --git a/scenes/song_select.py b/scenes/song_select.py index f8aa0f7..60c0363 100644 --- a/scenes/song_select.py +++ b/scenes/song_select.py @@ -251,6 +251,7 @@ class SongSelectScreen(Screen): self.blue_arrow_move.update(current_time) self.dan_transition.update(current_time) if self.dan_transition.is_finished: + self.navigator.select_current_item() return self.on_screen_end('DAN_SELECT') next_screen = self.update_players(current_time)