game picker
This commit is contained in:
61
src/main.rs
61
src/main.rs
@@ -9,12 +9,22 @@ use crossbeam_channel::{Receiver, Sender};
|
||||
use eframe::egui;
|
||||
use egui::{mutex::{Mutex, RwLock}, Align, Layout, RichText, ThemePreference};
|
||||
use egui_alignments::{center_horizontal, center_vertical, top_horizontal, Aligner};
|
||||
use omori_locator::{get_omori_key, get_omori_path};
|
||||
use egui_modal::Modal;
|
||||
use sha2::Digest;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
env_logger::init();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
log::trace!("How do you even do serious work on ValorantOS??");
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
log::trace!("Mac user, rich fuck, send me $500");
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
log::trace!("Linux user... Please touch grass for once");
|
||||
|
||||
|
||||
let options = eframe::NativeOptions {
|
||||
viewport: egui::ViewportBuilder::default()
|
||||
.with_min_inner_size([640.0, 480.0]),
|
||||
@@ -128,6 +138,55 @@ impl eframe::App for Application {
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
UiState::PickGame(steam, others) => {
|
||||
let invalid_path_modal = Modal::new(ctx, "invalid_path_modal");
|
||||
invalid_path_modal.show(|ui| {
|
||||
invalid_path_modal.title(ui, "Invalid path");
|
||||
invalid_path_modal.frame(ui, |ui| {
|
||||
invalid_path_modal.body(ui, "Please pick a correct installation of OMORI.");
|
||||
});
|
||||
invalid_path_modal.buttons(ui, |ui| {
|
||||
invalid_path_modal.button(ui, "OK");
|
||||
});
|
||||
});
|
||||
egui::TopBottomPanel::top("key_prompt_title_bar").show(ctx, |ui| {
|
||||
ui.with_layout(Layout::top_down(Align::Center), |ui| {
|
||||
ui.label(RichText::new("Select your base game").size(32.0));
|
||||
});
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.columns(2, |columns| {
|
||||
columns[0].vertical(|ui| {
|
||||
ui.label(RichText::new("Steam Installation").size(24.0));
|
||||
match steam {
|
||||
Ok(path) => {
|
||||
ui.label(RichText::new(format!("Found game at:\n{}", path.display())).italics());
|
||||
ui.separator();
|
||||
ui.button(RichText::new("Use Steam version").size(16.0));
|
||||
},
|
||||
Err(e) => {
|
||||
ui.label(RichText::new(format!("Failed to find game:\n{}", e)).color(ui.visuals().error_fg_color));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
columns[1].vertical(|ui| {
|
||||
ui.label(RichText::new("Custom").size(24.0));
|
||||
if ui.button(RichText::new("Pick game location").size(16.0)).clicked() {
|
||||
rfd::FileDialog::new().pick_folder();
|
||||
invalid_path_modal.open();
|
||||
}
|
||||
ui.separator();
|
||||
if others.len() > 0 {
|
||||
|
||||
} else {
|
||||
ui.label("Once you use a custom location, it will be remembered here.");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user