|
|
@ -1,6 +1,6 @@
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
use eframe::{
|
|
|
|
use eframe::{
|
|
|
|
egui::{CentralPanel, Context, Layout, TextFormat},
|
|
|
|
egui::{CentralPanel, Context, Layout, TextFormat, Visuals},
|
|
|
|
emath::Align,
|
|
|
|
emath::Align,
|
|
|
|
epaint::{text::LayoutJob, Color32, FontId},
|
|
|
|
epaint::{text::LayoutJob, Color32, FontId},
|
|
|
|
Frame,
|
|
|
|
Frame,
|
|
|
@ -38,18 +38,26 @@ struct SfhResponse {
|
|
|
|
songs: Vec<SfhSong>,
|
|
|
|
songs: Vec<SfhSong>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum Event {
|
|
|
|
|
|
|
|
IdSubmit { id: String },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum App {
|
|
|
|
enum App {
|
|
|
|
IdSelect { search_string: String },
|
|
|
|
IdSelect { search_string: String, enabled: bool },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl App {
|
|
|
|
impl App {
|
|
|
|
fn new() -> Self {
|
|
|
|
fn new() -> Self {
|
|
|
|
Self::IdSelect {
|
|
|
|
Self::IdSelect {
|
|
|
|
search_string: String::new(),
|
|
|
|
search_string: String::new(),
|
|
|
|
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn update(&mut self, ctx: &Context, frame: &mut Frame) {
|
|
|
|
fn update(&mut self, ctx: &Context, frame: &mut Frame) {
|
|
|
|
|
|
|
|
let mut events: Vec<Event> = vec![];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.set_visuals(Visuals::light());
|
|
|
|
let mut title_text = LayoutJob::default();
|
|
|
|
let mut title_text = LayoutJob::default();
|
|
|
|
title_text.append(
|
|
|
|
title_text.append(
|
|
|
|
"NONG",
|
|
|
|
"NONG",
|
|
|
@ -61,7 +69,7 @@ impl App {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
title_text.append(
|
|
|
|
title_text.append(
|
|
|
|
"fisher",
|
|
|
|
"fisher\n",
|
|
|
|
0.0,
|
|
|
|
0.0,
|
|
|
|
TextFormat {
|
|
|
|
TextFormat {
|
|
|
|
color: Color32::from_rgb(0x60, 0x80, 0xd0),
|
|
|
|
color: Color32::from_rgb(0x60, 0x80, 0xd0),
|
|
|
@ -76,14 +84,30 @@ impl App {
|
|
|
|
ui.label(title_text);
|
|
|
|
ui.label(title_text);
|
|
|
|
|
|
|
|
|
|
|
|
match self {
|
|
|
|
match self {
|
|
|
|
Self::IdSelect { search_string } => {
|
|
|
|
Self::IdSelect { search_string, enabled } => {
|
|
|
|
ui.horizontal(|ui| {
|
|
|
|
ui.label("Enter level ID:");
|
|
|
|
ui.text_edit_singleline(search_string);
|
|
|
|
ui.add_enabled_ui(*enabled, |ui| {
|
|
|
|
|
|
|
|
ui.text_edit_singleline(search_string).request_focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if *enabled {
|
|
|
|
|
|
|
|
if ui.button("submit").clicked() {
|
|
|
|
|
|
|
|
events.push(Event::IdSubmit { id: search_string.clone() });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ui.label("loading...");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for event in events {
|
|
|
|
|
|
|
|
match event {
|
|
|
|
|
|
|
|
Event::IdSubmit { id } => {
|
|
|
|
|
|
|
|
*self = Self::IdSelect { search_string: id, enabled: false };
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|