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:
@@ -538,7 +538,7 @@ class DanBox:
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
if self.name is None:
|
||||
if self.name is not None:
|
||||
self.name.unload()
|
||||
self.name = None
|
||||
|
||||
@@ -887,7 +887,7 @@ class DanCourse(FileSystemItem):
|
||||
def __init__(self, path: Path, name: str):
|
||||
super().__init__(path, name)
|
||||
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:
|
||||
data = json.load(f)
|
||||
self.title = data["title"]
|
||||
@@ -902,6 +902,8 @@ class DanCourse(FileSystemItem):
|
||||
path = Path(global_data.song_hashes[hash][0]["file_path"])
|
||||
if (path.parent.parent / "box.def").exists():
|
||||
_, genre_index, _ = parse_box_def(path.parent.parent)
|
||||
else:
|
||||
genre_index = 9
|
||||
self.charts.append((TJAParser(path), genre_index, difficulty))
|
||||
else:
|
||||
pass
|
||||
@@ -918,7 +920,7 @@ class FileNavigator:
|
||||
|
||||
# Pre-generated objects storage
|
||||
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
|
||||
|
||||
# OPTION 2: Lazy crown calculation with caching
|
||||
@@ -995,7 +997,10 @@ class FileNavigator:
|
||||
song_list = self._read_song_list(self.favorite_folder.path)
|
||||
for song_obj in song_list:
|
||||
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. "
|
||||
f"Directories: {len(self.all_directories)}, "
|
||||
|
||||
@@ -13,6 +13,7 @@ class GeneralConfig(TypedDict):
|
||||
judge_counter: bool
|
||||
nijiiro_notes: bool
|
||||
log_level: int
|
||||
fake_online: bool
|
||||
|
||||
class NameplateConfig(TypedDict):
|
||||
name: str
|
||||
|
||||
@@ -125,20 +125,20 @@ class AllNetIcon:
|
||||
"""All.Net status icon for the game."""
|
||||
def __init__(self):
|
||||
"""Initialize the All.Net status icon."""
|
||||
pass
|
||||
self.online = get_config()["general"]["fake_online"]
|
||||
def update(self, current_time_ms: float):
|
||||
"""Update the All.Net status icon."""
|
||||
pass
|
||||
def draw(self, x: int = 0, y: int = 0):
|
||||
"""Draw the All.Net status icon. Only drawn offline for now"""
|
||||
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:
|
||||
"""Banapass and Camera status icons"""
|
||||
def __init__(self):
|
||||
"""Initialize the Banapass and Camera status icons."""
|
||||
self.online = False
|
||||
self.online = get_config()["general"]["fake_online"]
|
||||
def update(self, current_time_ms: float):
|
||||
"""Update the Banapass and Camera status icons."""
|
||||
pass
|
||||
@@ -151,7 +151,7 @@ class EntryOverlay:
|
||||
if not 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:
|
||||
"""Timer class for displaying countdown timers."""
|
||||
|
||||
Reference in New Issue
Block a user