mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
add online toggle
This commit is contained in:
@@ -9,6 +9,7 @@ timer_frozen = true
|
|||||||
judge_counter = false
|
judge_counter = false
|
||||||
nijiiro_notes = false
|
nijiiro_notes = false
|
||||||
log_level = 30
|
log_level = 30
|
||||||
|
fake_online = false
|
||||||
|
|
||||||
[nameplate_1p]
|
[nameplate_1p]
|
||||||
name = 'どんちゃん'
|
name = 'どんちゃん'
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ class DanBox:
|
|||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
if self.name is None:
|
if self.name is not None:
|
||||||
self.name.unload()
|
self.name.unload()
|
||||||
self.name = None
|
self.name = None
|
||||||
|
|
||||||
@@ -887,7 +887,7 @@ class DanCourse(FileSystemItem):
|
|||||||
def __init__(self, path: Path, name: str):
|
def __init__(self, path: Path, name: str):
|
||||||
super().__init__(path, name)
|
super().__init__(path, name)
|
||||||
if name != "dan.json":
|
if name != "dan.json":
|
||||||
self.logging.error(f"Invalid dan course file: {path}")
|
logger.error(f"Invalid dan course file: {path}")
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
self.title = data["title"]
|
self.title = data["title"]
|
||||||
@@ -902,6 +902,8 @@ class DanCourse(FileSystemItem):
|
|||||||
path = Path(global_data.song_hashes[hash][0]["file_path"])
|
path = Path(global_data.song_hashes[hash][0]["file_path"])
|
||||||
if (path.parent.parent / "box.def").exists():
|
if (path.parent.parent / "box.def").exists():
|
||||||
_, genre_index, _ = parse_box_def(path.parent.parent)
|
_, genre_index, _ = parse_box_def(path.parent.parent)
|
||||||
|
else:
|
||||||
|
genre_index = 9
|
||||||
self.charts.append((TJAParser(path), genre_index, difficulty))
|
self.charts.append((TJAParser(path), genre_index, difficulty))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
@@ -918,7 +920,7 @@ class FileNavigator:
|
|||||||
|
|
||||||
# Pre-generated objects storage
|
# Pre-generated objects storage
|
||||||
self.all_directories: dict[str, Directory] = {} # path -> Directory
|
self.all_directories: dict[str, Directory] = {} # path -> Directory
|
||||||
self.all_song_files: dict[str, SongFile] = {} # path -> SongFile
|
self.all_song_files: dict[str, Union[SongFile, DanCourse]] = {} # path -> SongFile
|
||||||
self.directory_contents: dict[str, list[Union[Directory, SongFile]]] = {} # path -> list of items
|
self.directory_contents: dict[str, list[Union[Directory, SongFile]]] = {} # path -> list of items
|
||||||
|
|
||||||
# OPTION 2: Lazy crown calculation with caching
|
# OPTION 2: Lazy crown calculation with caching
|
||||||
@@ -995,7 +997,10 @@ class FileNavigator:
|
|||||||
song_list = self._read_song_list(self.favorite_folder.path)
|
song_list = self._read_song_list(self.favorite_folder.path)
|
||||||
for song_obj in song_list:
|
for song_obj in song_list:
|
||||||
if str(song_obj) in self.all_song_files:
|
if str(song_obj) in self.all_song_files:
|
||||||
self.all_song_files[str(song_obj)].box.is_favorite = True
|
if isinstance(self.all_song_files[str(song_obj)].box, DanBox):
|
||||||
|
logger.warning(f"Cannot favorite DanCourse: {song_obj}")
|
||||||
|
else:
|
||||||
|
self.all_song_files[str(song_obj)].box.is_favorite = True
|
||||||
|
|
||||||
logging.info(f"Object generation complete. "
|
logging.info(f"Object generation complete. "
|
||||||
f"Directories: {len(self.all_directories)}, "
|
f"Directories: {len(self.all_directories)}, "
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class GeneralConfig(TypedDict):
|
|||||||
judge_counter: bool
|
judge_counter: bool
|
||||||
nijiiro_notes: bool
|
nijiiro_notes: bool
|
||||||
log_level: int
|
log_level: int
|
||||||
|
fake_online: bool
|
||||||
|
|
||||||
class NameplateConfig(TypedDict):
|
class NameplateConfig(TypedDict):
|
||||||
name: str
|
name: str
|
||||||
|
|||||||
@@ -125,20 +125,20 @@ class AllNetIcon:
|
|||||||
"""All.Net status icon for the game."""
|
"""All.Net status icon for the game."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the All.Net status icon."""
|
"""Initialize the All.Net status icon."""
|
||||||
pass
|
self.online = get_config()["general"]["fake_online"]
|
||||||
def update(self, current_time_ms: float):
|
def update(self, current_time_ms: float):
|
||||||
"""Update the All.Net status icon."""
|
"""Update the All.Net status icon."""
|
||||||
pass
|
pass
|
||||||
def draw(self, x: int = 0, y: int = 0):
|
def draw(self, x: int = 0, y: int = 0):
|
||||||
"""Draw the All.Net status icon. Only drawn offline for now"""
|
"""Draw the All.Net status icon. Only drawn offline for now"""
|
||||||
tex = global_tex
|
tex = global_tex
|
||||||
tex.draw_texture('overlay', 'allnet_indicator', x=x, y=y, frame=0)
|
tex.draw_texture('overlay', 'allnet_indicator', x=x, y=y, frame=2 if self.online else 0)
|
||||||
|
|
||||||
class EntryOverlay:
|
class EntryOverlay:
|
||||||
"""Banapass and Camera status icons"""
|
"""Banapass and Camera status icons"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the Banapass and Camera status icons."""
|
"""Initialize the Banapass and Camera status icons."""
|
||||||
self.online = False
|
self.online = get_config()["general"]["fake_online"]
|
||||||
def update(self, current_time_ms: float):
|
def update(self, current_time_ms: float):
|
||||||
"""Update the Banapass and Camera status icons."""
|
"""Update the Banapass and Camera status icons."""
|
||||||
pass
|
pass
|
||||||
@@ -151,7 +151,7 @@ class EntryOverlay:
|
|||||||
if not self.online:
|
if not self.online:
|
||||||
tex.draw_texture('overlay', 'banapass_no', x=x, y=y, frame=self.online)
|
tex.draw_texture('overlay', 'banapass_no', x=x, y=y, frame=self.online)
|
||||||
|
|
||||||
tex.draw_texture('overlay', 'camera', x=x, y=y, frame=0)
|
tex.draw_texture('overlay', 'camera', x=x, y=y, frame=self.online)
|
||||||
|
|
||||||
class Timer:
|
class Timer:
|
||||||
"""Timer class for displaying countdown timers."""
|
"""Timer class for displaying countdown timers."""
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class TwoPlayerGameScreen(GameScreen):
|
|||||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_F1):
|
if ray.is_key_pressed(ray.KeyboardKey.KEY_F1):
|
||||||
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.selected_song)
|
self.init_tja(global_data.session_data[global_data.player_num-1].selected_song)
|
||||||
audio.play_sound('restart', 'sound')
|
audio.play_sound('restart', 'sound')
|
||||||
self.song_started = False
|
self.song_started = False
|
||||||
logger.info("F1 pressed: song restarted")
|
logger.info("F1 pressed: song restarted")
|
||||||
@@ -124,10 +124,10 @@ class TwoPlayerGameScreen(GameScreen):
|
|||||||
elif self.current_ms >= self.player_1.end_time:
|
elif self.current_ms >= self.player_1.end_time:
|
||||||
session_data = global_data.session_data[0]
|
session_data = global_data.session_data[0]
|
||||||
session_data.result_score, session_data.result_good, session_data.result_ok, session_data.result_bad, session_data.result_max_combo, session_data.result_total_drumroll = self.player_1.get_result_score()
|
session_data.result_score, session_data.result_good, session_data.result_ok, session_data.result_bad, session_data.result_max_combo, session_data.result_total_drumroll = self.player_1.get_result_score()
|
||||||
session_data.result_gauge_length = self.player_1.gauge.gauge_length
|
session_data.result_gauge_length = int(self.player_1.gauge.gauge_length)
|
||||||
session_data = global_data.session_data[1]
|
session_data = global_data.session_data[1]
|
||||||
session_data.result_score, session_data.result_good, session_data.result_ok, session_data.result_bad, session_data.result_max_combo, session_data.result_total_drumroll = self.player_2.get_result_score()
|
session_data.result_score, session_data.result_good, session_data.result_ok, session_data.result_bad, session_data.result_max_combo, session_data.result_total_drumroll = self.player_2.get_result_score()
|
||||||
session_data.result_gauge_length = self.player_2.gauge.gauge_length
|
session_data.result_gauge_length = int(self.player_2.gauge.gauge_length)
|
||||||
if self.end_ms != 0:
|
if self.end_ms != 0:
|
||||||
if current_time >= self.end_ms + 1000:
|
if current_time >= self.end_ms + 1000:
|
||||||
if self.player_1.ending_anim is None:
|
if self.player_1.ending_anim is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user