feat: add osu skin retrieval functionality and integrate into loading and setup processes
This commit is contained in:
parent
8c5e7ca6f2
commit
41608afae2
@ -198,6 +198,15 @@ pub fn get_skins_count(folder: String) -> Option<u64> {
|
||||
return Some(count);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_osu_skin(folder: String) -> String {
|
||||
let path = PathBuf::from(folder);
|
||||
let osu_user_config = get_osu_user_config(path.clone());
|
||||
return osu_user_config
|
||||
.and_then(|config| config.get("Skin").cloned())
|
||||
.unwrap_or_else(|| "Default".to_string());
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_osu_version(folder: String) -> String {
|
||||
let path = PathBuf::from(folder);
|
||||
|
@ -6,7 +6,7 @@ pub mod utils;
|
||||
use crate::commands::{
|
||||
find_osu_installation, get_beatmapsets_count, get_hwid, get_osu_release_stream,
|
||||
get_osu_version, get_skins_count, run_osu, run_osu_updater, set_osu_config_values,
|
||||
set_osu_user_config_values, valid_osu_folder,
|
||||
set_osu_user_config_values, valid_osu_folder, get_osu_skin
|
||||
};
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
@ -36,6 +36,7 @@ pub fn run() {
|
||||
set_osu_user_config_values,
|
||||
run_osu_updater,
|
||||
run_osu,
|
||||
get_osu_skin
|
||||
])
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
|
@ -22,6 +22,8 @@ export const skins = writable<number | undefined>(undefined);
|
||||
export const osuStream = writable<string | undefined>(undefined);
|
||||
export const osuBuild = writable<string | undefined>(undefined);
|
||||
|
||||
export const currentSkin = writable<string>("");
|
||||
|
||||
let updateValues = true;
|
||||
launching.subscribe((val) => (updateValues = !val));
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
import * as Select from '@/components/ui/select';
|
||||
import {
|
||||
beatmapSets,
|
||||
currentSkin,
|
||||
currentView,
|
||||
launching,
|
||||
osuBuild,
|
||||
@ -121,6 +122,10 @@
|
||||
if (skinsCount) {
|
||||
skins.set(skinsCount);
|
||||
}
|
||||
const skin: string = await invoke('get_osu_skin', {
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
currentSkin.set(skin);
|
||||
}
|
||||
};
|
||||
|
||||
@ -266,6 +271,11 @@
|
||||
});
|
||||
if (skinCount) skins.set(skinCount);
|
||||
|
||||
const skin: string = await invoke('get_osu_skin', {
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
currentSkin.set(skin);
|
||||
|
||||
launching.set(false);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@ -706,6 +716,16 @@
|
||||
{/if}
|
||||
</Badge>
|
||||
</span>
|
||||
<span class="text-sm text-muted-foreground font-semibold">Skin</span>
|
||||
<span class="text-sm font-semibold text-end text-theme-50">
|
||||
<Badge>
|
||||
{#if $currentSkin}
|
||||
{$currentSkin}
|
||||
{:else}
|
||||
<LoaderCircle class="animate-spin" size={17} />
|
||||
{/if}
|
||||
</Badge>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{:else if selectedTab === 'settings'}
|
||||
|
@ -4,6 +4,7 @@
|
||||
import {
|
||||
beatmapSets,
|
||||
currentLoadingInfo,
|
||||
currentSkin,
|
||||
currentView,
|
||||
firstStartup,
|
||||
osuBuild,
|
||||
@ -136,6 +137,10 @@
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
if (skinCount) skins.set(skinCount);
|
||||
const skin: string = await invoke('get_osu_skin', {
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
currentSkin.set(skin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
userSettings,
|
||||
} from '@/userSettings';
|
||||
import Label from '@/components/ui/label/label.svelte';
|
||||
import { beatmapSets, currentView, osuBuild, osuStream, skins } from '@/global';
|
||||
import { beatmapSets, currentSkin, currentView, osuBuild, osuStream, skins } from '@/global';
|
||||
import Launch from './Launch.svelte';
|
||||
import Confetti from 'svelte-confetti';
|
||||
|
||||
@ -92,6 +92,11 @@
|
||||
skins.set(skinsCount);
|
||||
}
|
||||
|
||||
const skin: string = await invoke('get_osu_skin', {
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
currentSkin.set(skin);
|
||||
|
||||
const osuReleaseStream: string = await invoke('get_osu_release_stream', {
|
||||
folder: $osuInstallationPath,
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user