Merge branch '172_add_server_name_to_char_selection' into 'master'

Add server name to char selection screen,  closes #172

Closes #172

See merge request veloren/veloren!330
This commit is contained in:
Imbris 2019-07-21 18:13:17 +00:00
commit cac780c5b9
2 changed files with 8 additions and 7 deletions

View File

@ -55,10 +55,10 @@ impl PlayState for CharSelectionState {
global_state.window.renderer_mut().clear();
// Maintain the UI.
for event in self
let events = self
.char_selection_ui
.maintain(global_state.window.renderer_mut())
{
.maintain(global_state.window.renderer_mut(), &self.client.borrow());
for event in events {
match event {
ui::Event::Logout => {
return PlayStateResult::Pop;

View File

@ -7,6 +7,7 @@ use crate::{
},
window::Window,
};
use client::Client;
use common::comp::{humanoid, item::Weapon};
use conrod_core::{
color,
@ -235,7 +236,7 @@ impl CharSelectionUi {
}
// TODO: Split this into multiple modules or functions.
fn update_layout(&mut self) -> Vec<Event> {
fn update_layout(&mut self, client: &Client) -> Vec<Event> {
let mut events = Vec::new();
let ref mut ui_widgets = self.ui.set_widgets();
let version = env!("CARGO_PKG_VERSION");
@ -270,7 +271,7 @@ impl CharSelectionUi {
.rgba(0.0, 0.0, 0., 0.0)
.set(self.ids.selection_scrollbar, ui_widgets);
// Server Name
Text::new("Server Name") //TODO: Add in Server Name
Text::new(&client.server_info.name)
.mid_top_with_margin_on(self.ids.server_frame_bg, 5.0)
.font_size(24)
.font_id(self.fonts.metamorph)
@ -1064,8 +1065,8 @@ impl CharSelectionUi {
self.ui.handle_event(event);
}
pub fn maintain(&mut self, renderer: &mut Renderer) -> Vec<Event> {
let events = self.update_layout();
pub fn maintain(&mut self, renderer: &mut Renderer, client: &Client) -> Vec<Event> {
let events = self.update_layout(client);
self.ui.maintain(renderer, None);
events
}