mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 03:30:13 +01:00
minor fixes
This commit is contained in:
@@ -147,26 +147,6 @@ class GameScreen(Screen):
|
||||
self.player_1 = Player(self.tja, global_data.player_num, global_data.session_data[global_data.player_num].selected_difficulty, False, global_data.modifiers[global_data.player_num])
|
||||
self.start_ms = get_current_ms() - self.tja.metadata.offset*1000
|
||||
|
||||
def get_song_hash(self, song: Path):
|
||||
notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(song), self.player_1.difficulty)
|
||||
if branch_m:
|
||||
for branch in branch_m:
|
||||
notes.play_notes.extend(branch.play_notes)
|
||||
notes.draw_notes.extend(branch.draw_notes)
|
||||
notes.bars.extend(branch.bars)
|
||||
if branch_e:
|
||||
for branch in branch_e:
|
||||
notes.play_notes.extend(branch.play_notes)
|
||||
notes.draw_notes.extend(branch.draw_notes)
|
||||
notes.bars.extend(branch.bars)
|
||||
if branch_n:
|
||||
for branch in branch_n:
|
||||
notes.play_notes.extend(branch.play_notes)
|
||||
notes.draw_notes.extend(branch.draw_notes)
|
||||
notes.bars.extend(branch.bars)
|
||||
hash = self.tja.hash_note_data(notes)
|
||||
return hash
|
||||
|
||||
def write_score(self):
|
||||
"""Write the score to the database"""
|
||||
if global_data.modifiers[global_data.player_num].auto:
|
||||
@@ -174,7 +154,7 @@ class GameScreen(Screen):
|
||||
with sqlite3.connect('scores.db') as con:
|
||||
session_data = global_data.session_data[global_data.player_num]
|
||||
cursor = con.cursor()
|
||||
hash = self.get_song_hash(session_data.selected_song)
|
||||
hash = session_data.song_hash
|
||||
check_query = "SELECT score, clear FROM Scores WHERE hash = ? LIMIT 1"
|
||||
cursor.execute(check_query, (hash,))
|
||||
result = cursor.fetchone()
|
||||
|
||||
@@ -3,6 +3,7 @@ import pyray as ray
|
||||
|
||||
from libs.audio import audio
|
||||
from libs.screen import Screen
|
||||
from libs.texture import tex
|
||||
from libs.utils import (
|
||||
global_data,
|
||||
is_l_don_pressed,
|
||||
@@ -227,6 +228,7 @@ class SettingsScreen(Screen):
|
||||
|
||||
def draw(self):
|
||||
# Draw title
|
||||
ray.draw_rectangle(0, 0, tex.screen_width, tex.screen_height, ray.BLACK)
|
||||
ray.draw_text("SETTINGS", 20, 20, 30, ray.WHITE)
|
||||
|
||||
# Draw section headers
|
||||
|
||||
@@ -85,6 +85,7 @@ class SongSelectScreen(Screen):
|
||||
|
||||
def finalize_song(self, current_item: SongFile):
|
||||
global_data.session_data[global_data.player_num].selected_song = current_item.path
|
||||
global_data.session_data[global_data.player_num].song_hash = global_data.song_hashes[current_item.hash][0]["diff_hashes"][self.player_1.selected_difficulty]
|
||||
global_data.session_data[global_data.player_num].selected_difficulty = self.player_1.selected_difficulty
|
||||
global_data.session_data[global_data.player_num].genre_index = current_item.box.name_texture_index
|
||||
|
||||
|
||||
Reference in New Issue
Block a user