Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
release/
dist/
dist/win-unpacked/
dist/builder-debug.yml
dist/*.exe
Expand Down
23 changes: 0 additions & 23 deletions dist/builder-effective-config.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions dist/renderer.js

This file was deleted.

38 changes: 0 additions & 38 deletions dist/renderer.js.LICENSE.txt

This file was deleted.

10 changes: 0 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,23 +1004,13 @@ function getSaveBackupDir() {
return dir;
}

const CHARACTER_NAMES = {
'CHARACTER.IRONCLAD': '铁甲战士',
'CHARACTER.SILENT': '沉默猎手',
'CHARACTER.REGENT': '摄政王',
'CHARACTER.NECROBINDER': '缚灵师',
'CHARACTER.DEFECT': '缺陷体',
'CHARACTER.WATCHER': '观察者',
};

function parseProgressSummary(progressPath) {
if (!fs.existsSync(progressPath)) return null;
try {
const raw = fs.readFileSync(progressPath, 'utf-8').replace(/^\uFEFF/, '');
const data = JSON.parse(raw);
const characters = (data.character_stats || []).map(c => ({
id: c.id,
name: CHARACTER_NAMES[c.id] || c.id?.split('.')[1] || c.id,
wins: c.total_wins || 0,
losses: c.total_losses || 0,
maxAscension: c.max_ascension || 0,
Expand Down
20 changes: 20 additions & 0 deletions src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tauri_plugin_dialog::DialogExt;
pub struct Config {
#[serde(rename = "gamePath")]
pub game_path: Option<String>,
#[serde(rename = "language", default = "default_language")]
pub language: String,
}

fn default_language() -> String {
"en".to_string()
}

#[derive(Serialize)]
Expand Down Expand Up @@ -169,3 +175,17 @@ pub async fn app_select_game_path(
Ok(None)
}
}

#[tauri::command]
pub fn get_language() -> String {
let cfg = load_config();
cfg.language
}

#[tauri::command]
pub fn set_language(language: String) -> Result<(), String> {
let mut cfg = load_config();
cfg.language = language;
save_config(&cfg);
Ok(())
}
2 changes: 2 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub fn run() {
// App
config::app_init,
config::app_select_game_path,
config::get_language,
config::set_language,
// Window
window_minimize,
window_maximize,
Expand Down
20 changes: 1 addition & 19 deletions src-tauri/src/saves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,6 @@ fn get_save_backup_dir() -> PathBuf {
dir
}

const CHARACTER_NAMES: &[(&str, &str)] = &[
("CHARACTER.IRONCLAD", "铁甲战士"),
("CHARACTER.SILENT", "沉默猎手"),
("CHARACTER.REGENT", "摄政王"),
("CHARACTER.NECROBINDER", "缚灵师"),
("CHARACTER.DEFECT", "缺陷体"),
("CHARACTER.WATCHER", "观察者"),
];

fn char_name(id: &str) -> String {
for (k, v) in CHARACTER_NAMES {
if *k == id {
return v.to_string();
}
}
id.split('.').last().unwrap_or(id).to_string()
}

fn parse_progress(path: &Path) -> Option<ProgressSummary> {
if !path.exists() {
return None;
Expand All @@ -148,7 +130,7 @@ fn parse_progress(path: &Path) -> Option<ProgressSummary> {
return None;
}
Some(CharacterStat {
name: char_name(&id),
name: id.clone(),
id,
wins,
losses,
Expand Down
Loading