mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Select newly created character automatically
This commit is contained in:
parent
08b44db1fc
commit
d6929ae0ea
@ -720,12 +720,12 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.create_button, ui_widgets)
|
.set(self.ids.create_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
// TODO: Save character.
|
global_state.meta.selected_character =
|
||||||
global_state.meta.add_character(CharacterData {
|
global_state.meta.add_character(CharacterData {
|
||||||
name: name.clone(),
|
name: name.clone(),
|
||||||
body: comp::Body::Humanoid(body.clone()),
|
body: comp::Body::Humanoid(body.clone()),
|
||||||
tool: tool.map(|tool| tool.to_string()),
|
tool: tool.map(|tool| tool.to_string()),
|
||||||
});
|
});
|
||||||
to_select = true;
|
to_select = true;
|
||||||
}
|
}
|
||||||
// Character Name Input
|
// Character Name Input
|
||||||
|
@ -28,7 +28,11 @@ impl Meta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_character(&mut self, data: CharacterData) { self.characters.push(data); }
|
pub fn add_character(&mut self, data: CharacterData) -> usize {
|
||||||
|
self.characters.push(data);
|
||||||
|
// return new character's index
|
||||||
|
self.characters.len() - 1
|
||||||
|
}
|
||||||
|
|
||||||
pub fn load() -> Self {
|
pub fn load() -> Self {
|
||||||
let path = Self::get_meta_path();
|
let path = Self::get_meta_path();
|
||||||
|
Loading…
Reference in New Issue
Block a user