mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
added viewable score
This commit is contained in:
@@ -292,4 +292,4 @@ def get_japanese_songs_for_version(csv_file_path, version_column):
|
|||||||
|
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
get_japanese_songs_for_version("full.csv", sys.argv[1])
|
get_japanese_songs_for_version(sys.argv[1], sys.argv[2])
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ class TJAParser:
|
|||||||
if spacing_before and spacing_after:
|
if spacing_before and spacing_after:
|
||||||
play_note_list[-3].moji = se_notes[1][2]
|
play_note_list[-3].moji = se_notes[1][2]
|
||||||
else:
|
else:
|
||||||
play_note_list[-3].moji = se_notes[play_note_list[-3].moji][2]
|
play_note_list[-3].moji = se_notes[1][2]
|
||||||
|
|
||||||
def notes_to_position(self, diff: int):
|
def notes_to_position(self, diff: int):
|
||||||
play_note_list: list[Note | Drumroll | Balloon] = []
|
play_note_list: list[Note | Drumroll | Balloon] = []
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import pyray as ray
|
import pyray as ray
|
||||||
|
|
||||||
from libs.utils import global_data, session_data
|
from libs.texture import tex
|
||||||
|
from libs.utils import get_current_ms
|
||||||
|
from scenes.song_select import ScoreHistory
|
||||||
|
|
||||||
|
|
||||||
class DevScreen:
|
class DevScreen:
|
||||||
@@ -8,14 +10,16 @@ class DevScreen:
|
|||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.screen_init = False
|
self.screen_init = False
|
||||||
|
tex.load_screen_textures('song_select')
|
||||||
|
self.history = ScoreHistory({0: (583892, 0, 0, 0),
|
||||||
|
1: (234941, 0, 0, 0),
|
||||||
|
2: (867847, 0, 0, 0),
|
||||||
|
3: (485589, 0, 0, 0),
|
||||||
|
4: (1584395, 0, 0, 0)}, get_current_ms())
|
||||||
|
|
||||||
def on_screen_start(self):
|
def on_screen_start(self):
|
||||||
if not self.screen_init:
|
if not self.screen_init:
|
||||||
self.screen_init = True
|
self.screen_init = True
|
||||||
session_data.result_score = 961000
|
|
||||||
session_data.result_good = 100
|
|
||||||
session_data.result_max_combo = 20
|
|
||||||
session_data.result_total_drumroll = 40
|
|
||||||
|
|
||||||
def on_screen_end(self, next_screen: str):
|
def on_screen_end(self, next_screen: str):
|
||||||
self.screen_init = False
|
self.screen_init = False
|
||||||
@@ -23,12 +27,12 @@ class DevScreen:
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.on_screen_start()
|
self.on_screen_start()
|
||||||
|
self.history.update(get_current_ms())
|
||||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER):
|
if ray.is_key_pressed(ray.KeyboardKey.KEY_ENTER):
|
||||||
return self.on_screen_end('RESULT')
|
return self.on_screen_end('RESULT')
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
pass
|
self.history.draw()
|
||||||
|
|
||||||
def draw_3d(self):
|
def draw_3d(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -65,14 +65,7 @@ class SettingsScreen:
|
|||||||
step = step_sizes.get(key, 1)
|
step = step_sizes.get(key, 1)
|
||||||
new_value = current_value + (step * increment)
|
new_value = current_value + (step * increment)
|
||||||
|
|
||||||
# Apply constraints for specific settings
|
if key == 'sample_rate':
|
||||||
if key == 'judge_offset':
|
|
||||||
new_value = max(-50, min(50, new_value))
|
|
||||||
elif key == 'visual_offset':
|
|
||||||
new_value = max(-20, min(20, new_value))
|
|
||||||
elif key == 'buffer_size':
|
|
||||||
new_value = max(1, min(32, new_value))
|
|
||||||
elif key == 'sample_rate':
|
|
||||||
valid_rates = [-1, 22050, 44100, 48000, 88200, 96000]
|
valid_rates = [-1, 22050, 44100, 48000, 88200, 96000]
|
||||||
current_idx = valid_rates.index(current_value) if current_value in valid_rates else 2
|
current_idx = valid_rates.index(current_value) if current_value in valid_rates else 2
|
||||||
new_idx = max(0, min(len(valid_rates) - 1, current_idx + increment))
|
new_idx = max(0, min(len(valid_rates) - 1, current_idx + increment))
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ class SongSelectScreen:
|
|||||||
def handle_input_browsing(self):
|
def handle_input_browsing(self):
|
||||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_LEFT_CONTROL) or (is_l_kat_pressed() and get_current_ms() <= self.last_moved + 50):
|
if ray.is_key_pressed(ray.KeyboardKey.KEY_LEFT_CONTROL) or (is_l_kat_pressed() and get_current_ms() <= self.last_moved + 50):
|
||||||
self.reset_demo_music()
|
self.reset_demo_music()
|
||||||
self.wait = get_current_ms()
|
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
self.navigator.navigate_left()
|
self.navigator.navigate_left()
|
||||||
audio.play_sound(self.sound_skip)
|
audio.play_sound(self.sound_skip)
|
||||||
@@ -431,6 +430,8 @@ class SongSelectScreen:
|
|||||||
|
|
||||||
if self.navigator.genre_bg is not None and self.state == State.BROWSING:
|
if self.navigator.genre_bg is not None and self.state == State.BROWSING:
|
||||||
self.navigator.genre_bg.draw(95)
|
self.navigator.genre_bg.draw(95)
|
||||||
|
self.ura_switch_animation.draw()
|
||||||
|
|
||||||
for item in self.navigator.items:
|
for item in self.navigator.items:
|
||||||
box = item.box
|
box = item.box
|
||||||
if -156 <= box.position <= self.screen_width + 144:
|
if -156 <= box.position <= self.screen_width + 144:
|
||||||
@@ -439,10 +440,10 @@ class SongSelectScreen:
|
|||||||
else:
|
else:
|
||||||
box.draw(box.position + int(self.move_away.attribute), 95, self.is_ura, fade_override=self.diff_fade_out.attribute)
|
box.draw(box.position + int(self.move_away.attribute), 95, self.is_ura, fade_override=self.diff_fade_out.attribute)
|
||||||
|
|
||||||
self.ura_switch_animation.draw()
|
|
||||||
|
|
||||||
tex.draw_texture('global', 'footer')
|
tex.draw_texture('global', 'footer')
|
||||||
|
|
||||||
|
if self.state == State.BROWSING:
|
||||||
|
self.navigator.get_current_item().box.draw_score_history()
|
||||||
if self.diff_sort_selector is not None:
|
if self.diff_sort_selector is not None:
|
||||||
self.diff_sort_selector.draw()
|
self.diff_sort_selector.draw()
|
||||||
|
|
||||||
@@ -508,6 +509,8 @@ class SongBox:
|
|||||||
self.is_dir = is_dir
|
self.is_dir = is_dir
|
||||||
self.tja_count = tja_count
|
self.tja_count = tja_count
|
||||||
self.tja_count_text = None
|
self.tja_count_text = None
|
||||||
|
self.score_history = None
|
||||||
|
self.history_wait = 0
|
||||||
self.tja = tja
|
self.tja = tja
|
||||||
self.hash = dict()
|
self.hash = dict()
|
||||||
|
|
||||||
@@ -583,6 +586,12 @@ class SongBox:
|
|||||||
if self.yellow_box is not None:
|
if self.yellow_box is not None:
|
||||||
self.yellow_box.update(is_diff_select)
|
self.yellow_box.update(is_diff_select)
|
||||||
|
|
||||||
|
if self.history_wait == 0:
|
||||||
|
self.history_wait = get_current_ms()
|
||||||
|
|
||||||
|
if self.score_history is None and {k: v for k, v in self.scores.items() if v is not None}:
|
||||||
|
self.score_history = ScoreHistory(self.scores, get_current_ms())
|
||||||
|
|
||||||
if not is_open_prev and self.is_open:
|
if not is_open_prev and self.is_open:
|
||||||
if self.black_name is None:
|
if self.black_name is None:
|
||||||
self.black_name = OutlinedText(self.text_name, 40, ray.WHITE, ray.BLACK, outline_thickness=5, vertical=True)
|
self.black_name = OutlinedText(self.text_name, 40, ray.WHITE, ray.BLACK, outline_thickness=5, vertical=True)
|
||||||
@@ -594,6 +603,8 @@ class SongBox:
|
|||||||
self.open_anim.start()
|
self.open_anim.start()
|
||||||
self.open_fade.start()
|
self.open_fade.start()
|
||||||
self.wait = get_current_ms()
|
self.wait = get_current_ms()
|
||||||
|
if get_current_ms() >= self.history_wait + 3000:
|
||||||
|
self.history_wait = get_current_ms()
|
||||||
if self.tja_count is not None and self.tja_count > 0 and self.tja_count_text is None:
|
if self.tja_count is not None and self.tja_count > 0 and self.tja_count_text is None:
|
||||||
self.tja_count_text = OutlinedText(str(self.tja_count), 35, ray.WHITE, ray.BLACK, outline_thickness=5)#, horizontal_spacing=1.2)
|
self.tja_count_text = OutlinedText(str(self.tja_count), 35, ray.WHITE, ray.BLACK, outline_thickness=5)#, horizontal_spacing=1.2)
|
||||||
if self.box_texture is None and self.box_texture_path is not None:
|
if self.box_texture is None and self.box_texture_path is not None:
|
||||||
@@ -605,6 +616,9 @@ class SongBox:
|
|||||||
if self.name is None:
|
if self.name is None:
|
||||||
self.name = OutlinedText(self.text_name, 40, ray.WHITE, 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.WHITE, SongBox.OUTLINE_MAP.get(self.name_texture_index, ray.Color(101, 0, 82, 255)), outline_thickness=5, vertical=True)
|
||||||
|
|
||||||
|
if self.score_history is not None:
|
||||||
|
self.score_history.update(get_current_ms())
|
||||||
|
|
||||||
|
|
||||||
def _draw_closed(self, x: int, y: int):
|
def _draw_closed(self, x: int, y: int):
|
||||||
tex.draw_texture('box', 'folder_texture_left', frame=self.texture_index, x=x)
|
tex.draw_texture('box', 'folder_texture_left', frame=self.texture_index, x=x)
|
||||||
@@ -679,6 +693,10 @@ class SongBox:
|
|||||||
elif self.box_texture is not None:
|
elif self.box_texture is not None:
|
||||||
ray.draw_texture(self.box_texture, (x+48) - (self.box_texture.width//2), (y+240) - (self.box_texture.height//2), color)
|
ray.draw_texture(self.box_texture, (x+48) - (self.box_texture.width//2), (y+240) - (self.box_texture.height//2), color)
|
||||||
|
|
||||||
|
def draw_score_history(self):
|
||||||
|
if self.is_open and get_current_ms() >= self.wait + 83.33:
|
||||||
|
if self.score_history is not None and get_current_ms() >= self.history_wait + 3000:
|
||||||
|
self.score_history.draw()
|
||||||
def draw(self, x: int, y: int, is_ura: bool, fade_override=None):
|
def draw(self, x: int, y: int, is_ura: bool, fade_override=None):
|
||||||
if self.is_open and get_current_ms() >= self.wait + 83.33:
|
if self.is_open and get_current_ms() >= self.wait + 83.33:
|
||||||
if self.yellow_box is not None:
|
if self.yellow_box is not None:
|
||||||
@@ -1192,6 +1210,56 @@ class NeiroSelector:
|
|||||||
dest = ray.Rectangle((self.direction*-100) + 235 - (self.text_2.texture.width//2) + (self.move_sideways.attribute*self.direction), y+1000, self.text_2.texture.width, self.text_2.texture.height)
|
dest = ray.Rectangle((self.direction*-100) + 235 - (self.text_2.texture.width//2) + (self.move_sideways.attribute*self.direction), y+1000, self.text_2.texture.width, self.text_2.texture.height)
|
||||||
self.text_2.draw(self.text_2.default_src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, 1 - self.fade_sideways.attribute))
|
self.text_2.draw(self.text_2.default_src, dest, ray.Vector2(0, 0), 0, ray.fade(ray.WHITE, 1 - self.fade_sideways.attribute))
|
||||||
|
|
||||||
|
class ScoreHistory:
|
||||||
|
def __init__(self, scores: dict[int, tuple[int, int, int, int]], current_ms):
|
||||||
|
self.scores = {k: v for k, v in scores.items() if v is not None}
|
||||||
|
self.difficulty_keys = list(self.scores.keys())
|
||||||
|
self.curr_difficulty_index = 0
|
||||||
|
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
||||||
|
self.curr_difficulty = self.difficulty_keys[self.curr_difficulty_index]
|
||||||
|
self.curr_score = self.scores[self.curr_difficulty][0]
|
||||||
|
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
||||||
|
self.last_ms = current_ms
|
||||||
|
|
||||||
|
def update(self, current_ms):
|
||||||
|
if current_ms >= self.last_ms + 1000:
|
||||||
|
self.last_ms = current_ms
|
||||||
|
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
||||||
|
self.curr_difficulty = self.difficulty_keys[self.curr_difficulty_index]
|
||||||
|
self.curr_score = self.scores[self.curr_difficulty][0]
|
||||||
|
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
tex.draw_texture('leaderboard','background')
|
||||||
|
tex.draw_texture('leaderboard','title')
|
||||||
|
|
||||||
|
if self.curr_difficulty == 4:
|
||||||
|
tex.draw_texture('leaderboard', 'normal_ura')
|
||||||
|
tex.draw_texture('leaderboard', 'shinuchi_ura')
|
||||||
|
else:
|
||||||
|
tex.draw_texture('leaderboard', 'normal')
|
||||||
|
tex.draw_texture('leaderboard', 'shinuchi')
|
||||||
|
|
||||||
|
color = ray.BLACK
|
||||||
|
if self.curr_difficulty == 4:
|
||||||
|
color = ray.WHITE
|
||||||
|
tex.draw_texture('leaderboard','ura')
|
||||||
|
|
||||||
|
tex.draw_texture('leaderboard', 'pts', color=color)
|
||||||
|
tex.draw_texture('leaderboard', 'pts', y=50)
|
||||||
|
|
||||||
|
tex.draw_texture('leaderboard', 'difficulty', frame=self.curr_difficulty)
|
||||||
|
|
||||||
|
counter = str(self.curr_score)
|
||||||
|
total_width = len(counter) * 14
|
||||||
|
for i in range(len(counter)):
|
||||||
|
tex.draw_texture('leaderboard', 'counter', frame=int(counter[i]), x=-(total_width // 2) + (i * 14), color=color)
|
||||||
|
|
||||||
|
counter = str(self.curr_score_su)
|
||||||
|
total_width = len(counter) * 14
|
||||||
|
for i in range(len(counter)):
|
||||||
|
tex.draw_texture('leaderboard', 'counter', frame=int(counter[i]), x=-(total_width // 2) + (i * 14), y=50, color=ray.WHITE)
|
||||||
|
|
||||||
class FileSystemItem:
|
class FileSystemItem:
|
||||||
GENRE_MAP = {
|
GENRE_MAP = {
|
||||||
'J-POP': 1,
|
'J-POP': 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user