mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
minor fixes
This commit is contained in:
@@ -183,16 +183,13 @@ class DanSelectPlayer:
|
||||
|
||||
def handle_input(self, state, screen):
|
||||
"""Main input dispatcher. Delegates to state-specific handlers."""
|
||||
if self.is_voice_playing():
|
||||
return
|
||||
|
||||
if state == State.BROWSING:
|
||||
screen.handle_input_browsing()
|
||||
elif state == State.SONG_SELECTED:
|
||||
res = screen.handle_input_selected()
|
||||
|
||||
if res:
|
||||
return res
|
||||
if res:
|
||||
return res
|
||||
|
||||
def handle_input_selected(self):
|
||||
"""Handle input for selecting difficulty. Returns 'cancel', 'confirm', or None"""
|
||||
@@ -12,7 +12,7 @@ from libs.tja import TJAParser
|
||||
from libs.transition import Transition
|
||||
from libs.utils import OutlinedText, get_current_ms
|
||||
from libs.texture import tex
|
||||
from scenes.game import ClearAnimation, FCAnimation, FailAnimation, GameScreen, ResultTransition, SongInfo
|
||||
from scenes.game import ClearAnimation, FCAnimation, FailAnimation, GameScreen, Gauge, ResultTransition, SongInfo
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -91,7 +91,8 @@ class DanGameScreen(GameScreen):
|
||||
session_data.selected_difficulty = difficulty
|
||||
self.player_1.difficulty = difficulty
|
||||
self.tja = TJAParser(song.file_path, start_delay=self.start_delay, distance=SCREEN_WIDTH - GameScreen.JUDGE_X)
|
||||
audio.unload_music_stream(self.song_music)
|
||||
if self.song_music is not None:
|
||||
audio.unload_music_stream(self.song_music)
|
||||
self.song_music = None
|
||||
self.song_started = False
|
||||
|
||||
@@ -326,7 +327,7 @@ class DanTransition:
|
||||
tex.draw_texture('dan', 'transition', index=1, x=-self.move.attribute)
|
||||
|
||||
|
||||
class DanGauge:
|
||||
class DanGauge(Gauge):
|
||||
"""The player's gauge"""
|
||||
def __init__(self, player_num: str, total_notes: int):
|
||||
self.player_num = player_num
|
||||
@@ -122,12 +122,12 @@ class ResultPlayer:
|
||||
plate_info = global_data.config[f'nameplate_{self.player_num}p']
|
||||
self.nameplate = Nameplate(plate_info['name'], plate_info['title'], int(self.player_num), plate_info['dan'], plate_info['gold'], plate_info['title_bg'])
|
||||
self.score, self.good, self.ok, self.bad, self.max_combo, self.total_drumroll = '', '', '', '', '', ''
|
||||
self.update_list: list[tuple[str, int]] = [['score', session_data.result_score],
|
||||
['good', session_data.result_good],
|
||||
['ok', session_data.result_ok],
|
||||
['bad', session_data.result_bad],
|
||||
['max_combo', session_data.result_max_combo],
|
||||
['total_drumroll', session_data.result_total_drumroll]]
|
||||
self.update_list: list[tuple[str, int]] = [('score', session_data.result_score),
|
||||
('good', session_data.result_good),
|
||||
('ok', session_data.result_ok),
|
||||
('bad', session_data.result_bad),
|
||||
('max_combo', session_data.result_max_combo),
|
||||
('total_drumroll', session_data.result_total_drumroll)]
|
||||
self.update_index = 0
|
||||
if session_data.result_ok == 0 and session_data.result_bad == 0:
|
||||
self.crown_type = 'crown_dfc'
|
||||
|
||||
@@ -252,7 +252,7 @@ class SettingsScreen(Screen):
|
||||
display_value = ', '.join(map(str, value))
|
||||
else:
|
||||
display_value = str(value)
|
||||
if key == 'device_type':
|
||||
if key == 'device_type' and not isinstance(value, list):
|
||||
display_value = f'{display_value} ({audio.get_host_api_name(value)})'
|
||||
ray.draw_text(f'{key}: {display_value}', 250, i*25 + 70, 20, color)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
import pyray as ray
|
||||
import logging
|
||||
|
||||
from libs.file_navigator import navigator
|
||||
from libs.file_navigator import DanCourse, navigator
|
||||
from libs.audio import audio
|
||||
from libs.chara_2d import Chara2D
|
||||
from libs.file_navigator import Directory, SongBox, SongFile
|
||||
@@ -74,7 +74,9 @@ class SongSelectScreen(Screen):
|
||||
return self.on_screen_end("ENTRY")
|
||||
|
||||
if str(session_data.selected_song) in self.navigator.all_song_files:
|
||||
self.navigator.mark_crowns_dirty_for_song(self.navigator.all_song_files[str(session_data.selected_song)])
|
||||
selected_song = self.navigator.all_song_files[str(session_data.selected_song)]
|
||||
if not isinstance(selected_song, DanCourse):
|
||||
self.navigator.mark_crowns_dirty_for_song(selected_song)
|
||||
|
||||
curr_item = self.navigator.get_current_item()
|
||||
curr_item.box.get_scores()
|
||||
@@ -214,7 +216,7 @@ class SongSelectScreen(Screen):
|
||||
def handle_input(self):
|
||||
self.player_1.handle_input(self.state, self)
|
||||
|
||||
def update_players(self, current_time):
|
||||
def update_players(self, current_time) -> str:
|
||||
self.player_1.update(current_time)
|
||||
if self.text_fade_out.is_finished:
|
||||
self.player_1.selected_song = True
|
||||
@@ -376,6 +378,7 @@ class SongSelectPlayer:
|
||||
self.selected_difficulty = -3
|
||||
self.prev_diff = -3
|
||||
self.selected_song = False
|
||||
self.is_ready = False
|
||||
self.is_ura = False
|
||||
self.ura_toggle = 0
|
||||
self.diff_select_move_right = False
|
||||
@@ -492,7 +495,7 @@ class SongSelectPlayer:
|
||||
|
||||
def handle_input(self, state, screen):
|
||||
"""Main input dispatcher. Delegates to state-specific handlers."""
|
||||
if self.is_voice_playing():
|
||||
if self.is_voice_playing() or self.is_ready:
|
||||
return
|
||||
|
||||
if state == State.BROWSING:
|
||||
@@ -538,6 +541,7 @@ class SongSelectPlayer:
|
||||
self.neiro_selector = NeiroSelector(self.player_num)
|
||||
return None
|
||||
else:
|
||||
self.is_ready = True
|
||||
return "confirm"
|
||||
|
||||
if is_l_kat_pressed(self.player_num) or is_r_kat_pressed(self.player_num):
|
||||
|
||||
@@ -128,7 +128,7 @@ class TwoPlayerSongSelectScreen(SongSelectScreen):
|
||||
super()._cancel_selection()
|
||||
self.player_2.selected_song = False
|
||||
|
||||
def _confirm_selection(self, player_selected: int):
|
||||
def _confirm_selection(self, player_selected: int = 1):
|
||||
"""Confirm song selection and create game transition"""
|
||||
audio.play_sound('don', 'sound')
|
||||
audio.play_sound(f'voice_start_song_{global_data.player_num}p', 'voice')
|
||||
@@ -160,7 +160,7 @@ class TwoPlayerSongSelectScreen(SongSelectScreen):
|
||||
self.game_transition.start()
|
||||
logger.info(f"Game transition started for song: {title} - {subtitle}")
|
||||
|
||||
def update_players(self, current_time):
|
||||
def update_players(self, current_time) -> str:
|
||||
self.player_1.update(current_time)
|
||||
self.player_2.update(current_time)
|
||||
if self.text_fade_out.is_finished:
|
||||
|
||||
Reference in New Issue
Block a user