fix(gameins): 更新游戏资源包相关提示信息
- 修改查找数据文件的提示信息为获取游戏资源包- 更新未找到资源包时的错误提示,增加重新下载建议 - 调整解压完成后的进度提示信息为安装成功 - 统一资源包相关日志输出的表述 - 优化安装进度百分比显示逻辑 -修复资源包路径不存在时的错误处理逻辑
This commit is contained in:
@@ -67,9 +67,9 @@ pub async fn install_game(window: tauri::Window, target_dir: String) -> Result<S
|
|||||||
// 2. 构造 data.bin 的路径
|
// 2. 构造 data.bin 的路径
|
||||||
let data_bin_path = exe_dir.join("data.bin");
|
let data_bin_path = exe_dir.join("data.bin");
|
||||||
|
|
||||||
println!("正在查找数据文件: {:?}", data_bin_path);
|
println!("正在获取游戏资源包: {:?}", data_bin_path);
|
||||||
window.emit("install_progress", InstallProgress {
|
window.emit("install_progress", InstallProgress {
|
||||||
message: format!("正在查找数据文件: {:?}", data_bin_path),
|
message: "正在获取游戏资源包".into(),
|
||||||
percentage: 1.0 // 1%
|
percentage: 1.0 // 1%
|
||||||
}).ok();
|
}).ok();
|
||||||
|
|
||||||
@@ -77,15 +77,15 @@ pub async fn install_game(window: tauri::Window, target_dir: String) -> Result<S
|
|||||||
if !data_bin_path.exists() {
|
if !data_bin_path.exists() {
|
||||||
// 返回错误,Svelte 的 catch 块会捕获它
|
// 返回错误,Svelte 的 catch 块会捕获它
|
||||||
return Err(InstallError::DataFileNotFound(
|
return Err(InstallError::DataFileNotFound(
|
||||||
format!("未在 {:?} 找到 data.bin", data_bin_path)
|
format!("未在 {:?} 找到游戏资源包,请重新下载", data_bin_path)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 从硬盘打开文件
|
// 3. 从硬盘打开文件
|
||||||
let archive_file = File::open(&data_bin_path)?;
|
let archive_file = File::open(&data_bin_path)?;
|
||||||
println!("成功打开 data.bin。");
|
println!("成功打开游戏资源包");
|
||||||
window.emit("install_progress", InstallProgress {
|
window.emit("install_progress", InstallProgress {
|
||||||
message: "成功打开 data.bin。".into(),
|
message: "成功打开游戏资源包".into(),
|
||||||
percentage: 5.0 // 5%
|
percentage: 5.0 // 5%
|
||||||
}).ok();
|
}).ok();
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ pub async fn install_game(window: tauri::Window, target_dir: String) -> Result<S
|
|||||||
let mut archive = ZipArchive::new(archive_file)?;
|
let mut archive = ZipArchive::new(archive_file)?;
|
||||||
|
|
||||||
let total_files = archive.len() as f32;
|
let total_files = archive.len() as f32;
|
||||||
println!("在压缩包中找到 {} 个文件。", total_files);
|
println!("在游戏资源包中找到 {} 个文件。", total_files);
|
||||||
window.emit("install_progress", InstallProgress {
|
window.emit("install_progress", InstallProgress {
|
||||||
message: format!("包中找到 {} 个文件。", total_files),
|
message: format!("包中找到 {} 个文件。", total_files),
|
||||||
percentage: 10.0 // 10%
|
percentage: 10.0 // 10%
|
||||||
@@ -140,7 +140,7 @@ pub async fn install_game(window: tauri::Window, target_dir: String) -> Result<S
|
|||||||
|
|
||||||
println!("Rust 后端:解压成功。");
|
println!("Rust 后端:解压成功。");
|
||||||
window.emit("install_progress", InstallProgress {
|
window.emit("install_progress", InstallProgress {
|
||||||
message: "✅ 解压完成。".into(),
|
message: "安装成功".into(),
|
||||||
percentage: 100.0 // 100%
|
percentage: 100.0 // 100%
|
||||||
}).ok();
|
}).ok();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user