mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
add detailed statistics on song select
This commit is contained in:
@@ -99,7 +99,7 @@ class SongBox:
|
|||||||
placeholders = ','.join('?' * len(hash_values))
|
placeholders = ','.join('?' * len(hash_values))
|
||||||
|
|
||||||
batch_query = f"""
|
batch_query = f"""
|
||||||
SELECT hash, score, good, ok, bad, clear
|
SELECT hash, score, good, ok, bad, drumroll, clear
|
||||||
FROM Scores
|
FROM Scores
|
||||||
WHERE hash IN ({placeholders})
|
WHERE hash IN ({placeholders})
|
||||||
"""
|
"""
|
||||||
@@ -206,11 +206,11 @@ class SongBox:
|
|||||||
if valid_scores:
|
if valid_scores:
|
||||||
highest_key = max(valid_scores.keys())
|
highest_key = max(valid_scores.keys())
|
||||||
score = self.scores[highest_key]
|
score = self.scores[highest_key]
|
||||||
if score and ((score[4] == 2 and score[2] == 0) or (score[2] == 0 and score[3] == 0)):
|
if score and ((score[5] == 2 and score[2] == 0) or (score[2] == 0 and score[3] == 0)):
|
||||||
tex.draw_texture('yellow_box', 'crown_dfc', x=x, y=y, frame=min(4, highest_key))
|
tex.draw_texture('yellow_box', 'crown_dfc', x=x, y=y, frame=min(4, highest_key))
|
||||||
elif score and ((score[4] == 2) or (score[3] == 0)):
|
elif score and ((score[5] == 2) or (score[3] == 0)):
|
||||||
tex.draw_texture('yellow_box', 'crown_fc', x=x, y=y, frame=min(4, highest_key))
|
tex.draw_texture('yellow_box', 'crown_fc', x=x, y=y, frame=min(4, highest_key))
|
||||||
elif score and score[4] >= 1:
|
elif score and score[5] >= 1:
|
||||||
tex.draw_texture('yellow_box', 'crown_clear', x=x, y=y, frame=min(4, highest_key))
|
tex.draw_texture('yellow_box', 'crown_clear', x=x, y=y, frame=min(4, highest_key))
|
||||||
if self.crown: #Folder lamp
|
if self.crown: #Folder lamp
|
||||||
highest_crown = max(self.crown)
|
highest_crown = max(self.crown)
|
||||||
@@ -551,6 +551,7 @@ class ScoreHistory:
|
|||||||
current_ms (int): The current time in milliseconds.
|
current_ms (int): The current time in milliseconds.
|
||||||
"""
|
"""
|
||||||
self.scores = {k: v for k, v in scores.items() if v is not None}
|
self.scores = {k: v for k, v in scores.items() if v is not None}
|
||||||
|
print(self.scores)
|
||||||
self.difficulty_keys = list(self.scores.keys())
|
self.difficulty_keys = list(self.scores.keys())
|
||||||
self.curr_difficulty_index = 0
|
self.curr_difficulty_index = 0
|
||||||
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
self.curr_difficulty_index = (self.curr_difficulty_index + 1) % len(self.difficulty_keys)
|
||||||
@@ -558,6 +559,7 @@ class ScoreHistory:
|
|||||||
self.curr_score = self.scores[self.curr_difficulty][0]
|
self.curr_score = self.scores[self.curr_difficulty][0]
|
||||||
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
||||||
self.last_ms = current_ms
|
self.last_ms = current_ms
|
||||||
|
self.long = True
|
||||||
|
|
||||||
def update(self, current_ms):
|
def update(self, current_ms):
|
||||||
if current_ms >= self.last_ms + 1000:
|
if current_ms >= self.last_ms + 1000:
|
||||||
@@ -567,7 +569,40 @@ class ScoreHistory:
|
|||||||
self.curr_score = self.scores[self.curr_difficulty][0]
|
self.curr_score = self.scores[self.curr_difficulty][0]
|
||||||
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
self.curr_score_su = self.scores[self.curr_difficulty][0]
|
||||||
|
|
||||||
|
def draw_long(self):
|
||||||
|
tex.draw_texture('leaderboard','background_2')
|
||||||
|
tex.draw_texture('leaderboard','title', index=self.long)
|
||||||
|
if self.curr_difficulty == 4:
|
||||||
|
tex.draw_texture('leaderboard', 'shinuchi_ura', index=self.long)
|
||||||
|
else:
|
||||||
|
tex.draw_texture('leaderboard', 'shinuchi', index=self.long)
|
||||||
|
|
||||||
|
tex.draw_texture('leaderboard', 'pts', color=ray.WHITE, index=self.long)
|
||||||
|
tex.draw_texture('leaderboard', 'difficulty', frame=self.curr_difficulty, index=self.long)
|
||||||
|
|
||||||
|
for i in range(4):
|
||||||
|
tex.draw_texture('leaderboard', 'normal', index=self.long, y=50+(i*50))
|
||||||
|
|
||||||
|
tex.draw_texture('leaderboard', 'judge_good')
|
||||||
|
tex.draw_texture('leaderboard', 'judge_ok')
|
||||||
|
tex.draw_texture('leaderboard', 'judge_bad')
|
||||||
|
tex.draw_texture('leaderboard', 'judge_drumroll')
|
||||||
|
|
||||||
|
for j, counter in enumerate(self.scores[self.curr_difficulty]):
|
||||||
|
if j == 5:
|
||||||
|
continue
|
||||||
|
counter = str(counter)
|
||||||
|
margin = 24
|
||||||
|
for i in range(len(counter)):
|
||||||
|
if j == 0:
|
||||||
|
tex.draw_texture('leaderboard', 'counter', frame=int(counter[i]), x=-((len(counter) * 14) // 2) + (i * 14), color=ray.WHITE, index=self.long)
|
||||||
|
else:
|
||||||
|
tex.draw_texture('leaderboard', 'judge_num', frame=int(counter[i]), x=-(len(counter) - i) * margin, y=j*50)
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
|
if self.long:
|
||||||
|
self.draw_long()
|
||||||
|
return
|
||||||
tex.draw_texture('leaderboard','background')
|
tex.draw_texture('leaderboard','background')
|
||||||
tex.draw_texture('leaderboard','title')
|
tex.draw_texture('leaderboard','title')
|
||||||
|
|
||||||
@@ -1085,11 +1120,11 @@ class FileNavigator:
|
|||||||
all_scores[diff].append(song_obj.box.scores[diff])
|
all_scores[diff].append(song_obj.box.scores[diff])
|
||||||
|
|
||||||
for diff in all_scores:
|
for diff in all_scores:
|
||||||
if all(score is not None and ((score[4] == 2 and score[2] == 0) or (score[2] == 0 and score[3] == 0)) for score in all_scores[diff]):
|
if all(score is not None and ((score[5] == 2 and score[2] == 0) or (score[2] == 0 and score[3] == 0)) for score in all_scores[diff]):
|
||||||
crowns[diff] = 'DFC'
|
crowns[diff] = 'DFC'
|
||||||
elif all(score is not None and ((score[4] == 2) or (score[3] == 0)) for score in all_scores[diff]):
|
elif all(score is not None and ((score[5] == 2) or (score[3] == 0)) for score in all_scores[diff]):
|
||||||
crowns[diff] = 'FC'
|
crowns[diff] = 'FC'
|
||||||
elif all(score is not None and score[4] >= 1 for score in all_scores[diff]):
|
elif all(score is not None and score[5] >= 1 for score in all_scores[diff]):
|
||||||
crowns[diff] = 'CLEAR'
|
crowns[diff] = 'CLEAR'
|
||||||
|
|
||||||
self.directory_crowns[dir_key] = crowns
|
self.directory_crowns[dir_key] = crowns
|
||||||
|
|||||||
@@ -59,9 +59,13 @@ class GameScreen:
|
|||||||
if global_data.hit_sound == 0:
|
if global_data.hit_sound == 0:
|
||||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "don.wav", 'hitsound_don_1p')
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "don.wav", 'hitsound_don_1p')
|
||||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "ka.wav", 'hitsound_kat_1p')
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "ka.wav", 'hitsound_kat_1p')
|
||||||
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "don.wav", 'hitsound_don_2p')
|
||||||
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "ka.wav", 'hitsound_kat_2p')
|
||||||
else:
|
else:
|
||||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "don.ogg", 'hitsound_don_1p')
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "don.ogg", 'hitsound_don_1p')
|
||||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "ka.ogg", 'hitsound_kat_1p')
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "ka.ogg", 'hitsound_kat_1p')
|
||||||
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "don.ogg", 'hitsound_don_2p')
|
||||||
|
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "ka.ogg", 'hitsound_kat_2p')
|
||||||
|
|
||||||
def init_tja(self, song: Path):
|
def init_tja(self, song: Path):
|
||||||
"""Initialize the TJA file"""
|
"""Initialize the TJA file"""
|
||||||
|
|||||||
Reference in New Issue
Block a user