minor changes

This commit is contained in:
Yonokid
2025-07-27 21:35:14 -04:00
parent 53eeb69243
commit 03a95b2de7
5 changed files with 181 additions and 76 deletions

View File

@@ -76,6 +76,7 @@ def main():
camera.projection = CAMERA_ORTHOGRAPHIC camera.projection = CAMERA_ORTHOGRAPHIC
ray.init_window(screen_width, screen_height, "PyTaiko") ray.init_window(screen_width, screen_height, "PyTaiko")
global_data.textures = load_all_textures_from_zip(Path('Graphics/lumendata/intermission.zip'))
if global_data.config["video"]["borderless"]: if global_data.config["video"]["borderless"]:
ray.toggle_borderless_windowed() ray.toggle_borderless_windowed()
if global_data.config["video"]["fullscreen"]: if global_data.config["video"]["fullscreen"]:
@@ -111,7 +112,6 @@ def main():
ray.gen_texture_mipmaps(target.texture) ray.gen_texture_mipmaps(target.texture)
ray.rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD) ray.rl_set_blend_factors_separate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE_MINUS_SRC_ALPHA, RL_FUNC_ADD, RL_FUNC_ADD)
ray.set_exit_key(ray.KeyboardKey.KEY_A) ray.set_exit_key(ray.KeyboardKey.KEY_A)
global_data.textures = load_all_textures_from_zip(Path('Graphics/lumendata/intermission.zip'))
while not ray.window_should_close(): while not ray.window_should_close():
ray.begin_texture_mode(target) ray.begin_texture_mode(target)

View File

@@ -17,6 +17,8 @@ class Background:
self.footer = Footer(self.screen_width, self.screen_height, random.randint(1, 3)) self.footer = Footer(self.screen_width, self.screen_height, random.randint(1, 3))
self.is_clear = False self.is_clear = False
def update(self, current_time_ms: float, is_clear: bool): def update(self, current_time_ms: float, is_clear: bool):
if not self.is_clear and is_clear:
self.bg_fever.start()
self.is_clear = is_clear self.is_clear = is_clear
self.donbg.update(current_time_ms, self.is_clear) self.donbg.update(current_time_ms, self.is_clear)
self.bg_normal.update(current_time_ms) self.bg_normal.update(current_time_ms)
@@ -51,10 +53,15 @@ class DonBGBase:
self.textures = (load_all_textures_from_zip(Path(f'Graphics/lumendata/enso_original/{self.name}_{self.player_num}p.zip'))) self.textures = (load_all_textures_from_zip(Path(f'Graphics/lumendata/enso_original/{self.name}_{self.player_num}p.zip')))
self.move = Animation.create_move(3000, start_position=0, total_distance=-self.textures[self.name + f'_{self.player_num}p'][0].width) self.move = Animation.create_move(3000, start_position=0, total_distance=-self.textures[self.name + f'_{self.player_num}p'][0].width)
self.is_clear = False self.is_clear = False
self.clear_fade = None
def update(self, current_time_ms: float, is_clear: bool): def update(self, current_time_ms: float, is_clear: bool):
if not self.is_clear and is_clear:
self.clear_fade = Animation.create_fade(150, initial_opacity=0.0, final_opacity=1.0)
self.is_clear = is_clear self.is_clear = is_clear
self.move.update(current_time_ms) self.move.update(current_time_ms)
if self.clear_fade is not None:
self.clear_fade.update(current_time_ms)
if self.move.is_finished: if self.move.is_finished:
self.move.restart() self.move.restart()
@@ -73,20 +80,21 @@ class DonBG1(DonBGBase):
if self.overlay_move.is_finished: if self.overlay_move.is_finished:
self.overlay_move.restart() self.overlay_move.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 3 self._draw_textures(3, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
wave_texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] wave_texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width + (wave_texture.width+80), wave_texture.width+80): for i in range(0, self.screen_width + (wave_texture.width+80), wave_texture.width+80):
ray.draw_texture(wave_texture, i + int(self.move.attribute * ((wave_texture.width+80)/top_texture.width)) + 100, int(self.overlay_move.attribute), ray.WHITE) ray.draw_texture(wave_texture, i + int(self.move.attribute * ((wave_texture.width+80)/top_texture.width)) + 100, int(self.overlay_move.attribute), color)
texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index]
for i in range(0, self.screen_width + texture.width + texture.width*5, texture.width): for i in range(0, self.screen_width + texture.width + texture.width*5, texture.width):
ray.draw_texture(texture, i + int(self.move.attribute * (texture.width/top_texture.width)*3), int(self.overlay_move.attribute) + 105, ray.WHITE) ray.draw_texture(texture, i + int(self.move.attribute * (texture.width/top_texture.width)*3), int(self.overlay_move.attribute) + 105, color)
class DonBG2(DonBGBase): class DonBG2(DonBGBase):
def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int): def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int):
@@ -98,16 +106,17 @@ class DonBG2(DonBGBase):
if self.overlay_move.is_finished: if self.overlay_move.is_finished:
self.overlay_move.restart() self.overlay_move.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 2 self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width + texture.width, texture.width): for i in range(0, self.screen_width + texture.width, texture.width):
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, ray.WHITE) ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, color)
class DonBG3(DonBGBase): class DonBG3(DonBGBase):
def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int): def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int):
@@ -132,15 +141,17 @@ class DonBG3(DonBGBase):
self.overlay_move_2.restart() self.overlay_move_2.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 2 self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width + texture.width, texture.width): for i in range(0, self.screen_width + texture.width, texture.width):
ray.draw_texture(texture, i + int(self.move.attribute*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - 25 + int(self.overlay_move.attribute) + int(self.overlay_move_2.attribute), ray.WHITE) ray.draw_texture(texture, i + int(self.move.attribute*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - 25 + int(self.overlay_move.attribute) + int(self.overlay_move_2.attribute), color)
class DonBG4(DonBGBase): class DonBG4(DonBGBase):
def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int): def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int):
@@ -152,16 +163,18 @@ class DonBG4(DonBGBase):
if self.overlay_move.is_finished: if self.overlay_move.is_finished:
self.overlay_move.restart() self.overlay_move.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 2 self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width + texture.width, texture.width): for i in range(0, self.screen_width + texture.width, texture.width):
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, ray.WHITE) ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 25, color)
class DonBG5(DonBGBase): class DonBG5(DonBGBase):
def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int): def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int):
@@ -183,15 +196,17 @@ class DonBG5(DonBGBase):
self.adjust.restart() self.adjust.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 2 self._draw_textures(2, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width + texture.width + texture.width*2, texture.width*2): for i in range(0, self.screen_width + texture.width + texture.width*2, texture.width*2):
ray.draw_texture(texture, i + int((self.move.attribute * (texture.width/top_texture.width))*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - int(self.adjust.attribute), ray.WHITE) ray.draw_texture(texture, i + int((self.move.attribute * (texture.width/top_texture.width))*2), int(self.bounce_up.attribute) - int(self.bounce_down.attribute) - int(self.adjust.attribute), color)
class DonBG6(DonBGBase): class DonBG6(DonBGBase):
def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int): def __init__(self, index: int, screen_width: int, screen_height: int, player_num: int):
@@ -203,21 +218,23 @@ class DonBG6(DonBGBase):
if self.overlay_move.is_finished: if self.overlay_move.is_finished:
self.overlay_move.restart() self.overlay_move.restart()
def draw(self): def draw(self):
texture_index = 0 self._draw_textures(0, ray.WHITE)
if self.is_clear: if self.is_clear and self.clear_fade is not None:
texture_index = 3 self._draw_textures(3, ray.fade(ray.WHITE, self.clear_fade.attribute))
def _draw_textures(self, texture_index: int, color: ray.Color):
top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index] top_texture = self.textures[self.name + f'_{self.player_num}p'][0 + texture_index]
for i in range(0, self.screen_width + top_texture.width, top_texture.width): for i in range(0, self.screen_width + top_texture.width, top_texture.width):
ray.draw_texture(top_texture, i + int(self.move.attribute), 0, ray.WHITE) ray.draw_texture(top_texture, i + int(self.move.attribute), 0, color)
texture_flowers = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index] texture_flowers = self.textures[self.name + f'_{self.player_num}p'][1 + texture_index]
for i in range(0, self.screen_width, texture_flowers.width): for i in range(0, self.screen_width, texture_flowers.width):
if i % (2 * texture_flowers.width) != 0: if i % (2 * texture_flowers.width) != 0:
ray.draw_texture(texture_flowers, i + int(self.move.attribute*3) + 100, -int(self.move.attribute*0.85)-100, ray.WHITE) ray.draw_texture(texture_flowers, i + int(self.move.attribute*3) + 100, -int(self.move.attribute*0.85)-100, color)
texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index] texture = self.textures[self.name + f'_{self.player_num}p'][2 + texture_index]
for i in range(0, self.screen_width + texture.width, texture.width): for i in range(0, self.screen_width + texture.width, texture.width):
ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 50, ray.WHITE) ray.draw_texture(texture, i + int(self.move.attribute), int(self.overlay_move.attribute) - 50, color)
class BGNormal: class BGNormal:
@@ -406,8 +423,7 @@ class BGFeverBase:
self.screen_height = screen_height self.screen_height = screen_height
self.name = 'bg_fever_a_' + str(index).zfill(2) self.name = 'bg_fever_a_' + str(index).zfill(2)
self.textures = (load_all_textures_from_zip(Path(f'Graphics/lumendata/enso_original/{self.name}.zip'))) self.textures = (load_all_textures_from_zip(Path(f'Graphics/lumendata/enso_original/{self.name}.zip')))
self.vertical_move = Animation.create_move(1300, start_position=0, total_distance=50, reverse_delay=0) self.transitioned = False
self.horizontal_move = Animation.create_move(5000, start_position=0, total_distance=self.textures[self.name][2].width)
def unload(self): def unload(self):
for texture_group in self.textures: for texture_group in self.textures:
@@ -417,20 +433,43 @@ class BGFeverBase:
class BGFever4(BGFeverBase): class BGFever4(BGFeverBase):
def __init__(self, index: int, screen_width: int, screen_height: int): def __init__(self, index: int, screen_width: int, screen_height: int):
super().__init__(index, screen_width, screen_height) super().__init__(index, screen_width, screen_height)
self.vertical_move = Animation.create_move(1300, start_position=0, total_distance=50, reverse_delay=0)
self.horizontal_move = Animation.create_move(5000, start_position=0, total_distance=self.textures[self.name][2].width)
self.bg_texture_move_down = None
self.bg_texture_move_up = None
def start(self):
self.bg_texture_move_down = Animation.create_move(516, total_distance=400, ease_in='cubic')
self.bg_texture_move_up = Animation.create_move(200, total_distance=40, delay=self.bg_texture_move_down.duration, ease_out='quadratic')
def update(self, current_time_ms: float): def update(self, current_time_ms: float):
self.vertical_move.update(current_time_ms) if self.bg_texture_move_down is not None:
if self.vertical_move.is_finished: self.bg_texture_move_down.update(current_time_ms)
self.vertical_move.restart()
self.horizontal_move.update(current_time_ms) if self.bg_texture_move_up is not None:
if self.horizontal_move.is_finished: self.bg_texture_move_up.update(current_time_ms)
self.horizontal_move.restart() if self.bg_texture_move_up.is_finished and not self.transitioned:
self.transitioned = True
self.vertical_move.restart()
self.horizontal_move.restart()
if self.transitioned:
self.vertical_move.update(current_time_ms)
if self.vertical_move.is_finished:
self.vertical_move.restart()
self.horizontal_move.update(current_time_ms)
if self.horizontal_move.is_finished:
self.horizontal_move.restart()
def draw(self): def draw(self):
if self.bg_texture_move_down is None or self.bg_texture_move_up is None:
return
texture = self.textures[self.name][0] texture = self.textures[self.name][0]
y = int(self.bg_texture_move_down.attribute) - int(self.bg_texture_move_up.attribute)
for i in range(0, self.screen_width + texture.width, texture.width): for i in range(0, self.screen_width + texture.width, texture.width):
ray.draw_texture(texture, i, 360, ray.WHITE) ray.draw_texture(texture, i, y, ray.WHITE)
ray.draw_texture(self.textures[self.name][1], 0, 360 + 50 - int(self.vertical_move.attribute), ray.WHITE) ray.draw_texture(self.textures[self.name][1], 0, (720 + 50 - int(self.vertical_move.attribute)) - y, ray.WHITE)
ray.draw_texture(self.textures[self.name][2], -int(self.horizontal_move.attribute), 360, ray.WHITE) ray.draw_texture(self.textures[self.name][2], -int(self.horizontal_move.attribute), y, ray.WHITE)
ray.draw_texture(self.textures[self.name][2], self.textures[self.name][2].width -int(self.horizontal_move.attribute), 360, ray.WHITE) ray.draw_texture(self.textures[self.name][2], self.textures[self.name][2].width -int(self.horizontal_move.attribute), y, ray.WHITE)
class Footer: class Footer:
def __init__(self, screen_width: int, screen_height: int, index: int): def __init__(self, screen_width: int, screen_height: int, index: int):

View File

@@ -1,17 +1,15 @@
import pyray as ray import pyray as ray
from libs.utils import get_current_ms, is_l_don_pressed, is_r_don_pressed
from scenes.song_select import Transition
class DevScreen: class DevScreen:
def __init__(self, width: int, height: int): def __init__(self, width: int, height: int):
self.width = width self.width = width
self.height = height self.height = height
self.screen_init = False self.screen_init = False
self.model = ray.load_model("model/mikudon.obj") self.transition = Transition(self.height, 'TRIPLE HELIX', 'Yonokid')
self.model_position = ray.Vector3(-450.0, 100.0, -180.0)
self.model_scale = 1000.0
self.model_rotation_y = 45.0 # Face towards camera (rotate 180 degrees on Y-axis)
self.model_rotation_x = 0.0 # No up/down tilt
self.model_rotation_z = 0.0 # No roll
def on_screen_start(self): def on_screen_start(self):
if not self.screen_init: if not self.screen_init:
@@ -19,26 +17,20 @@ class DevScreen:
def on_screen_end(self, next_screen: str): def on_screen_end(self, next_screen: str):
self.screen_init = False self.screen_init = False
ray.unload_model(self.model)
return next_screen return next_screen
def update(self): def update(self):
self.on_screen_start() self.on_screen_start()
self.transition.update(get_current_ms())
if is_l_don_pressed() or is_r_don_pressed():
self.transition = Transition(self.height, 'TRIPLE HELIX', 'Yonokid')
if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER): if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER):
return self.on_screen_end('GAME') return self.on_screen_end('GAME')
def draw(self): def draw(self):
pass self.transition.draw(self.height)
def draw_3d(self): def draw_3d(self):
# Method 1: Using draw_model_ex for full control over rotation pass
rotation_axis = ray.Vector3(0.0, 1.0, 0.0) # Y-axis for horizontal rotation
ray.draw_model_ex(
self.model,
self.model_position,
rotation_axis,
self.model_rotation_y,
ray.Vector3(self.model_scale, self.model_scale, self.model_scale),
ray.WHITE
)

View File

@@ -134,7 +134,11 @@ class GameScreen:
self.init_tja(global_data.selected_song, session_data.selected_difficulty) self.init_tja(global_data.selected_song, session_data.selected_difficulty)
self.song_info = SongInfo(session_data.song_title, 'TEST') self.song_info = SongInfo(session_data.song_title, 'TEST')
self.result_transition = None self.result_transition = None
self.transition = Transition(self.height) if self.tja is not None:
subtitle = self.tja.metadata.subtitle.get(global_data.config['general']['language'].lower(), '')
else:
subtitle = ''
self.transition = Transition(self.height, session_data.song_title, subtitle)
def on_screen_end(self, next_screen): def on_screen_end(self, next_screen):
self.screen_init = False self.screen_init = False
@@ -1270,12 +1274,17 @@ class SongInfo:
self.song_title.draw(src, dest, ray.Vector2(0, 0), 0, self.song_name_fade) self.song_title.draw(src, dest, ray.Vector2(0, 0), 0, self.song_name_fade)
class Transition: class Transition:
def __init__(self, screen_height: int) -> None: def __init__(self, screen_height: int, title: str, subtitle: str) -> None:
duration = 266
self.is_finished = False self.is_finished = False
self.rainbow_up = Animation.create_move(266, start_position=0, total_distance=screen_height + global_data.textures['scene_change_rainbow'][2].height, ease_in='cubic') self.rainbow_up = Animation.create_move(duration, start_position=0, total_distance=screen_height + global_data.textures['scene_change_rainbow'][2].height, ease_in='cubic')
self.chara_down = None self.chara_down = None
self.title = OutlinedText(title, 40, ray.WHITE, ray.BLACK, outline_thickness=5)
self.subtitle = OutlinedText(subtitle, 30, ray.WHITE, ray.BLACK, outline_thickness=5)
self.song_info_fade = Animation.create_fade(duration/2)
def update(self, current_time_ms: float): def update(self, current_time_ms: float):
self.rainbow_up.update(current_time_ms) self.rainbow_up.update(current_time_ms)
self.song_info_fade.update(current_time_ms)
if self.rainbow_up.is_finished and self.chara_down is None: if self.rainbow_up.is_finished and self.chara_down is None:
self.chara_down = Animation.create_move(33, start_position=0, total_distance=30) self.chara_down = Animation.create_move(33, start_position=0, total_distance=30)
@@ -1283,6 +1292,24 @@ class Transition:
self.chara_down.update(current_time_ms) self.chara_down.update(current_time_ms)
self.is_finished = self.chara_down.is_finished self.is_finished = self.chara_down.is_finished
def draw_song_info(self):
texture = global_data.textures['scene_change_rainbow'][6]
y = 720//2 - texture.height
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - (texture.width*3)//2, y, texture.width*3, texture.height*2)
ray.draw_texture_pro(texture, src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, min(0.70, self.song_info_fade.attribute)))
texture = self.title.texture
y = 720//2 - texture.height//2 - 20
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - texture.width//2, y, texture.width, texture.height)
self.title.draw(src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, self.song_info_fade.attribute))
texture = self.subtitle.texture
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - texture.width//2, y + 50, texture.width, texture.height)
self.subtitle.draw(src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, self.song_info_fade.attribute))
def draw(self, screen_height: int): def draw(self, screen_height: int):
ray.draw_texture(global_data.textures['scene_change_rainbow'][1], 0, screen_height - int(self.rainbow_up.attribute), ray.WHITE) ray.draw_texture(global_data.textures['scene_change_rainbow'][1], 0, screen_height - int(self.rainbow_up.attribute), ray.WHITE)
texture = global_data.textures['scene_change_rainbow'][0] texture = global_data.textures['scene_change_rainbow'][0]
@@ -1293,8 +1320,12 @@ class Transition:
offset = 0 offset = 0
if self.chara_down is not None: if self.chara_down is not None:
offset = int(self.chara_down.attribute) offset = int(self.chara_down.attribute)
ray.draw_texture(global_data.textures['scene_change_rainbow'][4], 142, 14 -int(self.rainbow_up.attribute*3) - offset, ray.WHITE)
ray.draw_texture(global_data.textures['scene_change_rainbow'][5], 958, 144 -int(self.rainbow_up.attribute*3) - offset, ray.WHITE)
ray.draw_texture(texture, 76, -int(self.rainbow_up.attribute*3) - offset, ray.WHITE) ray.draw_texture(texture, 76, -int(self.rainbow_up.attribute*3) - offset, ray.WHITE)
self.draw_song_info()
class ResultTransition: class ResultTransition:
def __init__(self, screen_height: int): def __init__(self, screen_height: int):
self.move = Animation.create_move(983.33, start_position=0, total_distance=screen_height//2, ease_out='quadratic') self.move = Animation.create_move(983.33, start_position=0, total_distance=screen_height//2, ease_out='quadratic')

View File

@@ -153,7 +153,12 @@ class SongSelectScreen:
item.box.reset() item.box.reset()
else: else:
audio.play_sound(self.sound_don) audio.play_sound(self.sound_don)
self.game_transition = Transition(self.screen_height) selected_song = self.navigator.get_current_item()
if not isinstance(selected_song, SongFile):
raise Exception("picked directory")
title = selected_song.tja.metadata.title.get(global_data.config['general']['language'], '')
subtitle = selected_song.tja.metadata.subtitle.get(global_data.config['general']['language'], '')
self.game_transition = Transition(self.screen_height, title, subtitle)
if is_l_kat_pressed(): if is_l_kat_pressed():
audio.play_sound(self.sound_kat) audio.play_sound(self.sound_kat)
selected_song = self.navigator.get_current_item() selected_song = self.navigator.get_current_item()
@@ -405,6 +410,19 @@ class SongBox:
self.tja = tja self.tja = tja
self.hash = dict() self.hash = dict()
def unload(self):
if self.black_name is not None:
self.black_name.unload()
if self.hori_name is not None:
self.hori_name.unload()
if self.name is not None:
self.name.unload()
if self.yellow_box is not None:
if self.yellow_box.name is not None:
self.yellow_box.name.unload()
if self.yellow_box.subtitle is not None:
self.yellow_box.subtitle.unload()
def reset(self): def reset(self):
if self.black_name is not None: if self.black_name is not None:
if self.tja is not None: if self.tja is not None:
@@ -500,10 +518,6 @@ class SongBox:
if self.name is None and -56 <= self.position <= 1280: if self.name is None and -56 <= self.position <= 1280:
self.name = OutlinedText(self.text_name, 40, ray.Color(255, 255, 255, 255), SongBox.OUTLINE_MAP.get(self.name_texture_index, ray.Color(101, 0, 82, 255)), outline_thickness=5, vertical=True) self.name = OutlinedText(self.text_name, 40, ray.Color(255, 255, 255, 255), SongBox.OUTLINE_MAP.get(self.name_texture_index, ray.Color(101, 0, 82, 255)), outline_thickness=5, vertical=True)
#print(f"loaded {self.text_name}")
elif self.name is not None and (self.position < -56 or self.position > 1280):
self.name.unload()
self.name = None
def _draw_closed(self, x: int, y: int, textures): def _draw_closed(self, x: int, y: int, textures):
@@ -922,10 +936,15 @@ class UraSwitchAnimation:
ray.draw_texture(textures['song_select'][self.texture_change.attribute], 815, 134, ray.fade(ray.WHITE, self.fade_out.attribute)) ray.draw_texture(textures['song_select'][self.texture_change.attribute], 815, 134, ray.fade(ray.WHITE, self.fade_out.attribute))
class Transition: class Transition:
def __init__(self, screen_height: int) -> None: def __init__(self, screen_height: int, title: str, subtitle: str) -> None:
duration = 266
self.is_finished = False self.is_finished = False
self.rainbow_up = Animation.create_move(266, start_position=0, total_distance=screen_height + global_data.textures['scene_change_rainbow'][2].height, ease_in='cubic') self.rainbow_up = Animation.create_move(duration, start_position=0, total_distance=screen_height + global_data.textures['scene_change_rainbow'][2].height, ease_in='cubic')
self.mini_up = Animation.create_move(duration*1.1, start_position=0, total_distance=screen_height + global_data.textures['scene_change_rainbow'][2].height, ease_in='cubic', ease_out='exponential')
self.chara_down = None self.chara_down = None
self.title = OutlinedText(title, 40, ray.WHITE, ray.BLACK, outline_thickness=5)
self.subtitle = OutlinedText(subtitle, 30, ray.WHITE, ray.BLACK, outline_thickness=5)
self.song_info_fade = Animation.create_fade(duration, initial_opacity=0.0, final_opacity=1.0, delay=duration*2)
def update(self, current_time_ms: float): def update(self, current_time_ms: float):
self.rainbow_up.update(current_time_ms) self.rainbow_up.update(current_time_ms)
if self.rainbow_up.is_finished and self.chara_down is None: if self.rainbow_up.is_finished and self.chara_down is None:
@@ -933,7 +952,28 @@ class Transition:
if self.chara_down is not None: if self.chara_down is not None:
self.chara_down.update(current_time_ms) self.chara_down.update(current_time_ms)
self.is_finished = self.chara_down.is_finished
self.mini_up.update(current_time_ms)
self.song_info_fade.update(current_time_ms)
self.is_finished = self.song_info_fade.is_finished
def draw_song_info(self):
texture = global_data.textures['scene_change_rainbow'][6]
y = 720//2 - texture.height - int(self.rainbow_up.attribute) + self.rainbow_up.total_distance
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - (texture.width*3)//2, y, texture.width*3, texture.height*2)
ray.draw_texture_pro(texture, src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, min(0.70, self.song_info_fade.attribute)))
texture = self.title.texture
y = 720//2 - texture.height//2 - int(self.rainbow_up.attribute) + self.rainbow_up.total_distance - 20
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - texture.width//2, y, texture.width, texture.height)
self.title.draw(src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, self.song_info_fade.attribute))
texture = self.subtitle.texture
src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(1280//2 - texture.width//2, y + 50, texture.width, texture.height)
self.subtitle.draw(src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, self.song_info_fade.attribute))
def draw(self, screen_height: int): def draw(self, screen_height: int):
ray.draw_texture(global_data.textures['scene_change_rainbow'][2], 0, screen_height - int(self.rainbow_up.attribute), ray.WHITE) ray.draw_texture(global_data.textures['scene_change_rainbow'][2], 0, screen_height - int(self.rainbow_up.attribute), ray.WHITE)
@@ -941,11 +981,14 @@ class Transition:
src = ray.Rectangle(0, 0, texture.width, texture.height) src = ray.Rectangle(0, 0, texture.width, texture.height)
dest = ray.Rectangle(0, screen_height - int(self.rainbow_up.attribute) + global_data.textures['scene_change_rainbow'][2].height, texture.width, screen_height) dest = ray.Rectangle(0, screen_height - int(self.rainbow_up.attribute) + global_data.textures['scene_change_rainbow'][2].height, texture.width, screen_height)
ray.draw_texture_pro(texture, src, dest, ray.Vector2(0, 0), 0, ray.WHITE) ray.draw_texture_pro(texture, src, dest, ray.Vector2(0, 0), 0, ray.WHITE)
texture = global_data.textures['scene_change_rainbow'][3]
offset = 0 offset = 0
if self.chara_down is not None: if self.chara_down is not None:
offset = int(self.chara_down.attribute) offset = int(self.chara_down.attribute)
ray.draw_texture(texture, 76, 816 - int(self.rainbow_up.attribute) + offset, ray.WHITE) ray.draw_texture(global_data.textures['scene_change_rainbow'][4], 550 - int(self.mini_up.attribute//2), 830 - int(self.mini_up.attribute) + offset, ray.WHITE)
ray.draw_texture(global_data.textures['scene_change_rainbow'][5], 550 + int(self.mini_up.attribute//2), 860 - int(self.mini_up.attribute) + offset, ray.WHITE)
ray.draw_texture(global_data.textures['scene_change_rainbow'][3], 76, 816 - int(self.rainbow_up.attribute) + offset, ray.WHITE)
self.draw_song_info()
class FileSystemItem: class FileSystemItem:
GENRE_MAP = { GENRE_MAP = {