mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
fix all paths manually
This commit is contained in:
@@ -11,18 +11,16 @@ import tomllib
|
||||
|
||||
#TJA Format creator is unknown. I did not create the format, but I did write the parser though.
|
||||
|
||||
def get_zip_filenames(zip_path: str) -> list[str]:
|
||||
def get_zip_filenames(zip_path: Path) -> list[str]:
|
||||
result = []
|
||||
new_path = Path(zip_path)
|
||||
with zipfile.ZipFile(new_path, 'r') as zip_ref:
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
file_list = zip_ref.namelist()
|
||||
for file_name in file_list:
|
||||
result.append(file_name)
|
||||
return result
|
||||
|
||||
def load_image_from_zip(zip_path: str, filename: str) -> ray.Image:
|
||||
new_path = Path(zip_path)
|
||||
with zipfile.ZipFile(new_path, 'r') as zip_ref:
|
||||
def load_image_from_zip(zip_path: Path, filename: str) -> ray.Image:
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
with zip_ref.open(filename) as image_file:
|
||||
with tempfile.NamedTemporaryFile(delete=False, suffix='.png') as temp_file:
|
||||
temp_file.write(image_file.read())
|
||||
@@ -31,9 +29,8 @@ def load_image_from_zip(zip_path: str, filename: str) -> ray.Image:
|
||||
os.remove(temp_file_path)
|
||||
return image
|
||||
|
||||
def load_texture_from_zip(zip_path: str, filename: str) -> ray.Texture:
|
||||
new_path = Path(zip_path)
|
||||
with zipfile.ZipFile(new_path, 'r') as zip_ref:
|
||||
def load_texture_from_zip(zip_path: Path, filename: str) -> ray.Texture:
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
with zip_ref.open(filename) as image_file:
|
||||
with tempfile.NamedTemporaryFile(delete=False, suffix='.png') as temp_file:
|
||||
temp_file.write(image_file.read())
|
||||
@@ -42,10 +39,9 @@ def load_texture_from_zip(zip_path: str, filename: str) -> ray.Texture:
|
||||
os.remove(temp_file_path)
|
||||
return texture
|
||||
|
||||
def load_all_textures_from_zip(zip_path: str) -> dict[str, list[ray.Texture]]:
|
||||
def load_all_textures_from_zip(zip_path: Path) -> dict[str, list[ray.Texture]]:
|
||||
result_dict = dict()
|
||||
new_path = Path(zip_path)
|
||||
with zipfile.ZipFile(new_path, 'r') as zip_ref:
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
files = zip_ref.namelist()
|
||||
for file in files:
|
||||
with zip_ref.open(file) as image_file:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pyray as ray
|
||||
|
||||
from libs.utils import load_texture_from_zip
|
||||
@@ -8,7 +10,7 @@ class EntryScreen:
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
self.texture_footer = load_texture_from_zip('Graphics\\lumendata\\entry.zip', 'entry_img00375.png')
|
||||
self.texture_footer = load_texture_from_zip(Path('Graphics/lumendata/entry.zip'), 'entry_img00375.png')
|
||||
|
||||
self.screen_init = False
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ class GameScreen:
|
||||
self.screen_init = False
|
||||
|
||||
def load_textures(self):
|
||||
self.textures = load_all_textures_from_zip('Graphics\\lumendata\\enso_system\\common.zip')
|
||||
zip_file = 'Graphics\\lumendata\\enso_system\\common.zip'
|
||||
self.textures = load_all_textures_from_zip(Path('Graphics/lumendata/enso_system/common.zip'))
|
||||
zip_file = Path('Graphics/lumendata/enso_system/common.zip')
|
||||
|
||||
image = load_image_from_zip(zip_file, 'lane_img00000.png')
|
||||
ray.image_resize(image, 948, 176)
|
||||
@@ -133,11 +133,11 @@ class GameScreen:
|
||||
filename = 'onp_renda_moji_img00001.png'
|
||||
self.texture_se_moji.append(load_texture_from_zip(zip_file, filename))
|
||||
|
||||
self.textures.update(load_all_textures_from_zip('Graphics\\lumendata\\enso_system\\base1p.zip'))
|
||||
self.textures.update(load_all_textures_from_zip('Graphics\\lumendata\\enso_system\\don1p.zip'))
|
||||
self.textures.update(load_all_textures_from_zip(Path('Graphics/lumendata/enso_system/base1p.zip')))
|
||||
self.textures.update(load_all_textures_from_zip(Path('Graphics/lumendata/enso_system/don1p.zip')))
|
||||
|
||||
self.result_transition_1 = load_texture_from_zip('Graphics\\lumendata\\enso_result.zip', 'retry_game_img00125.png')
|
||||
self.result_transition_2 = load_texture_from_zip('Graphics\\lumendata\\enso_result.zip', 'retry_game_img00126.png')
|
||||
self.result_transition_1 = load_texture_from_zip(Path('Graphics/lumendata/enso_result.zip'), 'retry_game_img00125.png')
|
||||
self.result_transition_2 = load_texture_from_zip(Path('Graphics/lumendata/enso_result.zip'), 'retry_game_img00126.png')
|
||||
|
||||
def load_sounds(self):
|
||||
sounds_dir = Path("Sounds")
|
||||
|
||||
@@ -28,7 +28,7 @@ class ResultScreen:
|
||||
self.sound_kat = audio.load_sound(str(sounds_dir / "inst_00_katsu.wav"))
|
||||
self.bgm = audio.load_sound(str(sounds_dir / "result" / "JINGLE_SEISEKI [1].ogg"))
|
||||
|
||||
zip_file = 'Graphics\\lumendata\\enso_result.zip'
|
||||
zip_file = Path('Graphics/lumendata/enso_result.zip')
|
||||
self.textures = load_all_textures_from_zip(zip_file)
|
||||
|
||||
self.song_info = FontText(global_data.song_title, 40).texture
|
||||
@@ -40,7 +40,7 @@ class ResultScreen:
|
||||
|
||||
def on_screen_start(self):
|
||||
if not self.screen_init:
|
||||
self.textures = load_all_textures_from_zip('Graphics\\lumendata\\enso_result.zip')
|
||||
self.textures = load_all_textures_from_zip(Path('Graphics/lumendata/enso_result.zip'))
|
||||
self.screen_init = True
|
||||
self.song_info = FontText(global_data.song_title, 40).texture
|
||||
self.bgm_volume = 1.0
|
||||
|
||||
@@ -34,7 +34,7 @@ class TitleScreen:
|
||||
return self.op_video, self.attract_video
|
||||
|
||||
def load_textures(self):
|
||||
self.textures = load_all_textures_from_zip('Graphics\\lumendata\\attract\\keikoku.zip')
|
||||
self.textures = load_all_textures_from_zip(Path('Graphics/lumendata/attract/keikoku.zip'))
|
||||
|
||||
sounds_dir = Path("Sounds")
|
||||
title_dir = sounds_dir / "title"
|
||||
@@ -44,7 +44,7 @@ class TitleScreen:
|
||||
self.sound_warning_message = audio.load_sound(str(title_dir / "VO_ATTRACT_3.ogg"))
|
||||
self.sound_warning_error = audio.load_sound(str(title_dir / "SE_ATTRACT_1.ogg"))
|
||||
|
||||
self.texture_black = load_texture_from_zip('Graphics\\lumendata\\attract\\movie.zip', 'movie_img00000.png')
|
||||
self.texture_black = load_texture_from_zip(Path('Graphics/lumendata/attract/movie.zip'), 'movie_img00000.png')
|
||||
|
||||
def on_screen_start(self):
|
||||
if not self.screen_init:
|
||||
|
||||
Reference in New Issue
Block a user