defunpack_all_assets(source_folder: str, destination_folder: str): # iterate over all files in source folder for root, dirs, files in os.walk(source_folder): for file_name in files: # generate file_path file_path = os.path.join(root, file_name) # load that file via UnityPy.load env = UnityPy.load(file_path)
# iterate over internal objects for obj in env.objects: # process specific object types if obj.type.name in ["Texture2D", "Sprite"]: # parse the object data data = obj.read()
# create destination path dest = os.path.join(destination_folder, data.name)
# make sure that the extension is correct # you probably only want to do so with images/textures dest, ext = os.path.splitext(dest) dest = dest + ".png"
img = data.image img.save(dest)
# alternative way which keeps the original path for path,obj in env.container.items(): if obj.type.name in ["Texture2D", "Sprite"]: data = obj.read() # create dest based on original path dest = os.path.join(destination_folder, *path.split("/")) # make sure that the dir of that path exists os.makedirs(os.path.dirname(dest), exist_ok = True) # correct extension dest, ext = os.path.splitext(dest) dest = dest + ".png" data.image.save(dest)
# 成功提示 Write-Host"`n"-NoNewline Write-Host"==========================================="-ForegroundColor Green Write-Host" 虹组汉化补丁安装成功!按 Enter 键退出!"-ForegroundColor Green Write-Host" 璃奈板「TOKIMEKI!!!」 "-ForegroundColor Magenta Write-Host"==========================================="-ForegroundColor Green
# 启动游戏 $exePath = Join-Path$gamePath"nijichizu.exe" if (Test-Path$exePath) { Read-Host"按 Enter 键退出补丁并清除缓存" } else { Write-Host"[WARNING] 未找到游戏主程序"-ForegroundColor Yellow }