refactor: rewrote game edition selector
This commit is contained in:
parent
ba41a3c004
commit
e09efc6ed3
1 changed files with 4 additions and 10 deletions
|
@ -291,21 +291,15 @@ impl SimpleAsyncComponent for GeneralApp {
|
||||||
&tr!("china")
|
&tr!("china")
|
||||||
])),
|
])),
|
||||||
|
|
||||||
set_selected: match CONFIG.launcher.edition {
|
set_selected: GameEdition::list().iter()
|
||||||
GameEdition::Global => 0,
|
.position(|edition| edition == &CONFIG.launcher.edition)
|
||||||
GameEdition::China => 1
|
.unwrap() as u32,
|
||||||
},
|
|
||||||
|
|
||||||
connect_selected_notify[sender] => move |row| {
|
connect_selected_notify[sender] => move |row| {
|
||||||
if is_ready() {
|
if is_ready() {
|
||||||
#[allow(unused_must_use)]
|
#[allow(unused_must_use)]
|
||||||
if let Ok(mut config) = Config::get() {
|
if let Ok(mut config) = Config::get() {
|
||||||
config.launcher.edition = match row.selected() {
|
config.launcher.edition = GameEdition::list()[row.selected() as usize];
|
||||||
0 => GameEdition::Global,
|
|
||||||
1 => GameEdition::China,
|
|
||||||
|
|
||||||
_ => unreachable!()
|
|
||||||
};
|
|
||||||
|
|
||||||
Config::update(config);
|
Config::update(config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue