更新图标及场景序列化系统

This commit is contained in:
YHH
2025-10-17 18:13:31 +08:00
parent 2ce7dad8d8
commit b826bbc4c7
74 changed files with 1382 additions and 721 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -34,6 +34,26 @@ fn export_binary(data: Vec<u8>, output_path: String) -> Result<(), String> {
Ok(())
}
#[tauri::command]
fn create_directory(path: String) -> Result<(), String> {
std::fs::create_dir_all(&path)
.map_err(|e| format!("Failed to create directory: {}", e))?;
Ok(())
}
#[tauri::command]
fn write_file_content(path: String, content: String) -> Result<(), String> {
std::fs::write(&path, content)
.map_err(|e| format!("Failed to write file: {}", e))?;
Ok(())
}
#[tauri::command]
fn path_exists(path: String) -> Result<bool, String> {
use std::path::Path;
Ok(Path::new(&path).exists())
}
#[tauri::command]
async fn open_project_dialog(app: AppHandle) -> Result<Option<String>, String> {
use tauri_plugin_dialog::DialogExt;
@@ -46,6 +66,37 @@ async fn open_project_dialog(app: AppHandle) -> Result<Option<String>, String> {
Ok(folder.map(|path| path.to_string()))
}
#[tauri::command]
async fn save_scene_dialog(app: AppHandle, default_name: Option<String>) -> Result<Option<String>, String> {
use tauri_plugin_dialog::DialogExt;
let mut dialog = app.dialog()
.file()
.set_title("Save ECS Scene")
.add_filter("ECS Scene Files", &["ecs"]);
if let Some(name) = default_name {
dialog = dialog.set_file_name(&name);
}
let file = dialog.blocking_save_file();
Ok(file.map(|path| path.to_string()))
}
#[tauri::command]
async fn open_scene_dialog(app: AppHandle) -> Result<Option<String>, String> {
use tauri_plugin_dialog::DialogExt;
let file = app.dialog()
.file()
.set_title("Open ECS Scene")
.add_filter("ECS Scene Files", &["ecs"])
.blocking_pick_file();
Ok(file.map(|path| path.to_string()))
}
#[tauri::command]
fn scan_directory(path: String, pattern: String) -> Result<Vec<String>, String> {
use glob::glob;
@@ -300,7 +351,12 @@ fn main() {
open_project,
save_project,
export_binary,
create_directory,
write_file_content,
path_exists,
open_project_dialog,
save_scene_dialog,
open_scene_dialog,
scan_directory,
read_file_content,
list_directory,