From 3024b7d4127f0530f9905752aa0b6696578aec85 Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Wed, 29 Oct 2025 23:52:39 -0400 Subject: [PATCH] more bug fixes because I messed up stuff --- libs/file_navigator.py | 28 +++++++++++++++++++++++++--- libs/transition.py | 2 ++ scenes/game.py | 3 --- scenes/game_dan.py | 34 ++++++++++++++++++++++++++++++++++ scenes/result.py | 2 +- 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 scenes/game_dan.py diff --git a/libs/file_navigator.py b/libs/file_navigator.py index 6c43ffe..0440e36 100644 --- a/libs/file_navigator.py +++ b/libs/file_navigator.py @@ -501,7 +501,18 @@ class DanBox: self.songs = songs self.exams = exams self.song_text: list[tuple[OutlinedText, OutlinedText]] = [] + self.total_notes = 0 + for song, genre_index, difficulty in self.songs: + notes, branch_m, branch_e, branch_n = song.notes_to_position(difficulty) + self.total_notes += len(notes.play_notes) + for branch in branch_m: + self.total_notes += len(branch.play_notes) + for branch in branch_e: + self.total_notes += len(branch.play_notes) + for branch in branch_n: + self.total_notes += len(branch.play_notes) self.name = None + self.hori_name = None self.yellow_box = None def move_box(self): @@ -533,14 +544,15 @@ class DanBox: def get_text(self): if self.name is None: - self.name = OutlinedText(self.title, 40, ray.WHITE, outline_thickness=5, vertical=True) + self.name = OutlinedText(self.title, 40, ray.WHITE, vertical=True) + self.hori_name = OutlinedText(self.title, 40, ray.WHITE) if self.is_open and not self.song_text: for song, genre, difficulty in self.songs: title = song.metadata.title.get(global_data.config["general"]["language"], song.metadata.title["en"]) subtitle = song.metadata.subtitle.get(global_data.config["general"]["language"], "") - title_text = OutlinedText(title, 40, ray.WHITE, outline_thickness=5, vertical=True) + title_text = OutlinedText(title, 40, ray.WHITE, vertical=True) font_size = 30 if len(subtitle) < 30 else 20 - subtitle_text = OutlinedText(subtitle, font_size, ray.WHITE, outline_thickness=5, vertical=True) + subtitle_text = OutlinedText(subtitle, font_size, ray.WHITE, vertical=True) self.song_text.append((title_text, subtitle_text)) def update(self, is_diff_select: bool): @@ -579,6 +591,16 @@ class DanBox: title.draw(outline_color=ray.BLACK, x=665+x, y=127, y2=min(title.texture.height, 400)-title.texture.height) subtitle.draw(outline_color=ray.BLACK, x=620+x, y=525-min(subtitle.texture.height, 400), y2=min(subtitle.texture.height, 400)-subtitle.texture.height) + tex.draw_texture('yellow_box', 'total_notes_bg') + tex.draw_texture('yellow_box', 'total_notes') + counter = str(self.total_notes) + for i in range(len(counter)): + tex.draw_texture('yellow_box', 'total_notes_counter', frame=int(counter[i]), x=(i * 25)) + + tex.draw_texture('yellow_box', 'frame', frame=self.color) + if self.hori_name is not None: + self.hori_name.draw(outline_color=ray.BLACK, x=434 - (self.hori_name.texture.width//2), y=84, x2=min(self.hori_name.texture.width, 275)-self.hori_name.texture.width) + def draw(self, x: int, y: int, is_ura: bool): if self.is_open: self._draw_open(x, y, is_ura) diff --git a/libs/transition.py b/libs/transition.py index e500fdd..2983e1b 100644 --- a/libs/transition.py +++ b/libs/transition.py @@ -69,6 +69,8 @@ class Transition: if self.is_second: offset = self.chara_down.attribute - self.mini_up.attribute//3 chara_offset = 408 + if self.title == '' and self.subtitle == '': + return global_tex.draw_texture('rainbow_transition', 'chara_left', x=-self.mini_up.attribute//2 - chara_offset, y=-self.mini_up.attribute + offset - total_offset) global_tex.draw_texture('rainbow_transition', 'chara_right', x=self.mini_up.attribute//2 + chara_offset, y=-self.mini_up.attribute + offset - total_offset) global_tex.draw_texture('rainbow_transition', 'chara_center', y=-self.rainbow_up.attribute + offset - total_offset) diff --git a/scenes/game.py b/scenes/game.py index bd47bba..c11ca68 100644 --- a/scenes/game.py +++ b/scenes/game.py @@ -52,10 +52,8 @@ class GameScreen(Screen): self.end_ms = 0 self.start_delay = 1000 self.song_started = False - self.screen_init = True self.movie = None self.song_music = None - logger.info("Game screen textures loaded") if global_data.config["general"]["nijiiro_notes"]: # drop original if "notes" in tex.textures: @@ -65,7 +63,6 @@ class GameScreen(Screen): tex.load_zip("game", "notes_nijiiro") tex.textures["notes"] = tex.textures.pop("notes_nijiiro") logger.info("Loaded nijiiro notes textures") - logger.info("Game screen sounds loaded") 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) session_data = global_data.session_data[global_data.player_num-1] diff --git a/scenes/game_dan.py b/scenes/game_dan.py new file mode 100644 index 0000000..3d0110e --- /dev/null +++ b/scenes/game_dan.py @@ -0,0 +1,34 @@ +import logging +from libs.audio import audio +from libs.background import Background +from libs.global_data import global_data +from libs.transition import Transition +from scenes.game import GameScreen, SongInfo + +logger = logging.getLogger(__name__) + +class DanGameScreen(GameScreen): + JUDGE_X = 414 + def on_screen_start(self): + super().on_screen_start() + self.init_tja(global_data.selected_song) + logger.info(f"TJA initialized for song: {global_data.selected_song}") + self.song_info = SongInfo(session_data.song_title, session_data.genre_index) + self.background = Background(global_data.player_num, self.bpm, scene_preset='DAN') + self.transition = Transition('', '', is_second=True) + self.transition.start() + + def update(self): + super().update() + current_time = get_current_ms() + self.transition.update(current_time) + self.current_ms = current_time - self.start_ms + self.start_song(current_time) + self.update_background(current_time) + + if self.song_music is not None: + audio.update_music_stream(self.song_music) + + self.player_1.update(self.current_ms, current_time, self.background) + self.song_info.update(current_time) + return self.global_keys() diff --git a/scenes/result.py b/scenes/result.py index b8535ea..23e63c3 100644 --- a/scenes/result.py +++ b/scenes/result.py @@ -72,7 +72,7 @@ class ResultScreen(Screen): def draw_song_info(self): tex.draw_texture('song_info', 'song_num', frame=global_data.songs_played%4) - self.song_info.draw(x=1252 - self.song_info.texture.width, y=35 - self.song_info.texture.height / 2) + self.song_info.draw(outline_color=ray.BLACK, x=1252 - self.song_info.texture.width, y=35 - self.song_info.texture.height / 2) def draw(self): self.background.draw()