fix(zzz); voicepack language detection
This commit is contained in:
@ -30,3 +30,23 @@ class VoicePackLanguage(Enum):
|
||||
return VoicePackLanguage.English
|
||||
else:
|
||||
raise ValueError(f"Invalid language string: {s}")
|
||||
|
||||
@staticmethod
|
||||
def from_zzz_name(s: str) -> "VoicePackLanguage":
|
||||
"""
|
||||
Converts a language string from ZZZ file name to a VoicePackLanguage enum.
|
||||
|
||||
Only English is tested for now.
|
||||
"""
|
||||
if s == "Jp":
|
||||
return VoicePackLanguage.Japanese
|
||||
elif s == "Cn":
|
||||
return VoicePackLanguage.Chinese
|
||||
elif s == "Tw":
|
||||
return VoicePackLanguage.Taiwanese
|
||||
elif s == "Kr":
|
||||
return VoicePackLanguage.Korean
|
||||
elif s == "En":
|
||||
return VoicePackLanguage.English
|
||||
else:
|
||||
raise ValueError(f"Invalid language string: {s}")
|
||||
@ -277,12 +277,12 @@ class Game(GameABC):
|
||||
voicepacks = []
|
||||
for child in (
|
||||
self.data_folder()
|
||||
.joinpath("StreamingAssets/AudioAssets/AudioPackage/")
|
||||
.joinpath("StreamingAssets/Audio/Windows/Full/")
|
||||
.iterdir()
|
||||
):
|
||||
if child.resolve().is_dir():
|
||||
try:
|
||||
voicepacks.append(VoicePackLanguage[child.name])
|
||||
voicepacks.append(VoicePackLanguage.from_zzz_name(child.name))
|
||||
except ValueError:
|
||||
pass
|
||||
return voicepacks
|
||||
|
||||
Reference in New Issue
Block a user