mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
minor changes
This commit is contained in:
@@ -153,7 +153,12 @@ class SongSelectScreen:
|
||||
item.box.reset()
|
||||
else:
|
||||
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():
|
||||
audio.play_sound(self.sound_kat)
|
||||
selected_song = self.navigator.get_current_item()
|
||||
@@ -405,6 +410,19 @@ class SongBox:
|
||||
self.tja = tja
|
||||
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):
|
||||
if self.black_name 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:
|
||||
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):
|
||||
@@ -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))
|
||||
|
||||
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.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.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):
|
||||
self.rainbow_up.update(current_time_ms)
|
||||
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:
|
||||
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):
|
||||
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)
|
||||
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)
|
||||
texture = global_data.textures['scene_change_rainbow'][3]
|
||||
offset = 0
|
||||
if self.chara_down is not None:
|
||||
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:
|
||||
GENRE_MAP = {
|
||||
|
||||
Reference in New Issue
Block a user