|
|
@ -1,4 +1,6 @@
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
use std::{sync::mpsc, thread};
|
|
|
|
|
|
|
|
|
|
|
|
use eframe::{
|
|
|
|
use eframe::{
|
|
|
|
egui::{CentralPanel, Context, Layout, TextFormat, Visuals},
|
|
|
|
egui::{CentralPanel, Context, Layout, TextFormat, Visuals},
|
|
|
|
emath::Align,
|
|
|
|
emath::Align,
|
|
|
@ -42,15 +44,26 @@ enum Event {
|
|
|
|
IdSubmit { id: String },
|
|
|
|
IdSubmit { id: String },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum App {
|
|
|
|
enum State {
|
|
|
|
IdSelect { search_string: String, enabled: bool },
|
|
|
|
IdSelect { search_string: String, enabled: bool },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct App {
|
|
|
|
|
|
|
|
state: State,
|
|
|
|
|
|
|
|
event_tx: mpsc::Sender<Event>,
|
|
|
|
|
|
|
|
event_rx: mpsc::Receiver<Event>,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl App {
|
|
|
|
impl App {
|
|
|
|
fn new() -> Self {
|
|
|
|
fn new() -> Self {
|
|
|
|
Self::IdSelect {
|
|
|
|
let (event_tx, event_rx) = mpsc::channel();
|
|
|
|
search_string: String::new(),
|
|
|
|
Self {
|
|
|
|
enabled: true
|
|
|
|
state: State::IdSelect {
|
|
|
|
|
|
|
|
search_string: String::new(),
|
|
|
|
|
|
|
|
enabled: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
event_tx,
|
|
|
|
|
|
|
|
event_rx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -83,8 +96,8 @@ impl App {
|
|
|
|
ui.with_layout(Layout::top_down(Align::Center), |ui| {
|
|
|
|
ui.with_layout(Layout::top_down(Align::Center), |ui| {
|
|
|
|
ui.label(title_text);
|
|
|
|
ui.label(title_text);
|
|
|
|
|
|
|
|
|
|
|
|
match self {
|
|
|
|
match &mut self.state {
|
|
|
|
Self::IdSelect { search_string, enabled } => {
|
|
|
|
State::IdSelect { search_string, enabled } => {
|
|
|
|
ui.label("Enter level ID:");
|
|
|
|
ui.label("Enter level ID:");
|
|
|
|
ui.add_enabled_ui(*enabled, |ui| {
|
|
|
|
ui.add_enabled_ui(*enabled, |ui| {
|
|
|
|
ui.text_edit_singleline(search_string).request_focus();
|
|
|
|
ui.text_edit_singleline(search_string).request_focus();
|
|
|
@ -104,7 +117,16 @@ impl App {
|
|
|
|
for event in events {
|
|
|
|
for event in events {
|
|
|
|
match event {
|
|
|
|
match event {
|
|
|
|
Event::IdSubmit { id } => {
|
|
|
|
Event::IdSubmit { id } => {
|
|
|
|
*self = Self::IdSelect { search_string: id, enabled: false };
|
|
|
|
let tx = self.event_tx.clone();
|
|
|
|
|
|
|
|
self.state = State::IdSelect { search_string: id.clone(), enabled: false };
|
|
|
|
|
|
|
|
thread::spawn(move || {
|
|
|
|
|
|
|
|
let res = ureq::post("http://www.boomlings.com/database/downloadGJLevel22.php")
|
|
|
|
|
|
|
|
.set("User-Agent", "")
|
|
|
|
|
|
|
|
.send_form(&[
|
|
|
|
|
|
|
|
("levelID", &id),
|
|
|
|
|
|
|
|
("secret", "Wmfd2893gb7"),
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|