mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
oops
This commit is contained in:
@@ -52,23 +52,23 @@ class PathsConfig(TypedDict):
|
|||||||
video_path: list[Path]
|
video_path: list[Path]
|
||||||
|
|
||||||
class KeysConfig(TypedDict):
|
class KeysConfig(TypedDict):
|
||||||
exit_key: str
|
exit_key: int
|
||||||
fullscreen_key: str
|
fullscreen_key: int
|
||||||
borderless_key: str
|
borderless_key: int
|
||||||
back_key: str
|
back_key: int
|
||||||
restart_key: str
|
restart_key: int
|
||||||
|
|
||||||
class Keys1PConfig(TypedDict):
|
class Keys1PConfig(TypedDict):
|
||||||
left_kat: list[str]
|
left_kat: list[int]
|
||||||
left_don: list[str]
|
left_don: list[int]
|
||||||
right_don: list[str]
|
right_don: list[int]
|
||||||
right_kat: list[str]
|
right_kat: list[int]
|
||||||
|
|
||||||
class Keys2PConfig(TypedDict):
|
class Keys2PConfig(TypedDict):
|
||||||
left_kat: list[str]
|
left_kat: list[int]
|
||||||
left_don: list[str]
|
left_don: list[int]
|
||||||
right_don: list[str]
|
right_don: list[int]
|
||||||
right_kat: list[str]
|
right_kat: list[int]
|
||||||
|
|
||||||
class GamepadConfig(TypedDict):
|
class GamepadConfig(TypedDict):
|
||||||
left_kat: list[int]
|
left_kat: list[int]
|
||||||
|
|||||||
@@ -82,6 +82,16 @@ def get_config() -> Config:
|
|||||||
config_file = tomlkit.load(f)
|
config_file = tomlkit.load(f)
|
||||||
|
|
||||||
config: Config = json.loads(json.dumps(config_file))
|
config: Config = json.loads(json.dumps(config_file))
|
||||||
|
for key in config['keys']:
|
||||||
|
config[key] = get_key_code(config['keys'][key])
|
||||||
|
for key in config['keys_1p']:
|
||||||
|
bindings = config['keys_1p'][key]
|
||||||
|
for i, bind in enumerate(bindings):
|
||||||
|
config['keys_1p'][key][i] = get_key_code(bind)
|
||||||
|
for key in config['keys_2p']:
|
||||||
|
bindings = config['keys_2p'][key]
|
||||||
|
for i, bind in enumerate(bindings):
|
||||||
|
config['keys_2p'][key][i] = get_key_code(bind)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def save_config(config: Config) -> None:
|
def save_config(config: Config) -> None:
|
||||||
@@ -102,13 +112,11 @@ def get_key_code(key: str) -> int:
|
|||||||
raise ValueError(f"Invalid key: {key}")
|
raise ValueError(f"Invalid key: {key}")
|
||||||
return key_code
|
return key_code
|
||||||
|
|
||||||
def is_input_key_pressed(keys: list[str], gamepad_buttons: list[int]):
|
def is_input_key_pressed(keys: list[int], gamepad_buttons: list[int]):
|
||||||
if global_data.input_locked:
|
if global_data.input_locked:
|
||||||
return False
|
return False
|
||||||
for key in keys:
|
for key in keys:
|
||||||
key_code = get_key_code(key)
|
if ray.is_key_pressed(key):
|
||||||
|
|
||||||
if ray.is_key_pressed(key_code):
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if ray.is_gamepad_available(0):
|
if ray.is_gamepad_available(0):
|
||||||
|
|||||||
@@ -229,14 +229,14 @@ class GameScreen(Screen):
|
|||||||
self.start_ms = get_current_ms() - self.pause_time
|
self.start_ms = get_current_ms() - self.pause_time
|
||||||
|
|
||||||
def global_keys(self):
|
def global_keys(self):
|
||||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["restart_key"])):
|
if ray.is_key_pressed(global_data.config["keys"]["restart_key"]):
|
||||||
if self.song_music is not None:
|
if self.song_music is not None:
|
||||||
audio.stop_music_stream(self.song_music)
|
audio.stop_music_stream(self.song_music)
|
||||||
self.init_tja(global_data.session_data[global_data.player_num].selected_song)
|
self.init_tja(global_data.session_data[global_data.player_num].selected_song)
|
||||||
audio.play_sound('restart', 'sound')
|
audio.play_sound('restart', 'sound')
|
||||||
self.song_started = False
|
self.song_started = False
|
||||||
|
|
||||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["back_key"])):
|
if ray.is_key_pressed(global_data.config["keys"]["back_key"]):
|
||||||
if self.song_music is not None:
|
if self.song_music is not None:
|
||||||
audio.stop_music_stream(self.song_music)
|
audio.stop_music_stream(self.song_music)
|
||||||
return self.on_screen_end('SONG_SELECT')
|
return self.on_screen_end('SONG_SELECT')
|
||||||
@@ -626,7 +626,7 @@ class Player:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(self.current_notes_draw[0], Drumroll):
|
if isinstance(self.current_notes_draw[0], Drumroll):
|
||||||
self.current_notes_draw[0].color = max(255, self.current_notes_draw[0].color + 1)
|
self.current_notes_draw[0].color = min(255, self.current_notes_draw[0].color + 1)
|
||||||
|
|
||||||
note = self.current_notes_draw[0]
|
note = self.current_notes_draw[0]
|
||||||
if note.type in {NoteType.ROLL_HEAD, NoteType.ROLL_HEAD_L, NoteType.BALLOON_HEAD, NoteType.KUSUDAMA} and len(self.current_notes_draw) > 1:
|
if note.type in {NoteType.ROLL_HEAD, NoteType.ROLL_HEAD_L, NoteType.BALLOON_HEAD, NoteType.KUSUDAMA} and len(self.current_notes_draw) > 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user