mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
more graphics wrapper updates
This commit is contained in:
@@ -122,7 +122,7 @@ class EntryScreen:
|
||||
tex.draw_texture('background', 'people')
|
||||
tex.draw_texture('background', 'shops_left')
|
||||
tex.draw_texture('background', 'shops_right')
|
||||
tex.draw_texture('background', 'lights', scale=2.0, color=ray.fade(ray.WHITE, self.bg_flicker.attribute))
|
||||
tex.draw_texture('background', 'lights', scale=2.0, fade=self.bg_flicker.attribute)
|
||||
|
||||
def draw_footer(self):
|
||||
tex.draw_texture('side_select', 'footer')
|
||||
@@ -132,35 +132,34 @@ class EntryScreen:
|
||||
tex.draw_texture('side_select', 'footer_right')
|
||||
|
||||
def draw_side_select(self, fade):
|
||||
color = ray.fade(ray.WHITE, fade)
|
||||
tex.draw_texture('side_select', 'box_top_left', color=color)
|
||||
tex.draw_texture('side_select', 'box_top_right', color=color)
|
||||
tex.draw_texture('side_select', 'box_bottom_left', color=color)
|
||||
tex.draw_texture('side_select', 'box_bottom_right', color=color)
|
||||
tex.draw_texture('side_select', 'box_top_left', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_top_right', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_bottom_left', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_bottom_right', fade=fade)
|
||||
|
||||
tex.draw_texture('side_select', 'box_top', color=color)
|
||||
tex.draw_texture('side_select', 'box_bottom', color=color)
|
||||
tex.draw_texture('side_select', 'box_left', color=color)
|
||||
tex.draw_texture('side_select', 'box_right', color=color)
|
||||
tex.draw_texture('side_select', 'box_center', color=color)
|
||||
tex.draw_texture('side_select', 'box_top', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_bottom', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_left', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_right', fade=fade)
|
||||
tex.draw_texture('side_select', 'box_center', fade=fade)
|
||||
|
||||
tex.draw_texture('side_select', 'question', color=color)
|
||||
tex.draw_texture('side_select', 'question', fade=fade)
|
||||
|
||||
tex.draw_texture('side_select', '1P', color=color)
|
||||
tex.draw_texture('side_select', 'cancel', color=color)
|
||||
tex.draw_texture('side_select', '2P', color=color)
|
||||
tex.draw_texture('side_select', '1P', fade=fade)
|
||||
tex.draw_texture('side_select', 'cancel', fade=fade)
|
||||
tex.draw_texture('side_select', '2P', fade=fade)
|
||||
if self.side == 0:
|
||||
tex.draw_texture('side_select', '1P_highlight', color=color)
|
||||
tex.draw_texture('side_select', '1P_highlight', fade=fade)
|
||||
tex.textures['side_select']['1P2P_outline'].x = 261
|
||||
tex.draw_texture('side_select', '1P2P_outline', color=color, mirror='horizontal')
|
||||
tex.draw_texture('side_select', '1P2P_outline', fade=fade, mirror='horizontal')
|
||||
elif self.side == 1:
|
||||
tex.draw_texture('side_select', 'cancel_highlight', color=color)
|
||||
tex.draw_texture('side_select', 'cancel_outline', color=color)
|
||||
tex.draw_texture('side_select', 'cancel_highlight', fade=fade)
|
||||
tex.draw_texture('side_select', 'cancel_outline', fade=fade)
|
||||
else:
|
||||
tex.draw_texture('side_select', '2P_highlight', color=color)
|
||||
tex.draw_texture('side_select', '2P_highlight', fade=fade)
|
||||
tex.textures['side_select']['1P2P_outline'].x = 762
|
||||
tex.draw_texture('side_select', '1P2P_outline', color=color)
|
||||
tex.draw_texture('side_select', 'cancel_text', color=color)
|
||||
tex.draw_texture('side_select', '1P2P_outline', fade=fade)
|
||||
tex.draw_texture('side_select', 'cancel_text', fade=fade)
|
||||
|
||||
def draw_player_drum(self):
|
||||
move_x = self.drum_move_3.attribute
|
||||
@@ -179,10 +178,9 @@ class EntryScreen:
|
||||
scale = self.cloud_resize.attribute
|
||||
if self.cloud_resize.is_finished:
|
||||
scale = max(1, self.cloud_resize_loop.attribute)
|
||||
color = ray.fade(ray.WHITE, self.cloud_fade.attribute)
|
||||
tex.update_attr('side_select', 'cloud', 'x', move_x)
|
||||
tex.update_attr('side_select', 'cloud', 'y', move_y)
|
||||
tex.draw_texture('side_select', 'cloud', frame=self.cloud_texture_change.attribute, color=color, scale=scale, center=True)
|
||||
tex.draw_texture('side_select', 'cloud', frame=self.cloud_texture_change.attribute, fade=self.cloud_fade.attribute, scale=scale, center=True)
|
||||
|
||||
def draw_mode_select(self):
|
||||
self.draw_player_drum()
|
||||
|
||||
@@ -45,7 +45,6 @@ class GameScreen:
|
||||
self.sound_restart = audio.load_sound(sounds_dir / 'song_select' / 'Skip.ogg')
|
||||
self.sound_balloon_pop = audio.load_sound(sounds_dir / "balloon_pop.wav")
|
||||
self.sound_result_transition = audio.load_sound(sounds_dir / "result" / "VO_RESULT [1].ogg")
|
||||
self.sounds = [self.sound_don, self.sound_kat, self.sound_balloon_pop, self.sound_result_transition]
|
||||
|
||||
def init_tja(self, song: Path, difficulty: int):
|
||||
if song == Path(''):
|
||||
@@ -82,8 +81,7 @@ class GameScreen:
|
||||
subtitle = self.tja.metadata.subtitle.get(global_data.config['general']['language'].lower(), '')
|
||||
else:
|
||||
subtitle = ''
|
||||
self.transition = Transition(session_data.song_title, subtitle)
|
||||
self.transition.is_second = True
|
||||
self.transition = Transition(session_data.song_title, subtitle, is_second=True)
|
||||
self.transition.start()
|
||||
|
||||
def on_screen_end(self, next_screen):
|
||||
@@ -242,13 +240,6 @@ class Player:
|
||||
self.autoplay_hit_side = 'L'
|
||||
self.last_subdivision = -1
|
||||
|
||||
self.model = ray.load_model("model/mikudon.obj")
|
||||
self.model_position = ray.Vector3(-475.0, 160.0, -180.0)
|
||||
self.model_scale = 850.0
|
||||
self.model_rotation_y = 30.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
|
||||
|
||||
def get_result_score(self):
|
||||
return self.score, self.good_count, self.ok_count, self.bad_count, self.total_drumroll, self.max_combo
|
||||
|
||||
@@ -657,17 +648,6 @@ class Player:
|
||||
#ray.draw_circle(game_screen.width//2, game_screen.height, 300, ray.ORANGE)
|
||||
|
||||
def draw_3d(self):
|
||||
'''
|
||||
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
|
||||
)
|
||||
'''
|
||||
pass
|
||||
|
||||
class Judgement:
|
||||
@@ -729,53 +709,47 @@ class Judgement:
|
||||
class LaneHitEffect:
|
||||
def __init__(self, type: str):
|
||||
self.type = type
|
||||
self.color = ray.fade(ray.WHITE, 0.5)
|
||||
self.fade = tex.get_animation(0, is_copy=True)
|
||||
self.fade.start()
|
||||
self.is_finished = False
|
||||
|
||||
def update(self, current_ms: float):
|
||||
self.fade.update(current_ms)
|
||||
fade_opacity = self.fade.attribute
|
||||
self.color = ray.fade(ray.WHITE, fade_opacity)
|
||||
if self.fade.is_finished:
|
||||
self.is_finished = True
|
||||
|
||||
def draw(self):
|
||||
if self.type == 'GOOD':
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=2, color=self.color)
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=2, fade=self.fade.attribute)
|
||||
elif self.type == 'DON':
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=0, color=self.color)
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=0, fade=self.fade.attribute)
|
||||
elif self.type == 'KAT':
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=1, color=self.color)
|
||||
tex.draw_texture('lane', 'lane_hit_effect', frame=1, fade=self.fade.attribute)
|
||||
|
||||
class DrumHitEffect:
|
||||
def __init__(self, type: str, side: str):
|
||||
self.type = type
|
||||
self.side = side
|
||||
self.color = ray.fade(ray.WHITE, 1)
|
||||
self.is_finished = False
|
||||
self.fade = tex.get_animation(1, is_copy=True)
|
||||
self.fade.start()
|
||||
|
||||
def update(self, current_ms: float):
|
||||
self.fade.update(current_ms)
|
||||
fade_opacity = self.fade.attribute
|
||||
self.color = ray.fade(ray.WHITE, fade_opacity)
|
||||
if self.fade.is_finished:
|
||||
self.is_finished = True
|
||||
|
||||
def draw(self):
|
||||
if self.type == 'DON':
|
||||
if self.side == 'L':
|
||||
tex.draw_texture('lane', 'drum_don_l', color=self.color)
|
||||
tex.draw_texture('lane', 'drum_don_l', fade=self.fade.attribute)
|
||||
elif self.side == 'R':
|
||||
tex.draw_texture('lane', 'drum_don_r', color=self.color)
|
||||
tex.draw_texture('lane', 'drum_don_r', fade=self.fade.attribute)
|
||||
elif self.type == 'KAT':
|
||||
if self.side == 'L':
|
||||
tex.draw_texture('lane', 'drum_kat_l', color=self.color)
|
||||
tex.draw_texture('lane', 'drum_kat_l', fade=self.fade.attribute)
|
||||
elif self.side == 'R':
|
||||
tex.draw_texture('lane', 'drum_kat_r', color=self.color)
|
||||
tex.draw_texture('lane', 'drum_kat_r', fade=self.fade.attribute)
|
||||
|
||||
class GaugeHitEffect:
|
||||
def __init__(self, note_type: int, big: bool):
|
||||
@@ -820,7 +794,7 @@ class GaugeHitEffect:
|
||||
origin = ray.Vector2(dest_width / 2, dest_height / 2)
|
||||
rotation = self.rotation.attribute*100
|
||||
tex.draw_texture('gauge', 'hit_effect', frame=self.texture_change.attribute, x2=-152 + (152 * self.resize.attribute), y2=-152 + (152 * self.resize.attribute), color=ray.fade(texture_color, self.fade_out.attribute), origin=origin, rotation=rotation, center=True)
|
||||
tex.draw_texture('notes', str(self.note_type), x=1158, y=101, color=ray.fade(ray.WHITE, self.fade_out.attribute))
|
||||
tex.draw_texture('notes', str(self.note_type), x=1158, y=101, fade=self.fade_out.attribute)
|
||||
if self.is_big:
|
||||
tex.draw_texture('gauge', 'hit_effect_circle_big', color=self.color)
|
||||
else:
|
||||
@@ -1154,7 +1128,7 @@ class SongInfo:
|
||||
self.fade.restart()
|
||||
|
||||
def draw(self):
|
||||
tex.draw_texture('song_info', 'song_num', color=ray.fade(ray.WHITE, self.fade.attribute), frame=global_data.songs_played % 4)
|
||||
tex.draw_texture('song_info', 'song_num', fade=self.fade.attribute, frame=global_data.songs_played % 4)
|
||||
|
||||
text_x = 1252 - self.song_title.texture.width
|
||||
text_y = 50 - self.song_title.texture.height//2
|
||||
@@ -1187,7 +1161,6 @@ class ResultTransition:
|
||||
x += 256
|
||||
|
||||
class Gauge:
|
||||
GAUGE_MAX = 87
|
||||
def __init__(self, difficulty: int, level: int, total_notes: int):
|
||||
self.gauge_length = 0
|
||||
self.previous_length = 0
|
||||
@@ -1300,16 +1273,16 @@ class Gauge:
|
||||
tex.draw_texture('gauge', 'bar', x=i*8)
|
||||
if gauge_length == 87 and self.rainbow_fade_in is not None and self.rainbow_animation is not None:
|
||||
if 0 < self.rainbow_animation.attribute < 8:
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute-1, color=ray.fade(ray.WHITE, self.rainbow_fade_in.attribute))
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute, color=ray.fade(ray.WHITE, self.rainbow_fade_in.attribute))
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute-1, fade=self.rainbow_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute, fade=self.rainbow_fade_in.attribute)
|
||||
if self.gauge_update_anim is not None and gauge_length < 88 and gauge_length > self.previous_length:
|
||||
if gauge_length == 69:
|
||||
tex.draw_texture('gauge', 'bar_clear_transition_fade', x=gauge_length*8, color=ray.fade(ray.WHITE, self.gauge_update_anim.attribute))
|
||||
tex.draw_texture('gauge', 'bar_clear_transition_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
elif gauge_length > 69:
|
||||
tex.draw_texture('gauge', 'bar_clear_fade', x=gauge_length*8, color=ray.fade(ray.WHITE, self.gauge_update_anim.attribute))
|
||||
tex.draw_texture('gauge', 'bar_clear_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
else:
|
||||
tex.draw_texture('gauge', 'bar_fade', x=gauge_length*8, color=ray.fade(ray.WHITE, self.gauge_update_anim.attribute))
|
||||
tex.draw_texture('gauge', 'overlay', color=ray.fade(ray.WHITE, 0.15))
|
||||
tex.draw_texture('gauge', 'bar_fade', x=gauge_length*8, fade=self.gauge_update_anim.attribute)
|
||||
tex.draw_texture('gauge', 'overlay', fade=0.15)
|
||||
if gauge_length >= 69:
|
||||
tex.draw_texture('gauge', 'clear')
|
||||
tex.draw_texture('gauge', 'tamashii')
|
||||
|
||||
@@ -182,10 +182,10 @@ class ResultScreen:
|
||||
|
||||
def draw_bottom_textures(self):
|
||||
if self.state == State.FAIL:
|
||||
tex.draw_texture('background', 'gradient_fail', color=ray.fade(ray.WHITE, min(0.4, self.fade_in_bottom.attribute)))
|
||||
tex.draw_texture('background', 'gradient_fail', fade=min(0.4, self.fade_in_bottom.attribute))
|
||||
else:
|
||||
ray.begin_shader_mode(self.alpha_shader)
|
||||
tex.draw_texture('background', 'gradient_clear', color=ray.fade(ray.WHITE, self.fade_in_bottom.attribute))
|
||||
tex.draw_texture('background', 'gradient_clear', fade=self.fade_in_bottom.attribute)
|
||||
ray.end_shader_mode()
|
||||
self.bottom_characters.draw()
|
||||
|
||||
@@ -259,7 +259,7 @@ class Crown:
|
||||
if self.resize.is_finished:
|
||||
scale = self.resize_fix.attribute
|
||||
tex.draw_texture('crown', crown_name, scale=scale, center=True)
|
||||
tex.draw_texture('crown', 'crown_fade', color=ray.fade(ray.WHITE, self.white_fadein.attribute))
|
||||
tex.draw_texture('crown', 'crown_fade', fade=self.white_fadein.attribute)
|
||||
if self.gleam.attribute >= 0:
|
||||
tex.draw_texture('crown', 'gleam', frame=self.gleam.attribute)
|
||||
|
||||
@@ -352,12 +352,11 @@ class FadeIn:
|
||||
|
||||
def draw(self):
|
||||
x = 0
|
||||
color = ray.fade(ray.WHITE, self.fadein.attribute)
|
||||
while x < 1280:
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=-360, color=color)
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=360, color=color)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=-77, color=color)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=653, color=color)
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=-360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'background_1p', x=x, y=360, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=-77, fade=self.fadein.attribute)
|
||||
tex.draw_texture('background', 'footer_1p', x=x, y=653, fade=self.fadein.attribute)
|
||||
x += 256
|
||||
|
||||
class ScoreAnimator:
|
||||
@@ -403,35 +402,34 @@ class Gauge:
|
||||
self.is_finished = self.gauge_fade_in.is_finished
|
||||
|
||||
def draw(self):
|
||||
color = ray.fade(ray.WHITE, self.gauge_fade_in.attribute)
|
||||
scale = 10/11
|
||||
tex.draw_texture('gauge', 'unfilled', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'unfilled', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
gauge_length = int(self.gauge_length)
|
||||
if gauge_length == 87:
|
||||
if 0 < self.rainbow_animation.attribute < 8:
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute-1, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute-1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'rainbow', frame=self.rainbow_animation.attribute, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
else:
|
||||
for i in range(gauge_length+1):
|
||||
width = int(i * 7.2)
|
||||
if i == 69:
|
||||
tex.draw_texture('gauge', 'bar_clear_transition', x=width, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar_clear_transition', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
elif i > 69:
|
||||
if i % 5 == 0:
|
||||
tex.draw_texture('gauge', 'bar_clear_top', x=width, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=width, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar_clear_top', x=width+1, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=width+1, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar_clear_top', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'bar_clear_top', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'bar_clear_bottom', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
else:
|
||||
if i % 5 == 0:
|
||||
tex.draw_texture('gauge', 'bar', x=width, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar', x=width+1, scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'overlay', scale=scale, color=ray.fade(ray.WHITE, min(0.15, self.gauge_fade_in.attribute)))
|
||||
tex.draw_texture('gauge', 'footer', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'bar', x=width, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'bar', x=width+1, scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'overlay', scale=scale, fade=min(0.15, self.gauge_fade_in.attribute))
|
||||
tex.draw_texture('gauge', 'footer', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
|
||||
if gauge_length >= 69:
|
||||
tex.draw_texture('gauge', 'clear', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'tamashii', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'clear', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'tamashii', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
else:
|
||||
tex.draw_texture('gauge', 'clear_dark', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'tamashii_dark', scale=scale, color=color)
|
||||
tex.draw_texture('gauge', 'clear_dark', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
tex.draw_texture('gauge', 'tamashii_dark', scale=scale, fade=self.gauge_fade_in.attribute)
|
||||
|
||||
@@ -25,7 +25,6 @@ class SettingsScreen:
|
||||
self.in_setting_edit = False
|
||||
self.editing_key = False
|
||||
self.editing_gamepad = False
|
||||
self.temp_key_input = ""
|
||||
|
||||
def on_screen_start(self):
|
||||
if not self.screen_init:
|
||||
@@ -109,7 +108,6 @@ class SettingsScreen:
|
||||
def handle_key_binding(self, section, key):
|
||||
"""Handle key binding changes"""
|
||||
self.editing_key = True
|
||||
self.temp_key_input = ""
|
||||
|
||||
def update_key_binding(self):
|
||||
"""Update key binding based on input"""
|
||||
@@ -129,7 +127,6 @@ class SettingsScreen:
|
||||
|
||||
def handle_gamepad_binding(self, section, key):
|
||||
self.editing_gamepad = True
|
||||
self.temp_key_input = ""
|
||||
|
||||
def update_gamepad_binding(self):
|
||||
"""Update gamepad binding based on input"""
|
||||
|
||||
@@ -63,7 +63,6 @@ class SongSelectScreen:
|
||||
self.game_transition = None
|
||||
self.texture_index = 9
|
||||
self.last_texture_index = 9
|
||||
self.default_texture = self.texture_index
|
||||
self.demo_song = None
|
||||
self.navigator.reset_items()
|
||||
self.navigator.get_current_item().box.get_scores()
|
||||
@@ -297,8 +296,7 @@ class SongSelectScreen:
|
||||
width = tex.textures['box']['background'].width
|
||||
for i in range(0, width * 4, width):
|
||||
tex.draw_texture('box', 'background', frame=self.last_texture_index, x=i - int(self.background_move.attribute))
|
||||
reverse_color = ray.fade(ray.WHITE, 1 - self.background_fade_change.attribute)
|
||||
tex.draw_texture('box', 'background', frame=self.texture_index, x=i - int(self.background_move.attribute), color=reverse_color)
|
||||
tex.draw_texture('box', 'background', frame=self.texture_index, x=i - int(self.background_move.attribute), fade=1 - self.background_fade_change.attribute)
|
||||
|
||||
if self.navigator.genre_bg is not None and self.state == State.BROWSING:
|
||||
self.navigator.genre_bg.draw(95)
|
||||
@@ -314,11 +312,9 @@ class SongSelectScreen:
|
||||
|
||||
if self.selected_song and self.state == State.SONG_SELECTED:
|
||||
self.draw_selector()
|
||||
fade = ray.fade(ray.WHITE, self.text_fade_in.attribute)
|
||||
tex.draw_texture('global', 'difficulty_select', color=fade)
|
||||
tex.draw_texture('global', 'difficulty_select', fade=self.text_fade_in.attribute)
|
||||
else:
|
||||
fade = ray.fade(ray.WHITE, self.text_fade_out.attribute)
|
||||
tex.draw_texture('global', 'song_select', color=fade)
|
||||
tex.draw_texture('global', 'song_select', fade=self.text_fade_out.attribute)
|
||||
|
||||
tex.draw_texture('global', 'footer')
|
||||
|
||||
@@ -365,9 +361,6 @@ class SongBox:
|
||||
self.move = None
|
||||
self.wait = 0
|
||||
self.is_dir = is_dir
|
||||
self.is_genre_start = 0
|
||||
self.is_genre_end = False
|
||||
self.genre_distance = 0
|
||||
self.tja_count = tja_count
|
||||
self.tja_count_text = None
|
||||
self.tja = tja
|
||||
@@ -642,7 +635,7 @@ class YellowBox:
|
||||
tex.draw_texture('yellow_box', 's_crown_fc', x=(diff*60), color=color)
|
||||
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] == 1:
|
||||
tex.draw_texture('yellow_box', 's_crown_clear', x=(diff*60), color=color)
|
||||
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*60), color=ray.fade(ray.WHITE, min(fade, 0.25)))
|
||||
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*60), fade=min(fade, 0.25))
|
||||
|
||||
if self.tja.ex_data.new_audio:
|
||||
tex.draw_texture('yellow_box', 'ex_data_new_audio', color=color)
|
||||
@@ -656,7 +649,7 @@ class YellowBox:
|
||||
for i in range(4):
|
||||
tex.draw_texture('yellow_box', 'difficulty_bar', frame=i, x=(i*60), color=color)
|
||||
if i not in self.tja.metadata.course_data:
|
||||
tex.draw_texture('yellow_box', 'difficulty_bar_shadow', frame=i, x=(i*60), color=ray.fade(ray.WHITE, min(fade, 0.25)))
|
||||
tex.draw_texture('yellow_box', 'difficulty_bar_shadow', frame=i, x=(i*60), fade=min(fade, 0.25))
|
||||
|
||||
for diff in self.tja.metadata.course_data:
|
||||
if diff >= 4:
|
||||
@@ -667,23 +660,22 @@ class YellowBox:
|
||||
def _draw_tja_data_diff(self, is_ura: bool):
|
||||
if self.tja is None:
|
||||
return
|
||||
color = ray.fade(ray.WHITE, self.fade_in.attribute)
|
||||
tex.draw_texture('diff_select', 'back', color=color)
|
||||
tex.draw_texture('diff_select', 'back', fade=self.fade_in.attribute)
|
||||
|
||||
for i in range(4):
|
||||
if i == 3 and is_ura:
|
||||
tex.draw_texture('diff_select', 'diff_tower', frame=4, x=(i*115), color=color)
|
||||
tex.draw_texture('diff_select', 'ura_oni_plate', color=color)
|
||||
tex.draw_texture('diff_select', 'diff_tower', frame=4, x=(i*115), fade=self.fade_in.attribute)
|
||||
tex.draw_texture('diff_select', 'ura_oni_plate', fade=self.fade_in.attribute)
|
||||
else:
|
||||
tex.draw_texture('diff_select', 'diff_tower', frame=i, x=(i*115), color=color)
|
||||
tex.draw_texture('diff_select', 'diff_tower', frame=i, x=(i*115), fade=self.fade_in.attribute)
|
||||
if i not in self.tja.metadata.course_data:
|
||||
tex.draw_texture('diff_select', 'diff_tower_shadow', frame=i, x=(i*115), color=ray.fade(ray.WHITE, min(self.fade_in.attribute, 0.25)))
|
||||
tex.draw_texture('diff_select', 'diff_tower_shadow', frame=i, x=(i*115), fade=min(self.fade_in.attribute, 0.25))
|
||||
|
||||
for course in self.tja.metadata.course_data:
|
||||
if (course == 4 and not is_ura) or (course == 3 and is_ura):
|
||||
continue
|
||||
for j in range(self.tja.metadata.course_data[course].level):
|
||||
tex.draw_texture('yellow_box', 'star_ura', x=min(course, 3)*115, y=(j*-20), color=color)
|
||||
tex.draw_texture('yellow_box', 'star_ura', x=min(course, 3)*115, y=(j*-20), fade=self.fade_in.attribute)
|
||||
|
||||
def _draw_text(self, song_box):
|
||||
if not isinstance(self.right_out, MoveAnimation):
|
||||
@@ -724,10 +716,9 @@ class YellowBox:
|
||||
fade = self.fade.attribute
|
||||
if fade_override is not None:
|
||||
fade = min(self.fade.attribute, fade_override)
|
||||
color = ray.fade(ray.WHITE, fade)
|
||||
if self.is_back:
|
||||
tex.draw_texture('box', 'back_graphic', color=color)
|
||||
self._draw_tja_data(song_box, color, fade)
|
||||
tex.draw_texture('box', 'back_graphic', fade=fade)
|
||||
self._draw_tja_data(song_box, ray.fade(ray.WHITE, fade), fade)
|
||||
|
||||
self._draw_text(song_box)
|
||||
|
||||
@@ -745,10 +736,9 @@ class GenreBG:
|
||||
self.end_position = self.end_box.position
|
||||
self.fade_in.update(current_ms)
|
||||
def draw(self, y):
|
||||
color = ray.fade(ray.WHITE, self.fade_in.attribute)
|
||||
offset = -150 if self.start_box.is_open else 0
|
||||
|
||||
tex.draw_texture('box', 'folder_background_edge', frame=self.end_box.texture_index, x=self.start_position+offset, y=y, mirror="horizontal", color=color)
|
||||
tex.draw_texture('box', 'folder_background_edge', frame=self.end_box.texture_index, x=self.start_position+offset, y=y, mirror="horizontal", fade=self.fade_in.attribute)
|
||||
extra_distance = 155 if self.end_box.is_open or self.start_box.is_open else 0
|
||||
if self.start_position >= -56 and self.end_position < self.start_position:
|
||||
x2 = self.start_position + 1336
|
||||
@@ -759,16 +749,16 @@ class GenreBG:
|
||||
x2 = min(self.end_position+75, 1280) + extra_distance
|
||||
tex.draw_texture('box', 'folder_background', x=-18, y=y, x2=x2, frame=self.end_box.texture_index)
|
||||
offset = 150 if self.end_box.is_open else 0
|
||||
tex.draw_texture('box', 'folder_background_edge', x=self.end_position+80+offset, y=y, color=color, frame=self.end_box.texture_index)
|
||||
tex.draw_texture('box', 'folder_background_edge', x=self.end_position+80+offset, y=y, fade=self.fade_in.attribute, frame=self.end_box.texture_index)
|
||||
|
||||
if ((self.start_position <= 594 and self.end_position >= 594) or
|
||||
((self.start_position <= 594 or self.end_position >= 594) and (self.start_position > self.end_position))):
|
||||
dest_width = min(300, self.title.texture.width)
|
||||
tex.draw_texture('box', 'folder_header', x=-(dest_width//2), y=y, x2=dest_width, color=color, frame=self.end_box.texture_index)
|
||||
tex.draw_texture('box', 'folder_header_edge', x=-(dest_width//2), y=y, color=color, frame=self.end_box.texture_index, mirror="horizontal")
|
||||
tex.draw_texture('box', 'folder_header_edge', x=(dest_width//2), y=y, color=color, frame=self.end_box.texture_index)
|
||||
tex.draw_texture('box', 'folder_header', x=-(dest_width//2), y=y, x2=dest_width, fade=self.fade_in.attribute, frame=self.end_box.texture_index)
|
||||
tex.draw_texture('box', 'folder_header_edge', x=-(dest_width//2), y=y, fade=self.fade_in.attribute, frame=self.end_box.texture_index, mirror="horizontal")
|
||||
tex.draw_texture('box', 'folder_header_edge', x=(dest_width//2), y=y, fade=self.fade_in.attribute, frame=self.end_box.texture_index)
|
||||
dest = ray.Rectangle((1280//2) - (dest_width//2), y-60, dest_width, self.title.texture.height)
|
||||
self.title.draw(self.title.default_src, dest, ray.Vector2(0, 0), 0, color)
|
||||
self.title.draw(self.title.default_src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, self.fade_in.attribute))
|
||||
|
||||
class UraSwitchAnimation:
|
||||
def __init__(self) -> None:
|
||||
@@ -785,7 +775,7 @@ class UraSwitchAnimation:
|
||||
self.texture_change.update(current_ms)
|
||||
self.fade_out.update(current_ms)
|
||||
def draw(self):
|
||||
tex.draw_texture('diff_select', 'ura_switch', frame=self.texture_change.attribute, color=ray.fade(ray.WHITE, self.fade_out.attribute))
|
||||
tex.draw_texture('diff_select', 'ura_switch', frame=self.texture_change.attribute, fade=self.fade_out.attribute)
|
||||
|
||||
class FileSystemItem:
|
||||
GENRE_MAP = {
|
||||
@@ -801,7 +791,6 @@ class FileSystemItem:
|
||||
"""Base class for files and directories in the navigation system"""
|
||||
def __init__(self, path: Path, name: str):
|
||||
self.path = path
|
||||
self.selected = False
|
||||
|
||||
class Directory(FileSystemItem):
|
||||
"""Represents a directory in the navigation system"""
|
||||
@@ -1188,10 +1177,6 @@ class FileNavigator:
|
||||
else:
|
||||
item.box.target_position = position
|
||||
|
||||
def set_base_positions(self):
|
||||
"""Set initial positions for all items"""
|
||||
self.calculate_box_positions()
|
||||
|
||||
def load_root_directories(self):
|
||||
"""Load the pre-generated root directory items"""
|
||||
self.items = self.root_items.copy()
|
||||
@@ -1338,24 +1323,3 @@ class FileNavigator:
|
||||
def reset_items(self):
|
||||
for item in self.items:
|
||||
item.box.reset()
|
||||
|
||||
def regenerate_objects(self):
|
||||
"""Regenerate all objects (useful if files have changed on disk)"""
|
||||
print("Regenerating all objects...")
|
||||
|
||||
# Clear existing objects
|
||||
self.all_directories.clear()
|
||||
self.all_song_files.clear()
|
||||
self.directory_contents.clear()
|
||||
self.root_items.clear()
|
||||
self.directory_crowns.clear() # Clear crown cache
|
||||
self.crown_cache_dirty.clear() # Clear dirty flags
|
||||
|
||||
# Regenerate everything
|
||||
self._generate_all_objects()
|
||||
|
||||
# Reset navigation state
|
||||
self.current_dir = Path()
|
||||
self.current_root_dir = Path()
|
||||
self.history.clear()
|
||||
self.load_root_directories()
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import random
|
||||
from pathlib import Path
|
||||
|
||||
import pyray as ray
|
||||
|
||||
from libs.audio import audio
|
||||
from libs.texture import tex
|
||||
from libs.utils import (
|
||||
@@ -108,7 +106,7 @@ class TitleScreen:
|
||||
elif self.state == State.ATTRACT_VIDEO and self.attract_video is not None:
|
||||
self.attract_video.draw()
|
||||
|
||||
tex.draw_texture('movie', 'background', color=ray.fade(ray.WHITE, self.fade_out.attribute))
|
||||
tex.draw_texture('movie', 'background', fade=self.fade_out.attribute)
|
||||
|
||||
def draw_3d(self):
|
||||
pass
|
||||
@@ -134,10 +132,10 @@ class WarningScreen:
|
||||
self.sound_played = True
|
||||
|
||||
def draw_bg(self):
|
||||
tex.draw_texture('warning', 'x_lightred', color=ray.fade(ray.WHITE, self.fadein_2.attribute))
|
||||
tex.draw_texture('warning', 'x_lightred', fade=self.fadein_2.attribute)
|
||||
|
||||
def draw_fg(self):
|
||||
tex.draw_texture('warning', 'x_red', color=ray.fade(ray.WHITE, self.fadein.attribute), scale=self.resize.attribute, center=True)
|
||||
tex.draw_texture('warning', 'x_red', fade=self.fadein.attribute, scale=self.resize.attribute, center=True)
|
||||
|
||||
class BachiHit:
|
||||
def __init__(self):
|
||||
@@ -156,7 +154,7 @@ class WarningScreen:
|
||||
self.fadein.update(current_ms)
|
||||
|
||||
def draw(self):
|
||||
tex.draw_texture('warning', 'bachi_hit', color=ray.fade(ray.WHITE, self.fadein.attribute), scale=self.resize.attribute, center=True)
|
||||
tex.draw_texture('warning', 'bachi_hit', fade=self.fadein.attribute, scale=self.resize.attribute, center=True)
|
||||
if self.resize.attribute > 0 and self.sound_played:
|
||||
tex.draw_texture('warning', 'bachi')
|
||||
|
||||
@@ -182,14 +180,14 @@ class WarningScreen:
|
||||
else:
|
||||
self.shadow_fade.restart()
|
||||
self.is_finished = self.chara_1_frame.is_finished
|
||||
def draw(self, fade: ray.Color, fade_2: ray.Color):
|
||||
tex.draw_texture('warning', 'chara_0_shadow', color=fade_2)
|
||||
tex.draw_texture('warning', 'chara_0', frame=self.chara_0_frame.attribute, color=fade)
|
||||
def draw(self, fade: float, fade_2: float):
|
||||
tex.draw_texture('warning', 'chara_0_shadow', fade=fade_2)
|
||||
tex.draw_texture('warning', 'chara_0', frame=self.chara_0_frame.attribute, fade=fade)
|
||||
|
||||
tex.draw_texture('warning', 'chara_1_shadow', color=fade_2)
|
||||
tex.draw_texture('warning', 'chara_1_shadow', fade=fade_2)
|
||||
if -1 < self.chara_1_frame.attribute-1 < 7:
|
||||
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute-1, color=ray.fade(ray.WHITE, self.shadow_fade.attribute))
|
||||
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute, color=fade)
|
||||
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute-1, fade=self.shadow_fade.attribute)
|
||||
tex.draw_texture('warning', 'chara_1', frame=self.chara_1_frame.attribute, fade=fade)
|
||||
|
||||
class Board:
|
||||
def __init__(self):
|
||||
@@ -256,13 +254,10 @@ class WarningScreen:
|
||||
self.is_finished = self.fade_out.is_finished
|
||||
|
||||
def draw(self):
|
||||
fade = ray.fade(ray.WHITE, self.fade_in.attribute)
|
||||
fade_2 = ray.fade(ray.WHITE, min(self.fade_in.attribute, 0.75))
|
||||
|
||||
self.board.draw()
|
||||
self.warning_x.draw_bg()
|
||||
self.characters.draw(fade, fade_2)
|
||||
self.characters.draw(self.fade_in.attribute, min(self.fade_in.attribute, 0.75))
|
||||
self.warning_x.draw_fg()
|
||||
self.warning_bachi_hit.draw()
|
||||
|
||||
tex.draw_texture('movie', 'background', color=ray.fade(ray.WHITE, self.fade_out.attribute))
|
||||
tex.draw_texture('movie', 'background', fade=self.fade_out.attribute)
|
||||
|
||||
Reference in New Issue
Block a user